:root {
  --paper: #f5f2ec;
  --card: #fffdf9;
  --ink: #1c2130;
  --ink-2: #4a5164;
  --ink-3: #8a90a0;
  --line: #e4dfd5;
  --line-2: #efeae0;
  --opal-a: #8fd8cf;
  --opal-b: #b8a9f0;
  --opal-c: #f3c5d6;
  --opal: linear-gradient(120deg, var(--opal-a), var(--opal-b) 55%, var(--opal-c));
  --open: #d9892b;
  --open-bg: #fbeed9;
  --ok: #1f8f7e;
  --ok-bg: #dff3ee;
  --gap: #d4502f;
  --gap-bg: #fbe3dc;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(28, 33, 48, .05), 0 8px 28px rgba(28, 33, 48, .07);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", Inter, Roboto, "Helvetica Neue", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 15px/1.5 var(--sans); color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; margin: 0; }
h1 { font-size: 30px; line-height: 1.15; }
h2 { font-size: 21px; }
h3 { font-size: 16px; font-family: var(--sans); font-weight: 650; }
a { color: inherit; }
.mono { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }

/* shell */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.rail { position: sticky; top: 0; height: 100vh; padding: 22px 16px; display: flex; flex-direction: column; gap: 6px; border-right: 1px solid var(--line); background: linear-gradient(180deg, #fbf9f4, #f5f2ec); }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; font-family: var(--serif); font-size: 21px; font-weight: 650; }
.gem { width: 26px; height: 26px; border-radius: 9px 9px 9px 3px; background: var(--opal); box-shadow: inset 0 0 0 1px rgba(255,255,255,.6), 0 3px 10px rgba(184,169,240,.5); transform: rotate(8deg); }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; text-decoration: none; color: var(--ink-2); font-weight: 520; }
.nav a:hover { background: rgba(28,33,48,.05); }
.nav a.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 0 var(--line), 0 4px 14px rgba(28,33,48,.06); }
.nav a .n { margin-left: auto; font-size: 12px; background: var(--gap); color: #fff; border-radius: 99px; padding: 0 7px; min-width: 20px; text-align: center; }
.nav svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.rail .foot { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid var(--line); }
.who { font-size: 13px; color: var(--ink-2); word-break: break-all; }
.role-pill { display: inline-block; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; padding: 2px 8px; border-radius: 99px; background: var(--opal); color: var(--ink); font-weight: 700; }
.main { padding: 30px 40px 80px; max-width: 1280px; width: 100%; }
.head { display: flex; align-items: flex-end; gap: 18px; margin-bottom: 22px; flex-wrap: wrap; }
.head .sub { color: var(--ink-3); margin-top: 4px; }
.head .actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }

/* controls */
.btn { border: 1px solid var(--line); background: var(--card); padding: 8px 14px; border-radius: 10px; cursor: pointer; font-weight: 580; display: inline-flex; align-items: center; gap: 8px; transition: transform .06s, box-shadow .15s, background .15s; }
.btn:hover { box-shadow: 0 3px 12px rgba(28,33,48,.1); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.primary:hover { background: #2b3350; }
.btn.opal { background: var(--opal); border-color: transparent; color: var(--ink); }
.btn.danger { color: var(--gap); }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
input, select, textarea { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: #fff; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--opal-b); box-shadow: 0 0 0 3px rgba(184,169,240,.28); }
label { display: block; font-size: 12.5px; font-weight: 620; color: var(--ink-2); margin: 0 0 5px; letter-spacing: .01em; }
.field { margin-bottom: 14px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.seg { display: inline-flex; background: #ebe7dd; border-radius: 11px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 6px 14px; border-radius: 8px; cursor: pointer; font-weight: 580; color: var(--ink-2); }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 4px rgba(28,33,48,.12); }

/* cards + tiles */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad { padding: 20px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }
.tile { padding: 16px 18px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); position: relative; overflow: hidden; }
.tile .k { font-size: 12.5px; color: var(--ink-3); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.tile .v { font-family: var(--serif); font-size: 38px; line-height: 1.1; margin-top: 4px; }
.tile.hot { border-color: #f0c2b5; background: linear-gradient(180deg, #fff6f2, var(--card)); }
.tile.hot .v { color: var(--gap); }
.tile::after { content: ""; position: absolute; right: -22px; top: -22px; width: 70px; height: 70px; border-radius: 50%; background: var(--opal); opacity: .22; }
.grid2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; }
.sec-title { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; }
.sec-title .count { font-size: 12px; background: #ebe7dd; padding: 1px 8px; border-radius: 99px; color: var(--ink-2); }

/* chips */
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 640; padding: 2px 9px; border-radius: 99px; }
.chip.open { background: var(--open-bg); color: #9a5a0c; }
.chip.assigned { background: var(--ok-bg); color: #126b5e; }
.chip.uncovered { background: var(--gap-bg); color: #a53318; }
.chip.neutral { background: #ebe7dd; color: var(--ink-2); }
.chip.pending { background: #e9e3fb; color: #52409b; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* lists */
.list { display: flex; flex-direction: column; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line-2); cursor: default; }
.item:last-child { border-bottom: 0; }
.item.click { cursor: pointer; }
.item.click:hover { background: #faf7f0; }
.item .grow { flex: 1; min-width: 0; }
.item .t { font-weight: 600; }
.item .s { color: var(--ink-3); font-size: 13px; }
.empty { padding: 34px 18px; text-align: center; color: var(--ink-3); }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); font-weight: 650; padding: 11px 16px; border-bottom: 1px solid var(--line); background: #faf7f0; position: sticky; top: 0; }
td { padding: 11px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #faf7f0; }
.pager { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); }
.pager .grow { flex: 1; }

/* week grid */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.day { background: var(--card); border: 1px solid var(--line); border-radius: 12px; min-height: 220px; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.day.today { border-color: var(--opal-b); box-shadow: 0 0 0 3px rgba(184,169,240,.22); }
.day .dh { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 4px; }
.day .dn { font-family: var(--serif); font-size: 22px; }
.day .dw { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); font-weight: 650; }
.shift { border-radius: 9px; padding: 6px 8px; font-size: 12.5px; cursor: pointer; border: 1px solid transparent; line-height: 1.3; text-align: left; width: 100%; background: var(--ok-bg); }
.shift .tm { font-weight: 700; font-variant-numeric: tabular-nums; }
.shift .pp { display: block; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shift.open { background: var(--open-bg); border-color: #efd3a8; }
.shift.uncovered { background: var(--gap-bg); border-color: #f0b8a8; }
.shift:hover { filter: brightness(.97); }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--ink-2); margin-bottom: 12px; flex-wrap: wrap; }

/* drawer + modal */
.scrim { position: fixed; inset: 0; background: rgba(28,33,48,.35); backdrop-filter: blur(2px); z-index: 20; animation: fade .15s; }
.drawer { position: fixed; top: 0; right: 0; height: 100%; width: min(520px, 100vw); background: var(--paper); z-index: 21; box-shadow: -12px 0 50px rgba(28,33,48,.25); display: flex; flex-direction: column; animation: slide .2s ease-out; }
.drawer header { padding: 20px 24px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: flex-start; gap: 12px; }
.drawer header .x { margin-left: auto; }
.drawer .body { padding: 20px 24px 40px; overflow: auto; flex: 1; }
.modal { position: fixed; inset: 0; display: grid; place-items: center; z-index: 22; padding: 20px; }
.modal .box { width: min(560px, 100%); max-height: 92vh; overflow: auto; background: var(--paper); border-radius: 18px; padding: 24px; box-shadow: 0 30px 80px rgba(28,33,48,.35); animation: pop .18s ease-out; }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
@keyframes pop { from { transform: scale(.96); opacity: 0; } }

.verdict { border-radius: 12px; padding: 12px 14px; margin: 12px 0; font-size: 14px; }
.verdict.good { background: var(--ok-bg); color: #0f5a4e; }
.verdict.bad { background: var(--gap-bg); color: #8e2a12; }
.verdict ul { margin: 6px 0 0 18px; padding: 0; }
.cand { display: flex; gap: 12px; align-items: flex-start; padding: 11px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); margin-bottom: 8px; }
.cand.no { opacity: .8; background: #faf6f1; }
.cand .grow { flex: 1; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs button { background: none; border: 0; padding: 9px 14px; cursor: pointer; font-weight: 600; color: var(--ink-3); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--ink); border-color: var(--opal-b); }
.toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 40; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.3); max-width: min(620px, 92vw); animation: pop .18s; }
.toast.err { background: #8e2a12; }

/* auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth .art { background: radial-gradient(900px 600px at 20% 15%, #bde9e1 0, transparent 60%), radial-gradient(800px 600px at 85% 30%, #cfc4f6 0, transparent 60%), radial-gradient(700px 500px at 40% 100%, #f7cfdc 0, transparent 60%), #efe9de; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.auth .art h1 { font-size: 46px; max-width: 520px; line-height: 1.08; }
.auth .art p { max-width: 460px; font-size: 17px; color: var(--ink-2); }
.rules { display: grid; gap: 10px; margin-top: 26px; max-width: 480px; }
.rules div { background: rgba(255,253,249,.72); backdrop-filter: blur(6px); border: 1px solid rgba(255,255,255,.7); border-radius: 12px; padding: 10px 14px; font-size: 14px; }
.rules b { font-family: var(--serif); }
.auth .form { padding: 56px; display: flex; flex-direction: column; justify-content: center; max-width: 480px; width: 100%; margin: 0 auto; }
.err-line { color: var(--gap); font-size: 14px; min-height: 20px; margin: 4px 0 8px; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--opal-b); animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { padding: 40px; text-align: center; color: var(--ink-3); }
.kbd { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; background: #ebe7dd; padding: 2px 7px; border-radius: 6px; word-break: break-all; }

@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 12px; }
  .rail .foot { margin: 0 0 0 auto; border: 0; padding: 0; }
  .brand { padding: 0 8px; }
  .nav { display: flex; flex-wrap: wrap; }
  .main { padding: 20px 16px 80px; }
  .week { grid-template-columns: 1fr; }
  .grid2, .auth { grid-template-columns: 1fr; }
  .auth .art { padding: 28px; } .auth .art h1 { font-size: 32px; }
  .auth .form { padding: 28px; }
  .row3 { grid-template-columns: 1fr; }
}
