:root {
  --bg: #0E0D0B;
  --card: #17150F;
  --card2: #1E1B14;
  --line: #2E2A20;
  --text: #F3EFE6;
  --muted: #A79F8C;
  --gold: #C9A45C;
  --gold-grad: linear-gradient(135deg, #F1DFAE 0%, #C9A45C 55%, #8B6B3A 100%);
  --yellow: #F2C94C;
  --red: #FF6B6B;
  --green: #4CC38A;
  --radius: 16px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; min-height: 100vh; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
.boot { padding: 40px; text-align: center; color: var(--muted); }

/* Buttons and fields */
.btn { min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--card2); cursor: pointer; font-weight: 600; }
.btn:hover { border-color: var(--gold); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--gold-grad); color: #1A1508; border-color: transparent; }
.btn.danger { color: var(--red); border-color: rgba(255,107,107,.4); background: transparent; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 14px; }
label { display: block; font-size: 13px; color: var(--muted); }
label > input, label > select, label > textarea { display: block; width: 100%; margin-top: 6px; }
input, select, textarea { min-height: 44px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); background: #100F0B; color: var(--text); font-size: 16px; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
textarea { resize: vertical; }
.error { color: var(--red); font-size: 14px; }
.hint { color: var(--muted); font-size: 13px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }

/* Login */
.login { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 24px; }
.login-logo { width: min(320px, 78vw); height: auto; }
.login form { width: min(380px, 100%); display: grid; gap: 14px; }

/* Layout */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 18px; padding: calc(10px + var(--safe-top)) 18px 10px; background: rgba(14,13,11,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top-logo { height: 34px; width: auto; }
.tabs { display: none; gap: 6px; margin-left: 12px; }
.tab { min-height: 40px; padding: 0 16px; border-radius: 10px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-weight: 600; }
.tab.active { color: var(--gold); background: var(--card2); }
.who { margin-left: auto; color: var(--muted); font-size: 14px; }
.content { max-width: 1240px; margin: 0 auto; padding: 16px 16px calc(150px + var(--safe-bottom)); }
.bottom-tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; background: rgba(14,13,11,.96); backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding-bottom: var(--safe-bottom); }
.bottom-tabs .tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 6px; border-radius: 0; font-size: 12px; min-height: 56px; }
.bottom-tabs svg { width: 22px; height: 22px; }
@media (min-width: 900px) {
  .tabs { display: flex; }
  .bottom-tabs { display: none; }
  .content { padding-bottom: 120px; }
}

/* Toolbar */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.toolbar h1 { font-size: 24px; }
.switch { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.switch input { width: 20px; height: 20px; min-height: 0; margin: 0; accent-color: var(--gold); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; background: var(--line); }
.legend .l-soon::before { background: var(--yellow); }
.legend .l-late::before { background: var(--red); }
.legend .l-done::before { background: var(--green); }

/* Columns */
.segs { display: flex; gap: 6px; margin-bottom: 12px; }
.seg { flex: 1; min-height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--muted); cursor: pointer; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 8px; }
.seg.active { border-color: var(--gold); color: var(--gold); background: var(--card2); }
.count { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--line); color: var(--text); font-size: 12px; display: inline-flex; align-items: center; justify-content: center; }
.cols { display: grid; gap: 14px; }
.col { display: none; }
.col.active { display: block; }
.col-head { display: none; margin-bottom: 10px; }
.col-head h2 { font-size: 18px; }
.col-head p { color: var(--muted); font-size: 13px; }
@media (min-width: 900px) {
  .segs { display: none; }
  .cols { grid-template-columns: repeat(3, 1fr); align-items: start; }
  .col { display: block; }
  .col-head { display: block; }
}
.empty { color: var(--muted); font-size: 14px; padding: 18px 4px; text-align: center; border: 1px dashed var(--line); border-radius: 14px; }
.list { display: grid; gap: 10px; }

/* Tasks */
.task { display: flex; gap: 12px; padding: 12px 14px 12px 8px; border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 14px; background: var(--card); }
.task.soon { border-left-color: var(--yellow); background: linear-gradient(90deg, rgba(242,201,76,.13), transparent 70%), var(--card); }
.task.late { border-left-color: var(--red); background: linear-gradient(90deg, rgba(255,107,107,.15), transparent 70%), var(--card); }
.task.done { border-left-color: var(--green); background: linear-gradient(90deg, rgba(76,195,138,.13), transparent 70%), var(--card); }
.task.done h3 { text-decoration: line-through; opacity: .75; }
.check { flex: none; width: 44px; height: 44px; border: 0; background: transparent; cursor: pointer; display: grid; place-items: center; }
.check span { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--muted); display: grid; place-items: center; }
.check svg { width: 16px; height: 16px; opacity: 0; }
.task.done .check span { background: var(--green); border-color: var(--green); }
.task.done .check svg { opacity: 1; color: #06210F; }
.task-main { flex: 1; min-width: 0; cursor: pointer; padding-top: 2px; }
.task-main h3 { font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.notes { color: var(--muted); font-size: 14px; margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; font-size: 13px; color: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line); font-weight: 600; }
.pill.soon { color: var(--yellow); border-color: rgba(242,201,76,.5); }
.pill.late { color: var(--red); border-color: rgba(255,107,107,.5); }
.pill.done { color: var(--green); border-color: rgba(76,195,138,.5); }
.take { align-self: center; flex: none; }
.fab { position: fixed; right: 16px; bottom: calc(76px + var(--safe-bottom)); z-index: 6; min-height: 52px; padding: 0 22px; border-radius: 26px; border: 0; background: var(--gold-grad); color: #1A1508; font-weight: 700; box-shadow: 0 8px 24px rgba(0,0,0,.5); cursor: pointer; }
@media (min-width: 900px) { .fab { bottom: 24px; right: 24px; } }

/* Modal */
.overlay { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.65); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: min(560px, 100%); max-height: 92vh; overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: 22px 22px 0 0; padding: 20px 18px calc(20px + var(--safe-bottom)); display: grid; gap: 14px; }
.sheet h2 { font-size: 20px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
@media (min-width: 700px) { .overlay { align-items: center; } .sheet { border-radius: 22px; } }

/* Hours */
.weekbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.weeklabel { font-weight: 700; min-width: 190px; text-align: center; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); }
th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
td.name { font-weight: 600; min-width: 120px; }
td input.num { width: 92px; text-align: right; }
th.r, td.r { text-align: right; }
tfoot td { font-weight: 700; border-bottom: 0; color: var(--gold); }
.pay { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.wrow { display: grid; grid-template-columns: 1fr 90px auto; gap: 8px; align-items: center; }
.wrow.off { opacity: .55; }
.wrow label.chk { display: flex; align-items: center; gap: 6px; }
.wrow input[type=checkbox] { width: 20px; height: 20px; min-height: 0; accent-color: var(--gold); }
.preview { max-height: 220px; overflow: auto; font-size: 14px; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; }
.preview .bad { color: var(--red); }
.preview .ok { color: var(--green); }

/* Settings */
.stack { display: grid; gap: 14px; max-width: 520px; }
.stack h2 { font-size: 18px; }

/* Toast */
#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(150px + var(--safe-bottom)); z-index: 30; background: #2A261B; border: 1px solid var(--gold); padding: 10px 16px; border-radius: 12px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 90vw; }
#toast.show { opacity: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Accounts */
.acct { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.acct.off { opacity: .6; }
.acct h3 { font-size: 16px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.acct-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Month view */
.week { margin-bottom: 22px; }
.week-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.week-head h2 { font-size: 17px; }
.month-sum { margin-top: 30px; }
.month-sum .week-head h2 { color: var(--gold); font-size: 20px; }
.weekbar select { min-height: 40px; min-width: 190px; font-weight: 700; text-align: center; }