/* ------------------------------------------------------------------
   Design tokens
------------------------------------------------------------------ */
:root {
  --ink:            #14121c;
  --ink-2:          #453f57;
  --ink-3:          #6e6884;
  --line:           #e6e2ef;
  --line-2:         #f1eef7;
  --paper:          #fbfaff;
  --card:           #ffffff;
  --raise:          #ffffff;

  --accent:         #6d4aff;
  --accent-ink:     #4a2ee0;
  --accent-soft:    #efeaff;
  --accent-glow:    rgba(109, 74, 255, .28);

  --warm:           #ff7a4d;
  --warm-soft:      #ffeee7;
  --gold:           #e0a615;
  --gold-soft:      #fdf3d9;
  --green:          #16a06a;
  --green-soft:     #e2f6ee;
  --red:            #e0435c;
  --red-soft:       #fdeaed;
  --blue:           #2d7ff9;
  --blue-soft:      #e7f0ff;

  --r-sm: 8px;  --r: 14px;  --r-lg: 22px;  --r-xl: 30px;
  --shadow-1: 0 1px 2px rgba(20,18,28,.05), 0 2px 8px rgba(20,18,28,.04);
  --shadow-2: 0 2px 6px rgba(20,18,28,.06), 0 12px 32px rgba(20,18,28,.08);
  --shadow-3: 0 24px 70px rgba(20,18,28,.18);
  --sans: ui-sans-serif, -apple-system, "Segoe UI", Inter, system-ui, sans-serif;
  --serif: ui-serif, "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
}
:root[data-accent="teal"]   { --accent:#0e9b8e; --accent-ink:#07766c; --accent-soft:#e0f6f3; --accent-glow:rgba(14,155,142,.28); }
:root[data-accent="rose"]   { --accent:#e0457f; --accent-ink:#bb2c64; --accent-soft:#fdeaf2; --accent-glow:rgba(224,69,127,.28); }
:root[data-accent="amber"]  { --accent:#d9860a; --accent-ink:#a96504; --accent-soft:#fdf0da; --accent-glow:rgba(217,134,10,.28); }
:root[data-accent="ocean"]  { --accent:#2563eb; --accent-ink:#1d4ed8; --accent-soft:#e6edff; --accent-glow:rgba(37,99,235,.28); }
:root[data-accent="forest"] { --accent:#2f7d4f; --accent-ink:#22603c; --accent-soft:#e3f3e9; --accent-glow:rgba(47,125,79,.28); }

:root[data-theme="dark"] {
  --ink:#f2f0f8; --ink-2:#c3bdd6; --ink-3:#8e88a5;
  --line:#2b2740; --line-2:#221e35;
  --paper:#0e0c16; --card:#181528; --raise:#201c34;
  --accent-soft:#251d4d;
  --warm-soft:#3a221a; --gold-soft:#3a2f11; --green-soft:#12362a;
  --red-soft:#3b1a22; --blue-soft:#152a4d;
  --shadow-1: 0 1px 2px rgba(0,0,0,.4);
  --shadow-2: 0 2px 6px rgba(0,0,0,.4), 0 14px 34px rgba(0,0,0,.45);
  --shadow-3: 0 30px 80px rgba(0,0,0,.6);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--sans); color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  font-size: 15px; line-height: 1.5;
}
body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(900px 500px at 8% -10%, var(--accent-glow), transparent 60%),
    radial-gradient(700px 420px at 100% 0%, rgba(255,122,77,.14), transparent 55%);
  opacity: .7;
}
a { color: var(--accent-ink); }
:root[data-theme="dark"] a { color: #b3a0ff; }
h1,h2,h3,h4 { margin: 0; line-height: 1.18; letter-spacing: -.02em; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--accent); color: #fff; }

/* ------------------------------------------------------------------
   App shell
------------------------------------------------------------------ */
.app { position: relative; z-index: 1; display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  padding: 20px 14px; gap: 4px;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--card) 72%, transparent);
  backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 18px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 11px; flex: none;
  background: linear-gradient(140deg, var(--accent), var(--warm));
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 15px;
  box-shadow: 0 6px 18px var(--accent-glow);
}
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: -.02em; }
.brand-year { font-size: 12px; color: var(--ink-3); }

.nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .09em; color: var(--ink-3);
  padding: 16px 10px 6px; font-weight: 700; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border-radius: 10px; border: 0; background: none;
  color: var(--ink-2); font-weight: 550; cursor: pointer; text-align: left;
  transition: background .14s, color .14s;
}
.nav-item:hover { background: var(--line-2); color: var(--ink); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 650; }
:root[data-theme="dark"] .nav-item.active { color: #cbbcff; }
.nav-item .ico { width: 18px; text-align: center; font-size: 15px; }
.nav-item .count { margin-left: auto; font-size: 11px; font-weight: 700; color: var(--ink-3);
  background: var(--line-2); padding: 1px 7px; border-radius: 20px; }
.nav-item.active .count { background: #fff3; color: inherit; }
.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }
.who { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; }
.who:hover { background: var(--line-2); }

.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: #fff;
  background: linear-gradient(140deg, var(--accent), var(--accent-ink));
}
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }
.avatar.xs { width: 20px; height: 20px; font-size: 9px; }

.main { min-width: 0; padding: 26px 34px 90px; }
.topbar { display: flex; align-items: flex-start; gap: 18px; margin-bottom: 26px; flex-wrap: wrap; }
.topbar h1 { font-size: 30px; font-weight: 750; }
.topbar .sub { color: var(--ink-3); margin-top: 5px; max-width: 62ch; }
.topbar .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ------------------------------------------------------------------
   Primitives
------------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 15px; border-radius: 11px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); font-weight: 600; font-size: 14px;
  cursor: pointer; box-shadow: var(--shadow-1); white-space: nowrap;
  transition: transform .1s, box-shadow .15s, background .15s, border-color .15s;
}
.btn:hover { box-shadow: var(--shadow-2); border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); }
/* Buttons that are really links (downloads, OAuth hops) must not look like links. */
a.btn, a.btn:hover, a.btn:visited { text-decoration: none; color: var(--ink); }
a.btn.primary, a.btn.primary:visited { color: #fff; }
:root[data-theme="dark"] a.btn { color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: linear-gradient(140deg, var(--accent), var(--accent-ink));
  color: #fff; border-color: transparent; box-shadow: 0 6px 20px var(--accent-glow);
}
.btn.primary:hover { box-shadow: 0 10px 28px var(--accent-glow); }
.btn.ghost { background: none; border-color: transparent; box-shadow: none; color: var(--ink-2); }
.btn.ghost:hover { background: var(--line-2); }
.btn.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 30%, var(--line)); }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 9px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-1); padding: 20px;
}
.card.pad-0 { padding: 0; overflow: hidden; }
.card h3 { font-size: 16px; margin-bottom: 3px; }
.card .hint { color: var(--ink-3); font-size: 13px; }

.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
label.field .note { font-weight: 400; color: var(--ink-3); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number],
select, textarea {
  width: 100%; padding: 10px 12px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink);
  outline: none; transition: border-color .15s, box-shadow .15s, background .15s;
}
:root[data-theme="dark"] input, :root[data-theme="dark"] select, :root[data-theme="dark"] textarea { background: var(--raise); }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3.5px var(--accent-soft); background: var(--card);
}
textarea { resize: vertical; min-height: 90px; line-height: 1.55; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px; border: 1px solid var(--line);
  border-radius: 12px; cursor: pointer; background: var(--card); margin-bottom: 8px; transition: border-color .15s, background .15s; }
.check:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.check input { margin-top: 3px; accent-color: var(--accent); width: 16px; height: 16px; flex: none; }
.check .t { font-weight: 600; }
.check .d { font-size: 13px; color: var(--ink-3); }

.pill {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 650;
  padding: 3px 9px; border-radius: 20px; background: var(--line-2); color: var(--ink-2); white-space: nowrap;
}
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.red   { background: var(--red-soft);   color: var(--red); }
.pill.gold  { background: var(--gold-soft);  color: var(--gold); }
.pill.blue  { background: var(--blue-soft);  color: var(--blue); }
.pill.warm  { background: var(--warm-soft);  color: var(--warm); }
.pill.accent{ background: var(--accent-soft);color: var(--accent-ink); }
:root[data-theme="dark"] .pill.accent { color:#c0aeff; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.stat { padding: 18px 20px; }
.stat .k { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.stat .v { font-size: 34px; font-weight: 760; letter-spacing: -.03em; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.stat .d { font-size: 13px; color: var(--ink-3); }
.bar { height: 7px; border-radius: 10px; background: var(--line-2); overflow: hidden; margin-top: 11px; }
.bar > i { display: block; height: 100%; border-radius: 10px; background: linear-gradient(90deg, var(--accent), var(--warm)); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink-3); font-weight: 700; padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--line-2); }
td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
tbody tr:hover { background: color-mix(in srgb, var(--accent-soft) 40%, transparent); }
tbody tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }

.empty { text-align: center; padding: 54px 20px; color: var(--ink-3); }
.empty .big { font-size: 36px; margin-bottom: 10px; }
.empty h3 { color: var(--ink); margin-bottom: 6px; }

/* ------------------------------------------------------------------
   Task cards and the deadline timeline
------------------------------------------------------------------ */
.tcard {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 12px 13px; margin-bottom: 9px; box-shadow: var(--shadow-1); cursor: grab;
  transition: transform .12s, box-shadow .15s;
}
.tcard:hover { box-shadow: var(--shadow-2); transform: translateY(-1px); }
.tcard .t { font-weight: 620; margin-bottom: 7px; line-height: 1.35; }
.tcard .meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tcard.overdue { border-left: 3px solid var(--red); }
.tcard.soon { border-left: 3px solid var(--gold); }

.timeline { position: relative; padding-left: 26px; }
.timeline::before { content:''; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px;
  background: linear-gradient(var(--accent), var(--warm)); opacity: .35; border-radius: 2px; }
.tl-item { position: relative; padding: 0 0 20px; }
.tl-item::before { content:''; position: absolute; left: -23px; top: 5px; width: 11px; height: 11px;
  border-radius: 50%; background: var(--card); border: 2.5px solid var(--accent); }
.tl-item.done::before { background: var(--accent); }
.tl-date { font-size: 12px; font-weight: 700; color: var(--accent-ink); letter-spacing: .02em; }
:root[data-theme="dark"] .tl-date { color: #b7a5ff; }

/* ------------------------------------------------------------------
   Modal / drawer / toast
------------------------------------------------------------------ */
.scrim { position: fixed; inset: 0; background: rgba(16,12,30,.5); backdrop-filter: blur(3px);
  z-index: 60; display: grid; place-items: center; padding: 20px; animation: fade .16s ease; }
@keyframes fade { from { opacity: 0 } }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.985) } }
.modal {
  background: var(--card); border-radius: var(--r-xl); box-shadow: var(--shadow-3);
  width: min(720px, 100%); max-height: 88vh; overflow: auto; animation: rise .2s cubic-bezier(.2,.7,.3,1);
  border: 1px solid var(--line);
}
.modal.wide { width: min(980px, 100%); }
.modal-head { position: sticky; top: 0; background: var(--card); padding: 22px 26px 14px;
  border-bottom: 1px solid var(--line-2); z-index: 2; display: flex; align-items: flex-start; gap: 14px; }
.modal-head h2 { font-size: 20px; }
.modal-head .sub { color: var(--ink-3); font-size: 13px; margin-top: 4px; }
.modal-body { padding: 20px 26px; }
.modal-foot { position: sticky; bottom: 0; background: var(--card); padding: 14px 26px 20px;
  border-top: 1px solid var(--line-2); display: flex; gap: 10px; justify-content: flex-end; }
.x { margin-left: auto; border: 0; background: var(--line-2); width: 30px; height: 30px; border-radius: 9px;
  cursor: pointer; color: var(--ink-2); font-size: 16px; flex: none; }
.x:hover { background: var(--red-soft); color: var(--red); }

.toast-wrap { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 90;
  display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--ink); color: var(--paper); padding: 11px 18px; border-radius: 12px;
  box-shadow: var(--shadow-3); font-weight: 600; font-size: 14px; animation: rise .18s ease; }
.toast.bad { background: var(--red); color: #fff; }
.toast.good { background: var(--green); color: #fff; }

.tabs { display: flex; gap: 4px; background: var(--line-2); padding: 4px; border-radius: 12px; }
.tabs button { border: 0; background: none; padding: 7px 14px; border-radius: 9px; cursor: pointer;
  font-weight: 600; color: var(--ink-3); font-size: 13px; }
.tabs button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow-1); }

code, .mono { font-family: var(--mono); font-size: .92em; }
.ref { font-family: var(--mono); font-weight: 700; letter-spacing: .04em; background: var(--accent-soft);
  color: var(--accent-ink); padding: 3px 8px; border-radius: 7px; }
:root[data-theme="dark"] .ref { color:#c6b5ff; }

.callout { border-left: 3px solid var(--accent); background: var(--accent-soft);
  padding: 13px 16px; border-radius: 0 var(--r) var(--r) 0; font-size: 14px; }
.callout.warn { border-color: var(--gold); background: var(--gold-soft); }
.callout.bad { border-color: var(--red); background: var(--red-soft); }
:root[data-theme="dark"] .callout { color: var(--ink); }

/* ------------------------------------------------------------------
   Public pages (form + auth)
------------------------------------------------------------------ */
.center-page { min-height: 100vh; display: grid; place-items: center; padding: 32px 18px; position: relative; z-index: 1; }
.sheet {
  width: min(680px, 100%); background: var(--card); border-radius: var(--r-xl);
  box-shadow: var(--shadow-3); border: 1px solid var(--line); overflow: hidden;
}
.sheet-hero { padding: 34px 34px 26px; background: linear-gradient(145deg, var(--accent), var(--accent-ink) 60%, var(--warm)); color: #fff; }
.sheet-hero .eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; opacity: .85; font-weight: 700; }
.sheet-hero h1 { font-size: 28px; margin-top: 9px; font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; }
.sheet-hero p { margin: 10px 0 0; opacity: .92; line-height: 1.55; }
.sheet-body { padding: 28px 34px 32px; }
.sheet-foot { padding: 16px 34px; border-top: 1px solid var(--line-2); color: var(--ink-3); font-size: 13px;
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.steps { display: flex; gap: 8px; margin-bottom: 22px; }
.steps i { flex: 1; height: 4px; border-radius: 4px; background: var(--line); }
.steps i.on { background: var(--accent); }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; overflow-x: auto; align-items: center;
    padding: 10px; gap: 6px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar .nav-group, .sidebar-foot { display: none; }
  .nav-item { width: auto; white-space: nowrap; }
  .brand { padding: 0 10px 0 4px; }
  .main { padding: 18px 16px 70px; }
  .sheet-hero, .sheet-body { padding-left: 22px; padding-right: 22px; }
}
@media print {
  .sidebar, .topbar .actions, .btn { display: none !important; }
  body::before { display: none; }
  .card { box-shadow: none; border-color: #ddd; break-inside: avoid; }
}

/* ------------------------------------------------------------------
   Magic send — the one-click "render it and send it" button
------------------------------------------------------------------ */
.magic {
  position: relative; overflow: hidden; isolation: isolate;
  background: linear-gradient(120deg, var(--accent), var(--accent-ink) 55%, var(--warm));
  color: #fff; border-color: transparent; box-shadow: 0 6px 20px var(--accent-glow);
  transition: background .3s, box-shadow .3s, transform .12s;
}
.magic:hover { box-shadow: 0 10px 30px var(--accent-glow); }
.magic .label { display: inline-flex; align-items: center; gap: 7px; }

/* a light sweeps across while the request is in flight */
.magic.sending { pointer-events: none; }
.magic.sending::after {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(100deg, transparent 20%, rgba(255,255,255,.42) 50%, transparent 80%);
  animation: magic-sweep 1s linear infinite;
}
@keyframes magic-sweep { from { transform: translateX(-100%) } to { transform: translateX(100%) } }

/* the plane leaves */
.magic .plane { display: inline-block; }
.magic.sending .plane { animation: magic-fly .85s cubic-bezier(.35,0,.6,1) forwards; }
@keyframes magic-fly {
  40%  { transform: translate(6px, -3px) rotate(8deg); }
  100% { transform: translate(46px, -26px) rotate(22deg); opacity: 0; }
}

.magic.sent {
  background: var(--green); box-shadow: 0 6px 20px rgba(22,160,106,.35); pointer-events: none;
}
.magic.sent .label { animation: magic-pop .34s cubic-bezier(.2,.9,.3,1.3); }
@keyframes magic-pop {
  0%   { transform: scale(.55); opacity: 0 }
  65%  { transform: scale(1.12) }
  100% { transform: scale(1); opacity: 1 }
}

.magic.failed { background: var(--red); box-shadow: 0 6px 20px rgba(224,67,92,.3); }

/* three sparkles that puff outward on success */
.magic .spark {
  position: absolute; width: 5px; height: 5px; border-radius: 50%;
  background: #fff; opacity: 0; pointer-events: none;
}
.magic.sent .spark { animation: magic-spark .62s ease-out forwards; }
.magic.sent .spark:nth-of-type(1) { left: 24%; top: 52%; animation-delay: .04s; }
.magic.sent .spark:nth-of-type(2) { left: 52%; top: 24%; animation-delay: .11s; }
.magic.sent .spark:nth-of-type(3) { left: 74%; top: 60%; animation-delay: .17s; }
@keyframes magic-spark {
  0%   { opacity: 0; transform: scale(0) translateY(0) }
  35%  { opacity: 1; transform: scale(1.5) translateY(-7px) }
  100% { opacity: 0; transform: scale(0) translateY(-18px) }
}

@media (prefers-reduced-motion: reduce) {
  .magic.sending::after, .magic.sending .plane, .magic.sent .label, .magic.sent .spark {
    animation: none;
  }
  .magic.sending .plane { opacity: .55; }
}

/* ------------------------------------------------------------------
   Photo upload + tagging (public form)
------------------------------------------------------------------ */
.photo-drop {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 26px 20px; border: 2px dashed var(--line); border-radius: var(--r-lg);
  background: var(--paper); cursor: pointer; text-align: center;
  transition: border-color .15s, background .15s;
}
.photo-drop:hover, .photo-drop.over { border-color: var(--accent); background: var(--accent-soft); }
.photo-drop-icon { font-size: 26px; }
.photo-drop-hint { font-size: 12.5px; color: var(--ink-3); }

.photo-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px; margin-top: 14px;
}
.photo-card {
  position: relative; border: 1px solid var(--line); border-radius: var(--r);
  overflow: hidden; background: var(--card);
}
.photo-card.bad { border-color: var(--red); }
.photo-card img { width: 100%; height: 150px; object-fit: cover; display: block; cursor: zoom-in; }
.photo-card img:hover { opacity: .92; }
.photo-thumb-pending { height: 110px; display: grid; place-items: center; color: var(--ink-3); background: var(--line-2); }
.photo-card-body { padding: 9px 10px; }
.photo-meta { font-size: 12px; color: var(--ink-3); }
.photo-tag-btn {
  width: 100%; border: 1px solid var(--line); background: var(--paper); color: var(--ink);
  border-radius: 9px; padding: 6px 8px; font-size: 12.5px; cursor: pointer; font-weight: 600;
}
.photo-tag-btn:hover { border-color: var(--accent); color: var(--accent-ink); }
.photo-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.photo-tags .pill { font-size: 11px; cursor: pointer; border: 0; }
.photo-remove {
  position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%;
  border: 0; background: rgba(10,8,20,.66); color: #fff; cursor: pointer; font-size: 12px;
}
.photo-remove:hover { background: var(--red); }
.photo-progress { height: 4px; border-radius: 4px; background: var(--line-2); overflow: hidden; margin-bottom: 6px; }
.photo-progress > i {
  display: block; height: 100%; width: 40%; border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), var(--warm));
  animation: photo-slide 1.1s ease-in-out infinite;
}
@keyframes photo-slide { 0% { margin-left: -40% } 100% { margin-left: 100% } }

.tagger {
  margin-top: 16px; padding: 16px; border: 1px solid var(--accent);
  border-radius: var(--r-lg); background: var(--card); box-shadow: var(--shadow-2);
}
.tagger-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.tagger-stage { position: relative; margin-bottom: 12px; }
.tagger-photo {
  width: 100%; max-height: min(52vh, 460px); object-fit: contain; border-radius: var(--r);
  background: var(--line-2); display: block; cursor: zoom-in;
}
.tagger-zoom {
  position: absolute; right: 8px; bottom: 8px; border: 0; cursor: pointer;
  background: rgba(10,8,20,.7); color: #fff; border-radius: 20px;
  padding: 5px 12px; font-size: 12.5px; font-weight: 600;
}
.tagger-zoom:hover { background: rgba(10,8,20,.9); }

/* Shown only when the browser cannot decode the file — HEIC from an iPhone,
   usually. Tagging without seeing the photo is guesswork, so say so plainly. */
.photo-undecodable { display: none; }
.photo-card.undecodable img, .tagger-stage.undecodable img,
.review-card.undecodable img, .tagger-stage.undecodable .tagger-zoom { display: none; }
.photo-card.undecodable .photo-undecodable, .tagger-stage.undecodable .photo-undecodable,
.review-card.undecodable .photo-undecodable {
  display: block; text-align: center; padding: 18px 14px;
  background: var(--gold-soft); color: var(--ink); border-radius: var(--r); font-size: 13px;
}

.photo-lightbox {
  position: fixed; inset: 0; z-index: 95; background: rgba(8,6,16,.94);
  display: grid; place-items: center; padding: 20px; cursor: zoom-out;
}
.photo-lightbox img { max-width: 100%; max-height: 92vh; border-radius: var(--r); }
.photo-lightbox-close {
  position: absolute; top: 16px; right: 18px; width: 38px; height: 38px; border-radius: 50%;
  border: 0; background: rgba(255,255,255,.14); color: #fff; font-size: 16px; cursor: pointer;
}
.tagger-search { margin-bottom: 10px; }
.tagger-results { display: flex; flex-wrap: wrap; gap: 6px; max-height: 132px; overflow: auto; }
.tagger-chip {
  border: 1px solid var(--line); background: var(--paper); color: var(--ink);
  border-radius: 20px; padding: 5px 12px; font-size: 13px; cursor: pointer; font-weight: 550;
}
.tagger-chip:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }

/* ------------------------------------------------------------------
   Photo review (staff side)
------------------------------------------------------------------ */
.review-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.review-card {
  border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden;
  background: var(--card); box-shadow: var(--shadow-1);
}
.review-card img { width: 100%; height: 170px; object-fit: cover; display: block; cursor: zoom-in; background: var(--line-2); }
.review-card-body { padding: 13px 14px; }
.lightbox {
  position: fixed; inset: 0; z-index: 80; background: rgba(8,6,16,.9);
  display: grid; place-items: center; padding: 24px; cursor: zoom-out;
}
.lightbox img { max-width: 100%; max-height: 88vh; border-radius: var(--r); box-shadow: var(--shadow-3); }

/* ------------------------------------------------------------------
   Page plan gallery
------------------------------------------------------------------ */
.page-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.page-card {
  border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden;
  background: var(--card); box-shadow: var(--shadow-1); display: flex; flex-direction: column;
}
.page-card.locked { border-color: color-mix(in srgb, var(--green) 45%, var(--line)); }
.page-art {
  position: relative; background: var(--line-2); height: 190px;
  display: grid; place-items: center; overflow: hidden;
}
.page-art img { width: 100%; height: 100%; object-fit: contain; display: block; cursor: zoom-in; }
.page-empty { text-align: center; color: var(--ink-3); }
.page-lock {
  position: absolute; top: 8px; right: 8px; background: var(--green); color: #fff;
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12px;
}
.page-card-body { padding: 14px; flex: 1; display: flex; flex-direction: column; }
.page-art.undecodable img { display: none; }
.page-art.undecodable .photo-undecodable { display: block; padding: 14px; text-align: center; }
/* A file input dressed as a button. */
label.btn { cursor: pointer; }

/* The alternative offered to somebody who declines a photo. */
.stand-in {
  margin-top: 20px; padding: 18px; border-radius: var(--r-lg);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  background: var(--accent-soft);
}
.stand-in[hidden] { display: none; }
