:root {
  --bg: #f5f6f9; --panel: #fff; --ink: #1d2433; --muted: #5d6679; --faint: #8a92a6; --line: #e3e7ef;
  --brand: #2f6fed; --brand-ink: #fff; --brand-soft: #e9f0ff;
  --ok: #1f9d55; --ok-soft: #e4f5eb; --warn: #b7791f; --warn-soft: #fdf3e1; --bad: #d64545; --bad-soft: #fde8e8; --pend: #7a8499; --pend-soft: #eef0f4;
  --radius: 10px; --shadow: 0 1px 2px rgba(20,30,60,.06), 0 4px 16px rgba(20,30,60,.05);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.45; }
a { color: var(--brand); text-decoration: none; }
h1 { font-size: 22px; margin: 0; } h2 { font-size: 16px; margin: 0; } h3 { font-size: 14px; margin: 0; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12px; }
.row { display: flex; align-items: center; gap: 8px; } .row.wrap { flex-wrap: wrap; } .grow { flex: 1; } .space { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.hidden { display: none !important; }

/* top bar */
.topbar { background: #1b2540; color: #fff; display: flex; align-items: center; gap: 4px; padding: 0 16px; height: 54px; position: sticky; top: 0; z-index: 20; }
.topbar .brand { font-weight: 700; font-size: 16px; margin-right: 18px; display: flex; align-items: center; gap: 8px; color: #fff; }
.topbar .brand .logo { width: 26px; height: 26px; border-radius: 7px; background: linear-gradient(135deg,#4f8bff,#7a5cff); display: grid; place-items: center; font-size: 14px; }
.topbar nav { display: flex; gap: 2px; overflow-x: auto; }
.topbar nav a { color: #c5cde0; padding: 8px 12px; border-radius: 7px; white-space: nowrap; font-weight: 500; }
.topbar nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.topbar nav a.active { background: rgba(255,255,255,.13); color: #fff; }
.topbar .right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.langtoggle { display: inline-flex; border: 1px solid rgba(255,255,255,.25); border-radius: 7px; overflow: hidden; }
.langtoggle button { background: none; border: 0; color: #c5cde0; padding: 5px 9px; font-weight: 600; font-size: 12px; cursor: pointer; }
.langtoggle button.on { background: #fff; color: #1b2540; }
.light .langtoggle { border-color: var(--line); } .light .langtoggle button { color: var(--muted); } .light .langtoggle button.on { background: var(--ink); color: #fff; }

main { max-width: 1180px; margin: 0 auto; padding: 24px 20px 80px; }
.pagehead { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.pagehead .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* panels & lists */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card > .hd { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.card > .bd { padding: 16px; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: 2fr 1fr; } .grid.cols { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
@media (max-width: 860px) { .grid.two { grid-template-columns: 1fr; } }
.list > .item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); }
.list > .item:first-child { border-top: 0; }
.list > a.item { color: inherit; } .list > a.item:hover { background: #fafbfd; }
.empty { padding: 28px; text-align: center; color: var(--faint); }

/* buttons & inputs */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 7px 12px; border-radius: 8px; font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #c9d0dd; background: #fafbfd; }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); } .btn.primary:hover { filter: brightness(1.06); }
.btn.ok { background: var(--ok); color: #fff; border-color: var(--ok); } .btn.danger { color: var(--bad); }
.btn.danger.solid { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.sm { padding: 4px 9px; font-size: 12.5px; } .btn.ghost { border-color: transparent; background: none; } .btn.ghost:hover { background: var(--pend-soft); }
.btn:disabled { opacity: .5; cursor: default; }
.wa { background: #25d366; color: #fff; border-color: #25d366; }
label.f { display: block; } label.f > span { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
input, select, textarea { font: inherit; color: inherit; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
input[type=checkbox] { width: auto; } input.num { width: 64px; text-align: center; }
.fields { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; } .fields .full { grid-column: 1 / -1; }
.search { max-width: 280px; }

/* status */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.C { background: var(--ok-soft); color: var(--ok); } .pill.U { background: var(--pend-soft); color: var(--pend); } .pill.D { background: var(--bad-soft); color: var(--bad); }
.pill.warn { background: var(--warn-soft); color: var(--warn); } .pill.info { background: var(--brand-soft); color: var(--brand); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.sicon { width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.sicon.C { background: var(--ok); color: #fff; } .sicon.U { background: var(--pend-soft); color: var(--pend); border: 1px dashed #aab1c2; } .sicon.D { background: var(--bad); color: #fff; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 12px; color: #fff; flex: none; }

/* fill bar */
.fill { display: flex; height: 6px; border-radius: 4px; background: var(--pend-soft); overflow: hidden; width: 140px; }
.fill > i { display: block; height: 100%; } .fill .c { background: var(--ok); } .fill .u { background: #aeb6c7; } .fill .d { background: var(--bad); }

/* plan page */
.datebadge { width: 54px; text-align: center; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: #fff; flex: none; }
.datebadge .m { background: var(--bad); color: #fff; font-size: 10.5px; font-weight: 700; text-transform: uppercase; padding: 2px 0; }
.datebadge .d { font-size: 20px; font-weight: 700; padding: 2px 0 0; } .datebadge .w { font-size: 10.5px; color: var(--muted); padding-bottom: 3px; text-transform: uppercase; }
.team { margin-bottom: 16px; }
.team > .hd { border-left: 4px solid var(--team, var(--brand)); }
.pos { padding: 12px 16px; border-top: 1px solid var(--line); display: grid; grid-template-columns: 210px 1fr; gap: 12px; }
.pos:first-child { border-top: 0; }
@media (max-width: 700px) { .pos { grid-template-columns: 1fr; } }
.pos .pname { font-weight: 600; } .pos .need { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.slots { display: flex; flex-direction: column; gap: 6px; }
.slot { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; border: 1px solid transparent; }
.slot:hover { background: #fafbfd; border-color: var(--line); }
.slot .who { font-weight: 500; } .slot .tools { margin-left: auto; display: flex; gap: 4px; opacity: .25; transition: opacity .1s; }
.slot:hover .tools, .slot:focus-within .tools { opacity: 1; }
.slot.open { color: var(--faint); border: 1px dashed var(--line); cursor: pointer; } .slot.open:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.stepper { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.stepper button { border: 0; background: #fff; width: 24px; cursor: pointer; font-weight: 700; color: var(--muted); } .stepper button:hover { background: var(--pend-soft); }
.stepper span { min-width: 24px; text-align: center; font-weight: 600; font-size: 12.5px; padding: 2px 0; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }

/* candidates */
.cand { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; cursor: pointer; border: 1px solid transparent; }
.cand:hover { background: var(--brand-soft); border-color: #cddcff; }
.cand.dim { opacity: .55; } .cand.taken { cursor: default; opacity: .5; } .cand.taken:hover { background: none; border-color: transparent; }
.cand .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }

/* table */
table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 10px 16px; border-bottom: 1px solid var(--line); background: #fafbfd; }
table.t td { padding: 10px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; } table.t tr.click { cursor: pointer; } table.t tr.click:hover td { background: #fafbfd; }

/* matrix */
.matrix { overflow-x: auto; }
.matrix table { border-collapse: separate; border-spacing: 0; min-width: 100%; }
.matrix th, .matrix td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); padding: 8px 10px; vertical-align: top; min-width: 140px; }
.matrix th:first-child, .matrix td:first-child { position: sticky; left: 0; background: #fff; z-index: 1; min-width: 170px; }
.matrix thead th { background: #fafbfd; font-size: 12px; text-align: left; }
.matrix .teamrow td { background: #f3f5fa; font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.mname { display: flex; align-items: center; gap: 5px; font-size: 12.5px; padding: 1px 0; } .mname.D { text-decoration: line-through; color: var(--faint); }
.mopen { font-size: 12px; color: var(--warn); }

/* modal */
.backdrop { position: fixed; inset: 0; background: rgba(20,28,48,.45); display: grid; place-items: start center; padding: 6vh 16px; z-index: 50; overflow-y: auto; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 560px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.wide { max-width: 760px; }
.modal > .hd { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.modal > .bd { padding: 18px 20px; max-height: 65vh; overflow-y: auto; }
.modal > .ft { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.x { margin-left: auto; background: none; border: 0; font-size: 22px; cursor: pointer; color: var(--faint); line-height: 1; }

/* menu */
.menu { position: absolute; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(20,30,60,.16); padding: 6px; z-index: 60; min-width: 200px; }
.menu button { display: flex; width: 100%; gap: 8px; align-items: center; border: 0; background: none; padding: 8px 10px; border-radius: 7px; cursor: pointer; font: inherit; text-align: left; }
.menu button:hover { background: var(--pend-soft); } .menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #1b2540; color: #fff; padding: 10px 16px; border-radius: 9px; z-index: 99; box-shadow: var(--shadow); }
.chk { display: flex; align-items: center; gap: 8px; padding: 6px 4px; border-radius: 6px; cursor: pointer; } .chk:hover { background: #fafbfd; }
.cols2 { columns: 2; column-gap: 20px; } .cols2 > * { break-inside: avoid; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { padding: 14px 16px; } .kpi .n { font-size: 26px; font-weight: 700; } .kpi .l { color: var(--muted); font-size: 12.5px; }
.weeklabel { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 18px 0 8px; }

/* auth */
.authwrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.authcard { width: 100%; max-width: 400px; padding: 28px; }
.err { color: var(--bad); font-size: 13px; min-height: 18px; }

/* ---------- phones ---------- */
@media (hover: none) { .slot .tools { opacity: 1; } }
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; height: auto; padding: 8px 12px 0; gap: 0; }
  .topbar .brand { margin-right: auto; }
  .topbar .right { margin-left: 0; }
  .topbar nav { order: 3; width: 100%; margin: 6px -12px 0; padding: 0 8px 6px; scrollbar-width: none; }
  .topbar nav::-webkit-scrollbar { display: none; }
  .topbar nav a { padding: 7px 10px; }
  main { padding: 16px 12px 60px; }
  h1 { font-size: 19px; }
  .pagehead .actions { margin-left: 0; width: 100%; }
  .pagehead .actions .search { max-width: none; flex: 1 1 100%; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 8px; } .kpi { padding: 10px 12px; } .kpi .n { font-size: 22px; }
  .list > a.item.plan { flex-wrap: wrap; align-items: flex-start; }
  .list > a.item.plan .stats { width: 100%; justify-content: flex-start !important; padding-left: 66px; }
  .list > a.item.plan .stats > div { text-align: left !important; }
  .hide-sm { display: none; }
  table.t td, table.t th { padding: 10px 12px; }
  .fields { grid-template-columns: 1fr; }
  .modal > .bd { max-height: 70vh; }
  .backdrop { padding: 3vh 8px; }
}
