/* ---- theme variables ---- */
:root, [data-theme="dark"] {
  --bg: #1a1d22; --bg2: #23262d; --bg3: #2c2f36;
  --fg: #e6e8eb; --muted: #9aa3af;
  --accent: #6699ff; --accent2: #45b06c;
  --danger: #e25c5c; --border: #353a44;
  --hover: rgba(102, 153, 255, 0.08);
  --running-bg: rgba(69, 176, 108, 0.10);
}

[data-theme="light"] {
  --bg: #f5f6f8; --bg2: #ffffff; --bg3: #eef0f3;
  --fg: #1a1d22; --muted: #6b7280;
  --accent: #2c5fcc; --accent2: #2e8b51;
  --danger: #c0392b; --border: #d1d5db;
  --hover: rgba(44, 95, 204, 0.08);
  --running-bg: rgba(46, 139, 81, 0.10);
}

/* Solarized — by Ethan Schoonover */
[data-theme="solarized-dark"] {
  --bg: #002b36; --bg2: #073642; --bg3: #094556;
  --fg: #fdf6e3; --muted: #93a1a1;
  --accent: #268bd2; --accent2: #859900;
  --danger: #dc322f; --border: #094556;
  --hover: rgba(38, 139, 210, 0.10);
  --running-bg: rgba(133, 153, 0, 0.12);
}
[data-theme="solarized-light"] {
  --bg: #fdf6e3; --bg2: #eee8d5; --bg3: #ddd6c1;
  --fg: #073642; --muted: #586e75;
  --accent: #268bd2; --accent2: #859900;
  --danger: #dc322f; --border: #c8c0aa;
  --hover: rgba(38, 139, 210, 0.10);
  --running-bg: rgba(133, 153, 0, 0.12);
}

/* Dracula — by Zeno Rocha */
[data-theme="dracula"] {
  --bg: #282a36; --bg2: #343746; --bg3: #44475a;
  --fg: #f8f8f2; --muted: #6272a4;
  --accent: #bd93f9; --accent2: #50fa7b;
  --danger: #ff5555; --border: #44475a;
  --hover: rgba(189, 147, 249, 0.10);
  --running-bg: rgba(80, 250, 123, 0.10);
}

/* Nord — by Arctic Ice Studio */
[data-theme="nord"] {
  --bg: #2e3440; --bg2: #3b4252; --bg3: #434c5e;
  --fg: #eceff4; --muted: #81a1c1;
  --accent: #88c0d0; --accent2: #a3be8c;
  --danger: #bf616a; --border: #4c566a;
  --hover: rgba(136, 192, 208, 0.10);
  --running-bg: rgba(163, 190, 140, 0.10);
}

/* Gruvbox — by morhetz */
[data-theme="gruvbox-dark"] {
  --bg: #282828; --bg2: #3c3836; --bg3: #504945;
  --fg: #ebdbb2; --muted: #a89984;
  --accent: #83a598; --accent2: #b8bb26;
  --danger: #fb4934; --border: #504945;
  --hover: rgba(131, 165, 152, 0.10);
  --running-bg: rgba(184, 187, 38, 0.10);
}
[data-theme="gruvbox-light"] {
  --bg: #fbf1c7; --bg2: #ebdbb2; --bg3: #d5c4a1;
  --fg: #3c3836; --muted: #7c6f64;
  --accent: #076678; --accent2: #79740e;
  --danger: #9d0006; --border: #d5c4a1;
  --hover: rgba(7, 102, 120, 0.10);
  --running-bg: rgba(121, 116, 14, 0.10);
}

/* Monokai — classic */
[data-theme="monokai"] {
  --bg: #272822; --bg2: #3e3d32; --bg3: #49483e;
  --fg: #f8f8f2; --muted: #75715e;
  --accent: #66d9ef; --accent2: #a6e22e;
  --danger: #f92672; --border: #3e3d32;
  --hover: rgba(102, 217, 239, 0.10);
  --running-bg: rgba(166, 226, 46, 0.10);
}

/* One Dark — Atom */
[data-theme="one-dark"] {
  --bg: #282c34; --bg2: #353b45; --bg3: #3e4451;
  --fg: #abb2bf; --muted: #5c6370;
  --accent: #61afef; --accent2: #98c379;
  --danger: #e06c75; --border: #3e4451;
  --hover: rgba(97, 175, 239, 0.10);
  --running-bg: rgba(152, 195, 121, 0.10);
}

/* High Contrast — accessibility */
[data-theme="high-contrast"] {
  --bg: #000000; --bg2: #0a0a0a; --bg3: #1a1a1a;
  --fg: #ffffff; --muted: #cccccc;
  --accent: #ffff00; --accent2: #00ff00;
  --danger: #ff5050; --border: #ffffff;
  --hover: rgba(255, 255, 0, 0.15);
  --running-bg: rgba(0, 255, 0, 0.15);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #f5f6f8; --bg2: #ffffff; --bg3: #eef0f3;
    --fg: #1a1d22; --muted: #6b7280;
    --accent: #2c5fcc; --accent2: #2e8b51;
    --danger: #c0392b; --border: #d1d5db;
    --hover: rgba(44, 95, 204, 0.08);
    --running-bg: rgba(46, 139, 81, 0.10);
  }
}

/* ---- base ---- */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15.4px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}

button {
  background: var(--bg2);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
}
button:hover { border-color: var(--accent); background: var(--hover); }
button.btn-start { background: var(--accent2); border-color: var(--accent2); color: #fff; font-weight: 600; }
button.btn-start:hover { filter: brightness(1.1); }
button.btn-stop  { background: var(--danger);  border-color: var(--danger);  color: #fff; font-weight: 600; }
button.btn-stop:hover  { filter: brightness(1.1); }

button.icon-btn {
  padding: 4px 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
button.icon-btn img { width: 18px; height: 12px; display: block; border: 1px solid var(--border); }
button.icon-btn .theme-icon { width: 16px; height: 16px; display: inline-block; }

/* Theme selector — sits between the icon-buttons in the user-menu */
.theme-select {
  padding: 4px 6px;
  font-size: 12px;
  max-width: 140px;
}

input, select {
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  font: inherit;
}

/* ---- topbar (two rows: status row + start-form row) ---- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  grid-template-areas:
    "brand  timer    nav    tools"
    "form   form     form   form";
  gap: 10px 12px;
  align-items: center;
  padding: 10px 16px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
}
/* Dashboard topbar: no timer / no start-form — just one row.
   Nav is pinned to the right of its 1fr cell so it ends up directly to the
   left of tools, matching the overview layout. */
.topbar.dashboard-topbar {
  grid-template-columns: auto 1fr auto;
  grid-template-areas: "brand nav tools";
}
.topbar.dashboard-topbar .page-nav {
  justify-self: end;
}
.brand {
  grid-area: brand;
  font-weight: 700; letter-spacing: 0.04em; color: var(--accent);
  text-decoration: none;
}
.brand:hover { filter: brightness(1.2); }

.page-nav {
  grid-area: nav;
  display: flex; gap: 4px;
}
.page-nav .nav-link {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--fg);
  text-decoration: none;
  font-size: 13px;
}
.page-nav .nav-link:hover {
  background: var(--hover);
  border-color: var(--accent);
}
.page-nav .nav-link.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.timer {
  grid-area: timer;
  justify-self: start;
  display: flex; align-items: center; gap: 10px;
  padding: 5px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.timer.running { border-color: var(--accent2); }
.timer-label { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timer.running .timer-label { color: var(--fg); }
.timer .clock { font-size: 18px; font-weight: 600; color: var(--accent2); margin-right: 6px; }

.start-form {
  grid-area: form;
  display: flex;
  gap: 6px;
  align-items: center;
  min-width: 0;
}
/* Selects share the row evenly so long names stay readable; comment input
   gets a double share. */
.start-form select { flex: 1 1 0; min-width: 110px; }
.start-form input[name="comment"] { flex: 2 1 0; min-width: 140px; }
.start-form button.btn-start { flex: 0 0 auto; }

.user-menu {
  grid-area: tools;
  display: flex; gap: 4px; align-items: center;
  justify-self: end;
}
.user-menu #user-name { color: var(--muted); margin-right: 4px; white-space: nowrap; }

/* ---- entries list ---- */
.entries { padding: 16px 20px; max-width: 1100px; margin: 0 auto; }

.overview-toolbar {
  max-width: 1100px;
  margin: 12px auto 0;
  padding: 0 20px;
  display: flex;
  justify-content: flex-end;
}
.overview-toolbar .limit-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}
.overview-toolbar .limit-field input {
  width: 70px;
  padding: 4px 6px;
  font-variant-numeric: tabular-nums;
}
.day-group { margin-bottom: 24px; }
.day-header {
  display: flex; justify-content: space-between; align-items: baseline;
  border-bottom: 1px solid var(--border);
  padding: 4px 0; margin-bottom: 8px;
}
.day-header h2 { margin: 0; font-size: 14px; color: var(--muted); font-weight: 600; }
.day-total { font-variant-numeric: tabular-nums; color: var(--accent); }

.entry-row {
  display: grid;
  grid-template-columns: 140px minmax(220px, 1fr) 1fr 80px auto;
  gap: 12px;
  align-items: center;
  padding: 6px 8px;
  border-radius: 6px;
  transition: background 0.08s, box-shadow 0.08s;
}
.entry-row:hover {
  background: var(--bg3);
  /* inset shadow as accent-bar without affecting layout (no border push) */
  box-shadow: inset 3px 0 0 var(--accent);
}
.entry-row.running { background: var(--running-bg); }
.entry-row .time   { font-variant-numeric: tabular-nums; color: var(--muted); }
.entry-row .group  { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.entry-row .swatch { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.entry-row .activity { color: var(--muted); }
.entry-row .customer { color: var(--muted); font-size: 12px; }

/* customer-toggle: when off, hide customer dropdown in topbar,
   customer breadcrumb in entry rows, customer filter, and customer
   stats card. */
[data-show-customer="0"] #sel-customer { display: none; }
[data-show-customer="0"] .entry-row .customer { display: none; }
[data-show-customer="0"] .filter-customer-label { display: none; }
[data-show-customer="0"] .stats-card.by-customer { display: none; }
[data-show-customer="0"] .ne-customer-label { display: none; }

.icon-btn.active {
  border-color: var(--accent);
  background: var(--hover);
}

/* ---- filter bar ---- */
.filter-bar {
  /* Sticks directly under the dashboard topbar (~52px tall, single row) */
  position: sticky; top: 52px; z-index: 8;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.filter-row label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 0;
  min-width: 110px;
}
.filter-row label select,
.filter-row label input { width: 100%; }
/* Only the small caption above each input stays muted/small;
   the input/select itself uses the body font size. */
.filter-row label > span {
  font-size: 11px;
  color: var(--muted);
}
.filter-row label.filter-q { flex: 2 1 0; min-width: 200px; }
.filter-presets { display: flex; gap: 4px; }
.filter-presets button { padding: 4px 10px; }
.filter-presets button.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
#f-reset { align-self: flex-end; padding: 4px 10px; }

/* ---- stats cards (vertical stack, full width) ---- */
.stats-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 10px 16px;
  max-width: 1100px;
  margin: 0 auto;
}
.stats-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  width: 100%;
}
.stats-card h3 {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.stats-card .stats-total {
  font-size: 22px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}
.stats-card .stats-meta { color: var(--muted); font-size: 11px; }
.stats-card ul {
  list-style: none;
  padding: 0;
  margin: 4px 0 0;
  /* No max-height: cards stack vertically, the whole page scrolls instead. */
}
.stats-card ul li {
  display: flex; justify-content: space-between;
  font-variant-numeric: tabular-nums;
  padding: 2px 0;
  border-bottom: 1px dotted var(--border);
}
.stats-card ul li:last-child { border-bottom: none; }
.stats-card ul li .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.stats-card ul li .val { color: var(--muted); margin-left: 8px; font-variant-numeric: tabular-nums; }
/* Hover-Highlight im Dashboard: Background + blauer Akzent links wie in der
   Übersicht. Wir nutzen inset box-shadow statt border-left, weil hier-sub
   bereits border-left als Tree-Linie verwendet — box-shadow überlagert die
   ohne Layout-Shift. */
.stats-card ul li {
  transition: background 0.08s, box-shadow 0.08s;
}
.stats-card ul li:hover {
  background: var(--bg3);
  box-shadow: inset 3px 0 0 var(--accent);
}

/* Hierarchical list (parent group + drill rows).
   Visual goal: each top + its drills should look like a self-contained
   block, so that a drill named "BiI Kopplung" under "Administration" is
   not confused with the same name under "Programmieren". */
.stats-card ul.hier li.hier-top {
  font-weight: 600;
  border-bottom: none;
  border-top: 1px solid var(--border);
  padding-top: 8px;
  margin-top: 6px;
}
.stats-card ul.hier li.hier-top:first-child {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}
.stats-card ul.hier li.hier-top .val { color: var(--accent); }

.stats-card ul.hier li.hier-sub {
  padding: 1px 0 1px 18px;
  margin-left: 6px;
  color: var(--muted);
  border-bottom: none;
  border-left: 2px solid var(--border);
  position: relative;
}
.stats-card ul.hier li.hier-sub::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 10px;
  height: 1px;
  background: var(--border);
}

/* clickable BY-PROJECT rows + inline timeline expansion */
.stats-card ul.hier li.hier-top.expandable,
.stats-card ul.hier li.hier-sub.expandable {
  cursor: pointer;
}
.stats-card ul.hier li.hier-top.expandable .name::before,
.stats-card ul.hier li.hier-sub.expandable .name::before {
  content: "▸";
  display: inline-block;
  width: 12px;
  margin-right: 4px;
  color: var(--muted);
  transition: transform 0.15s;
}
.stats-card ul.hier li.hier-top.expandable.open .name::before,
.stats-card ul.hier li.hier-sub.expandable.open .name::before {
  transform: rotate(90deg);
}
.stats-card ul.hier li.hier-top.expandable:hover,
.stats-card ul.hier li.hier-sub.expandable:hover {
  background: var(--bg3);
}
.stats-card ul.hier li.timeline-slot {
  display: block;
  padding: 8px 4px 12px;
  border-bottom: none;
  background: transparent;
}
.stats-card ul.hier li.timeline-slot.timeline-slot-sub {
  margin-left: 6px;
  padding-left: 22px;
  border-left: 2px solid var(--border);
}
.timeline-meta {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
}
.timeline-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 90px;
  overflow-x: auto;
  padding-bottom: 38px;
}
.timeline-bars .tl-col {
  flex: 0 0 34px;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  position: relative;
}
.timeline-bars .tl-bar {
  width: 100%;
  min-height: 1px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
}
.timeline-bars .tl-col:hover .tl-bar {
  filter: brightness(1.2);
}
.timeline-bars .tl-label {
  position: absolute;
  bottom: -18px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.timeline-loading, .timeline-empty, .timeline-error {
  font-size: 13px;
  color: var(--muted);
  padding: 4px 0;
}
.timeline-error { color: #c66; }
.entry-row .comment {
  color: var(--fg);
  display: flex;
  align-items: center;
  min-width: 0;
  /* overflow visible so the CSS tooltip isn't clipped — the inner span
     handles ellipsis */
}
.entry-row .comment .comment-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
.entry-row .comment .tag-badge {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 6px;
  font-size: 11px;
  background: var(--bg3);
  color: var(--accent);
  border-radius: 10px;
  vertical-align: middle;
}
.entry-row .duration { font-variant-numeric: tabular-nums; text-align: right; }
.entry-row .actions { display: flex; gap: 4px; }
.entry-row .actions button { padding: 2px 8px; font-size: 12px; }

.empty-state { color: var(--muted); text-align: center; padding: 40px; }

/* ---- dialogs ---- */
dialog {
  background: var(--bg2);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
  min-width: 480px;
  max-width: 90vw;
}
dialog::backdrop { background: rgba(0, 0, 0, 0.5); }
dialog h3 { margin-top: 0; }
dialog label { display: block; margin: 8px 0; }
dialog label input, dialog label select { display: block; width: 100%; margin-top: 2px; }
dialog menu { display: flex; gap: 8px; justify-content: flex-end; padding: 0; margin-top: 16px; }
dialog ul { list-style: none; padding: 0; margin: 0 0 8px; }
dialog ul li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 0; border-bottom: 1px solid var(--border);
}
dialog form section { margin: 12px 0; }
dialog .datetime-pair {
  display: flex;
  gap: 6px;
  margin-top: 2px;
}
dialog .datetime-pair input[type="date"] {
  flex: 0 0 auto;
  width: 140px;
}
dialog .datetime-pair input[type="time"],
dialog .datetime-pair input[type="text"] {
  flex: 0 0 auto;
  width: 110px;
  font-variant-numeric: tabular-nums;
}
dialog label.datetime-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
dialog label.datetime-row > span:first-child {
  flex: 0 0 90px;
}
dialog label.datetime-row .datetime-pair {
  margin-top: 0;
}
dialog .dialog-hint {
  margin: 4px 0 12px;
  color: var(--muted);
  font-size: 12px;
  max-width: 420px;
}
dialog#dlg-master { min-width: 540px; max-width: 720px; }
dialog#dlg-master form { display: flex; gap: 6px; flex-wrap: wrap; }
dialog#dlg-master form input[name="name"] { flex: 1 1 160px; min-width: 0; }
dialog#dlg-master form input[name="description"] { flex: 1 1 200px; min-width: 0; }
dialog#dlg-master form select { flex: 0 1 200px; min-width: 0; }

/* Subprojects-by-name grouping in master data dialog */
dialog#dlg-master li.sub-group {
  display: block;
  border-bottom: 1px solid var(--border);
  padding: 6px 0;
}
dialog#dlg-master li.sub-group .sub-name {
  font-weight: 600;
}
dialog#dlg-master li.sub-group .sub-drill {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 0 2px 16px;
  font-size: 12px;
  color: var(--muted);
}
dialog#dlg-master li.sub-group .sub-drill .proj-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
dialog#dlg-master li.sub-group .sub-drill button {
  padding: 2px 8px;
  font-size: 12px;
}

/* Users section */
dialog#dlg-master li.user-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}
dialog#dlg-master li.user-row .user-info { display: flex; gap: 6px; align-items: center; }
dialog#dlg-master li.user-row .user-info .badge {
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}
dialog#dlg-master li.user-row .user-info .badge.admin { background: var(--accent); color: #fff; }
dialog#dlg-master li.user-row .user-info .badge.user  { background: var(--bg3); color: var(--muted); }
dialog#dlg-master li.user-row .user-actions { display: flex; gap: 4px; }
dialog#dlg-master li.user-row .user-actions button {
  padding: 2px 6px;
  font-size: 12px;
}

.error { color: var(--danger); }

/* ---- Custom tooltip (CSS-only, font-size inherits from the row) ----
   Positioned BELOW the hover element so it doesn't cover the topbar /
   filter dropdowns above the lists. */
[data-tooltip] {
  position: relative;
}
[data-tooltip]:hover::after,
[data-tooltip].sticky-tip::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: var(--bg2);
  color: var(--fg);
  border: 1px solid var(--border);
  padding: 4px 8px;
  border-radius: 4px;
  white-space: pre-wrap;
  max-width: 600px;
  width: max-content;
  font-size: inherit;
  font-family: inherit;
  line-height: 1.35;
  z-index: 1000;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
[data-tooltip]:hover::before,
[data-tooltip].sticky-tip::before {
  /* small connector arrow pointing up */
  content: "";
  position: absolute;
  top: calc(100% + 0px);
  left: 12px;
  width: 0;
  height: 0;
  border: 4px solid transparent;
  border-bottom-color: var(--border);
  z-index: 1001;
  pointer-events: none;
}
.timeline-bars .tl-col { cursor: pointer; }
.timeline-bars .tl-col.sticky-tip .tl-bar {
  outline: 1px solid var(--accent);
  outline-offset: 1px;
}
/* Suppress the global CSS-only tooltip on bars — the floating .tl-tip below
   is used instead so it can render outside the overflow-clipped container. */
.timeline-bars .tl-col[data-tooltip]:hover::after,
.timeline-bars .tl-col[data-tooltip]:hover::before,
.timeline-bars .tl-col[data-tooltip].sticky-tip::after,
.timeline-bars .tl-col[data-tooltip].sticky-tip::before {
  content: none;
  display: none;
}

/* Floating tooltip rendered as a body-level <div> so it isn't clipped by
   the timeline-bars overflow-x:auto container. Positioned by JS via fixed
   coords. */
.tl-tip {
  position: fixed;
  background: var(--bg2);
  color: var(--fg);
  border: 1px solid var(--border);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
  line-height: 1.35;
  z-index: 1000;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  white-space: nowrap;
}
.tl-tip[hidden] { display: none; }
.tl-tip::after {
  /* arrow pointing down toward the bar */
  content: "";
  position: absolute;
  top: 100%;
  left: 12px;
  width: 0;
  height: 0;
  border: 4px solid transparent;
  border-top-color: var(--border);
}

/* ---- login ---- */
body.login {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
}
.login-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 32px;
  min-width: 320px;
  position: relative;
}
.login-card h1 { color: var(--accent); margin-top: 0; text-align: center; }
.login-card label { display: block; margin: 12px 0; }
.login-card input { display: block; width: 100%; margin-top: 4px; }
.login-card button[type="submit"] { width: 100%; margin-top: 16px; padding: 10px; font-weight: 600; background: var(--accent); border-color: var(--accent); color: #fff; }
.login-card button[type="submit"]:hover { filter: brightness(1.1); background: var(--accent); }

.login-tools {
  position: absolute; top: 8px; right: 8px;
  display: flex; gap: 4px;
}
