/* ─────────────────────────────────────────────────────────────
   today.saicretary.com — Things-artige Triage auf GitLab-Issues
   Konzept: die ruhige Things-Oberflaeche liegt oben, per Schalter
   „Mechanik" scheint die GitLab-Schicht (Mono) darunter durch.
   ───────────────────────────────────────────────────────────── */
:root {
  --paper:      #FCFBF9;
  --sidebar:    #F0EDE7;
  --raise:      #FFFFFF;
  --ink:        #22201D;
  --ink-2:      #56524C;
  --muted:      #9A948B;
  --line:       #E6E1D9;
  --line-soft:  #EFEBE4;
  --accent:     #3A6FE0;
  --accent-ink: #FFFFFF;
  --tint:       rgba(58,111,224,.10);
  --hover:      rgba(0,0,0,.038);
  --star:       #DE9A2E;
  --flag:       #C94F3D;
  --green:      #4E8F5B;
  --shadow:     0 1px 2px rgba(40,34,24,.06), 0 8px 24px rgba(40,34,24,.08);
  --mech:       #8C8578;
  --mech-bg:    rgba(140,133,120,.10);

  --a-privat: #E0A03C;
  --a-ges:    #C05F53;
  --a-infra:  #5E8A9E;
  --a-firma:  #7E7BB5;
  --a-dev:    #5E9B6B;
  --a-rest:   #9A948B;

  --ui: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1A1918; --sidebar: #131211; --raise: #232220;
    --ink: #EDEAE4; --ink-2: #B5AFA6; --muted: #7C766D;
    --line: #2E2B27; --line-soft: #26241F;
    --accent: #6E9BFF; --accent-ink: #11131A; --tint: rgba(110,155,255,.14);
    --hover: rgba(255,255,255,.045);
    --star: #EDB25A; --flag: #E0705C; --green: #6FBF80;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 28px rgba(0,0,0,.35);
    --mech: #918A7C; --mech-bg: rgba(145,138,124,.12);
  }
}
:root[data-theme="dark"] {
  --paper: #1A1918; --sidebar: #131211; --raise: #232220;
  --ink: #EDEAE4; --ink-2: #B5AFA6; --muted: #7C766D;
  --line: #2E2B27; --line-soft: #26241F;
  --accent: #6E9BFF; --accent-ink: #11131A; --tint: rgba(110,155,255,.14);
  --hover: rgba(255,255,255,.045);
  --star: #EDB25A; --flag: #E0705C; --green: #6FBF80;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 28px rgba(0,0,0,.35);
  --mech: #918A7C; --mech-bg: rgba(145,138,124,.12);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--ui); font-size: 15px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; overscroll-behavior-y: none;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: var(--accent); }
a.btn, a.pill, .navitem, .citem { text-decoration: none; }
input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

/* ── Anmeldung ────────────────────────────────────────────── */
.login {
  min-height: 100vh; display: grid; place-items: center; padding: 32px 20px;
  text-align: center;
}
.login .box { max-width: 380px; display: flex; flex-direction: column; gap: 16px; align-items: center; }
.login h1 { margin: 0; font-size: 27px; letter-spacing: -.02em; }
.login p { margin: 0; color: var(--ink-2); font-size: 14.5px; }
.login .host { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.btn {
  background: var(--accent); color: var(--accent-ink); padding: 11px 26px;
  border-radius: 9px; font-size: 15px; font-weight: 500;
}
.btn:active { transform: scale(.98); }

/* ── Geruest ──────────────────────────────────────────────── */
.app { display: grid; grid-template-columns: 252px minmax(0,1fr); min-height: 100vh; }

.sidebar {
  background: var(--sidebar); border-right: 1px solid var(--line);
  padding: max(18px, env(safe-area-inset-top)) 10px 12px; display: flex; flex-direction: column;
  gap: 2px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { padding: 0 10px 14px; }
.brand b { font-size: 13.5px; font-weight: 600; color: var(--ink); display: block; }
.brand small { font-size: 11px; color: var(--muted); font-family: var(--mono); }

.navitem {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 6px 10px; border-radius: 7px; text-align: left; color: var(--ink);
  font-size: 14.5px; line-height: 1.3;
}
.navitem:hover { background: var(--hover); }
.navitem[aria-current="true"] { background: var(--tint); color: var(--accent); font-weight: 500; }
.navitem .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.navitem .ct { margin-left: auto; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.navitem[aria-current="true"] .ct { color: var(--accent); }
.navitem svg { width: 17px; height: 17px; flex: none; }
.navdot { width: 9px; height: 9px; border-radius: 50%; flex: none; margin: 0 4px; }

.navgroup {
  margin-top: 16px; padding: 0 10px 5px; font-size: 11px; letter-spacing: .07em;
  text-transform: uppercase; color: var(--muted); font-weight: 600;
}
.sidefoot { margin-top: auto; padding: 14px 10px max(4px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.switch { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--ink-2); width: 100%; }
.switch .track {
  width: 34px; height: 20px; border-radius: 10px; background: var(--line);
  position: relative; flex: none; transition: background .18s;
}
.switch .track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: var(--raise); box-shadow: 0 1px 2px rgba(0,0,0,.25);
  transition: transform .18s;
}
.switch[aria-pressed="true"] .track { background: var(--accent); }
.switch[aria-pressed="true"] .track::after { transform: translateX(14px); }
.whoami { margin-top: 11px; font-size: 11.5px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.whoami a { color: var(--muted); }

/* ── Inhalt ───────────────────────────────────────────────── */
.content { padding: 34px 40px 120px; max-width: 760px; }
.vhead { display: flex; align-items: center; gap: 11px; margin-bottom: 4px; }
.vhead svg { width: 26px; height: 26px; }
.vhead h1 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -.02em; text-wrap: balance; }
.vsub { color: var(--muted); font-size: 13.5px; margin: 0 0 22px; }

.mech-line {
  display: none; font-family: var(--mono); font-size: 11.5px; color: var(--mech);
  background: var(--mech-bg); border-radius: 6px; padding: 7px 10px; margin: 0 0 22px;
  overflow-x: auto; white-space: nowrap;
}
body.mech .mech-line { display: block; }
body.mech .vsub { margin-bottom: 10px; }

.grouphead {
  font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  color: var(--muted); margin: 26px 0 7px; display: flex; align-items: center; gap: 8px;
}
.grouphead:first-of-type { margin-top: 0; }
.grouphead.due { color: var(--flag); }
.grouphead .rule { flex: 1; height: 1px; background: var(--line-soft); }
.list { display: flex; flex-direction: column; }

/* ── Zeile ────────────────────────────────────────────────── */
.row {
  display: grid; grid-template-columns: 22px minmax(0,1fr) auto; gap: 10px;
  align-items: start; padding: 7px 8px 7px 4px; border-radius: 8px;
  cursor: pointer; position: relative;
}
.row:hover { background: var(--hover); }
.row.open { background: var(--raise); box-shadow: var(--shadow); cursor: default; padding-bottom: 12px; }
.row.leaving { opacity: 0; transform: translateX(6px); transition: opacity .28s, transform .28s; }
.row.busy { opacity: .55; }

.tick {
  width: 19px; height: 19px; border-radius: 50%; border: 1.5px solid var(--line);
  margin-top: 2px; background: var(--paper); display: grid; place-items: center;
  transition: background .12s, border-color .12s; flex: none;
}
.row.open .tick { background: var(--raise); }
.tick:hover { border-color: var(--accent); }
.tick svg { width: 11px; height: 11px; opacity: 0; color: var(--accent-ink); }
.row.done .tick { background: var(--accent); border-color: var(--accent); }
.row.done .tick svg { opacity: 1; }
.row.done .title { color: var(--muted); text-decoration: line-through; }

.body { min-width: 0; }
.title { font-size: 15px; line-height: 1.35; overflow-wrap: anywhere; }
.meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 3px;
  font-size: 12.5px; color: var(--muted);
}
.meta .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.meta .sep { opacity: .5; }
.meta .flag { color: var(--flag); display: inline-flex; align-items: center; gap: 3px; }
.meta .flag.over { font-weight: 600; }
.meta .chk { display: inline-flex; align-items: center; gap: 3px; }
.meta svg { width: 13px; height: 13px; }

.tail { display: flex; align-items: center; gap: 7px; margin-top: 2px; }
.star { width: 18px; height: 18px; color: var(--star); flex: none; }
.row .acts { display: none; gap: 2px; }
.row:hover .acts { display: flex; }
.row.open .acts { display: none; }
.acts button { width: 27px; height: 27px; border-radius: 6px; display: grid; place-items: center; color: var(--ink-2); }
.acts button:hover { background: var(--tint); color: var(--accent); }
.acts svg { width: 16px; height: 16px; }

.mechrow { display: none; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
body.mech .mechrow { display: flex; }
.mechrow code {
  font-family: var(--mono); font-size: 10.5px; color: var(--mech);
  background: var(--mech-bg); padding: 1px 6px; border-radius: 4px; white-space: nowrap;
}

/* ── Detail ───────────────────────────────────────────────── */
.detail { grid-column: 2 / -1; margin-top: 8px; display: flex; flex-direction: column; gap: 12px; }
.detail .note { font-size: 14px; color: var(--ink-2); line-height: 1.55; max-width: 62ch; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.detail .note a { color: var(--accent); }
.detail .note code { font-family: var(--mono); font-size: 12.5px; background: var(--mech-bg); padding: 1px 5px; border-radius: 4px; }
.loadingnote { color: var(--muted); font-size: 13.5px; }
.checklist { display: flex; flex-direction: column; gap: 2px; }
.citem { display: flex; align-items: flex-start; gap: 9px; font-size: 14px; padding: 2px 0; text-align: left; }
.cbox { width: 15px; height: 15px; border-radius: 4px; border: 1.5px solid var(--line); display: grid; place-items: center; flex: none; margin-top: 3px; }
.cbox svg { width: 9px; height: 9px; opacity: 0; color: var(--accent-ink); }
.citem.done .cbox { background: var(--accent); border-color: var(--accent); }
.citem.done .cbox svg { opacity: 1; }
.citem.done span { color: var(--muted); text-decoration: line-through; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 11.5px; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line);
  color: var(--ink-2); background: var(--paper); font-family: var(--mono);
}
.dfoot { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; border-top: 1px solid var(--line-soft); padding-top: 11px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 7px;
  border: 1px solid var(--line); font-size: 13px; color: var(--ink-2); background: var(--paper);
}
.pill:hover { border-color: var(--accent); color: var(--accent); }
.pill svg { width: 14px; height: 14px; }
.pill.ghost { border-style: dashed; color: var(--muted); }
.comments { display: flex; flex-direction: column; gap: 9px; }
.cmt { display: grid; grid-template-columns: 24px minmax(0,1fr); gap: 9px; }
.avatar {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  font-size: 9.5px; font-weight: 600; color: var(--accent-ink); background: var(--accent);
  position: relative; overflow: hidden; flex: none;
}
.avatar i { font-style: normal; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar.bot { background: var(--mech); }
.cmt .who { font-size: 12px; color: var(--muted); }
.cmt .txt { font-size: 13.5px; color: var(--ink-2); line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ── Menue, Modal, Toast ──────────────────────────────────── */
.menu {
  position: absolute; z-index: 40; background: var(--raise); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow); padding: 5px; min-width: 218px;
}
.menu button { display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 10px; border-radius: 7px; font-size: 14px; text-align: left; }
.menu button:hover { background: var(--tint); color: var(--accent); }
.menu button .k { margin-left: auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.menu hr { border: 0; border-top: 1px solid var(--line-soft); margin: 4px 6px; }
.menu label { display: flex; align-items: center; gap: 9px; padding: 7px 10px; font-size: 14px; }
.menu input[type="date"] { font-size: 13px; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; margin-left: auto; }

.sheet { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; background: rgba(0,0,0,.28); padding: 20px; }
.sheet .card {
  background: var(--raise); border-radius: 14px; box-shadow: var(--shadow);
  width: min(460px, 100%); padding: 18px; display: flex; flex-direction: column; gap: 12px;
}
.sheet h2 { margin: 0; font-size: 16px; }
.sheet .head { display: flex; align-items: center; gap: 10px; }
.sheet .head h2 { flex: 1; }
.sheet .x { width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center; color: var(--muted); flex: none; }
.sheet .x:hover { background: var(--hover); color: var(--ink); }
.sheet .x svg { width: 16px; height: 16px; }
.sheet .hint { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.sheet .hint b { color: var(--ink-2); font-weight: 600; }
.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid transparent; }
.btn svg { width: 15px; height: 15px; }
.btn.secondary { background: transparent; color: var(--ink-2); border-color: var(--line); }
.btn.secondary:hover { border-color: var(--accent); color: var(--accent); }
.sheet input[type="text"], .sheet textarea, .sheet select {
  width: 100%; background: var(--paper); border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 11px; font-size: 15px;
}
.sheet textarea { min-height: 72px; resize: vertical; font-size: 14px; }
.sheet .rowbtns { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.sheet .rowbtns .btn { padding: 9px 16px; font-size: 14px; }
.sheet .quick { display: flex; flex-wrap: wrap; gap: 6px; }
.sheet .quick button { border: 1px solid var(--line); border-radius: 7px; padding: 5px 11px; font-size: 13px; color: var(--ink-2); }
.sheet .quick button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: var(--tint); }

.toast {
  position: fixed; left: 50%; bottom: max(28px, env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: var(--ink); color: var(--paper); padding: 9px 16px; border-radius: 9px; font-size: 13.5px;
  box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  z-index: 80; max-width: min(92vw, 520px);
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast code { font-family: var(--mono); font-size: 12px; opacity: .72; }
.toast.err { background: var(--flag); color: #fff; }

.fab {
  position: fixed; right: 28px; bottom: max(28px, env(safe-area-inset-bottom)); width: 52px; height: 52px;
  border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center;
  box-shadow: 0 4px 14px rgba(58,111,224,.4); z-index: 30;
}
.fab svg { width: 22px; height: 22px; }
.fab:active { transform: scale(.94); }

.empty { color: var(--muted); font-size: 14px; padding: 18px 4px; }
.stale { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.stale .pip { width: 7px; height: 7px; border-radius: 50%; background: var(--flag); }

/* ── Mobil ────────────────────────────────────────────────── */
.mobar { display: none; }
.scrim { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 55; }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 60; inset: 0 auto 0 0; width: 264px; transform: translateX(-100%); transition: transform .22s; }
  body.nav .sidebar { transform: none; }
  body.nav .scrim { display: block; }
  .mobar {
    display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 20;
    background: var(--paper); border-bottom: 1px solid var(--line-soft);
    padding: max(10px, env(safe-area-inset-top)) 16px 10px;
  }
  .mobar b { font-size: 15px; }
  .mobar svg { width: 20px; height: 20px; }
  .content { padding: 20px 16px 120px; }
  .vhead h1 { font-size: 23px; }
  .row .acts { display: flex; }
  .acts button { width: 30px; height: 30px; }
  .fab { right: 18px; bottom: max(22px, env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
