/* Imports, leads and settings. Shared components live in components.css. */
/* layout.css sets the phone grid to 1fr, which grows to the widest unbreakable content (a row of tabs) and pushes the page sideways. */

/* Import: file drop zone, the chosen file, column mapping, the bar that starts it. */
.drop {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 38px 20px; text-align: center;
  border: 2px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface); transition: border-color .12s, background .12s;
}
.drop:hover, .drop.over, .drop:focus-within { border-color: var(--accent); background: var(--accent-soft); }
.drop svg { color: var(--ink-3); margin-bottom: 6px; }
.drop:hover svg, .drop.over svg { color: var(--accent); }
.drop b { font-size: 1.05rem; font-weight: 620; }
.drop span { color: var(--ink-3); }
.drop input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.fileinfo { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.fileinfo .ico { flex: none; width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); }
.fileinfo .grow b { display: block; overflow-wrap: anywhere; }
.fileopts { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.fileopts summary { cursor: pointer; color: var(--ink-2); font-weight: 560; }
.fileopts .grid { margin-top: 12px; }
.maprow { display: grid; grid-template-columns: minmax(0, 1fr) 20px minmax(0, 1fr); gap: 6px 14px; align-items: center; padding: 11px 0; border-top: 1px solid var(--line); }
.maprow .src b { display: block; overflow-wrap: anywhere; }
.maprow .src small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.maprow > svg { color: var(--ink-3); }
@media (max-width: 700px) { .maprow { grid-template-columns: minmax(0, .85fr) 16px minmax(0, 1.3fr); gap: 6px 10px; } }
.maprow.skip .src { opacity: .55; }
.maprow.skip > svg { opacity: .3; }
.maphead { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; margin-bottom: 4px; }
.choice { display: flex; flex-direction: column; gap: 2px; }
.choice .check { align-items: flex-start; }
.choice .check input { margin-top: 5px; }
.choice small { display: block; padding-left: 24px; }
.actionbar {
  position: sticky; bottom: 0; z-index: 6; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px;
  margin: 22px -36px -64px; padding: 14px 36px; background: var(--surface); border-top: 1px solid var(--line);
}
.actionbar .sum { flex: 1 1 18rem; min-width: 0; }
.actionbar .sum b { display: block; }
@media (max-width: 900px) { .actionbar { margin: 18px -16px -48px; padding: 12px 16px; } }
@media (max-width: 700px) {
  .actionbar { gap: 8px; padding: 10px 16px; }
  .actionbar .sum b { font-size: .92rem; }
  .actionbar .sum .calm { display: none; }
  .actionbar button.primary { width: 100%; }
}

/* Progress: a bar that fills, or slides while the total is unknown. */
.bar.big { height: 12px; border-radius: 6px; }
.bar.busy i { width: 35%; animation: slide 1.3s ease-in-out infinite; }
@keyframes slide { from { margin-left: -35%; } to { margin-left: 100%; } }
@media (prefers-reduced-motion: reduce) { .bar.busy i { animation: none; width: 100%; opacity: .45; } }
.stat.warn b { color: var(--warn); }
.usage summary { cursor: pointer; font-weight: 600; }
.usage[open] summary { margin-bottom: 14px; }
.maplist { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: 4px 20px; }
.maplist li { overflow-wrap: anywhere; }
.raw { max-width: 30rem; color: var(--ink-2); font-size: .85rem; }

/* Newsletter media browser. */
button.media-launch {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px;
  width: 100%; min-height: 62px; height: auto; padding: 10px 12px;
  text-align: left; white-space: normal; background: var(--surface-2); border-color: var(--line-strong);
}
button.media-launch:hover { background: var(--surface-3); }
.media-launch strong, .media-launch small { display: block; }
.media-launch strong { font-weight: 650; }
.media-launch small { margin-top: 2px; color: var(--ink-2); font-size: .8rem; font-weight: 400; }
.media-launch-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius-sm); background: var(--surface); }
.media-launch-icon, .media-launch > svg { color: var(--ink-2); }
dialog.media-dialog { width: min(68rem, calc(100% - 32px)); height: min(46rem, calc(100dvh - 32px)); max-height: none; overflow: hidden; }
.media-dialog[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.media-dialog-head, .media-dialog-foot { padding: 12px 20px; display: flex; align-items: center; gap: 12px; }
.media-dialog-head { justify-content: space-between; border-bottom: 1px solid var(--line); }
.media-dialog-head h2, .media-folder-head h3, .media-gallery-title { margin: 0; }
.media-dialog-foot { border-top: 1px solid var(--line); flex-wrap: wrap; }
.media-dialog-foot small { margin-left: auto; }
.media-dialog small, .media-dialog input::placeholder, .media-dialog .empty { color: var(--ink-2); }
.media-status { overflow-wrap: anywhere; color: var(--ink-2); font-size: .85rem; }
.media-status:empty { display: none; }
.media-workspace { display: grid; grid-template-columns: 17rem minmax(0, 1fr); min-height: 0; }
.media-sidebar, .media-gallery { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.media-sidebar { background: var(--surface-2); border-right: 1px solid var(--line); padding: 16px 12px 0; gap: 12px; }
.media-folder-head, .media-gallery-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.media-dialog .media-create { padding: 12px; display: grid; gap: 8px; background: var(--surface); border-radius: var(--radius-sm); }
.media-folder-scroll, .media-gallery-scroll { min-height: 0; overflow: auto; overscroll-behavior: contain; }
.media-folder-scroll { padding: 3px 3px 12px; margin: -3px; }
.media-folders, .media-files { list-style: none; padding: 0; margin: 0; }
.media-folders { display: grid; gap: 3px; }
button.media-folder { justify-content: start; text-align: left; width: 100%; height: auto; min-height: 40px; padding: 8px; border: 0; background: transparent; white-space: normal; overflow-wrap: anywhere; }
button.media-folder svg { flex: none; }
button.media-folder:hover { background: var(--surface-3); }
button.media-folder[aria-current] { background: var(--accent-soft); color: var(--ink); }
button.media-folder[aria-current] svg { color: var(--accent); }
.media-folder-note { color: var(--ink-2); font-size: .88rem; padding: 4px 6px; }
.media-folder-note:empty { display: none; }
.media-gallery { position: relative; }
.media-gallery-head { padding: 16px 20px 12px; border-bottom: 1px solid var(--line); }
.media-gallery-title { font-size: 1rem; overflow-wrap: anywhere; }
.media-gallery-bar { flex-wrap: wrap; }
.media-gallery-scroll { flex: 1; padding: 16px 20px; }
.media-base { margin-top: 10px; }
.media-base-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.media-base-row .f { flex: 1 1 13rem; min-width: 0; }
.media-base-row button { height: 38px; }
.media-base input { font-family: var(--mono); font-size: .8rem; }
.media-files { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 10rem), 1fr)); gap: 12px; }
.media-file { min-width: 0; display: grid; grid-template-rows: auto 1fr auto; gap: 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px; }
.media-thumb { position: relative; display: grid; place-items: center; aspect-ratio: 4 / 3; background: var(--surface-2); border-radius: 4px; overflow: hidden; color: var(--ink-2); }
.media-thumb:hover { outline: 1px solid var(--accent); text-decoration: none; }
.media-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.media-thumb span { display: grid; justify-items: center; gap: 6px; padding: 6px; text-align: center; font-size: .8rem; }
.media-filename { overflow-wrap: anywhere; font-size: .85rem; }
.media-more { margin-top: 12px; }
.media-dialog .notice { margin: 0 0 8px; overflow-wrap: anywhere; }
.media-drop-label { display: none; }
.media-dropping .media-drop-label { display: flex; position: absolute; inset: 8px; justify-content: center; align-items: center; gap: 10px; border: 2px dashed var(--accent); border-radius: var(--radius-sm); background: var(--accent-soft); pointer-events: none; }
button.media-back { display: none; }
@media (max-width: 680px) {
  dialog.media-dialog { width: calc(100% - 16px); height: calc(100dvh - 16px); }
  .media-workspace { grid-template-columns: minmax(0, 1fr); }
  .media-dialog:not(.media-in-folder) .media-gallery, .media-dialog.media-in-folder .media-sidebar { display: none; }
  .media-dialog .media-sidebar { border-right: 0; }
  button.media-back { display: inline-flex; margin-bottom: 8px; }
  .media-dialog-head, .media-dialog-foot, .media-gallery-head, .media-gallery-scroll { padding-inline: 12px; }
  .media-files { grid-template-columns: repeat(auto-fill, minmax(min(100%, 8rem), 1fr)); }
}
@media (max-height: 520px) {
  .media-gallery { overflow: auto; }
  .media-gallery-scroll { flex: none; overflow: visible; }
}

/* Leads. */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.filters select { width: auto; min-width: 9.5rem; }
.filters .search { flex: 1 1 16rem; min-width: 14rem; }
.tog[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
td .sub.late { color: var(--bad); font-weight: 600; }
.filters .more-filters { flex: 1 1 100%; }
.filters summary { cursor: pointer; color: var(--ink-2); font-weight: 560; }
.filters .grid { margin-top: 10px; }
.lead-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.lead-grid .card + .card { margin-top: 0; }
.lead-grid > div { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-content: start; }
/* On a phone the columns dissolve: stage, what to do, who, then the notes. */
@media (max-width: 900px) {
  .lead-grid { grid-template-columns: minmax(0, 1fr); }
  .lead-grid > div { display: contents; }
  .lead-grid > div:first-child > :nth-child(2) { order: 4; }
  .lead-grid > div:last-child > :first-child { order: 2; }
  .lead-grid > div:last-child > :nth-child(2) { order: 3; }
}
.pipeline { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pipeline button { height: 34px; padding: 0 14px; border-radius: 999px; color: var(--ink-2); }
.pipeline button.past { background: var(--surface-2); border-color: transparent; }
.pipeline button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pipeline button.won[aria-pressed="true"] { background: var(--ok); border-color: var(--ok); color: #fff; }
.pipeline button.lost[aria-pressed="true"] { background: var(--bad); border-color: var(--bad); color: #fff; }
.pipeline .gap { width: 1px; height: 22px; margin: 0 6px; background: var(--line-strong); }
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.presets button { height: 26px; padding: 0 10px; font-size: .8rem; border-radius: 999px; }
.note-body { white-space: pre-wrap; overflow-wrap: anywhere; margin: 2px 0 0; }
.link-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.link-row a { overflow-wrap: anywhere; }

/* Settings. */
.items { display: flex; flex-direction: column; }
.items > div { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 20px; padding: 13px 0; border-top: 1px solid var(--line); }
.items > div:first-child { border-top: 0; padding-top: 0; }
.items > div:last-child { padding-bottom: 0; }
.items b { display: block; font-weight: 580; }
.items small { display: block; max-width: 34rem; }
.items .val { font-weight: 620; font-variant-numeric: tabular-nums; }
.secret { display: flex; gap: 8px; }
.secret input { font-family: var(--mono); font-size: 1.05rem; letter-spacing: .03em; }
.avatar-lg { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2); font-weight: 650; font-size: 1.1rem; }
.me { display: flex; align-items: center; gap: 14px; }
.narrow { max-width: 440px; }
.form { max-width: 640px; }
.me b { display: block; font-size: 1.05rem; }
.switches { display: flex; flex-direction: column; gap: 10px; }
.switches .check { align-items: flex-start; }
.switches .check input { margin-top: 5px; }
.switches small { display: block; }
