:root {
  --bg: #f7f5fa;
  --card: #ffffff;
  --ink: #2a2a2a;
  --muted: #6b6775;
  --line: #e5e0ec;
  --accent: #7357a4;
  --accent-ink: #ffffff;
  --box: #faf8fc;
  --warn: #b42318;
  --ok: #1a7f37;
  --s-none: #9aa0a6;
  --s-progress: #b7791f;
  --s-hold: #6f42c1;
  --s-complete: #1a7f37;
  --s-na: #8c8c8c;
  --s-notstarted: #4a6fa5;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17151c;
    --card: #211e28;
    --ink: #eeecf2;
    --muted: #a49fae;
    --line: #35313e;
    --accent: #a78bdb;
    --accent-ink: #17151c;
    --box: #2a2632;
    --warn: #ff7b72;
    --ok: #56d364;
    --s-progress: #e3b341;
    --s-hold: #b392f0;
    --s-complete: #56d364;
    --s-notstarted: #79a6dc;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.hidden { display: none !important; }

/* Mother Puppers brand: logo from "Mother Puppers Logo Transparent Background 2026.png" */
:root { --brand-purple: #7357a4; --brand-charcoal: #2a2a2a; --brand-tan: #d4a574; }
.top { border-bottom: 3px solid var(--brand-purple); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.brand .logo { height: 46px; width: auto; display: block; }
.brand small { display: block; padding-left: 12px; border-left: 2px solid var(--brand-tan); }
.login-logo { display: block; width: 100%; max-width: 260px; height: auto; margin: 0 auto 10px; }
@media (max-width: 520px) {
  .brand .logo { height: 36px; }
  .brand small { font-size: 11px; padding-left: 8px; }
}
.muted { color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* header */
.top { position: sticky; top: 0; z-index: 20; background: var(--card); border-bottom: 1px solid var(--line); }
.top-row { display: flex; align-items: center; gap: 10px; max-width: 1400px; margin: 0 auto; padding: 10px 16px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 17px; letter-spacing: .2px; margin-right: auto; }
.brand small { display: block; font-weight: 500; font-size: 12px; color: var(--muted); }
.me { white-space: nowrap; font-weight: 600; }
.btn {
  border: 1px solid var(--line); background: var(--box); border-radius: 8px;
  padding: 6px 12px; cursor: pointer; text-decoration: none; color: var(--ink); white-space: nowrap; display: inline-block;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.danger { color: var(--warn); }
.btn.small { padding: 3px 8px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: default; }

main { max-width: 1400px; margin: 0 auto; padding: 16px; }

/* summary tiles */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.tile .k { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.tile .v { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }
.tile .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.bar { height: 6px; background: var(--box); border-radius: 3px; margin-top: 8px; overflow: hidden; border: 1px solid var(--line); }
.bar > span { display: block; height: 100%; background: var(--ok); }

/* toolbar */
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar input[type=search] { flex: 1 1 260px; min-width: 0; }
.toolbar .spacer { flex: 1; }
.chk { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; color: var(--muted); }
input[type=text], input[type=search], input[type=password], input[type=date], select, textarea {
  border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 6px 9px;
}

.banner { background: var(--card); border: 1px solid var(--warn); color: var(--warn); border-radius: 8px; padding: 8px 12px; margin-bottom: 12px; }

/* sections */
.sec { background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 12px; overflow: hidden; }
.sec-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; user-select: none; }
.sec-head .chev { transition: transform .15s; color: var(--muted); width: 12px; flex: none; }
.sec.open .sec-head .chev { transform: rotate(90deg); }
.sec-head h2 { font-size: 14px; margin: 0; letter-spacing: .4px; flex: 1; min-width: 0; }
.sec-head .meta { font-size: 12px; color: var(--muted); white-space: nowrap; }
.sec-head .sum { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sec-body { display: none; border-top: 1px solid var(--line); }
.sec.open .sec-body { display: block; }
.sec-foot { display: flex; gap: 8px; padding: 8px 14px; border-top: 1px solid var(--line); background: var(--box); flex-wrap: wrap; align-items: center; }
.sec-foot .spacer { flex: 1; }

table.grid { width: 100%; border-collapse: collapse; table-layout: fixed; }
.grid th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 600; padding: 6px 6px; background: var(--box); border-bottom: 1px solid var(--line); }
.grid th.num { text-align: right; }
.grid td { border-bottom: 1px solid var(--line); padding: 2px 4px; vertical-align: middle; }
.grid tr:last-child td { border-bottom: 0; }
.grid tr.na td { opacity: .55; }
.grid tfoot td { font-weight: 700; background: var(--box); padding: 6px; border-top: 1px solid var(--line); }
.col-task { width: 22%; } .col-asg { width: 13%; } .col-date { width: 118px; } .col-status { width: 116px; }
.col-money { width: 112px; } .col-com { width: auto; } .col-x { width: 30px; } .col-grip { width: 26px; }

/* inline-edit cells look like text until focused */
input.cell, textarea.cell {
  width: 100%; border: 1px solid transparent; background: transparent; border-radius: 6px; padding: 5px 6px; min-width: 0;
}
.cell:hover:not(:disabled) { border-color: var(--line); }
.cell:focus { outline: none; border-color: var(--accent); background: var(--card); }
.cell.num { text-align: right; }
.cell:disabled { opacity: 1; -webkit-text-fill-color: var(--ink); }
input[type=date].cell { padding: 4px 4px; }
input[type=date].cell:not(:focus):invalid, input[type=date].cell.empty:not(:focus) { color: var(--muted); }
.cell.saving { border-color: var(--s-progress); }
.cell.saved { border-color: var(--ok); }
.cell.bad { border-color: var(--warn); }
textarea.cell { resize: vertical; min-height: 30px; height: 30px; line-height: 1.35; }
.due { padding: 5px 6px; display: block; }
.due.owed { color: var(--warn); font-weight: 600; }
.due.zero { color: var(--ok); }

select.status { font-weight: 600; font-size: 12px; padding: 4px 6px; border-radius: 999px; border: 1px solid currentColor; background: transparent; width: 100%; }
select.status[data-s=""] { color: var(--s-none); border-style: dashed; }
select.status[data-s="Not started"] { color: var(--s-notstarted); }
select.status[data-s="In progress"] { color: var(--s-progress); }
select.status[data-s="On hold"] { color: var(--s-hold); }
select.status[data-s="Complete"] { color: var(--s-complete); }
select.status[data-s="N/A"] { color: var(--s-na); }
select.status option { color: var(--ink); background: var(--card); }

/* drag to arrange */
.grip { border: 0; background: transparent; color: var(--muted); cursor: grab; font-size: 16px; line-height: 1; padding: 6px 4px; border-radius: 6px; touch-action: none; }
.grip:hover, .grip:focus-visible { color: var(--accent); background: var(--box); }
.grid td.t-grip { padding: 0 0 0 4px; }
tr.dragging { background: color-mix(in srgb, var(--accent) 12%, var(--card)); box-shadow: inset 3px 0 0 var(--accent); }
tr.dragging td { opacity: 1 !important; }
tr.dragging .grip { color: var(--accent); }
body.is-dragging, body.is-dragging * { cursor: grabbing !important; user-select: none; -webkit-user-select: none; }
body.is-dragging tr.dragging { pointer-events: none; }
.sec-head.drop { background: color-mix(in srgb, var(--accent) 16%, var(--card)); box-shadow: inset 0 0 0 2px var(--accent); }
.x { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1; padding: 4px; border-radius: 6px; }
.x:hover { color: var(--warn); background: var(--box); }
.who { font-size: 11px; color: var(--muted); padding: 0 6px 4px; }

.add-section { margin: 4px 0 16px; }
.grand { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; gap: 22px; flex-wrap: wrap; justify-content: flex-end; font-weight: 700; font-variant-numeric: tabular-nums; }
.grand span small { display: block; font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }

/* login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 24px; width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 8px; }
.login h1 { margin: 0; font-size: 22px; }
.login p { margin: 0 0 8px; color: var(--muted); }
.login .btn { margin-top: 8px; padding: 9px; }
.err { color: var(--warn); min-height: 1.2em; }

.toast { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 8px; z-index: 50; max-width: calc(100% - 32px); }

/* simple pages (admin, activity) */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 14px; overflow-x: auto; }
.panel h2 { margin: 0 0 10px; font-size: 16px; }
.list { width: 100%; border-collapse: collapse; }
.list th, .list td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.list th { font-size: 11px; text-transform: uppercase; color: var(--muted); letter-spacing: .5px; }
.form-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.form-row input[type=text], .form-row input[type=password] { flex: 1 1 160px; min-width: 0; }

/* phones / narrow: each line item becomes a card */
@media (max-width: 900px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .tile .v { font-size: 18px; }
  table.grid, .grid tbody, .grid tr, .grid td, .grid tfoot { display: block; width: 100%; }
  .grid thead, .grid colgroup { display: none; }
  .grid tbody tr { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 8px; padding: 8px 10px; border-bottom: 1px solid var(--line); position: relative; }
  .grid tbody tr:last-child { border-bottom: 0; }
  .grid td { border: 0; padding: 0; }
  .grid td[data-l]::before { content: attr(data-l); display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding: 2px 6px 0; }
  .grid td.t-task { grid-column: 1 / -1; padding-right: 60px; }
  .grid td.t-grip { position: absolute; top: 4px; right: 32px; width: auto; padding: 0; }
  .grid td.t-task .cell { font-weight: 600; }
  .grid td.t-com { grid-column: 1 / -1; }
  .grid td.t-x { position: absolute; top: 6px; right: 6px; width: auto; }
  .grid td.num, .grid .cell.num { text-align: left; }
  .grid tfoot tr { display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 8px 14px; }
  .grid tfoot td { padding: 0; border: 0; background: none; }
  .grid tfoot td:empty { display: none; }
  .sec-head { flex-wrap: wrap; }
  .sec-head h2 { flex-basis: calc(100% - 22px); }
  .sec-head .meta { margin-left: 22px; }
}
@media (max-width: 420px) {
  .tiles { gap: 8px; }
  .tile { padding: 10px; }
}

@media print {
  .top, .toolbar, .sec-foot, .x, .add-section, .toast, .banner { display: none !important; }
  body { background: #fff; color: #000; font-size: 10px; }
  main { max-width: none; padding: 0; }
  .sec { break-inside: auto; border-color: #ccc; }
  .sec .sec-body { display: block !important; }
  .cell { border: 0 !important; padding: 1px 2px; }
  textarea.cell { height: auto; resize: none; }
  select.status { border: 0; -webkit-appearance: none; appearance: none; padding: 0; }
}
