:root {
  --bg0: #0c1736; --bg1: #070b1a; --bg2: #03050d;
  --card: rgba(26, 40, 82, 0.62); --card2: rgba(20, 31, 66, 0.8); --line: rgba(255, 255, 255, 0.07);
  --text: #eef2ff; --muted: #8a94b4; --muted2: #5d6788;
  --green: #3ee08f; --red: #ff5a6a; --orange: #ff9f43; --blue: #7cc4ff;
  --r: 20px;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
  --name-w: 82px;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
html { background: #03050d; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text); font-size: 16px; line-height: 1.35;
  background: radial-gradient(120% 60% at 50% -10%, #17295c 0%, rgba(12, 23, 54, 0) 60%), linear-gradient(180deg, var(--bg0) 0%, var(--bg1) 45%, var(--bg2) 100%);
  background-attachment: fixed; min-height: 100vh;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
#app { max-width: 720px; margin: 0 auto; padding: calc(var(--safe-t) + 16px) calc(var(--safe-r) + 10px) calc(var(--safe-b) + 110px) calc(var(--safe-l) + 10px); }
@media (min-width: 900px) { #app { max-width: 980px; padding-left: 24px; padding-right: 24px; } }
.hidden, [hidden] { display: none !important; }

.top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin: 2px 2px 10px; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.09em; font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 0 0 4px; }
h1.title { font-size: 28px; margin: 0; letter-spacing: -0.02em; }
.sub { color: var(--muted); font-size: 14px; margin: 2px 0 0; }
.bolt { flex: none; width: 46px; height: 46px; border-radius: 50%; border: 0; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, #5cf5a9, #17b86a 70%); box-shadow: 0 0 0 4px rgba(62, 224, 143, 0.14), 0 6px 20px rgba(23, 184, 106, 0.35); }
.bolt.off { background: radial-gradient(circle at 35% 30%, #ffc27a, #e07a18 70%); box-shadow: 0 0 0 4px rgba(255, 159, 67, 0.14); }
.bolt svg { width: 22px; height: 22px; fill: #04210f; }

.week-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 4px 0 14px; }
.week-nav .mid { flex: 1; text-align: center; min-width: 0; }
.week-nav h1 { font-size: 26px; margin: 0; letter-spacing: -0.02em; }
.ib { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.06); display: grid; place-items: center; font-size: 18px; padding: 0; line-height: 1; }
.ib svg { width: 16px; height: 16px; stroke: var(--muted); stroke-width: 2.4; fill: none; }
.ib:disabled { opacity: 0.35; }
.jump { border: 0; background: none; color: var(--blue); font-size: 12.5px; font-weight: 650; padding: 4px 0 0; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; margin-bottom: 10px;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.card.pad { padding: 15px 16px; }

.rota-card { padding: 8px 6px 10px; overflow: visible; }
.rota-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.rota {
  display: grid;
  grid-template-columns: var(--name-w) repeat(7, minmax(0, 1fr));
  gap: 2px;
  width: 100%;
  min-width: 0;
}
.head, .name, .cell, .count {
  min-width: 0; text-align: center;
}
.head { padding: 4px 1px 6px; }
.head .d { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.head .n { font-size: 15px; font-weight: 700; margin-top: 1px; }
.head.today .d, .head.today .n { color: var(--green); }
.name {
  position: sticky; left: 0; z-index: 2;
  text-align: left; padding: 6px 4px 6px 6px;
  background: linear-gradient(90deg, #122047 70%, rgba(18, 32, 71, 0.92) 100%);
  border-radius: 10px;
  display: flex; flex-direction: column; justify-content: center; gap: 1px;
}
.name .nm { font-size: 12px; font-weight: 700; letter-spacing: -0.03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.name .hrs { font-size: 11px; color: var(--muted); font-weight: 650; }
.name .dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-right: 5px; vertical-align: 1px; }
.cell {
  appearance: none; -webkit-appearance: none;
  border: 1px solid transparent; background: rgba(255, 255, 255, 0.04);
  border-radius: 10px; padding: 5px 2px; min-height: 48px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0; color: inherit;
}
.cell.on { background: rgba(62, 224, 143, 0.12); border-color: rgba(62, 224, 143, 0.28); }
.cell.today { box-shadow: inset 0 0 0 1px rgba(62, 224, 143, 0.35); }
.cell .t, .cell .b { font-size: 10px; font-weight: 750; line-height: 1.15; letter-spacing: -0.03em; max-width: 100%; overflow: hidden; }
.cell .dash { color: var(--muted2); font-size: 14px; font-weight: 600; }
.cell:active { transform: scale(0.97); }
.count { padding: 6px 0 2px; font-size: 11px; font-weight: 700; color: var(--muted); }
.count b { color: var(--text); font-size: 13px; display: block; }
.corner { position: sticky; left: 0; z-index: 3; background: #101a3c; border-radius: 10px; }
.totals { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 10px 8px 2px; }
.totals .big { font-size: 22px; font-weight: 750; letter-spacing: -0.02em; }
.totals .big span { font-size: 14px; color: var(--muted); font-weight: 600; }
.totals .hint { color: var(--muted); font-size: 13px; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 2px 4px; }
.btn { flex: 1; border-radius: 14px; padding: 13px 14px; border: 1px solid rgba(255, 255, 255, 0.12); background: rgba(255, 255, 255, 0.06); font-weight: 650; font-size: 16px; }
.btn.go { background: var(--green); color: #05230f; border-color: var(--green); }
.btn.warn { color: #ffb3ba; border-color: rgba(255, 90, 106, 0.4); background: rgba(255, 90, 106, 0.08); }
.btn.sm { flex: none; padding: 9px 12px; font-size: 14px; border-radius: 11px; }

.eyebrow.sec { margin: 18px 4px 10px; }
.note { color: var(--muted); font-size: 13.5px; margin: 8px 0; }
.set-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.status-line { font-size: 14.5px; color: #cfd6ee; }
.field { margin: 12px 0; }
.field > label, .lab { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.in { width: 100%; background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 12px; padding: 11px 12px; font-size: 16px; outline: none; }
.in:focus { border-color: var(--blue); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { border: 1px solid rgba(255, 255, 255, 0.12); background: rgba(255, 255, 255, 0.04); border-radius: 10px; padding: 10px 11px; font-size: 14px; font-weight: 650; }
.seg button.on { border-color: var(--green); background: rgba(62, 224, 143, 0.15); color: #c9ffe3; }
.btns { display: flex; gap: 10px; margin-top: 16px; }

.staff-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.staff-row:last-child { border-bottom: 0; }
.staff-row .grow { flex: 1; min-width: 0; }
.staff-row .nm { font-weight: 700; font-size: 17px; }
.staff-row .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.icon-btns { display: flex; gap: 4px; }
.icon-btns button { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.05); display: grid; place-items: center; padding: 0; }
.icon-btns svg { width: 16px; height: 16px; stroke: var(--muted); stroke-width: 2.2; fill: none; }
.icon-btns button:disabled { opacity: 0.3; }

.sheet-wrap { position: fixed; inset: 0; z-index: 50; }
.sheet-backdrop { position: absolute; inset: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; background: rgba(2, 4, 12, 0.6); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-width: 560px; margin: 0 auto; max-height: calc(100% - var(--safe-t) - 10px); overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; outline: none;
  background: linear-gradient(180deg, #16234a, #0b1330); border: 1px solid var(--line); border-bottom: 0; border-radius: 26px 26px 0 0;
  padding: 0 calc(var(--safe-r) + 18px) calc(var(--safe-b) + 22px) calc(var(--safe-l) + 18px); animation: up 0.22s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: 0.3; } to { transform: none; opacity: 1; } }
.grab { width: 40px; height: 5px; border-radius: 5px; background: rgba(255, 255, 255, 0.18); margin: 0 auto 12px; }
.sheet h2 { margin: 0 0 4px; font-size: 22px; letter-spacing: -0.01em; }
.sheet-head { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; justify-content: flex-end; min-height: 52px; margin: 0 calc(-1 * (var(--safe-r) + 18px)) 4px calc(-1 * (var(--safe-l) + 18px)); padding: 8px calc(var(--safe-r) + 12px) 6px calc(var(--safe-l) + 12px); background: linear-gradient(180deg, #16234a 70%, rgba(22, 35, 74, 0)); }
.sheet-head .grab { position: absolute; left: 50%; top: 8px; transform: translateX(-50%); margin: 0; width: 44px; }
.sheet-x { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 14px 0 10px; border-radius: 19px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.08); color: var(--text); font-size: 15px; font-weight: 600; cursor: pointer; }
.sheet-x svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2.4; fill: none; }
.sheet .who { color: var(--muted); font-size: 14px; margin: 0 0 12px; }

.presets { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0 12px; }
.preset { border: 1px solid rgba(255, 255, 255, 0.12); background: rgba(255, 255, 255, 0.04); border-radius: 14px; padding: 12px 10px; text-align: center; }
.preset b { display: block; font-size: 15px; font-weight: 750; }
.preset span { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.preset.on { border-color: var(--green); background: rgba(62, 224, 143, 0.15); }
.preset.on span { color: #c9ffe3; }

.share-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.act { border: 1px solid var(--line); background: rgba(255, 255, 255, 0.04); border-radius: 14px; padding: 14px 12px; text-align: left; }
.act b { display: block; font-size: 15px; font-weight: 750; }
.act span { display: block; font-size: 12.5px; color: var(--muted); margin-top: 3px; }

.banner { background: rgba(124, 196, 255, 0.12); border: 1px solid rgba(124, 196, 255, 0.3); border-radius: 16px; padding: 12px 14px; margin-bottom: 12px; font-size: 14.5px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.banner .btn { flex: none; }
.flash { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--safe-b) + 96px); z-index: 60; background: rgba(20, 30, 62, 0.96); border: 1px solid var(--line); border-radius: 14px; padding: 11px 14px; font-size: 14.5px; display: flex; gap: 12px; align-items: center; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); max-width: calc(100vw - 32px); }
.flash button { background: none; border: 0; color: var(--green); font-weight: 700; padding: 0; }

.tabbar { position: fixed; z-index: 40; left: calc(var(--safe-l) + 12px); right: calc(var(--safe-r) + 12px); bottom: calc(var(--safe-b) + 10px); max-width: 536px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(4, 1fr); padding: 7px 6px; border-radius: 28px;
  background: rgba(38, 50, 88, 0.5); border: 1px solid rgba(255, 255, 255, 0.1); backdrop-filter: blur(22px) saturate(160%); -webkit-backdrop-filter: blur(22px) saturate(160%);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35); }
.tabbar button { border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--muted); font-size: 10.5px; font-weight: 600; padding: 6px 0; border-radius: 20px; }
.tabbar svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar button.on { color: #fff; background: rgba(255, 255, 255, 0.09); }
.tabbar button.on svg { stroke: var(--green); }

/* Off-screen share card used for PNG export (copied into a canvas). */
#share-card {
  position: fixed; left: -9999px; top: 0; width: 1080px;
  background: #070b1a; color: #eef2ff; padding: 48px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
#share-card .brand { text-transform: uppercase; letter-spacing: 0.14em; font-size: 22px; font-weight: 700; color: #8a94b4; }
#share-card h1 { font-size: 52px; margin: 6px 0 4px; letter-spacing: -0.03em; }
#share-card .dates { font-size: 28px; color: #8a94b4; margin-bottom: 28px; }
#share-card table { width: 100%; border-collapse: collapse; }
#share-card th, #share-card td { border: 1px solid rgba(255,255,255,0.08); padding: 14px 8px; text-align: center; }
#share-card th { color: #8a94b4; font-size: 18px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
#share-card td.nm { text-align: left; font-weight: 750; font-size: 26px; padding-left: 16px; }
#share-card td.sh { font-weight: 750; font-size: 20px; color: #c9ffe3; background: rgba(62, 224, 143, 0.12); }
#share-card td.off { color: #5d6788; }
#share-card .foot { display: flex; justify-content: space-between; margin-top: 28px; font-size: 24px; color: #cfd6ee; }

@media print {
  html, body { background: #fff !important; color: #111 !important; }
  #app { max-width: none; padding: 0; }
  .tabbar, .sheet-wrap, .flash, .bolt, .no-print, .banner, .actions, .jump, .ib { display: none !important; }
  .card, .rota-card, .name, .corner { background: #fff !important; border-color: #ddd !important; backdrop-filter: none !important; }
  .name { color: #111; background: #fff !important; }
  .cell { border: 1px solid #ccc; background: #fff; color: #111; }
  .cell.on { background: #eefaf3; }
  .head .d, .head .n, .sub, .hrs, .totals, .count { color: #333 !important; }
  .title, h1 { color: #111; }
  .rota { min-width: 0; }
}

@media (min-width: 700px) {
  :root { --name-w: 110px; }
  .name .nm { font-size: 14.5px; }
  .cell { min-height: 56px; }
  .cell .t, .cell .b { font-size: 12px; }
}
