/* PressPayDay design tokens + components. Modules should reuse these classes. */
:root {
  --brand: #4f46e5;
  --accent: #f59e0b;
  --bg: #f6f7fb;
  --panel: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --ok: #059669;
  --warn: #d97706;
  --bad: #dc2626;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(17,24,39,.06);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 14px; line-height: 1.45; background: var(--bg); }
a { color: var(--brand); }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 16px; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.boot, .loading { padding: 40px; color: var(--muted); text-align: center; }

/* ---- shell ---- */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: #0f172a; color: #cbd5e1; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; gap: 10px; align-items: center; padding: 18px 16px; border-bottom: 1px solid #1e293b; }
.brand-name { color: #fff; font-weight: 700; }
.brand-logo { width: 34px; height: 34px; object-fit: contain; border-radius: 8px; background: #fff; }
.logo-mark { width: 48px; height: 48px; border-radius: 12px; background: var(--brand); color: #fff; font-weight: 800; font-size: 24px; display: grid; place-items: center; }
.logo-mark.sm { width: 34px; height: 34px; font-size: 17px; border-radius: 8px; }
.nav { padding: 8px 8px 16px; flex: 1; }
.nav-group-title { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #64748b; padding: 14px 10px 4px; }
.nav-link { display: flex; gap: 8px; align-items: center; padding: 7px 10px; border-radius: 7px; color: #cbd5e1; text-decoration: none; }
.nav-link:hover { background: #1e293b; color: #fff; }
.nav-link.active { background: var(--brand); color: #fff; }
.nav-icon { width: 20px; text-align: center; }
.sidebar-foot { padding: 12px 16px; border-top: 1px solid #1e293b; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sidebar-foot .small { flex-basis: 100%; color: #e2e8f0; }
.sidebar-foot .btn-ghost { color: #cbd5e1; border-color: #334155; }
.main { padding: 24px 28px 60px; min-width: 0; outline: none; }
.menu-toggle { display: none; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 30; width: 260px; transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .sidebar { transform: none; }
  .menu-toggle { display: block; position: fixed; top: 10px; left: 10px; z-index: 31; border: 0; background: var(--panel); border-radius: 8px; padding: 6px 10px; box-shadow: var(--shadow); font-size: 18px; }
  .main { padding: 56px 16px 60px; }
}

/* ---- page ---- */
.page { max-width: 1200px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.card-title { margin-bottom: 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat-value { font-size: 20px; font-weight: 700; }
.stat-label { color: var(--muted); font-size: 12px; margin-top: 2px; }
.empty { color: var(--muted); padding: 22px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); background: #fafafa; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.feed li:last-child { border-bottom: 0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.notice { padding: 10px 14px; border-radius: 8px; background: #eff6ff; border: 1px solid #bfdbfe; color: #1e3a8a; }
.notice.warn { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.notice.bad { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.notice.ok { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }

/* ---- buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: #cbd5e1; background: #f9fafb; }
.btn:disabled { opacity: .55; cursor: progress; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand); filter: brightness(1.08); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-danger:hover { background: var(--bad); filter: brightness(1.08); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; }
.icon-btn { border: 0; background: transparent; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); padding: 2px 6px; }
.btn:focus-visible, .icon-btn:focus-visible, .nav-link:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---- forms ---- */
.form { display: flex; flex-direction: column; gap: 12px; }
.form.narrow { max-width: 420px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label { font-weight: 600; font-size: 13px; }
.field .req { color: var(--bad); }
.help { color: var(--muted); }
input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; color: var(--text); width: 100%; min-width: 0; }
input[type=checkbox] { width: auto; }
input[type=color] { padding: 2px; height: 36px; }
textarea { resize: vertical; }
.check { display: flex; align-items: center; gap: 6px; font-weight: 500; }
.form-error { color: var(--bad); min-height: 1em; }
.form-error:empty { display: none; }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: #f9fafb; }
.a-right { text-align: right; }
.a-center { text-align: center; }
.num { font-variant-numeric: tabular-nums; text-align: right; }

/* ---- badges ---- */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eef2ff; color: #3730a3; text-transform: capitalize; white-space: nowrap; }
.badge-draft, .badge-new, .badge-queue, .badge-scheduled, .badge-standard { background: #f3f4f6; color: #374151; }
.badge-sent, .badge-art, .badge-prep, .badge-open, .badge-queued { background: #e0f2fe; color: #075985; }
.badge-approval, .badge-pending, .badge-pending_approval, .badge-partial, .badge-not_configured, .badge-warning { background: #fef3c7; color: #92400e; }
.badge-production, .badge-printing, .badge-pressing, .badge-qc { background: #ede9fe; color: #5b21b6; }
.badge-accepted, .badge-approved, .badge-paid, .badge-completed, .badge-done, .badge-ready, .badge-shipped, .badge-succeeded, .badge-active, .badge-pass, .badge-converted { background: #d1fae5; color: #065f46; }
.badge-declined, .badge-rejected, .badge-void, .badge-cancelled, .badge-failed, .badge-overdue, .badge-changes_requested, .badge-closed, .badge-fail, .badge-expired { background: #fee2e2; color: #991b1b; }

/* ---- tabs ---- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tab { border: 0; background: transparent; padding: 9px 14px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }

/* ---- modal & toast ---- */
.overlay { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--panel); border-radius: 12px; width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal-wide { width: min(900px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); }
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { padding: 10px 14px; border-radius: 8px; color: #fff; background: #111827; box-shadow: var(--shadow); max-width: 360px; }
.toast-success { background: var(--ok); }
.toast-error { background: var(--bad); }
.toast-info { background: #1f2937; }

/* ---- kanban (production board) ---- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.column { background: #eef0f5; border-radius: var(--radius); padding: 10px; min-height: 200px; display: flex; flex-direction: column; gap: 8px; }
.column.drag-over { outline: 2px dashed var(--brand); }
.column-title { font-weight: 700; display: flex; justify-content: space-between; }
.job-card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px; box-shadow: var(--shadow); cursor: grab; display: flex; flex-direction: column; gap: 4px; }

/* ---- auth ---- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: linear-gradient(135deg, #eef2ff, #f8fafc); }
.auth-card { background: var(--panel); border-radius: 14px; padding: 32px; width: min(400px, 100%); box-shadow: 0 10px 40px rgba(0,0,0,.08); display: flex; flex-direction: column; gap: 10px; }
.auth-card h1 { margin-top: 8px; }
.auth-form { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }

/* ---- misc ---- */
.thumb { width: 64px; height: 64px; object-fit: contain; background: #f3f4f6; border-radius: 6px; border: 1px solid var(--line); }
.preview-img { max-width: 100%; max-height: 420px; object-fit: contain; background: repeating-conic-gradient(#f3f4f6 0% 25%, #fff 0% 50%) 50% / 16px 16px; border-radius: 8px; border: 1px solid var(--line); }
.swatch { width: 22px; height: 22px; border-radius: 5px; border: 1px solid rgba(0,0,0,.15); display: inline-block; vertical-align: middle; }
.pill-list { display: flex; flex-wrap: wrap; gap: 6px; }
.bar { height: 8px; background: #e5e7eb; border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--brand); }
pre.code { background: #0f172a; color: #e2e8f0; padding: 12px; border-radius: 8px; overflow-x: auto; font-size: 12px; }
.chart { width: 100%; height: auto; }
