:root {
  --pink: #e5195f;
  --pink-soft: #fde7ef;
  --green: #5b8a1f;
  --green-soft: #eaf3dc;
  --amber: #b86e00;
  --amber-soft: #fff1d6;
  --blue: #2463c7;
  --blue-soft: #e3edfb;
  --ink: #1d1d1f;
  --muted: #6b6b70;
  --line: #dedee2;
  --bg: #ececee;
  --card: #fff;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 1px 1px rgba(0, 0, 0, .04);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); font-size: 14px; line-height: 1.4; }
a { color: inherit; }
button { font: inherit; }
[hidden] { display: none !important; }

/* ---- Header ---- */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 20px;
  padding: 10px 20px; background: #fff; border-bottom: 1px solid var(--line);
}
.logo {
  flex: none; text-decoration: none; font-weight: 800; letter-spacing: -.01em;
  background: var(--pink); color: #fff; padding: 6px 12px; border-radius: 8px; font-size: 15px;
}
.logo b { font-weight: 400; opacity: .9; }
.logo.big { font-size: 22px; padding: 10px 18px; display: inline-block; }
.modules { display: flex; gap: 4px; }
.modules a, .modules span {
  padding: 6px 12px; border-radius: 8px; font-weight: 700; font-size: 12px;
  text-transform: uppercase; letter-spacing: .04em; text-decoration: none; color: var(--muted);
}
.modules a.on { color: var(--ink); background: var(--bg); }
.modules .soon { opacity: .45; cursor: default; }
.search {
  flex: 1; max-width: 520px; display: flex; align-items: center; gap: 8px;
  background: var(--bg); border-radius: 8px; padding: 0 10px; margin-left: auto;
}
.search svg { width: 16px; height: 16px; fill: var(--muted); flex: none; }
.search input { flex: 1; border: 0; background: transparent; padding: 9px 0; font: inherit; outline: none; min-width: 0; }
.me { display: flex; align-items: center; gap: 8px; flex: none; }
.me img, .me .initial { width: 28px; height: 28px; border-radius: 50%; }
.me .initial { display: grid; place-items: center; background: var(--pink-soft); color: var(--pink); font-weight: 700; }
.me button { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 4px; }
.live { background: var(--amber-soft); color: var(--amber); text-align: center; padding: 4px; font-size: 12px; }

main { padding: 20px; }
.loading, .empty { color: var(--muted); padding: 40px; text-align: center; }

/* ---- Board ---- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.col { min-width: 0; }
.col h2 {
  display: flex; align-items: center; justify-content: space-between;
  margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em;
}
.count { background: #fff; border-radius: 6px; padding: 2px 8px; font-size: 12px; color: var(--muted); }
.cards { display: flex; flex-direction: column; gap: 8px; }
.card {
  display: block; text-decoration: none; background: var(--card); border-radius: var(--radius);
  padding: 10px 12px; box-shadow: var(--shadow); border-left: 3px solid transparent;
}
.card:hover { outline: 2px solid var(--line); }
.card.express { border-left-color: var(--pink); }
.card .row { display: flex; align-items: center; gap: 6px; }
.card .num { font-weight: 800; font-variant-numeric: tabular-nums; }
.card .age { margin-left: auto; color: var(--muted); font-size: 12px; }
.card .who { color: var(--muted); font-size: 13px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .what { font-size: 12px; margin-top: 6px; color: #444; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--pink); flex: none; }
.badge {
  display: inline-block; font-size: 10px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  padding: 2px 6px; border-radius: 5px; background: var(--bg); color: var(--muted);
}
.badge.express { background: var(--pink); color: #fff; }
.badge.plain { background: #fff6c2; color: #7a6400; }
.badge.trade { background: var(--blue-soft); color: var(--blue); }
.badge.legacy { background: #eee; color: #888; }

/* status chips */
.chip { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--bg); }
.chip.to_check, .chip.proof_needed { background: var(--blue-soft); color: var(--blue); }
.chip.awaiting_artwork, .chip.changes_requested { background: var(--amber-soft); color: var(--amber); }
.chip.proof_sent { background: #efe6fb; color: #6b3fb5; }
.chip.approved, .chip.dispatched { background: var(--green-soft); color: var(--green); }
.chip.cancelled { background: #f4f4f4; color: #999; text-decoration: line-through; }

/* ---- Search results ---- */
.results { max-width: 900px; margin: 0 auto; display: flex; flex-direction: column; gap: 8px; }
.results h2 { font-size: 13px; color: var(--muted); font-weight: 600; margin: 0 0 4px; }
.results .card .row { gap: 10px; }

/* ---- Order ---- */
.order { display: grid; grid-template-columns: minmax(300px, 420px) minmax(0, 1fr); gap: 20px; max-width: 1400px; margin: 0 auto; align-items: start; }
.panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 14px; }
.panel h3 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; }
.bar { display: flex; align-items: center; gap: 8px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 8px; cursor: pointer;
  padding: 8px 12px; font-weight: 700; font-size: 13px; text-decoration: none; background: var(--bg); color: var(--ink);
}
.btn:hover { filter: brightness(.96); }
.btn.green { background: var(--green); color: #fff; }
.btn.icon { padding: 8px 10px; }
.btn[disabled] { opacity: .4; cursor: default; }
.bar .grow { flex: 1; }
.note { color: var(--muted); font-size: 13px; margin: 0; }
.timeline { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.timeline li { padding: 6px 0; border-top: 1px solid var(--bg); display: flex; gap: 10px; }
.timeline li:first-child { border-top: 0; }
.timeline time { color: var(--muted); flex: none; width: 110px; font-variant-numeric: tabular-nums; }

.sheet { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.sheet .stripe { height: 10px; background: var(--pink); }
.sheet .body { padding: 22px 26px 26px; }
.sheet .head { display: grid; grid-template-columns: 1fr auto auto; gap: 28px; align-items: start; }
.sheet .ordno { font-size: 34px; font-weight: 900; letter-spacing: -.02em; margin: 0; line-height: 1; }
.sheet .when { color: var(--muted); font-size: 12px; margin-top: 6px; }
.sheet .contact { font-size: 13px; margin-top: 10px; }
.addr { font-size: 12px; line-height: 1.45; }
.addr b { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 2px; }
.flags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.items { margin-top: 20px; border-top: 1px solid var(--line); }
.item { display: grid; grid-template-columns: 28px 1fr auto; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.item.removed { opacity: .45; }
.item .n { font-weight: 800; }
.item h4 { margin: 0 0 6px; font-size: 15px; }
.specs { display: grid; grid-template-columns: max-content 1fr; gap: 1px 12px; font-size: 13px; margin: 0; }
.specs dt { color: var(--muted); }
.specs dd { margin: 0; font-weight: 600; }
.files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.file { display: flex; align-items: center; gap: 6px; font-size: 12px; background: var(--bg); border-radius: 8px; padding: 4px 8px 4px 4px; text-decoration: none; max-width: 260px; }
.file img { width: 36px; height: 36px; object-fit: contain; background: #d6d6da; border-radius: 5px; }
.file span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .route { font-size: 12px; color: var(--muted); margin-top: 8px; }
.notes { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 18px; font-size: 13px; }
.notes h5 { margin: 0 0 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.notes p { margin: 0; white-space: pre-wrap; }
.totals { margin-left: auto; font-size: 13px; display: grid; grid-template-columns: auto auto; gap: 2px 18px; text-align: right; }
.totals .grand { font-weight: 800; font-size: 15px; padding-top: 4px; }

/* ---- Proofing panels ---- */
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.big { width: 100%; justify-content: center; padding: 12px; font-size: 15px; margin-top: 14px; }
.btn.green[disabled] { opacity: .6; }
select.move, .compose select, .compose input[type=text], .compose textarea {
  font: inherit; font-size: 13px; border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; background: #fff; width: 100%;
}
select.move { width: auto; padding: 5px 8px; font-size: 12px; }
.compose textarea { margin-top: 6px; resize: vertical; line-height: 1.45; }
.compose input[type=text] { margin-top: 6px; }
.lbl { display: block; font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 16px 0 6px; }
.err { color: var(--pink); font-weight: 600; font-size: 13px; }
.folder { background: var(--bg); border-radius: 8px; padding: 10px; margin-bottom: 10px; }
.folder .bar { margin-bottom: 6px; }
.pick { list-style: none; margin: 0 0 8px; padding: 0; font-size: 13px; }
.pick li { padding: 3px 0; word-break: break-word; }
.pick input { margin-right: 6px; }
.drop { display: block; border: 2px dashed var(--line); border-radius: 10px; padding: 16px; text-align: center; color: var(--muted); font-size: 13px; cursor: pointer; }
.drop.over { border-color: var(--green); background: var(--green-soft); color: var(--green); }
.chosen { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.chosen li { display: grid; grid-template-columns: 56px 1fr auto; gap: 10px; align-items: start; background: var(--bg); border-radius: 8px; padding: 8px; }
.chosen li.error { background: var(--pink-soft); }
.chosen img, .chosen .ph { width: 56px; height: 56px; object-fit: contain; background: #fff; border-radius: 5px; display: grid; place-items: center; color: var(--muted); font-weight: 800; }
.chosen .fname { font-size: 12px; font-weight: 600; word-break: break-word; }
.chosen select { margin-top: 6px; font-size: 12px; padding: 5px; }
.x { border: 0; background: none; font-size: 18px; color: var(--muted); cursor: pointer; line-height: 1; }
.to { list-style: none; margin: 0 0 8px; padding: 0; font-size: 13px; }
.to li { padding: 3px 0; }
.add-to { background: var(--bg); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.add-to input[type=text] { margin: 0; }
.linkbar { margin-bottom: 10px; }
.round { border-top: 1px solid var(--bg); padding: 10px 0; }
.round-head { margin-bottom: 8px; }
.pfile { display: grid; grid-template-columns: 96px 1fr; gap: 10px; margin-bottom: 10px; font-size: 13px; }
.thumbs { display: flex; flex-direction: column; gap: 4px; }
.thumb { position: relative; display: block; line-height: 0; background: #fff; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.thumb img { width: 100%; height: auto; }
.pin { position: absolute; transform: translate(-50%, -100%); width: 16px; height: 16px; border-radius: 50% 50% 50% 0; rotate: -45deg; background: var(--amber); }
.pin span { display: block; rotate: 45deg; color: #fff; font-size: 9px; font-weight: 800; line-height: 16px; text-align: center; font-style: normal; }
.pstat { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--bg); }
.pstat.approved { background: var(--green-soft); color: var(--green); }
.pstat.changes { background: var(--amber-soft); color: var(--amber); }
.pstat.awaiting { background: #efe6fb; color: #6b3fb5; }
.decision { margin-top: 6px; padding: 6px 8px; border-radius: 6px; background: var(--bg); }
.decision.approve { background: var(--green-soft); }
.decision.changes { background: var(--amber-soft); }
.decision p { margin: 4px 0 0; white-space: pre-wrap; }
.pinlist { margin: 4px 0 0; padding-left: 20px; }
.msgs { font-size: 12px; margin-top: 8px; }
.msgs ul { margin: 6px 0 0; padding-left: 16px; }
.mstat.failed, .mstat.bounced { color: var(--pink); font-weight: 700; }
.mstat.skipped { color: var(--amber); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 30; box-shadow: 0 4px 16px rgba(0,0,0,.2); max-width: calc(100vw - 32px); }

/* ---- Login ---- */
.login-page { display: grid; place-items: center; min-height: 100vh; }
.login { background: #fff; border-radius: 16px; padding: 40px; text-align: center; box-shadow: var(--shadow); width: min(420px, calc(100vw - 32px)); }
.login p { color: var(--muted); }
.btn.google { background: #fff; border: 1px solid var(--line); padding: 12px 18px; font-size: 15px; margin-top: 8px; }
.btn.google svg { width: 18px; height: 18px; }
.err { color: var(--pink) !important; font-weight: 600; }

@media (max-width: 900px) {
  .top { flex-wrap: wrap; gap: 10px; padding: 10px 16px; }
  .modules { display: none; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  main { padding: 16px; }
  .board { grid-auto-flow: row; grid-auto-columns: auto; }
  .order { grid-template-columns: 1fr; }
  .order .side { order: 2; }
  .sheet .head { grid-template-columns: 1fr; gap: 12px; }
  .notes { grid-template-columns: 1fr; }
}
