/* Design 1 "Tide": the Tilde look on CML OS. White paper, ink text, Newsreader titles, Manrope body, DM Mono for times
   and data, one periwinkle pill for the main action, the tide palette only on the tide art. Light and dark.
   CML OS draws everything from the variables below, so most of the change is here; the rest restyles shared pieces. */
:root[data-skin="1"] {
  --bg: #FFFFFF; --side: #FFFFFF; --panel: #FFFFFF; --hover: #F3F3F0; --active: #ECECE7;
  --line: #E3E3DE; --line-strong: #D3D3CC; --fg: #17171F; --muted: #5D5D69; --faint: #8E8E98;
  --accent: #2F55E8; --accent-hover: #2446C6; --on-accent: #FFFFFF; --bad: #A3237F;
  --wave: #2F55E8; --wave-dk: #2446C6; --wash: #F6F6F3; --good: #17825A; --tide-op: .55; --art: #FBFAFD;
  --r: 10px; --font: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Newsreader", Georgia, serif; --mono: "DM Mono", ui-monospace, monospace;
  --t-side: clamp(232px, 11vw, 264px); --pad: clamp(24px, 2.2vw, 40px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root[data-skin="1"]:not([data-theme="light"]) {
    --bg: #111217; --side: #111217; --panel: #17181F; --hover: #1F2029; --active: #262734;
    --line: #262731; --line-strong: #363744; --fg: #ECECF1; --muted: #A3A3B1; --faint: #74747F;
    --accent: #7D93FF; --accent-hover: #98A9FF; --on-accent: #FFFFFF; --bad: #F08AC8;
    --wave: #3E63F0; --wave-dk: #3253DA; --wash: #1A1B23; --good: #4FD49A; --tide-op: .4; --art: #15161D;
    color-scheme: dark;
  }
}
:root[data-skin="1"][data-theme="dark"] {
  --bg: #111217; --side: #111217; --panel: #17181F; --hover: #1F2029; --active: #262734;
  --line: #262731; --line-strong: #363744; --fg: #ECECF1; --muted: #A3A3B1; --faint: #74747F;
  --accent: #7D93FF; --accent-hover: #98A9FF; --on-accent: #FFFFFF; --bad: #F08AC8;
  --wave: #3E63F0; --wave-dk: #3253DA; --wash: #1A1B23; --good: #4FD49A; --tide-op: .4; --art: #15161D;
  color-scheme: dark;
}

body { font: 400 14.5px/1.5 var(--font); }
time, .tk-due, .db-trow { font-variant-numeric: tabular-nums; }
::selection { background: color-mix(in srgb, var(--wave) 22%, transparent); }

/* ---------- shell: one fixed sidebar (skin.js), CML OS's own one stays hidden on a computer ---------- */
@media (min-width: 761px) {
  .os { grid-template-columns: var(--t-side) minmax(0, 1fr); }
  .os > .side { display: none; }
  .os > .main { grid-column: 2; grid-row: 1; }
}
.t-side { grid-column: 1; grid-row: 1; display: flex; flex-direction: column; min-height: 0; padding: 20px 12px 14px 14px; border-right: 1px solid var(--line); background: var(--side); }
.t-brand { display: flex; align-items: baseline; gap: 7px; height: 44px; padding: 6px 10px 0; color: var(--fg); text-decoration: none; font: 400 27px/1 var(--display); letter-spacing: -.03em; }
.t-brand em { font-style: italic; color: var(--wave); }
.t-nav { flex: 1; min-height: 0; overflow-y: auto; margin: 18px -8px 0 -4px; padding: 0 8px 12px 4px; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.t-grp + .t-grp { margin-top: 14px; }
.t-gh { display: flex; align-items: center; justify-content: space-between; width: 100%; height: 28px; padding: 0 10px; border: 0; border-radius: 8px; background: none; color: var(--faint); font: 600 12.5px/1 var(--font); cursor: pointer; }
.t-gh:hover { color: var(--fg); }
.t-gh .t-chev { width: 14px; height: 14px; opacity: 0; transition: opacity .15s, transform .15s; }
.t-gh:hover .t-chev, .t-grp.shut > .t-gh .t-chev, .t-gh:focus-visible .t-chev { opacity: 1; }
.t-grp.shut > .t-items, .t-plat.shut > .t-kids { display: none; }
.t-grp.shut.has-on > .t-gh { color: var(--fg); }
.t-items, .t-kids, .t-home { display: grid; gap: 1px; }
.t-item { display: flex; align-items: center; gap: 11px; width: 100%; height: 36px; padding: 0 10px; border: 0; border-radius: 10px; background: none; color: var(--muted); font: 600 14px/1 var(--font); text-align: left; text-decoration: none; cursor: pointer; }
.t-item:hover { background: var(--hover); color: var(--fg); }
.t-item.on { background: var(--active); color: var(--fg); }
.t-item svg.i { width: 18px; height: 18px; }
.t-item > span { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.t-fold em { font: 400 12px/1 var(--mono); font-style: normal; color: var(--faint); }
.t-fold .t-chev { width: 14px; height: 14px; color: var(--faint); transition: transform .15s; }
.t-plat.shut > .t-fold .t-chev, .t-grp.shut > .t-gh .t-chev { transform: rotate(-90deg); }
.t-plat.shut.has-on > .t-fold { background: var(--active); color: var(--fg); }
.t-kids { margin: 1px 0 4px 19px; padding-left: 9px; border-left: 1px solid var(--line); }
.t-kids .t-item { height: 32px; font-weight: 500; }
.t-kids .t-item svg.i { display: none; }
.t-foot { padding-top: 12px; border-top: 1px solid var(--line); }
[data-switcher-slot] { padding: 0 0 10px 2px; }
.t-foot .me { flex-direction: row; align-items: center; gap: 2px; }
.t-foot .me .sh-face { width: 30px; height: 30px; font-size: 12px; }
.t-name { flex: 1; min-width: 0; height: 34px; padding: 0 6px; border: 0; background: none; color: var(--fg); font: 600 14px/1 var(--font); text-align: left; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: pointer; }
.t-name:hover { color: var(--wave); }
@media (max-width: 760px) {
  .t-side { display: none; }
  .t-name { display: none; }
  .side .rail .brand img { display: none; }
  .side .rail .brand span { display: inline; font: 400 22px/1 var(--display); letter-spacing: -.03em; }
  .side .rail-btn { font-weight: 600; }
  .side .rail-btn.on { background: none; color: var(--wave); }
  .nav { height: 32px; padding: 0 12px; border-radius: 999px; font-weight: 600; }
}

/* ---------- page header: big serif title, one plain line under it, actions on the right ---------- */
.bar { height: auto; min-height: 96px; padding: 18px var(--pad) 14px; border-bottom: 0; gap: 10px; }
.bar h1 { font: 400 34px/1.08 var(--display); letter-spacing: -.03em; }
.bar h1 .crumb { color: var(--faint); }
.kit-line { margin-top: 6px; color: var(--muted); font-size: 14px; }
.body { padding: 6px var(--pad) 32px; }
.main { background: var(--bg); }
@media (max-width: 760px) {
  .bar { min-height: 0; padding: 14px 16px 10px; }
  .bar h1 { font-size: 27px; }
  .kit-line { white-space: normal; font-size: 13.5px; }
  .body { padding: 4px 16px 24px; }
}

/* ---------- controls ---------- */
.btn { height: 36px; padding: 0 16px; border: 0; border-radius: 999px; background: var(--panel); box-shadow: inset 0 0 0 1px var(--line-strong); font: 600 14px/1 var(--font); transition: background-color .15s ease; }
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--wave); box-shadow: none; color: #FFFFFF; }
.btn.primary:hover { background: var(--wave-dk); }
.btn.danger { background: var(--bad); box-shadow: none; color: #FFFFFF; }
.btn:disabled { opacity: .55; cursor: default; }
.icon-btn { width: 34px; height: 34px; border-radius: 50%; }
.link { color: var(--accent); font-weight: 600; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=number], input[type=url], input[type=date], input[type=time], input[type=datetime-local], select, textarea {
  border-color: var(--line-strong); border-radius: 10px; background-color: var(--panel); }
input[type=text], input[type=email], input[type=password], input[type=search], select { height: 36px; padding-left: 12px; padding-right: 12px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid color-mix(in srgb, var(--wave) 55%, transparent); outline-offset: 1px; border-color: var(--wave); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--wave); outline-offset: 2px; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input[type=checkbox], input[type=radio] { accent-color: var(--wave); }
.seg { padding: 3px; border: 0; border-radius: 999px; background: var(--wash); box-shadow: inset 0 0 0 1px var(--line); }
.seg button { height: 28px; padding: 0 13px; border-radius: 999px; font-weight: 600; font-size: 13px; }
.seg button.on { background: var(--panel); color: var(--fg); box-shadow: 0 0 0 1px var(--line-strong); }

/* ---------- surfaces: soft cards, hairlines, no shadows on chrome ---------- */
.list, .db-team, .tk-card, .preset { border-radius: 16px; }
.menu { padding: 6px; border-radius: 14px; box-shadow: 0 12px 32px rgba(23, 23, 31, .10); }
.menu button { padding: 8px 10px; border-radius: 9px; font-weight: 500; }
.dlg { border-radius: 20px; background: var(--panel); box-shadow: 0 24px 64px rgba(23, 23, 31, .18); }
.dlg form { gap: 14px; padding: 24px; }
.dlg h2 { font: 400 26px/1.15 var(--display); letter-spacing: -.02em; }
.dlg::backdrop { background: rgba(23, 23, 31, .28); }
.toast { padding: 10px 18px; border-radius: 999px; font-weight: 600; }
.tk-panel aside { background: var(--panel); }
.tk-ptitle { font: 400 26px/1.2 var(--display); letter-spacing: -.02em; }
.tk-row { min-height: 46px; border-bottom-color: var(--line); }
.tk-due, .tk-meta, .db-trow > span:nth-child(n+3) { font-family: var(--mono); font-size: 12.5px; }
.tk-check { color: var(--line-strong); }
.tk-check:hover { color: var(--wave); }
.tk-check.done, .db-in { color: var(--good); }
.tk-ghead { font-weight: 600; font-size: 12.5px; }
.tk-tag, .db-pst { border-radius: 999px; }
.empty { color: var(--muted); }

/* ---------- Dashboard ---------- */
.db { gap: 22px; }
.t-hero { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 24px; background: var(--panel); }
.t-hero { --band: clamp(150px, 21vh, 260px); }
.t-tide { position: absolute; inset: 0 0 auto; height: var(--band); opacity: var(--tide-op); -webkit-mask-image: linear-gradient(#000 18%, transparent 92%); mask-image: linear-gradient(#000 18%, transparent 92%); pointer-events: none; }
.t-tide canvas, .t-login-art canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.t-hero-in { position: relative; padding: calc(var(--band) - 34px) clamp(24px, 2.4vw, 44px) 26px; }
.t-hero-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px 32px; align-items: end; }
.t-hello { display: grid; gap: 16px; min-width: 0; }
.db-hello h2 { margin: 0; font: 400 clamp(38px, 3.3vw, 58px)/1.02 var(--display); letter-spacing: -.035em; }
.db-hello p { margin: 10px 0 0; color: var(--muted); font-size: 15.5px; }
.t-hello .db-note { justify-self: start; align-items: baseline; gap: 16px; max-width: 90ch; padding: 2px 0 2px 14px; border: 0; border-left: 2px solid var(--wave); border-radius: 0; background: none; }
.t-hello .db-note p { flex: 0 1 auto; font-size: 15px; }
.t-hello .db-note .link { white-space: nowrap; }
.t-act .db-shift { padding: 0; border: 0; background: none; gap: 14px; }
.t-act .db-shift { align-items: center; }
.t-act .db-shift b { font-weight: 600; }
.t-act .db-shift small { font-size: 12.5px; color: var(--faint); max-width: 30ch; }
.db-shift.on .db-dot { background: var(--good); box-shadow: 0 0 0 4px color-mix(in srgb, var(--good) 18%, transparent); }
.t-stats .db-stats { margin-top: 26px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); border: 0; border-top: 1px solid var(--line); border-radius: 0; background: none; }
.t-stats .db-stat { padding: 18px 24px 0 0; border: 0; }
.db-stat b { font: 400 36px/1.05 var(--display); letter-spacing: -.02em; }
.db-stat b.warn { color: var(--bad); }
.db-stat span { margin-top: 2px; color: var(--muted); font-size: 13px; }
.db-cols { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; }
.db-cols > .db-section { padding: 18px 20px 12px; border: 1px solid var(--line); border-radius: 20px; background: var(--panel); }
.db-head { margin-bottom: 8px; }
.db-head h3 { font: 400 23px/1.2 var(--display); letter-spacing: -.02em; }
.db-head .link { font-size: 13px; }
.db-section .tk-row, .db-section .db-part { padding-left: 2px; padding-right: 2px; border-radius: 0; }
.db-section .tk-row:last-of-type, .db-section .db-part:last-of-type { border-bottom: 0; }
.db-team { border: 0; border-radius: 0; background: none; }
.db-trow { padding: 10px 2px; }
.db-thead { font-weight: 600; font-size: 12.5px; }
.db-muted { color: var(--faint); }
.t-hide { display: none !important; }
.t-more { display: block; margin: 6px 0 4px; padding: 6px 0; border: 0; background: none; color: var(--accent); font: 600 13px/1 var(--font); cursor: pointer; }
.t-more:hover { text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 900px) {
  .t-hero-top { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .t-hero { border-radius: 20px; }
  .t-hero-in { padding: 96px 20px 20px; }
  .t-hero { --band: 140px; }
  .db-hello h2 { font-size: 34px; }
  .t-stats .db-stats { grid-template-columns: 1fr 1fr; }
  .t-stats .db-stat { border-top: 0; padding: 14px 12px 0 0; }
  .db-cols > .db-section { padding: 16px 16px 10px; }
}

/* ---------- login: form left, tide right ---------- */
.login { gap: 10px; padding: 16px; background: var(--bg); }
.login form { max-width: 360px; gap: 12px; }
.login .brand { justify-content: flex-start; padding: 0 0 26px; font: 400 50px/1 var(--display); letter-spacing: -.035em; }
.login .brand img { display: none; }
.login input[type=text], .login input[type=email], .login input[type=password] { height: 46px; padding: 0 16px; border-radius: 12px; font-size: 15px; }
.login .btn.primary { justify-content: center; height: 46px; margin-top: 4px; font-size: 15px; }
.t-login-art { display: none; }
@media (min-width: 900px) {
  .login { grid-template-columns: minmax(0, 45fr) minmax(0, 55fr); }
  .t-login-art { display: block; position: relative; align-self: stretch; justify-self: stretch; overflow: hidden; border-radius: 28px; background: var(--art); }
  :root[data-theme="dark"] .t-login-art { opacity: .8; }
}
@media (min-width: 900px) and (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .t-login-art { opacity: .8; } }

@media (prefers-reduced-motion: reduce) { .btn, .t-gh .t-chev, .t-fold .t-chev { transition: none; } }
