:root {
  --navy: #1e3a5f;
  --navy-2: #152a46;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f4f7fb;
  --card: #ffffff;
  --blue: #1d4ed8;
  --count: #dbeafe;
  --count-ink: #1e40af;
  --mine: #fef3c7;
  --danger: #b91c1c;
  --ok: #15803d;
  --warn: #b45309;
  --U: #1d4ed8;
  --C: #15803d;
  --R: #b45309;
  --P: #7c3aed;
  --radius: 12px;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); min-height: 100%; }
button, input, select { font: inherit; }
button { cursor: pointer; }
a { color: var(--blue); }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px; justify-content: space-between;
  padding: 10px 16px; background: var(--navy); color: #fff;
}
.brand { display: flex; align-items: baseline; gap: 8px; font-weight: 700; letter-spacing: 0.02em; }
.brand span { font-weight: 500; font-size: 12px; opacity: 0.75; }
.topbar nav { display: flex; gap: 6px; flex-wrap: wrap; }
.topbar nav button, .ghost, .primary, .danger, .ok {
  border: 0; border-radius: 8px; padding: 8px 12px; font-weight: 600;
}
.topbar nav button { background: transparent; color: #fff; }
.topbar nav button.active, .topbar nav button:hover { background: rgba(255,255,255,0.12); }
.userchip { font-size: 13px; opacity: 0.9; display: flex; gap: 8px; align-items: center; }
.userchip button { background: rgba(255,255,255,0.12); color: #fff; border: 0; border-radius: 8px; padding: 6px 10px; }

.wrap { padding: 16px; max-width: 1400px; margin: 0 auto; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
h1, h2, h3 { margin: 0 0 12px; }
p.muted, .muted { color: var(--muted); }

.login {
  min-height: 100dvh; display: grid; place-items: center; padding: 24px;
  background: linear-gradient(160deg, var(--navy-2), var(--navy) 50%, #0f766e);
}
.login .card { width: min(100%, 400px); }
.login h1 { color: var(--navy); }
label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 6px; }
input, select { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.primary { background: var(--navy); color: #fff; }
.primary:disabled { opacity: 0.6; cursor: default; }
.danger { background: #fee2e2; color: var(--danger); }
.ok { background: #dcfce7; color: var(--ok); }
.ghost { background: #e2e8f0; color: var(--ink); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.error { color: var(--danger); background: #fef2f2; padding: 8px 12px; border-radius: 8px; margin: 8px 0; }
.okbox { color: var(--ok); background: #f0fdf4; padding: 8px 12px; border-radius: 8px; margin: 8px 0; }
.warn { color: var(--warn); background: #fffbeb; padding: 8px 12px; border-radius: 8px; margin: 8px 0; }
.banner { padding: 10px 16px; background: #fff7ed; color: #9a3412; border-bottom: 1px solid #fed7aa; }

.grid-wrap { overflow: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
table.sked { border-collapse: collapse; min-width: 100%; font-size: 13px; }
table.sked th, table.sked td { border: 1px solid var(--line); padding: 6px 8px; text-align: center; white-space: nowrap; }
table.sked thead th { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 3; }
table.sked th.sticky, table.sked td.sticky {
  position: sticky; left: 0; z-index: 2; background: #fff; text-align: left; min-width: 128px;
}
table.sked th.sticky { z-index: 4; left: 42px; }
table.sked th.ln, table.sked td.ln { position: sticky; left: 0; z-index: 2; width: 42px; min-width: 42px; background: #f8fafc; }
table.sked thead th.ln { z-index: 5; background: var(--navy); color: #fff; }
table.sked thead th.sticky { background: var(--navy); color: #fff; }
table.sked .sec td { background: #e2e8f0; font-weight: 700; text-align: left; }
table.sked tr.mine td { background: var(--mine); }
table.sked tr.mine td.sticky { background: #fde68a; font-weight: 700; }
table.sked tr.count td { background: var(--count); color: var(--count-ink); font-weight: 700; }
.code {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 28px; height: 28px; border-radius: 6px; font-weight: 800; color: #fff;
}
.code.U { background: var(--U); }
.code.C { background: var(--C); }
.code.R { background: var(--R); }
.code.P { background: var(--P); }
.code.off { background: transparent; color: #cbd5e1; font-weight: 500; }

.legend { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0; font-size: 13px; }
.legend span { display: flex; align-items: center; gap: 6px; }

.tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.list { display: flex; flex-direction: column; gap: 10px; }
.trade, .emp, .flag {
  border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: #fff;
}
.checks { display: flex; gap: 12px; flex-wrap: wrap; }
.checks label { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 600; }
.checks input { width: auto; }
.file { margin: 8px 0; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.stack { display: grid; gap: 16px; }
@media (min-width: 900px) {
  .split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
}
.hidden { display: none !important; }
