:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --line: #e3e6eb;
  --text: #1b2130;
  --muted: #677084;
  --brand: #1f3a5f;
  --brand-ink: #ffffff;
  --accent: #2f6fde;
  --ok: #1c7a45;
  --ok-bg: #e3f4ea;
  --warn: #9a5b00;
  --warn-bg: #fff2d9;
  --bad: #b42318;
  --bad-bg: #fde7e5;
  --info: #3b4fc4;
  --info-bg: #e8ebfd;
  --grey-bg: #eceef2;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151b;
    --surface: #1a1e26;
    --surface-2: #20252f;
    --line: #2c323d;
    --text: #e7eaf0;
    --muted: #98a1b3;
    --brand: #2b4d7a;
    --accent: #6d9eff;
    --ok: #5fd08e;
    --ok-bg: #173826;
    --warn: #f3b552;
    --warn-bg: #3a2c12;
    --bad: #ff7b6e;
    --bad-bg: #3f1d1a;
    --info: #9aa9ff;
    --info-bg: #23284a;
    --grey-bg: #262b35;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Helvetica, Arial, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0; }
h1 { font-size: 1.6rem; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85em; }
code { background: var(--surface-2); border: 1px solid var(--line); padding: 1px 5px; border-radius: 5px; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 24px; padding-bottom: 60px; }

.topbar { background: var(--brand); color: var(--brand-ink); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; min-height: 56px; gap: 16px; flex-wrap: wrap; }
.brand { color: inherit; font-weight: 650; display: flex; align-items: center; gap: 10px; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 14px; height: 14px; border-radius: 4px; background: #fff; transform: rotate(45deg); opacity: .9; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { color: rgba(255,255,255,.82); padding: 6px 12px; border-radius: 6px; }
.nav a:hover { background: rgba(255,255,255,.1); text-decoration: none; color: #fff; }
.nav a.on { background: rgba(255,255,255,.16); color: #fff; }

.muted { color: var(--muted); }
.small { font-size: .84rem; }
.strong { font-weight: 600; color: var(--text); }
.nowrap { white-space: nowrap; }
.ok { color: var(--ok); }
.bad { color: var(--bad); }
.warn-text { color: var(--warn); }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { margin: 4px 0 0; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 8px; }
.month-nav { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.month-label { font-weight: 600; padding: 0 6px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 20px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card h2 + p { margin-top: 6px; }
.empty-state { text-align: center; padding: 48px 20px; }
.empty-state p { margin: 8px 0 18px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 550; font-size: .9rem; line-height: 1;
  padding: 9px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); cursor: pointer; white-space: nowrap;
}
.btn:hover { text-decoration: none; border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.small { padding: 6px 10px; font-size: .82rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 8px 0; }
.btn-row form { margin: 0; }

.flash { padding: 12px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid transparent; }
.flash ul { margin: 6px 0 0; padding-left: 18px; }
.flash-ok { background: var(--ok-bg); color: var(--ok); }
.flash-warn { background: var(--warn-bg); color: var(--warn); }
.flash-error { background: var(--bad-bg); color: var(--bad); }

.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; }
.stat-n { font-size: 1.6rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat-l { color: var(--muted); font-size: .84rem; }
.stat-alert { border-color: var(--bad); }
.stat-alert .stat-n { color: var(--bad); }

.filters { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.pill { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); color: var(--text); background: var(--surface); font-size: .85rem; }
.pill:hover { text-decoration: none; border-color: var(--muted); }
.pill.on { background: var(--text); color: var(--surface); border-color: var(--text); }

/* calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 20px; }
.cal-head { background: var(--surface-2); padding: 8px 10px; font-size: .78rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.cal-cell { background: var(--surface); min-height: 104px; padding: 6px 6px 8px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cal-cell.blank { background: var(--surface-2); }
.cal-cell.weekend { background: var(--surface-2); }
.cal-cell.today { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-day { font-size: .82rem; font-weight: 600; color: var(--muted); padding: 0 2px 2px; }
.cal-dow { display: none; }
.today .cal-day { color: var(--accent); }

.chip { display: flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 550; padding: 4px 7px; border-radius: 6px; color: var(--text); background: var(--grey-bg); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.chip:hover { text-decoration: none; filter: brightness(.97); }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--muted); }

.badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--grey-bg); color: var(--muted); white-space: nowrap; vertical-align: middle; }
.st-reported { background: var(--ok-bg); color: var(--ok); }
.st-reported .dot { background: var(--ok); }
.st-complete { background: var(--info-bg); color: var(--info); }
.st-complete .dot { background: var(--info); }
.st-progress { background: var(--warn-bg); color: var(--warn); }
.st-progress .dot { background: var(--warn); }
.st-overdue { background: var(--bad-bg); color: var(--bad); }
.st-overdue .dot { background: var(--bad); }
.st-due { background: var(--info-bg); color: var(--info); box-shadow: inset 0 0 0 1px var(--info); }
.st-due .dot { background: var(--info); }
.chip.st-reported, .chip.st-complete, .chip.st-progress, .chip.st-overdue, .chip.st-due { color: var(--text); }

.host { font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 5px; border: 1px solid var(--line); white-space: nowrap; }
.host-hostinger { color: #673de6; border-color: rgba(103, 61, 230, .35); }
.host-webcp { color: #0e7c86; border-color: rgba(14, 124, 134, .35); }
@media (prefers-color-scheme: dark) {
  .host-hostinger { color: #b39bff; }
  .host-webcp { color: #5fd3dc; }
}

.progress { display: inline-block; width: 80px; height: 6px; background: var(--grey-bg); border-radius: 99px; overflow: hidden; vertical-align: middle; }
.progress span { display: block; height: 100%; background: var(--ok); border-radius: 99px; }
.progress-n { font-size: .8rem; color: var(--muted); margin-left: 8px; font-variant-numeric: tabular-nums; }

/* tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table.mini td { padding: 6px 4px; font-size: .86rem; }
.row-warn td { background: var(--warn-bg); }
.row-muted { opacity: .6; }

/* forms */
label { display: block; font-weight: 550; font-size: .9rem; }
input:not([type=checkbox]), select, textarea {
  display: block; width: 100%; margin-top: 5px; font: inherit; font-weight: 400; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--ok); margin: 0; flex: none; }
label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.stack > * + * { margin-top: 14px; }
.stack-lg > * + * { margin-top: 0; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { margin-top: 16px; }
.auth { max-width: 420px; margin: 40px auto; }
.auth h1 { margin-bottom: 8px; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }

/* run page */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 20px; }
.step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; gap: 12px; }
.step-n { width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 650; font-size: .85rem; display: grid; place-items: center; flex: none; }
.step-body { min-width: 0; }
.step-body p { margin: 6px 0; }

.task { display: grid; grid-template-columns: 1fr 200px; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); align-items: start; }
.task-main { display: flex; gap: 12px; font-weight: 400; cursor: pointer; }
.task-main > span { display: flex; flex-direction: column; gap: 2px; }
.task-label { font-weight: 600; }
.task-desc { color: var(--muted); font-size: .85rem; }
.task-meta { color: var(--ok); font-size: .8rem; }
.task.is-done .task-label { color: var(--ok); }
.task-note { margin-top: 0 !important; font-size: .85rem !important; padding: 7px 9px !important; }
.tag { font-size: .68rem; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; padding: 1px 6px; border-radius: 4px; background: var(--info-bg); color: var(--info); margin-left: 6px; vertical-align: 1px; }
.tag-soft { background: var(--grey-bg); color: var(--muted); }

.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 12px; margin: 0 0 12px; font-size: .9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
details.sub { border-top: 1px solid var(--line); padding: 10px 0 0; margin-top: 10px; }
details.sub summary { cursor: pointer; font-weight: 600; font-size: .9rem; }
details.sub table { margin-top: 8px; }
.changes { margin: 0; padding-left: 18px; }
.changes li { margin: 3px 0; }
.report-frame { width: 100%; height: 720px; border: 1px solid var(--line); border-radius: 8px; background: #f0f2f5; }
.log { list-style: none; margin: 0; padding: 0; }
.log li { padding: 8px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; }
.log li:first-child { border-top: 0; }

.setup { padding-left: 20px; margin: 12px 0; }
.setup li { margin: 0 0 12px; }
.copy-box { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.copy-box code { flex: 1; overflow-x: auto; white-space: nowrap; padding: 8px 10px; display: block; }

@media (max-width: 1000px) {
  .grid-2 { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 700px) {
  h1 { font-size: 1.35rem; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .cal { grid-template-columns: 1fr; }
  .cal-head, .cal-cell.blank, .cal-cell:not(.has) { display: none; }
  .cal-cell { min-height: 0; }
  .cal-dow { display: inline; }
  .row-2 { grid-template-columns: 1fr; }
  .task { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 8px; }
  .report-frame { height: 560px; }
}
