:root {
  --bg: #f4f6f9; --card: #fff; --ink: #1c2430; --mute: #667085; --line: #dde2ea; --brand: #2563eb;
  --ideal: #2f9e63; --ok: #a6d68b; --painful: #f2a73b; --off: #e4e8ee; --holiday: #b996dc; --nogo: #e5645a;
  --gold: #f7c52b; --feasible: #5fbf88; --blocked: #eef0f4;
  --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--ink); }
h1, h2 { margin: 0; }
h2 { font-size: 16px; margin-bottom: 10px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 5px 10px; }
button:hover:not(:disabled) { border-color: var(--brand); }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--brand); color: #fff; border-color: var(--brand); width: 100%; margin-top: 8px; }
button.link { border: 0; background: none; color: var(--brand); padding: 4px 0; }
input, select, textarea { border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; background: #fff; max-width: 100%; }
input.bad { border-color: #d92d20; background: #fef3f2; }
label { display: block; font-size: 12px; color: var(--mute); }
label input, label select { display: block; width: 100%; margin-top: 2px; color: var(--ink); font-size: 14px; }

.top { display: flex; gap: 24px; align-items: center; padding: 12px 20px; background: #101828; color: #fff; flex-wrap: wrap; }
.brand p { margin: 0; color: #98a2b3; font-size: 12px; }
.clocks { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; justify-content: flex-end; }
.clock { background: #1d2939 !important; display: grid; min-width: 96px; padding: 5px 10px; border-radius: 8px; background: #1d2939; border-left: 4px solid #475467; }
.clock b { font-size: 18px; font-variant-numeric: tabular-nums; }
.clock span { font-size: 12px; }
.clock small { color: #98a2b3; font-size: 11px; }
.clock.s-ideal { border-color: var(--ideal); } .clock.s-ok { border-color: var(--ok); } .clock.s-painful { border-color: var(--painful); }
.clock.s-off { border-color: #475467; } .clock.s-holiday { border-color: var(--holiday); } .clock.s-nogo { border-color: var(--nogo); }

.layout { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 16px; padding: 16px 20px; max-width: 1500px; margin: 0 auto; align-items: start; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 16px; }
.content { min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.grid4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 12px; }
.title-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.title-row h2 { margin: 0; }
.date-nav { display: flex; gap: 4px; }
.team-bar { display: flex; gap: 6px; margin-bottom: 8px; }
.team-bar input, .team-bar select { flex: 1; min-width: 0; }

.person { border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin: 10px 0; display: grid; gap: 7px; background: #fbfcfe; }
.person .head { display: flex; gap: 6px; }
.person .name { flex: 1; font-weight: 600; }
.person select { width: 100%; }
.row { display: flex; gap: 6px; align-items: center; }
.row.tz input { flex: 1; }
.row small { color: var(--mute); white-space: nowrap; }
.row input[type=time] { width: 92px; padding: 3px 5px; }
.day { display: flex; gap: 6px; align-items: center; width: 62px; color: var(--ink); }
.day input { width: auto; margin: 0; }
.check { display: flex; gap: 6px; align-items: center; }
.check input { width: auto; margin: 0; }
details { border-top: 1px dashed var(--line); padding-top: 6px; }
summary { cursor: pointer; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.lbl { width: 78px; font-size: 12px; font-weight: 600; padding: 1px 6px; border-radius: 4px; }
.lbl.ideal { background: #d6f0e1; } .lbl.ok { background: #e5f4da; }
.hint { color: var(--mute); font-size: 12px; margin: 6px 0 0; }
.icon { padding: 2px 8px; }
.city { position: relative; }
.city input { width: 100%; }
.suggest { position: absolute; z-index: 20; left: 0; right: 0; list-style: none; margin: 2px 0 0; padding: 4px; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgb(16 24 40 / .15); }
.suggest button { width: 100%; text-align: left; border: 0; }
.suggest button:hover { background: #eef4ff; }
.suggest small { color: var(--mute); }
.chips { display: inline-flex; gap: 2px; }
.chip { padding: 2px 6px; font-size: 12px; }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.nogo { flex-wrap: wrap; }
.days-field span { display: block; font-size: 12px; color: var(--mute); margin-bottom: 4px; }

.slots { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.slot button { display: flex; width: 100%; gap: 10px; align-items: center; text-align: left; flex-wrap: wrap; padding: 8px 10px; }
.slot.active button { border-color: var(--brand); background: #eef4ff; }
.rank { width: 22px; height: 22px; border-radius: 50%; background: #101828; color: #fff; display: grid; place-items: center; font-size: 12px; }
.cost { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--mute); }
.badge.gold { background: var(--gold); color: #402e00; border-radius: 10px; padding: 0 8px; font-size: 12px; font-weight: 600; }
.locals { display: flex; gap: 6px; flex-wrap: wrap; width: 100%; padding-left: 32px; }
.loc { font-size: 12px; padding: 1px 7px; border-radius: 10px; }
.empty { color: var(--mute); }

.scroll { overflow-x: auto; padding-bottom: 6px; }
.hm { display: grid; grid-template-columns: 120px repeat(96, 11px); gap: 1px; min-width: max-content; align-items: stretch; }
.hm-label { font-size: 12px; font-weight: 600; padding-right: 8px; align-self: center; line-height: 1.1; }
.hm-label small { display: block; font-weight: 400; color: var(--mute); }
.hm-hour { grid-column: span 4; font-size: 10px; color: var(--mute); text-align: left; }
.hm .c { position: relative; height: 26px; padding: 0; border: 0; border-radius: 2px; }
.hm .c.t::after { content: attr(data-t); position: absolute; left: 1px; top: 1px; font-size: 8px; color: rgb(0 0 0 / .65); pointer-events: none; }
.hm .c.sel { box-shadow: inset 0 0 0 2px #101828; }
.s-ideal { background: var(--ideal); } .s-ok { background: var(--ok); } .s-painful { background: var(--painful); }
.s-off { background: var(--off); } .s-holiday { background: var(--holiday); } .s-nogo { background: var(--nogo); }
.s-golden { background: var(--gold); } .s-feasible { background: var(--feasible); } .s-blocked { background: var(--blocked); }
.hm .s-ideal.t::after { color: #fff; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--mute); margin-top: 8px; }
.legend span { display: inline-flex; gap: 5px; align-items: center; }
.sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.sw.rot { background: var(--brand); } .sw.single { background: #98a2b3; }

textarea { width: 100%; font-family: ui-monospace, Menlo, monospace; font-size: 12px; resize: vertical; }
.actions { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; margin-top: 8px; }
.actions label select { margin-top: 2px; }

.bars { margin: 10px 0; }
.bar-row { display: grid; grid-template-columns: 90px 1fr; gap: 8px; align-items: center; margin: 6px 0; }
.bar { height: 15px; color: #fff; font-size: 10px; padding-left: 4px; line-height: 15px; border-radius: 3px; min-width: 14px; margin: 1px 0; }
.bar.rot { background: var(--brand); } .bar.single { background: #98a2b3; }
.table-wrap { overflow-x: auto; margin: 10px 0; max-height: 380px; overflow-y: auto; }
table.plan { border-collapse: collapse; font-size: 12px; width: 100%; }
.plan th, .plan td { border-bottom: 1px solid var(--line); padding: 4px 8px; text-align: left; white-space: nowrap; }
.plan th { position: sticky; top: 0; background: #fff; }
.plan td.s-ideal { background: #d6f0e1; } .plan td.s-ok { background: #ecf7e4; } .plan td.s-painful { background: #fde9c7; }
.plan td.s-off, .plan td.s-holiday, .plan td.s-nogo { background: #fbd9d5; }
.dst { color: #b54708; font-weight: 600; font-size: 11px; }
.warn { background: #fffaeb; border: 1px solid #fedf89; border-radius: 6px; padding: 6px 10px; color: #7a2e0e; margin: 8px 0; }
.plan-slots { margin: 6px 0; padding-left: 18px; }

#toast { position: fixed; bottom: 18px; left: 50%; transform: translate(-50%, 20px); background: #101828; color: #fff; padding: 8px 16px; border-radius: 8px; opacity: 0; transition: .2s; pointer-events: none; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 900px) { .layout { grid-template-columns: 1fr; padding: 12px; } .clocks { justify-content: flex-start; } }
