:root {
  /* hybcreate.com brand */
  --bg: #07080a;
  --surface: #0e1014;
  --surface-2: #1b1f26;
  --ink: #eceef1;
  --ink-2: #b4bac4;
  --ink-3: #8c94a1;
  --line: #232831;
  --line-strong: #2f3540;
  --accent: #22d3ee;
  --accent-2: #8b5cf6;
  --accent-soft: rgba(34, 211, 238, .12);
  --accent-ink: #04232a;
  --grad: linear-gradient(90deg, #22d3ee, #8b5cf6);
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
  --c-focus: #22d3ee;
  --c-admin: #60a5fa;
  --c-meet: #a78bfa;
  --c-personal: #34d399;
  --c-rest: #8c94a1;
  --serif: "Sora", system-ui, sans-serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.25);
  color-scheme: dark;
}
::selection { background: var(--accent); color: var(--accent-ink); }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
.boot { padding: 4rem; text-align: center; color: var(--ink-3); }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 4px;
  padding: 22px 14px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; text-decoration: none; font-size: 17px; }
.logo { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 5px; line-height: 1; font-family: var(--mono); color: #fff; }
.logo .lm { display: flex; align-items: center; font-weight: 700; font-size: 1.4em; letter-spacing: -0.04em; }
.logo .lm .p { color: #22d3ee; margin-right: .18em; letter-spacing: 0; }
.logo .lm .c { display: inline-block; width: .2em; height: .9em; margin-left: .16em; background: #8b5cf6; border-radius: .06em; animation: hyb-blink 1.1s steps(1) infinite; }
.logo .ls { font-weight: 500; font-size: max(.6em, 10px); letter-spacing: .04em; color: var(--ink-3); padding-left: .1em; }
.logo .ls i { font-style: normal; color: #8b5cf6; }
@keyframes hyb-blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .logo .lm .c { animation: none; } }
.nav-group { margin-top: 10px; padding: 0 10px 4px; font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 1.2px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
  color: var(--ink-2); text-decoration: none;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav svg { width: 17px; height: 17px; flex: none; }
.side-foot { margin-top: auto; padding: 10px; font-size: 13px; color: var(--ink-3); }
.side-foot .who { color: var(--ink-2); font-weight: 600; font-family: var(--mono); }

.main { min-width: 0; padding: 26px clamp(16px, 4vw, 48px) 80px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }
.eyebrow { font: 500 12px var(--mono); letter-spacing: .5px; color: var(--accent); }
.eyebrow::before { content: "// "; color: var(--accent-2); }
h1 { font: 600 clamp(24px, 3.2vw, 32px)/1.15 var(--serif); margin: 4px 0 0; letter-spacing: -.3px; text-transform: uppercase; }
h2 { font: 600 16px/1.25 var(--serif); margin: 0; letter-spacing: .2px; text-transform: uppercase; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 1.1px; color: var(--ink-2); margin: 0 0 8px; font-weight: 600; }
.sub { color: var(--ink-2); margin-top: 4px; font-size: 14px; }
.sub a { text-decoration: none; }
.sub a:hover { text-decoration: underline; }

.pager { display: flex; align-items: center; gap: 6px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  padding: 7px 12px; border-radius: 8px; cursor: pointer; text-decoration: none; font-size: 14px;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--grad); border-color: transparent; color: #fff; font-weight: 600; text-shadow: 0 1px 1px rgba(0,0,0,.25); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.danger { color: var(--danger); }
.btn.small { padding: 4px 9px; font-size: 13px; }
.btn.icon { padding: 7px; width: 34px; height: 34px; }
.btn svg { width: 16px; height: 16px; }
.btn:focus-visible, .nav a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.status {
  position: fixed; right: 16px; bottom: max(14px, env(safe-area-inset-bottom)); z-index: 30;
  font-size: 12px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--line); padding: 5px 11px; border-radius: 99px; box-shadow: var(--shadow);
}
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.status.saving::before { background: var(--warn); }
.status.error::before { background: var(--danger); }
.status.error { color: var(--danger); }

/* ---------- Cards & grid ---------- */
.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
.grid.side-right { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: start; }
.stack { display: grid; gap: 18px; align-content: start; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 2px 12px; margin-bottom: 12px; }
.card-head h2 { white-space: nowrap; }
.card-head .hint { font-size: 12px; color: var(--ink-3); }
.card.feature { position: relative; overflow: hidden; }
.card.feature::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--grad); }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }

/* ---------- Ruled inputs ---------- */
.line, .area {
  width: 100%; border: 0; border-bottom: 1px solid var(--line); background: transparent;
  padding: 7px 2px; outline: none; border-radius: 0;
}
.line:focus, .area:focus { border-bottom-color: var(--accent); }
.line::placeholder, .area::placeholder { color: var(--ink-3); opacity: .8; }
.area {
  resize: none; min-height: 72px; overflow: hidden;
  background-image: repeating-linear-gradient(transparent, transparent 29px, var(--line) 29px, var(--line) 30px);
  line-height: 30px; padding: 0 2px; border-bottom: 0;
}
.area:focus { background-image: repeating-linear-gradient(transparent, transparent 29px, var(--line-strong) 29px, var(--line-strong) 30px); }
.field { display: grid; gap: 2px; margin-bottom: 12px; }
.field > label, .label { font-size: 12px; color: var(--ink-2); font-weight: 600; }
.box {
  width: 100%; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 8px; padding: 8px 10px;
}
select.box { appearance: auto; }

/* ---------- Checklist rows ---------- */
.rows { display: grid; }
.row { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
.row .line { border-bottom: 0; }
.row .rm { opacity: 0; transition: opacity .15s; }
.row:hover .rm, .row:focus-within .rm { opacity: 1; }
@media (hover: none) { .row .rm { opacity: .6; } }
.check { position: relative; flex: none; width: 20px; height: 20px; }
.check input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.check span {
  display: block; width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--line-strong); background: var(--surface);
  transition: background .15s, border-color .15s;
}
.check input:checked + span { background: var(--accent); border-color: var(--accent); }
.check input:checked + span::after {
  content: ""; position: absolute; left: 7px; top: 3px; width: 5px; height: 10px;
  border: solid var(--accent-ink); border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.check input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.row.done .line { color: var(--ink-3); text-decoration: line-through; }
.num {
  flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font: 700 13px var(--mono); background: var(--accent-soft); color: var(--accent);
}
.add-row { margin-top: 8px; }

/* ---------- Schedule ---------- */
.sched .row { gap: 12px; }
.sched .t { flex: none; width: 52px; font-size: 12px; color: var(--ink-3); text-align: right; font-variant-numeric: tabular-nums; }
.sched .row.now .t { color: var(--accent); font-weight: 700; }
.sched .row.now { background: linear-gradient(90deg, var(--accent-soft), transparent 60%); }

/* ---------- Progress ---------- */
.qbar { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-2); }
.qbar .track { flex: 1; height: 6px; background: var(--surface-2); border-radius: 6px; overflow: hidden; min-width: 80px; }
.qbar .fill { height: 100%; background: var(--grad); border-radius: 6px; }

/* ---------- Week view ---------- */
.days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.day-card {
  display: block; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; min-height: 150px;
}
.day-card:hover { border-color: var(--accent); }
.day-card.today { border-color: var(--accent); box-shadow: inset 0 3px 0 var(--accent); }
.day-card .dn { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--ink-3); }
.day-card .dd { font: 700 22px var(--mono); margin-bottom: 6px; }
.day-card ol { margin: 0; padding-left: 16px; font-size: 13px; color: var(--ink-2); }
.day-card li { margin-bottom: 3px; overflow-wrap: anywhere; }
.day-card li.done { text-decoration: line-through; color: var(--ink-3); }
.day-card .empty { font-size: 12px; color: var(--ink-3); font-style: italic; }

table.habits { width: 100%; border-collapse: collapse; font-size: 14px; }
table.habits th, table.habits td { padding: 6px 4px; border-bottom: 1px solid var(--line); text-align: center; }
table.habits th:first-child, table.habits td:first-child { text-align: left; }
table.habits th { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--ink-3); font-weight: 600; }
table.habits .check { display: inline-block; vertical-align: middle; }

/* ---------- Quarter ---------- */
.weeks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.week-tile {
  display: block; text-decoration: none; color: inherit; padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface);
}
.week-tile:hover { border-color: var(--accent); }
.week-tile.current { border-color: var(--accent); background: var(--accent-soft); }
.week-tile .wk { font-weight: 600; font-size: 14px; }
.week-tile .rng { font-size: 12px; color: var(--ink-3); }
.week-tile .wt { font-size: 12px; color: var(--ink-2); margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Goals ---------- */
.goal { position: relative; }
.goal-title { font: 600 18px var(--serif); border-bottom-color: transparent; padding-left: 0; }
.goal-title:hover { border-bottom-color: var(--line); }
.goal-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 6px 0 12px; }
.pill {
  display: inline-block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .8px;
  padding: 3px 8px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2);
}
.pill.habit { background: rgba(139, 92, 246, .16); color: #c4b5fd; }
.pill.achievement { background: var(--accent-soft); color: var(--accent); }
.goal.is-done { opacity: .65; }
.goal-pick { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.goal-pick label { flex: 1; cursor: pointer; }

/* ---------- Ideal week ---------- */
.palette { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.swatch {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 99px;
  border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; font-size: 13px;
}
.swatch i { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.swatch.on { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.iw-wrap { overflow-x: auto; margin-top: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table.iw { border-collapse: collapse; width: 100%; min-width: 820px; table-layout: fixed; }
table.iw th { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--ink-3); padding: 8px 4px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; }
table.iw th:first-child { width: 58px; }
table.iw td { border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); padding: 0; position: relative; height: 34px; }
table.iw td.t { border-left: 0; font-size: 11px; color: var(--ink-3); text-align: right; padding-right: 8px; font-variant-numeric: tabular-nums; }
table.iw td button.paint { position: absolute; left: 0; top: 0; bottom: 0; width: 7px; border: 0; padding: 0; cursor: pointer; background: transparent; }
table.iw td button.paint:hover { background: var(--line-strong); }
table.iw td input { width: 100%; height: 100%; border: 0; background: transparent; padding: 0 6px 0 11px; font-size: 12px; outline: none; }
table.iw td input:focus { box-shadow: inset 0 0 0 2px var(--accent); }
table.iw td[data-c] { background: color-mix(in srgb, var(--cc) 20%, transparent); }
table.iw td[data-c] button.paint { background: var(--cc); }
[data-c="focus"] { --cc: var(--c-focus); }
[data-c="admin"] { --cc: var(--c-admin); }
[data-c="meet"] { --cc: var(--c-meet); }
[data-c="personal"] { --cc: var(--c-personal); }
[data-c="rest"] { --cc: var(--c-rest); }

/* ---------- Rituals in day ---------- */
details.ritual { border-bottom: 1px solid var(--line); }
details.ritual:last-child { border-bottom: 0; }
details.ritual summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; padding: 10px 0; font-weight: 600;
}
details.ritual summary::-webkit-details-marker { display: none; }
details.ritual summary .count { font-weight: 400; font-size: 13px; color: var(--ink-3); }
details.ritual summary .count.full { color: var(--ok); font-weight: 600; }
details.ritual .ritual-item { display: flex; align-items: center; gap: 10px; padding: 5px 0 5px 2px; cursor: pointer; }
details.ritual .ritual-items { padding-bottom: 10px; }

/* ---------- Tables (users) ---------- */
table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); }
table.list th { font-size: 12px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 1px; }

/* ---------- Login ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth .card { width: min(380px, 100%); padding: 30px 28px; }
.auth .brand { padding: 0 0 18px; }
.err { color: var(--danger); font-size: 14px; min-height: 20px; margin: 4px 0 8px; }
.okmsg { color: var(--ok); font-size: 14px; min-height: 20px; margin: 4px 0 8px; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 50;
  box-shadow: var(--shadow);
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .days { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side {
    position: sticky; top: 0; z-index: 20; height: auto; flex-direction: row; align-items: center;
    padding: 8px 10px; padding-top: max(8px, env(safe-area-inset-top)); overflow-x: auto; gap: 2px; border-right: 0; border-bottom: 1px solid var(--line);
  }
  .brand { padding: 0 8px 0 2px; }
  .logo .ls, .nav-group, .side-foot { display: none; }
  .brand { font-size: 14px; }
  .nav { display: flex; gap: 2px; }
  .nav a { white-space: nowrap; padding: 7px 9px; font-size: 14px; }
  .grid.two, .grid.side-right { grid-template-columns: 1fr; }
  .main { padding-top: 18px; }
}
@media (max-width: 560px) {
  .days { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .day-card { min-height: 0; }
  .nav a span { display: none; }
  .nav a.active span { display: inline; }
  .card { padding: 16px; }
}

/* ---------- Print ---------- */
@media print {
  :root { --bg: #fff; --surface: #fff; --ink: #111; --ink-2: #333; --ink-3: #666; --line: #ccc; --line-strong: #999; --shadow: none; color-scheme: light; }
  .side, .pager, .status, .btn, .add-row { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; }
  .card { break-inside: avoid; }
}
