/* zeitkort-web — styled to match fló.fo. Light + tokyo (dark), follows system. */

*, *::before, *::after { box-sizing: border-box; }

:root,
[data-theme="light"] {
  --bg: #f4f1ec;
  --fg: #1a1d22;
  --muted: #595f68;
  --dim: #9299a2;
  --border: rgba(26, 29, 34, 0.12);
  --border-soft: rgba(26, 29, 34, 0.06);
  --dotted: rgba(26, 29, 34, 0.12);
  --field-bg: rgba(26, 29, 34, 0.03);
  --field-border: rgba(26, 29, 34, 0.18);
  --btn-bg: rgba(26, 29, 34, 0.05);
  --btn-bg-hover: rgba(26, 29, 34, 0.09);
  --btn-border: rgba(26, 29, 34, 0.18);
  --header-border: rgba(26, 29, 34, 0.12);
  --th-bg: rgba(26, 29, 34, 0.04);
  --row-active: rgba(44, 90, 122, 0.06);
  --link: #2c5a7a;
  --accent: #2c5a7a;
  --accent-bg: rgba(44, 90, 122, 0.07);
  --accent-border: #2c5a7a;
  --nav-bg: rgba(244, 241, 236, 0.6);
  --bg-panel: rgba(255, 253, 250, 0.72);

  --notice-fg: #2a6e2a; --notice-bg: rgba(42, 110, 42, 0.06); --notice-border: rgba(42, 110, 42, 0.25);
  --error-fg: #a03030;  --error-bg: rgba(160, 48, 48, 0.06);  --error-border: rgba(160, 48, 48, 0.25);
  --go-bg: rgba(42, 110, 42, 0.06); --go-border: rgba(42, 110, 42, 0.3); --go-bg-hover: rgba(42, 110, 42, 0.1);
  --stop-bg: rgba(160, 48, 48, 0.06); --stop-border: rgba(160, 48, 48, 0.3); --stop-bg-hover: rgba(160, 48, 48, 0.1);
  --card-bg: #fff; --card-border: rgba(160, 48, 48, 0.3);
  --danger-btn-bg: rgba(160, 48, 48, 0.06); --danger-btn-bg-hover: rgba(160, 48, 48, 0.12);
  --backdrop: rgba(0, 0, 0, 0.3);
  --shadow: rgba(0, 0, 0, 0.12);

  /* Theme toggle pill */
  --toggle-bg: linear-gradient(135deg, #07070d 0%, #64dcff 100%);
  --toggle-border: rgba(26, 29, 34, 0.2);
  --toggle-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

[data-theme="tokyo"] {
  --bg: #07070d;
  --fg: #e8f4ff;
  --muted: #a3b3cc;
  --dim: #7886a0;
  --border: rgba(100, 220, 255, 0.12);
  --border-soft: rgba(100, 220, 255, 0.06);
  --dotted: rgba(100, 220, 255, 0.1);
  --field-bg: rgba(100, 220, 255, 0.04);
  --field-border: rgba(100, 220, 255, 0.15);
  --btn-bg: rgba(100, 220, 255, 0.06);
  --btn-bg-hover: rgba(100, 220, 255, 0.1);
  --btn-border: rgba(100, 220, 255, 0.18);
  --header-border: rgba(100, 220, 255, 0.12);
  --th-bg: rgba(100, 220, 255, 0.04);
  --row-active: rgba(100, 220, 255, 0.06);
  --link: #64dcff;
  --accent: #64dcff;
  --accent-bg: rgba(100, 220, 255, 0.06);
  --accent-border: #64dcff;
  --nav-bg: rgba(7, 7, 13, 0.65);
  --bg-panel: rgba(15, 16, 28, 0.72);

  --notice-fg: #8fe08f; --notice-bg: rgba(143, 224, 143, 0.06); --notice-border: rgba(143, 224, 143, 0.25);
  --error-fg: #ff9b9b;  --error-bg: rgba(255, 155, 155, 0.06);  --error-border: rgba(255, 155, 155, 0.2);
  --go-bg: rgba(80, 200, 80, 0.08); --go-border: rgba(80, 200, 80, 0.3); --go-bg-hover: rgba(80, 200, 80, 0.14);
  --stop-bg: rgba(200, 80, 80, 0.08); --stop-border: rgba(200, 80, 80, 0.3); --stop-bg-hover: rgba(200, 80, 80, 0.14);
  --card-bg: #0f1018; --card-border: rgba(200, 80, 80, 0.4);
  --danger-btn-bg: rgba(200, 80, 80, 0.1); --danger-btn-bg-hover: rgba(200, 80, 80, 0.18);
  --backdrop: rgba(0, 0, 0, 0.55);
  --shadow: rgba(0, 0, 0, 0.5);

  --toggle-bg: #f4f1ec;
  --toggle-border: rgba(100, 220, 255, 0.4);
  --toggle-shadow: 0 0 10px rgba(100, 220, 255, 0.5), 0 0 25px rgba(100, 220, 255, 0.3);
}

html, body { max-width: 100%; overflow-x: hidden; }
body {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88rem;
  font-weight: 300;
  line-height: 1.55;
  color: var(--fg);
  background: var(--bg);
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: background 0.3s ease, color 0.3s ease;
}

main { overflow-wrap: break-word; padding: 16px; max-width: 1040px; margin: 0 auto; width: 100%; flex: 1; }
input, select, textarea { max-width: 100%; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---- Header / nav ---- */
header {
  border-bottom: 1px solid var(--header-border);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.2rem;
  background: var(--nav-bg);
  backdrop-filter: blur(12px) saturate(120%);
  -webkit-backdrop-filter: blur(12px) saturate(120%);
  position: sticky;
  top: 0;
  z-index: 20;
  transition: background 0.3s ease;
}

.back-link {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 400;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--muted);
  text-decoration: none;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 2px;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.back-link:hover {
  color: var(--fg);
  border-color: var(--muted);
  background: var(--bg-panel);
}

.brand {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.02em;
  color: var(--fg);
  text-decoration: none;
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  white-space: nowrap;
}
.brand:hover { color: var(--accent); }

.brand-sep {
  font-weight: 300;
  color: var(--dim);
}
.brand-sub {
  font-weight: 400;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

[data-theme="tokyo"] .brand {
  color: #e8f4ff;
  text-shadow: 0 0 8px rgba(100, 220, 255, 0.3);
}

nav a {
  margin-right: 0.9rem;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 0.35rem 0;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}
nav a:hover { color: var(--fg); border-bottom-color: transparent; }

footer {
  padding: 0.9rem 1.5rem;
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  border-top: 1px solid var(--border-soft);
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

h2 {
  margin: 0 0 0.9rem;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

[data-theme="tokyo"] h2 {
  text-shadow: 0 0 10px rgba(100, 220, 255, 0.2);
}

/* ---- Forms ---- */
fieldset {
  border: 1px solid var(--border);
  margin: 0 0 14px;
  padding: 10px 12px;
  min-width: 0;
  border-radius: 3px;
  background: var(--field-bg);
  transition: border-color 0.3s ease, background 0.3s ease;
}
legend {
  font-weight: 500;
  padding: 0 6px;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

select, input[type=text], input[type=number], input:not([type]), textarea {
  font: inherit;
  font-size: 0.85rem;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--field-border);
  border-radius: 3px;
  background: var(--field-bg);
  color: var(--fg);
  transition: border-color 0.2s;
  outline: none;
}
select:focus, input[type=text]:focus, input[type=number]:focus, input:not([type]):focus, textarea:focus {
  border-color: var(--accent);
}
textarea { width: 100%; max-width: 460px; }
label { display: inline-block; font-size: 0.85rem; }

button {
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--btn-border);
  border-radius: 3px;
  background: var(--btn-bg);
  color: var(--fg);
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: background 0.15s, border-color 0.15s;
}
button:hover { background: var(--btn-bg-hover); }

.muted { color: var(--muted); font-size: 0.78rem; }
.error { color: var(--error-fg); border: 1px solid var(--error-border); padding: 6px 10px; background: var(--error-bg); border-radius: 3px; }
.notice { color: var(--notice-fg); border: 1px solid var(--notice-border); padding: 6px 10px; background: var(--notice-bg); border-radius: 3px; }

.columns { display: flex; gap: 16px; flex-wrap: wrap; }
.col { flex: 1 1 340px; min-width: 0; }

.task { padding: 5px 0; border-bottom: 1px dotted var(--dotted); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.task .pick { flex: 1 1 140px; min-width: 0; }

button.go { font-weight: 700; min-width: 84px; letter-spacing: 0.04em; }
button.go:not(.stop):not([disabled]) { background: var(--go-bg); border-color: var(--go-border); }
button.go:not(.stop):not([disabled]):hover { background: var(--go-bg-hover); }
button.go.stop { background: var(--stop-bg); border-color: var(--stop-border); }
button.go.stop:hover { background: var(--stop-bg-hover); }
button.go[disabled] { opacity: .45; cursor: not-allowed; }

.inline { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
fieldset > .inline { margin-top: 10px; }
.add-toggle { margin-top: 10px; }

.clock { font-family: 'JetBrains Mono', monospace; font-size: 1.5rem; font-weight: 700; margin: 0; letter-spacing: -0.02em; }

/* Sticky bar shown only while a timer runs. */
.running-bar {
  position: sticky;
  top: 52px;   /* below the header */
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  background: var(--go-bg);
  border: 1px solid var(--go-border);
  border-radius: 3px;
  padding: 8px 12px;
  margin: 0 0 14px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.rb-task { flex: 1 1 auto; }
.running-bar .go { margin-left: auto; }

.go-badge {
  display: inline-block;
  min-width: 84px;
  text-align: center;
  font-weight: 700;
  padding: 4px 10px;
  border: 1px solid var(--go-border);
  border-radius: 3px;
  background: var(--go-bg);
  color: var(--fg);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

/* ---- Tables ---- */
table { border-collapse: collapse; width: 100%; }
th, td { border: 1px solid var(--border-soft); padding: 0.3rem 0.5rem; text-align: left; font-size: 0.78rem; vertical-align: top; }
th { background: var(--th-bg); font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; font-size: 0.7rem; color: var(--muted); }
tr.active { background: var(--row-active); }
.row-actions { white-space: nowrap; }
.row-actions button { padding: 1px 6px; font-size: 0.72rem; }

.line { display: flex; gap: 6px; margin: 4px 0; flex-wrap: wrap; }
.line input { width: 110px; }
.line input[name=extra_desc] { width: 220px; }

/* ---- Two-tap delete confirm ---- */
details.confirm { display: inline-block; }
details.confirm > summary {
  list-style: none;
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--btn-border);
  border-radius: 3px;
  background: var(--btn-bg);
  color: var(--fg);
  display: inline-block;
}
details.confirm > summary::-webkit-details-marker { display: none; }
details.confirm > summary::marker { content: ""; }
details.confirm > summary:hover { background: var(--btn-bg-hover); }
details.confirm[open] > summary { background: var(--stop-bg); border-color: var(--stop-border); }

details.confirm[open]::before {
  content: "";
  position: fixed;
  inset: 0;
  background: var(--backdrop);
  z-index: 900;
}

.confirm-pop {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 1000;
  width: min(360px, 92vw);
  padding: 1.2rem 1.4rem;
  border: 1px solid var(--card-border);
  border-radius: 3px;
  background: var(--card-bg);
  color: var(--fg);
  white-space: normal;
  box-shadow: 0 8px 30px var(--shadow);
  font-size: 0.85rem;
  line-height: 1.55;
  text-align: left;
}
.confirm-pop button { margin-top: 12px; margin-right: 6px; }
.confirm-pop button:not(.cancel) { border-color: var(--stop-border); background: var(--danger-btn-bg); }
.confirm-pop button:not(.cancel):hover { background: var(--danger-btn-bg-hover); }

.row-actions details.confirm > summary { padding: 1px 6px; font-size: 0.72rem; }

/* ---- POC reset banner ---- */
.reset-banner {
  position: sticky;
  top: 52px;
  z-index: 18;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 16px;
  border-bottom: 1px solid var(--error-border);
  background: var(--error-bg);
  color: var(--error-fg);
  text-align: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.reset-label {
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
}
.reset-countdown {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(1.5rem, 6vw, 2.5rem);
  font-weight: 700;
  line-height: 1;
  padding: 2px 10px;
  border: 1px solid currentColor;
  border-radius: 3px;
  background: var(--bg);
}
.reset-note {
  flex-basis: 100%;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.04em;
}
.reset-imminent .reset-banner {
  outline: 2px solid var(--error-border);
  outline-offset: -2px;
}

.about-card {
  max-width: 760px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--field-bg);
  padding: 1.2rem 1.4rem;
  line-height: 1.75;
}
.about-card p { margin-bottom: 0.6rem; }

.poc-warning {
  border: 1px solid var(--error-border);
  border-radius: 3px;
  background: var(--error-bg);
  color: var(--error-fg);
  padding: 8px 10px;
  margin-top: 0.8rem;
}

/* ---- Theme toggle ---- */
.theme-toggle {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--toggle-border);
  cursor: pointer;
  padding: 0;
  z-index: 30;
  transition: all 0.3s ease;
  box-shadow: var(--toggle-shadow);
  background: var(--toggle-bg);
}
.theme-toggle:hover { transform: scale(1.08); }

@media (max-width: 640px) {
  header { padding: 0.7rem 0.9rem; gap: 0.6rem; }
  .back-link { font-size: 0.58rem; padding: 0.25rem 0.4rem; letter-spacing: 0.08em; }
  .brand { font-size: 0.9rem; }
  nav a { font-size: 0.62rem; margin-right: 0.6rem; letter-spacing: 0.08em; }
  footer { font-size: 0.62rem; padding: 0.7rem 0.9rem; }
  main { padding: 12px; }
  .theme-toggle { width: 20px; height: 20px; bottom: 1rem; right: 0.9rem; }
  .reset-banner { top: 44px; }
  .running-bar { top: 44px; }
}
