/*
 * Artistry for galleries: shared styles for the gallery dashboard and sign-in.
 * Route D: an ice-white wall, ink controls, Bricolage Grotesque display type
 * over Figtree, and artwork hung with a hook, wire and a real shadow.
 */
:root {
  --wall: #f4f7f9;
  --paper: #ffffff;
  --soft: #ebeff2;
  --ink: #141a1f;
  --ink-2: #2a333b;
  --muted: #525d67;
  --faint: #9aa5ae;
  --line: #dce2e6;
  --save: #c8102e;
  --ok: #1f7a4d;
  --ok-bg: #e3f1ea;
  --warn: #7a4d00;
  --warn-dot: #9a6200;
  --warn-bg: #fbefd9;
  --bad: #b3261e;
  --bad-bg: #fbe9e7;
  --display: "Bricolage Grotesque", "Helvetica Neue", sans-serif;
  --body: "Figtree", "Helvetica Neue", sans-serif;
  --pill: 999px;
  --card: 24px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--wall);
  color: var(--ink);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
[hidden], .hidden { display: none !important; }

/* ── Type ─────────────────────────────────────────────────── */
.wordmark { display: inline-flex; align-items: baseline; gap: 8px; text-decoration: none; }
.wordmark b { font-family: var(--display); font-weight: 800; font-size: 26px; letter-spacing: -0.03em; }
.wordmark span { font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.h1 {
  margin: 0; font-family: var(--display); font-weight: 800;
  font-size: clamp(34px, 4vw, 52px); line-height: 1; letter-spacing: -0.035em;
}
.h2 {
  margin: 0; font-family: var(--display); font-weight: 700;
  font-size: 24px; line-height: 1.15; letter-spacing: -0.02em;
}
.h3 { margin: 0; font-size: 17px; font-weight: 700; }
.lede { margin: 0; font-size: 17px; color: var(--muted); max-width: 680px; text-wrap: pretty; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.eyebrow {
  margin: 0; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase;
  font-weight: 700; color: var(--muted);
}
.num { font-family: var(--display); font-weight: 800; letter-spacing: -0.03em; line-height: 1; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  min-height: 44px; padding: 0 18px; border-radius: var(--pill); border: 0;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 700; text-decoration: none; white-space: nowrap;
  transition: opacity 0.15s ease, background 0.15s ease;
}
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.btn-ink { background: var(--ink); color: #fff; }
.btn-ink:hover:not(:disabled) { background: var(--ink-2); }
.btn-line { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.btn-line:hover:not(:disabled) { background: var(--soft); }
.btn-soft { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn-soft:hover:not(:disabled) { background: var(--soft); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover:not(:disabled) { background: var(--soft); }
.btn-danger { background: transparent; color: var(--bad); }
.btn-danger:hover:not(:disabled) { background: var(--bad-bg); }
.btn-lg { min-height: 52px; padding: 0 24px; font-size: 16px; }
.btn-icon { width: 44px; padding: 0; }
.btn .icon { width: 18px; height: 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 40px; padding: 0 16px; border-radius: var(--pill); border: 0;
  background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink);
  font-weight: 600; display: inline-flex; align-items: center; gap: 8px;
}
.chip[aria-pressed="true"], .chip[aria-selected="true"], .chip.is-on {
  background: var(--ink); color: #fff; font-weight: 700;
}

/* ── Icons (inline SVG, stroke) ───────────────────────────── */
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ── Shell ────────────────────────────────────────────────── */
.shell { min-height: 100vh; display: flex; align-items: stretch; }
.side {
  width: 272px; flex: none; padding: 28px 20px; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 28px; background: var(--wall);
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.side .wordmark { padding: 0 8px; }
.gallery-card {
  display: flex; align-items: center; gap: 12px; padding: 12px;
  background: var(--paper); border-radius: 18px; box-shadow: 0 0 0 1px var(--line);
}
.gallery-card .mark {
  width: 40px; height: 40px; flex: none; border-radius: 12px; background: var(--ink); color: var(--wall);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--display); font-weight: 800; font-size: 18px;
}
.gallery-card b { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  min-height: 44px; padding: 0 14px; border-radius: 22px; border: 0; background: transparent;
  display: flex; align-items: center; gap: 12px; text-decoration: none; font-weight: 600;
  color: var(--ink); text-align: left; width: 100%;
}
.nav-item:hover { background: var(--soft); }
.nav-item.active, .nav-item[aria-current="page"] { background: var(--ink); color: #fff; }
.nav-item .label { flex: 1; }
.badge {
  min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--save);
  color: #fff; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
}
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.main { flex: 1; min-width: 0; padding: 28px clamp(20px, 4vw, 56px) 72px; display: flex; flex-direction: column; gap: 32px; }
.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.menu-btn { display: none; }
.sidebar-overlay { display: none; }
.view { display: flex; flex-direction: column; gap: 28px; }
.view-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.view-head > div:first-child { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

@media (max-width: 900px) {
  .side {
    position: fixed; z-index: 40; left: 0; top: 0; bottom: 0; height: auto;
    transform: translateX(-100%); transition: transform 0.25s ease; box-shadow: none;
  }
  .side.open { transform: none; box-shadow: 0 0 60px rgba(20, 26, 31, 0.25); }
  .sidebar-overlay.open { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(20, 26, 31, 0.35); }
  .menu-btn { display: inline-flex; }
}

/* ── Search ───────────────────────────────────────────────── */
.search {
  flex: 1 1 280px; max-width: 420px; height: 48px; padding: 0 16px; border-radius: 24px;
  background: var(--paper); box-shadow: 0 0 0 1px var(--line);
  display: flex; align-items: center; gap: 10px; color: var(--muted);
}
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); }

/* ── Cards ────────────────────────────────────────────────── */
.card { background: var(--paper); border-radius: var(--card); box-shadow: 0 0 0 1px var(--line); padding: 24px; }
.card-flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.card-head a { font-weight: 700; font-size: 14px; }
.grid-auto { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(var(--min, 260px), 100%), 1fr)); align-items: start; }
.todo {
  padding: 20px; border-radius: 22px; background: var(--paper); box-shadow: 0 0 0 1px var(--line);
  border: 0; text-align: left; text-decoration: none; display: flex; flex-direction: column; gap: 6px; min-height: 160px;
}
.todo:hover { box-shadow: 0 0 0 1.5px var(--ink); }
.todo .kicker { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; }
.todo .kicker::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.todo .title { font-family: var(--display); font-weight: 700; font-size: 21px; letter-spacing: -0.02em; line-height: 1.15; }
.todo .go { margin-top: auto; padding-top: 10px; font-weight: 700; display: flex; align-items: center; gap: 6px; }

/* ── Stats strip ──────────────────────────────────────────── */
.stats { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr)); border-top: 2px solid var(--ink); }
.stats > div { padding: 18px 18px 18px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column-reverse; gap: 4px; }
.stats dt { font-size: 14px; color: var(--muted); font-weight: 600; }
.stats dd { margin: 0; font-family: var(--display); font-weight: 800; font-size: 40px; line-height: 1; letter-spacing: -0.03em; }

/* ── Hung art ─────────────────────────────────────────────── */
.wall-strip { padding: 26px 12px 18px; border-radius: 18px; background: var(--wall); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; align-items: start; }
.hung { display: flex; flex-direction: column; align-items: center; }
.hung::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--ink); opacity: 0.5; }
.hung .wire { width: 1px; height: 14px; background: var(--ink); opacity: 0.3; }
.hung img { width: 86%; display: block; box-shadow: 0 1px 1px rgba(0,0,0,0.16), 0 14px 22px -12px rgba(0,0,0,0.42); }
.hung .cap { align-self: stretch; padding-top: 14px; display: flex; flex-direction: column; gap: 2px; }
.hung .cap b { font-family: var(--display); font-size: 16px; line-height: 1.15; }
.shadowed { box-shadow: 0 1px 2px rgba(0,0,0,0.2), 0 6px 10px -6px rgba(0,0,0,0.4); }
.thumb { width: 64px; height: 64px; flex: none; border-radius: 10px; background: var(--wall); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.thumb img { max-width: 50px; max-height: 50px; display: block; }

/* ── Ranked list ──────────────────────────────────────────── */
.ranked { margin: 0; padding: 0; list-style: none; }
.ranked li { min-height: 64px; display: flex; align-items: center; gap: 16px; border-top: 1px solid var(--line); }
.ranked .rank { width: 32px; font-family: var(--display); font-weight: 800; font-size: 22px; color: var(--muted); }

/* ── Tables ───────────────────────────────────────────────── */
.table-box { background: var(--paper); border-radius: var(--card); box-shadow: 0 0 0 1px var(--line); overflow-x: auto; }
.g-table { width: 100%; min-width: 760px; border-collapse: collapse; }
.g-table th {
  text-align: left; padding: 18px 20px 12px 0; font-size: 12px; letter-spacing: 0.12em;
  text-transform: uppercase; font-weight: 700; color: var(--muted);
}
.g-table td { padding: 14px 20px 14px 0; border-top: 1px solid var(--line); vertical-align: middle; }
.g-table th:first-child, .g-table td:first-child { padding-left: 24px; }
.g-table th:last-child, .g-table td:last-child { padding-right: 24px; }
.g-table .actions { display: flex; justify-content: flex-end; gap: 6px; }
.g-table .empty { padding: 48px 24px; text-align: center; color: var(--muted); }
.work-cell { display: flex; align-items: center; gap: 16px; }
.work-cell b { display: block; font-size: 16px; }
.needs { margin-top: 4px; font-size: 13px; font-weight: 700; color: var(--warn); display: flex; align-items: center; gap: 6px; }
.needs::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--warn-dot); }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ── Status pills ─────────────────────────────────────────── */
.pill {
  height: 30px; padding: 0 12px; border-radius: 15px; display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 700; white-space: nowrap; background: var(--soft); color: #3b4650;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-ok { background: var(--ok-bg); color: var(--ok); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-bad { background: var(--bad-bg); color: var(--bad); }

/* ── Forms ────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 8px; font-weight: 700; }
.field .hint { font-weight: 400; font-size: 14px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; min-height: 50px; padding: 0 18px; border-radius: 25px; border: 1.5px solid var(--line);
  background: var(--paper); color: var(--ink); font-weight: 400; font-size: 15px; outline: 0;
}
.textarea { padding: 14px 18px; border-radius: 20px; min-height: 110px; resize: vertical; line-height: 1.5; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23141A1F' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 16px center; padding-right: 44px; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--ink); }
.input.is-error { border-color: var(--bad); }
.form-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); }
.alert { margin: 0; padding: 14px 16px; border-radius: 16px; background: var(--bad-bg); color: #8c1d18; font-weight: 600; }
.alert-warn { background: var(--warn-bg); color: var(--warn); }

/* ── Modals ───────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 60; background: rgba(20, 26, 31, 0.42);
  display: none; align-items: center; justify-content: center; padding: 24px; overflow-y: auto;
}
.modal-backdrop.open { display: flex; }
.modal {
  width: 100%; max-width: 520px; max-height: calc(100vh - 48px); overflow-y: auto;
  padding: 28px; border-radius: 28px; background: var(--paper);
  display: flex; flex-direction: column; gap: 20px;
}
.modal-wide { max-width: 980px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }

/* ── Toast ────────────────────────────────────────────────── */
.toast {
  position: fixed; right: 24px; bottom: 24px; z-index: 80; max-width: min(420px, calc(100vw - 48px));
  padding: 14px 18px; border-radius: 18px; background: var(--ink); color: #fff; font-weight: 600;
  box-shadow: 0 18px 40px -20px rgba(20, 26, 31, 0.6);
}

/* ── Messages ─────────────────────────────────────────────── */
.inbox { min-height: 640px; display: flex; flex-wrap: wrap; }
.threads { margin: 0; padding: 8px; list-style: none; flex: 1 1 300px; max-width: 360px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; max-height: 720px; overflow-y: auto; }
.thread-btn { width: 100%; padding: 14px; border: 0; border-radius: 18px; background: transparent; text-align: left; display: flex; gap: 12px; align-items: flex-start; }
.thread-btn:hover { background: var(--wall); }
.thread-btn.active { background: var(--soft); }
.avatar { width: 40px; height: 40px; flex: none; border-radius: 50%; background: #e1e6ea; display: flex; align-items: center; justify-content: center; font-weight: 700; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.thread-btn .snippet { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat { flex: 999 1 420px; min-width: 0; display: flex; flex-direction: column; }
.chat-head { padding: 18px 24px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 16px; }
.chat-log { flex: 1; min-height: 360px; max-height: 560px; overflow-y: auto; margin: 0; padding: 24px; list-style: none; display: flex; flex-direction: column; gap: 14px; background: var(--wall); }
.bubble-row { max-width: 70%; display: flex; flex-direction: column; gap: 4px; }
.bubble-row.me { align-self: flex-end; align-items: flex-end; }
.bubble-row.them { align-self: flex-start; align-items: flex-start; }
.bubble { padding: 12px 16px; border-radius: 20px; font-size: 15px; line-height: 1.45; white-space: pre-wrap; word-wrap: break-word; }
.me .bubble { background: var(--ink); color: #fff; }
.them .bubble { background: var(--paper); box-shadow: 0 0 0 1px var(--line); }
.composer { padding: 16px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; align-items: flex-end; }
.composer .textarea { min-height: 52px; }
.chat-empty { flex: 999 1 420px; display: flex; align-items: center; justify-content: center; padding: 48px; color: var(--muted); text-align: center; }

/* ── Bars (audience) ──────────────────────────────────────── */
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 160px) 1fr 52px; align-items: center; gap: 12px; font-size: 14px; }
.bar-track { height: 12px; border-radius: 6px; background: var(--soft); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; background: var(--ink); }
.bar-row .pct { text-align: right; font-weight: 700; }

/* ── Ad preview ───────────────────────────────────────────── */
.ad-preview { width: 100%; max-width: 380px; justify-self: center; border-radius: 22px; background: var(--paper); box-shadow: 0 0 0 1px var(--line), 0 24px 40px -28px rgba(20,26,31,0.45); overflow: hidden; }
.ad-preview .ad-head { padding: 12px 14px; display: flex; align-items: center; gap: 10px; }
.ad-preview .ad-art { aspect-ratio: 1; background: var(--wall); display: flex; align-items: center; justify-content: center; gap: 16px; padding: 0 22px; }
.ad-preview .ad-art .hung { flex: 1; }
.ad-preview .ad-art .hung img { width: 100%; }
.ad-preview .ad-cta { padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 14px; }
.ad-preview .ad-text { padding: 12px 14px 16px; font-size: 14px; line-height: 1.45; }

/* ── Campaign cards ───────────────────────────────────────── */
.metrics { margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.metrics > div { display: flex; flex-direction: column-reverse; }
.metrics dt { font-size: 13px; color: var(--muted); }
.metrics dd { margin: 0; font-family: var(--display); font-weight: 800; font-size: 26px; letter-spacing: -0.02em; }

/* ── Loading ──────────────────────────────────────────────── */
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--ink); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-block { min-height: 50vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } .side { transition: none; } }
