*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { overflow-x: clip; }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

body {
  min-height: 100vh;
  background: #f1f5f9;
  color: #1e293b;
  font-family: Montserrat, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body.app { display: flex; flex-direction: column; }
body.menu-open { overflow: hidden; }
.page { flex: 1; }

.top {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid #e2e8f0;
}
.top-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 10px 20px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; color: #0f172a; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--c-primary, #2563EB); color: #fff;
  display: grid; place-items: center; flex-shrink: 0;
}
.brand-mark svg { width: 16px; height: 16px; display: block; }
.tabs { display: flex; justify-content: center; gap: 6px; }
.tab {
  padding: 8px 16px; border-radius: 10px;
  font-size: .84rem; font-weight: 800; color: #64748b;
  border: 1px solid transparent; background: transparent;
}
.tab:hover { background: #f8fafc; color: #0f172a; border-color: #e2e8f0; }
.tab.is-on { background: var(--c-primary, #2563EB); color: #fff; border-color: var(--c-primary, #2563EB); }
.top-right { display: flex; align-items: center; gap: 10px; justify-content: flex-end; }
.who { text-align: right; }
.who b { display: block; font-size: .82rem; color: #0f172a; }
.who span { display: block; font-size: .7rem; color: #64748b; font-weight: 700; }
.signout {
  border: 1px solid #fecaca; background: #fef2f2; color: #dc2626;
  border-radius: 8px; padding: 7px 12px; font-weight: 800; font-size: .78rem;
}
.signout:hover { background: #fee2e2; }
.burger {
  display: none;
  width: 42px; height: 42px; padding: 0;
  border: 1px solid #e2e8f0; border-radius: 10px; background: #fff;
  flex-direction: column; justify-content: center; align-items: center; gap: 5px;
}
.burger span { display: block; width: 16px; height: 2px; border-radius: 2px; background: #0f172a; }
.drawer { position: fixed; inset: 0; z-index: 60; }
.drawer-bg { position: absolute; inset: 0; border: 0; background: rgba(15,23,42,.45); }
.drawer-panel {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: min(320px, 88vw);
  background: #fff;
  padding: 16px;
  box-shadow: -12px 0 32px rgba(15,23,42,.12);
  display: flex; flex-direction: column; gap: 6px;
  overflow: auto;
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.drawer-head strong { font-size: 1rem; }
.drawer-x {
  width: 40px; height: 40px; border: 0; border-radius: 10px;
  background: #f1f5f9; font-size: 1.4rem; line-height: 1;
}
.drawer-link {
  display: flex; align-items: center; min-height: 46px;
  padding: 0 12px; border-radius: 12px;
  font-weight: 800; color: #334155;
}
.drawer-link.is-on { background: color-mix(in srgb, var(--c-primary, #2563EB) 12%, #fff); color: var(--c-primary, #2563EB); }
.drawer-user { margin-top: 12px; padding-top: 12px; border-top: 1px solid #e2e8f0; }
.drawer-user b { display: block; }
.drawer-user span { display: block; color: #64748b; font-size: .78rem; font-weight: 700; }
.drawer-out { width: 100%; margin-top: 8px; min-height: 44px; }

.page { padding: 22px 20px 48px; }
.frame { max-width: 1120px; width: 100%; min-width: 0; margin: 0 auto; }
.frame-narrow { max-width: 720px; }

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 18px;
  align-items: start;
}

.head { margin-bottom: 14px; }
.head h1 { margin: 0; font-size: 1.05rem; font-weight: 800; color: #0f172a; }
.head p { margin: 4px 0 0; color: #64748b; font-size: .86rem; }

.sum, .tip, .job, .panel, .toolbar, .stats, .empty {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.sum { padding: 14px 16px; margin-bottom: 12px; }
.sum h2, .panel h2 {
  margin: 0 0 8px; font-size: .72rem; font-weight: 800;
  letter-spacing: .06em; text-transform: uppercase; color: #94a3b8;
}
.sum-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 0; border-top: 1px solid #f1f5f9;
  font-size: .84rem; font-weight: 700; color: #475569;
}
.sum-row b { font-size: 1rem; color: #0f172a; }
.tip { padding: 12px 14px; font-size: .8rem; font-weight: 700; color: #475569; line-height: 1.45; }

.job { margin-bottom: 8px; overflow: hidden; }
.job-line {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
}
.job-titles { min-width: 0; flex: 1; }
.job-line .code { font-size: .84rem; }
.job-line .wait {
  font-size: .75rem; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; max-width: 560px;
}
.job-line .job-actions { margin-left: auto; }
.btn-sm { padding: 6px 10px; font-size: .75rem; }
.job-detail .chips { margin: 8px 12px 4px; }
.job-detail .note { margin: 8px 12px 0; }
.pay-hist { font-size: .78rem; color: #64748b; font-weight: 700; padding-top: 6px; }
.job-top {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 16px 18px 8px;
}
.job-id { display: flex; align-items: center; gap: 10px; min-width: 0; }
.family {
  font-size: .68rem; font-weight: 800; letter-spacing: .04em;
  padding: 4px 8px; border-radius: 999px;
  color: var(--c-primary, #2563EB);
  background: color-mix(in srgb, var(--c-primary, #2563EB) 12%, #fff);
  border: 1px solid color-mix(in srgb, var(--c-primary, #2563EB) 28%, #fff);
}
.code { font-family: ui-monospace, Consolas, monospace; font-weight: 800; font-size: .92rem; color: #0f172a; }
.wait { color: #64748b; font-size: .78rem; font-weight: 700; margin-top: 2px; }
.job-actions { display: flex; gap: 8px; flex-shrink: 0; }

.chips {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 18px;
  margin: 4px 18px 14px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
}
.chip { display: block; font-size: .8rem; font-weight: 800; color: #334155; }
.chip i {
  display: block; font-style: normal;
  font-size: .66rem; font-weight: 800; letter-spacing: .04em;
  text-transform: uppercase; color: #94a3b8; margin-bottom: 1px;
}
.chip.is-on i { color: #15803d; }

.files { border-top: 1px solid #f1f5f9; }
.file { padding: 14px 18px; }
.file + .file { border-top: 1px solid #f1f5f9; }
.file-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.file-name { font-weight: 800; color: #0f172a; }
.file-meta { color: #64748b; font-size: .78rem; font-weight: 700; margin-top: 2px; }
.note {
  margin-top: 10px; background: #fffbeb; color: #92400e;
  border: 1px solid #fde68a; border-radius: 10px; padding: 8px 10px;
  font-size: .8rem; font-weight: 700;
}

.upload {
  margin-top: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px;
  gap: 10px 12px;
  align-items: end;
}
.field { min-width: 0; max-width: 100%; }
.field label, .check {
  display: block; font-size: .68rem; font-weight: 800; letter-spacing: .04em;
  text-transform: uppercase; color: #64748b; margin-bottom: 6px;
}
.field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.field select {
  display: block; width: 100%; max-width: 100%; min-width: 0;
  box-sizing: border-box; background: #fff;
  border: 1.5px solid #e2e8f0; border-radius: 10px;
  padding: 10px 12px; outline: none; font-weight: 700;
}
.field input:focus, .field select:focus {
  border-color: var(--c-primary, #2563EB);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-primary, #2563EB) 14%, transparent);
}
.checkline {
  grid-column: 1 / -1;
  display: flex; align-items: flex-start; gap: 8px;
  font-size: .82rem; font-weight: 700; color: #334155;
}
.checkline input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--c-primary, #2563EB); }
.pick {
  position: relative;
  display: flex; flex-direction: column; justify-content: center;
  min-height: 76px; padding: 12px 14px 12px 62px;
  border: 1.5px dashed #cbd5e1; border-radius: 12px;
  background: #f8fafc; cursor: pointer;
}
.pick input {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); border: 0;
}
.pick-ico {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 38px; height: 38px; border-radius: 10px;
  background: #e2e8f0; color: #475569;
  display: grid; place-items: center;
  font-size: .68rem; font-weight: 800;
}
.pick-name {
  font-weight: 800; color: #0f172a; font-size: .86rem;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pick-hint { font-size: .72rem; font-weight: 700; color: #94a3b8; }
.pick:hover { border-color: var(--c-primary, #2563EB); background: #fff; }
.pick.has-file { border-style: solid; border-color: #86efac; background: #f0fdf4; }
.pick.has-file .pick-ico { background: #dcfce7; color: #15803d; }
.file-actions, .job-foot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.file-actions { grid-column: 1 / -1; justify-content: flex-end; }
.job-foot { padding: 0 18px 16px; justify-content: flex-end; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px; border: 1px solid transparent;
  padding: 9px 14px; font-weight: 800; font-size: .82rem;
  background: #fff; color: #0f172a; white-space: nowrap;
}
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--c-primary, #2563EB); color: #fff; }
.btn-primary:hover:not(:disabled) { filter: brightness(1.06); }
.btn-ghost { border-color: #e2e8f0; color: #0f172a; }
.btn-ghost:hover { border-color: var(--c-primary, #2563EB); color: var(--c-primary, #2563EB); }
.btn-danger { border-color: #fecaca; background: #fff; color: #b91c1c; }
.btn-danger:hover { background: #fef2f2; }

.banner {
  max-width: 1120px; margin: 0 auto 14px;
  background: #fffbeb; color: #92400e; border: 1px solid #fde68a;
  border-radius: 12px; padding: 10px 12px; font-weight: 800;
}
.banner.ok { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.banner.bad { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.empty { padding: 28px 16px; text-align: center; color: #64748b; font-weight: 700; }

.toolbar {
  display: flex; flex-wrap: wrap; align-items: end; gap: 12px;
  padding: 14px 16px; margin-bottom: 14px;
  min-width: 0; max-width: 100%;
}
.toolbar .field { flex: 1 1 180px; min-width: 0; max-width: 100%; }
.toolbar-note { margin: 0 0 8px auto; color: #64748b; font-size: .8rem; font-weight: 700; }

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
}
.stat {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid #f1f5f9;
  border-right: 1px solid #f1f5f9;
  border-radius: 0; box-shadow: none;
}
.stat:nth-child(2n) { border-right: 0; }
.stat.span2 { grid-column: 1 / -1; border-right: 0; }
.stat em {
  font-style: normal; font-size: .84rem; font-weight: 800; color: #64748b;
  text-transform: none; letter-spacing: 0; margin: 0;
}
.stat strong { font-size: 1.15rem; font-weight: 800; color: #0f172a; }
.stat.good strong { color: #15803d; }
.stat.warn strong { color: #b45309; }

.panel { margin-bottom: 14px; overflow: hidden; }
.panel h2 { padding: 14px 18px 0; }
.panel .body { padding: 8px 18px 18px; }
.panel p { margin: 0 0 14px; color: #64748b; font-size: .86rem; font-weight: 700; }
.stack { display: grid; gap: 12px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.toast {
  position: fixed; right: 18px; bottom: 18px; z-index: 40;
  max-width: min(360px, calc(100vw - 36px));
  background: #0f172a; color: #fff;
  border-radius: 12px; padding: 12px 14px;
  box-shadow: 0 12px 30px rgba(15,23,42,.25);
  font-weight: 700; display: none;
}
.toast.show { display: block; }

.login-page {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center;
  width: 100%; max-width: 100%; overflow-x: clip;
  padding: 24px 16px 0; background: #f1f5f9;
}
.login-card { margin: auto; }
.login-card {
  width: 100%; max-width: 420px; box-sizing: border-box;
  background: #fff; border: 1px solid #e2e8f0; border-radius: 16px;
  box-shadow: 0 10px 30px rgba(15,23,42,.06);
  padding: 26px 20px 20px;
}
.login-card h1 { margin: 14px 0 4px; font-size: 1.6rem; font-weight: 800; color: #0f172a; }
.login-card .lead { margin: 0 0 16px; color: #64748b; font-weight: 700; }
.login-card .field { margin-bottom: 12px; }
.login-card .btn { width: 100%; margin-top: 4px; padding: 11px 14px; }
.fine { margin-top: 14px; color: #94a3b8; font-size: .75rem; font-weight: 700; }
.foot {
  text-align: center; color: #94a3b8;
  font-size: .75rem; font-weight: 700;
  padding: 8px 12px 18px;
}

@media (max-width: 860px) {
  .top-inner { grid-template-columns: 1fr auto; padding: 8px 12px; }
  .tabs, .who, .desk-out { display: none; }
  .burger { display: flex; }
  .page { padding: 14px 12px 20px; }
  .split, .chips, .upload, .row-2, .stats { grid-template-columns: 1fr; }
  .split-side { order: -1; }
  .stat, .stat.span2 { border-right: 0; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar-note { margin: 0; width: 100%; }
  .toolbar .field, .toolbar .btn { width: 100%; max-width: 100%; flex: none; min-width: 0; }
  .job-top, .file-top, .job-line { flex-direction: column; align-items: stretch; }
  .job-line .wait { white-space: normal; max-width: none; }
  .job-line .job-actions { margin-left: 0; }
  .job-actions, .file-actions, .job-foot { width: 100%; }
  .job-actions .btn, .file-top .btn, .file-actions .btn, .job-foot .btn { width: 100%; min-height: 44px; }
  .field input, .field select { font-size: 16px; }
  .code { overflow-wrap: anywhere; }
}
