:root {
  color-scheme: dark;
  --bg: #07080d;
  --tile: #10121a;
  --raised: #171a25;
  --border: rgba(255, 255, 255, 0.10);
  --border-2: rgba(255, 255, 255, 0.18);
  --text: #E6E9EF;
  --text-2: #C4CAD7;
  --muted: #99A2B5;
  --faint: #6F778A;
  --c1: #8b6bff;
  --c2: #2fd0e8;
  --c3: #ff5fa8;
  --accent: #8B6BFF;
  --accent-ink: #B7A4FF;
  --grad: linear-gradient(90deg, #8b6bff, #6f8dff);
  --ok: #3ECF8E;
  --ok-soft: rgba(62, 207, 142, 0.14);
  --warn: #E0B13C;
  --warn-soft: rgba(224, 177, 60, 0.15);
  --bad: #EF5C5C;
  --bad-soft: rgba(239, 92, 92, 0.14);
  --sasha: #6f8dff;
  --alena: #ff5fa8;
  --font: "Onest", system-ui, sans-serif;
  --display: "Unbounded", "Onest", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(40vw 46vh at 22% 8%, rgba(139, 107, 255, 0.32), transparent 70%),
    radial-gradient(34vw 42vh at 80% 4%, rgba(47, 208, 232, 0.20), transparent 70%),
    radial-gradient(30vw 38vh at 55% 30%, rgba(255, 95, 168, 0.12), transparent 70%),
    var(--bg);
  min-height: 100%;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding-bottom: 72px;
}

.navtop {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 14px 16px 12px;
  background: rgba(7, 8, 13, 0.86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.navtop .brand {
  font-family: var(--display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.03em;
  background: linear-gradient(90deg, var(--c1), var(--c2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.navtop .sub {
  margin-top: 2px;
  font-size: 12px;
  color: var(--faint);
}

.screens { flex: 1; padding: 12px 14px 20px; }
.screen { display: none; }
.screen.active { display: block; }

.banner {
  background: rgba(47, 208, 232, 0.08);
  border: 1px solid rgba(47, 208, 232, 0.35);
  color: var(--c2);
  font-size: 13px;
  line-height: 1.4;
  padding: 10px 12px;
  border-radius: 14px;
  margin-bottom: 10px;
}

.banner code, .guide code {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 6px;
}

.guide {
  background: rgba(47, 208, 232, 0.08);
  border: 1px solid rgba(47, 208, 232, 0.35);
  border-radius: 14px;
  margin-bottom: 10px;
  overflow: hidden;
}
.guide summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 12px;
  color: var(--c2);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}
.guide summary::-webkit-details-marker { display: none; }
.guide summary::after {
  content: "▾";
  color: var(--accent-ink);
  font-size: 12px;
  opacity: 0.85;
}
.guide[open] summary::after { content: "▴"; }
.guide-body {
  padding: 0 12px 12px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-2);
}
.guide-body p { margin: 0 0 8px; }
.guide-body p:last-child { margin-bottom: 0; }

.checks-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
  width: 100%;
  box-sizing: border-box;
}
.checks-row label {
  font-size: 13px;
  color: var(--muted);
  flex: none;
  width: 42px;
}
.checks-row input {
  flex: 1 1 0;
  min-width: 0;
  width: 0;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-family: var(--mono);
  font-size: 16px;
  padding: 0 12px;
  outline: none;
  box-sizing: border-box;
}
.checks-row input:focus {
  border-color: var(--accent-ink);
  box-shadow: 0 0 0 3px rgba(139, 107, 255, 0.16);
}
.checks-row .btn {
  flex: 0 0 auto;
  min-width: 52px;
  width: auto;
  height: 40px;
  padding: 0 12px;
  border-radius: 12px;
}

.person-rev .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.person-rev .actions .btn {
  flex: 1 1 calc(50% - 4px);
  min-width: 0;
}
.person-rev .meta {
  font-size: 12px;
  color: var(--muted);
  font-family: var(--mono);
  font-weight: 500;
}

.month-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.month-actions .btn {
  flex: 1;
  min-width: 0;
  height: 40px;
  border-radius: 12px;
}

.group {
  background: var(--tile);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  margin-bottom: 10px;
}

.cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  min-height: 48px;
}

.cell:last-child { border-bottom: none; }

.cell .l { font-size: 15px; color: var(--text); }
.cell .r { font-size: 15px; color: var(--muted); text-align: right; }
.cell .r.strong { color: var(--text); font-weight: 600; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.cell .r.accent { color: var(--accent-ink); font-weight: 600; font-family: var(--mono); }
.cell .r.ok { color: var(--ok); font-weight: 600; font-family: var(--mono); }
.cell .r.sasha { color: var(--sasha); font-weight: 600; font-family: var(--mono); }
.cell .r.alena { color: var(--alena); font-weight: 600; font-family: var(--mono); }

.section-label {
  font-size: 12px;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 6px 4px 8px;
}

.big-num {
  font-family: var(--mono);
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.04em;
  text-align: center;
  padding: 18px 12px 4px;
  background: linear-gradient(180deg, #fff, var(--c2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.subc {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  padding-bottom: 12px;
}

.actions {
  display: flex;
  gap: 8px;
  padding: 0 12px 14px;
  flex-wrap: wrap;
}

.btn {
  flex: 1;
  min-width: 120px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn.primary {
  background: var(--grad);
  border: none;
  color: #fff;
  box-shadow: 0 10px 30px rgba(139, 107, 255, 0.35);
}

.btn.danger {
  background: var(--bad-soft);
  border-color: rgba(239, 92, 92, 0.35);
  color: var(--bad);
}

.btn:disabled { opacity: 0.45; cursor: default; }

/* Compact buttons inside list rows (изм. / × / задать) */
.btn.sm {
  flex: none;
  flex-grow: 0;
  flex-shrink: 0;
  width: auto;
  min-width: 0;
  max-width: none;
  height: 30px;
  padding: 0 10px;
  margin: 0;
  font-size: 12px;
  border-radius: 10px;
  line-height: 1;
  white-space: nowrap;
}
.btn.sm.icon {
  width: 30px;
  padding: 0;
  font-size: 16px;
  font-weight: 500;
}
.cell .r.btns {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
  flex-shrink: 0;
  white-space: nowrap;
}

.field-row {
  display: flex;
  gap: 8px;
  padding: 0 12px 14px;
}

.field-row input, .sheet input, .modal input, .modal select, select.inline {
  width: 100%;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-family: var(--mono);
  font-size: 16px;
  padding: 0 12px;
  outline: none;
}

.field-row input:focus, .sheet input:focus, .modal input:focus, .modal select:focus {
  border-color: rgba(139, 107, 255, 0.6);
  box-shadow: 0 0 0 3px rgba(139, 107, 255, 0.16);
}

.cal {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  padding: 10px;
}

.cal .h {
  text-align: center;
  font-size: 10px;
  color: var(--faint);
  padding: 4px 0;
  text-transform: uppercase;
}

.day {
  aspect-ratio: 1;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text-2);
  cursor: pointer;
  position: relative;
  border: 1px solid transparent;
}

.day.muted { opacity: 0.25; pointer-events: none; }
.day.has::after {
  content: "";
  width: 4px;
  height: 4px;
  background: var(--ok);
  position: absolute;
  bottom: 5px;
  border-radius: 1px;
}
.day.today { background: rgba(139, 107, 255, 0.16); color: var(--accent-ink); font-weight: 700; }
.day.sel { background: var(--grad); color: #fff; border: none; }
.day.sel.has::after { background: #fff; }

.sheet {
  background: var(--tile);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px;
  margin-bottom: 10px;
}

.sheet h3 {
  font-family: var(--display);
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
}

.sheet .hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
  margin-bottom: 10px;
}

.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.pair .b {
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
}

.pair .n { font-size: 12px; color: var(--muted); }
.pair .v {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 700;
  margin-top: 2px;
}

.pair .b.s .n, .pair .b.s .v { color: var(--sasha); }
.pair .b.a .n, .pair .b.a .v { color: var(--alena); }

.tabs {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  max-width: 480px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: rgba(16, 18, 26, 0.96);
  border-top: 1px solid var(--border);
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
  z-index: 20;
}

.worker-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 12px 12px;
}

.worker-chip {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 14px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.worker-chip.on {
  color: #fff;
  background: var(--grad);
  border-color: transparent;
}

.worker-chip.on.sasha { background: linear-gradient(90deg, #6f8dff, #8b6bff); }
.worker-chip.on.alena { background: linear-gradient(90deg, #ff5fa8, #8b6bff); }

.day .marks {
  display: flex;
  gap: 2px;
  margin-top: 2px;
  min-height: 6px;
}

.day .mark {
  width: 5px;
  height: 5px;
  border-radius: 1px;
}

.day .mark.s { background: var(--sasha); }
.day .mark.a { background: var(--alena); }

.sched-card {
  display: block;
  background: var(--tile);
  border: 1px solid var(--border);
  border-radius: 18px;
  margin-bottom: 10px;
  overflow: hidden;
}

.sched-head {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 14px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-family: var(--font);
  box-sizing: border-box;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.sched-head-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 15px;
  font-weight: 600;
}
.sched-head-action {
  flex: 0 0 auto;
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.sched-body {
  display: block;
  width: 100%;
  box-sizing: border-box;
}

.sched-list {
  display: block;
  width: 100%;
}

.sched-row {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  box-sizing: border-box;
}
.sched-row:last-child { border-bottom: none; }

.sched-day {
  flex: 1 1 auto;
  min-width: 0;
  max-width: calc(100% - 120px);
}
.sched-date {
  font-size: 15px;
  color: var(--text);
  line-height: 1.3;
}
.sched-date .wd { color: var(--faint); font-weight: 400; }
.rev-line {
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
  font-family: var(--mono);
  line-height: 1.35;
  word-break: break-word;
}

.sched-list .toggles {
  display: flex;
  flex: 0 0 auto;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 6px;
  padding-top: 2px;
}

.sched-list .mini {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-family: var(--font);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}

.sched-list .mini.on.s { color: #fff; background: var(--sasha); border-color: transparent; }
.sched-list .mini.on.a { color: #fff; background: var(--alena); border-color: transparent; }

.sched-summary {
  display: block;
  width: 100%;
  padding: 12px 14px 14px;
  box-sizing: border-box;
}
.sched-summary .line {
  display: block;
  width: 100%;
  font-size: 13px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  line-height: 1.45;
  margin: 0 0 8px;
  word-break: break-word;
}
.sched-summary .line:last-child { margin-bottom: 0; }
.sched-summary .line .n { font-weight: 600; }
.sched-summary .line.sasha .n { color: var(--sasha); }
.sched-summary .line.alena .n { color: var(--alena); }
.sched-summary .line .amt {
  font-family: var(--mono);
  color: var(--text);
  font-weight: 600;
}

.month-bar .btn.sm {
  height: 36px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 12px;
}

.month-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.month-select {
  flex: 1;
  height: 36px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--tile);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  padding: 0 10px;
  outline: none;
}

.pay-off { opacity: 0.45; }

.person-rev {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.person-rev:last-child { border-bottom: none; }
.person-rev-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 14px;
}
.person-rev .hint {
  font-size: 12px;
  color: var(--faint);
}

.tabs button {
  background: none;
  border: none;
  color: var(--faint);
  font-family: var(--font);
  font-size: 10px;
  padding: 6px 2px;
  cursor: pointer;
}

.tabs button.active { color: var(--accent-ink); font-weight: 600; }
.tabs .ico { display: block; font-size: 16px; margin-bottom: 2px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%) translateY(16px);
  background: rgba(28, 28, 30, 0.94);
  color: #fff;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  z-index: 30;
  transition: transform 0.2s ease, opacity 0.2s ease, visibility 0.2s;
  pointer-events: none;
  max-width: 90%;
  text-align: center;
  border: 1px solid var(--border);
  opacity: 0;
  visibility: hidden;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  visibility: visible;
}

.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 40;
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.modal-bg.open { display: flex; }

.modal {
  width: 100%;
  max-width: 480px;
  background: var(--tile);
  border: 1px solid var(--border);
  border-radius: 22px 22px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  max-height: 85vh;
  overflow: auto;
}

.modal h3 {
  font-family: var(--display);
  font-size: 16px;
  margin-bottom: 12px;
}

.modal label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin: 10px 0 4px;
}

.modal .row-btns {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.pill {
  display: inline-block;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--ok-soft);
  border: 1px solid rgba(62, 207, 142, 0.38);
  color: var(--ok);
}

.loading {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
}

.error-box {
  margin: 20px 14px;
  padding: 14px;
  background: var(--bad-soft);
  border: 1px solid rgba(239, 92, 92, 0.35);
  border-radius: 14px;
  color: var(--bad);
  font-size: 14px;
}

.login-card {
  margin-top: 24px;
  background: var(--tile);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 20px 16px 18px;
}

.login-title {
  font-family: var(--display);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.login-hint, .login-foot {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
  margin-bottom: 14px;
}

.login-foot { margin: 12px 0 0; }

.login-card .lbl {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin: 10px 0 4px;
}

.login-card input {
  width: 100%;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  padding: 0 12px;
  outline: none;
}

.login-card input:focus {
  border-color: rgba(139, 107, 255, 0.6);
  box-shadow: 0 0 0 3px rgba(139, 107, 255, 0.16);
}

select.inline {
  width: auto;
  min-width: 140px;
  height: 34px;
  font-size: 13px;
  color: var(--accent-ink);
  text-align: right;
}
