:root {
  --bg: #f5f5f7; --card: #fff; --text: #111827; --muted: #6b7280; --line: #e5e7eb;
  --brand: #5b21b6; --brand-soft: #ede9fe; --ok: #059669; --ok-soft: #d1fae5;
  --warn: #d97706; --warn-soft: #fef3c7; --bad: #dc2626; --bad-soft: #fee2e2;
  --radius: 12px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; background: var(--bg); color: var(--text); font-size: 15px; }
h1, h2, h3 { margin: 0 0 12px; line-height: 1.2; }
h2 { font-size: 20px; } h3 { font-size: 16px; }
a { color: var(--brand); }
.muted { color: var(--muted); } .small { font-size: 13px; }
.hidden { display: none !important; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.stack > * + * { margin-top: 12px; }

header.top { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
header.top .inner { max-width: 1150px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
header.top .logo { font-weight: 700; font-size: 17px; }
header.top .logo span { color: var(--muted); font-weight: 500; }
nav.tabs { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
nav.tabs button { background: none; border: 0; padding: 8px 14px; border-radius: 8px; font: inherit; cursor: pointer; color: var(--muted); }
nav.tabs button.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
main { max-width: 1150px; margin: 0 auto; padding: 24px 20px 80px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 30px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat.ok .value { color: var(--ok); } .stat.warn .value { color: var(--warn); } .stat.brand .value { color: var(--brand); }
.progress { height: 12px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: var(--ok); transition: width .4s; }

label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; color: #374151; }
input, select, textarea { width: 100%; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 8px; font: inherit; background: #fff; color: inherit; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
input[type=checkbox] { width: auto; }
input[type=color] { padding: 2px; height: 42px; }
textarea { min-height: 90px; resize: vertical; }
.field + .field { margin-top: 12px; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 8px; border: 1px solid #d1d5db; background: #fff; font: inherit; font-weight: 600; cursor: pointer; color: var(--text); text-decoration: none; white-space: nowrap; }
button:hover, .btn:hover { background: #f9fafb; }
button.primary, .btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
button.primary:hover { filter: brightness(1.1); }
button.danger { color: var(--bad); border-color: #fecaca; }
button.small, .btn.small { padding: 5px 10px; font-size: 13px; font-weight: 500; }
button:disabled { opacity: .5; cursor: default; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: start; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.table-wrap { overflow-x: auto; }
.chip { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; background: #f3f4f6; color: #374151; white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: #065f46; } .chip.warn { background: var(--warn-soft); color: #92400e; }
.chip.bad { background: var(--bad-soft); color: #991b1b; } .chip.brand { background: var(--brand-soft); color: var(--brand); }
.names div { line-height: 1.5; } .names .arrived { color: var(--ok); }
.actions { display: flex; gap: 4px; flex-wrap: wrap; }

.dropzone { border: 2px dashed #c4b5fd; border-radius: var(--radius); padding: 30px; text-align: center; background: #faf8ff; cursor: pointer; }
.dropzone.over { background: var(--brand-soft); }
.notice { padding: 12px 14px; border-radius: 8px; background: var(--brand-soft); color: #3b0764; font-size: 14px; }
.notice.ok { background: var(--ok-soft); color: #065f46; } .notice.bad { background: var(--bad-soft); color: #991b1b; } .notice.warn { background: var(--warn-soft); color: #78350f; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #111827; color: #fff; padding: 12px 18px; border-radius: 10px; z-index: 100; max-width: 90vw; box-shadow: 0 8px 30px rgba(0,0,0,.2); }
.toast.bad { background: var(--bad); }

.center-screen { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.center-screen .card { width: 100%; max-width: 380px; }

.timeline { display: flex; align-items: flex-end; gap: 3px; height: 120px; padding-top: 10px; }
.timeline div { flex: 1; max-width: 36px; background: var(--brand); border-radius: 3px 3px 0 0; min-height: 2px; position: relative; }
.timeline-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 4px; }

dialog { border: 0; border-radius: var(--radius); padding: 24px; width: min(460px, 92vw); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(0,0,0,.4); }
