/* zeitkort-web — deliberately plain. Light + dark (follows the browser). */

:root {
  color-scheme: light dark;
  --bg: #fff;
  --fg: #000;
  --muted: #777;
  --border: #999;
  --border-soft: #ccc;
  --dotted: #ccc;
  --field-bg: #fff;
  --field-border: #888;
  --btn-bg: #eee;
  --btn-bg-hover: #ddd;
  --btn-border: #555;
  --header-border: #000;
  --th-bg: #f0f0f0;
  --row-active: #ffd;
  --link: #003;
  --accent-bg: #e3ecff;
  --accent-border: #357;
  --notice-fg: #060; --notice-bg: #efe; --notice-border: #060;
  --error-fg: #a00; --error-bg: #fee; --error-border: #a00;
  --go-bg: #e7f5e7; --go-border: #2a8a2a; --go-bg-hover: #d6eed6;
  --stop-bg: #fbe4e4; --stop-border: #a00; --stop-bg-hover: #f6d2d2;
  --card-bg: #fff; --card-border: #a00;
  --danger-btn-bg: #fee; --danger-btn-bg-hover: #fdd;
  --backdrop: rgba(0, 0, 0, .35);
  --shadow: rgba(0, 0, 0, .4);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1d1f21;
    --fg: #e6e6e6;
    --muted: #9aa0a6;
    --border: #555;
    --border-soft: #3a3d40;
    --dotted: #3a3d40;
    --field-bg: #2a2d30;
    --field-border: #5a5e62;
    --btn-bg: #34383c;
    --btn-bg-hover: #3f4348;
    --btn-border: #6a6e72;
    --header-border: #6a6e72;
    --th-bg: #2a2d30;
    --row-active: #3a3a20;
    --link: #9bbcff;
    --accent-bg: #21344f;
    --accent-border: #5a86c0;
    --notice-fg: #8fe08f; --notice-bg: #142a14; --notice-border: #3f7a3f;
    --error-fg: #ff9b9b; --error-bg: #3a1616; --error-border: #a85050;
    --go-bg: #1f3a1f; --go-border: #4caf4c; --go-bg-hover: #264826;
    --stop-bg: #3a1a1a; --stop-border: #cc5555; --stop-bg-hover: #4a2222;
    --card-bg: #26292c; --card-border: #cc5555;
    --danger-btn-bg: #3a1a1a; --danger-btn-bg-hover: #4a2222;
    --backdrop: rgba(0, 0, 0, .6);
    --shadow: rgba(0, 0, 0, .75);
  }
}

* { box-sizing: border-box; }
html, body { max-width: 100%; overflow-x: hidden; }
body {
  font-family: -apple-system, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.4;
  color: var(--fg);
  background: var(--bg);
  margin: 0;
  padding: 0;
}

/* Long, unbreakable names must never widen the page on mobile. */
main { overflow-wrap: break-word; padding: 16px; max-width: 1040px; margin: 0 auto; }
input, select, textarea { max-width: 100%; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

header {
  border-bottom: 2px solid var(--header-border);
  padding: 8px 16px;
  display: flex;
  align-items: baseline;
  gap: 20px;
}
.brand { font-weight: bold; font-size: 18px; }
nav a { margin-right: 14px; text-decoration: none; color: var(--link); }
nav a:hover { text-decoration: underline; }
footer { padding: 12px 16px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--border-soft); margin-top: 24px; }

h2 { margin: 0 0 12px; }

fieldset { border: 1px solid var(--border); margin: 0 0 14px; padding: 10px 12px; min-width: 0; }
legend { font-weight: bold; padding: 0 4px; }

select, input[type=text], input[type=number], input:not([type]), textarea {
  font: inherit;
  padding: 3px 5px;
  border: 1px solid var(--field-border);
  background: var(--field-bg);
  color: var(--fg);
}
textarea { width: 100%; max-width: 460px; }
label { display: inline-block; }

button {
  font: inherit;
  padding: 3px 10px;
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--fg);
  cursor: pointer;
}
button:hover { background: var(--btn-bg-hover); }

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

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

.task { padding: 4px 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: bold; min-width: 84px; }
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: monospace; font-size: 26px; font-weight: bold; margin: 0; }

/* Sticky bar shown only while a timer runs. */
.running-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  background: var(--go-bg);
  border: 1px solid var(--go-border);
  padding: 8px 12px;
  margin: 0 0 14px;
}
.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: bold;
  padding: 4px 10px;
  border: 1px solid var(--go-border);
  background: var(--go-bg);
  color: var(--fg);
}

table { border-collapse: collapse; width: 100%; }
th, td { border: 1px solid var(--border-soft); padding: 3px 6px; text-align: left; font-size: 13px; vertical-align: top; }
th { background: var(--th-bg); }
tr.active { background: var(--row-active); }
.row-actions { white-space: nowrap; }
.row-actions button { padding: 1px 6px; font-size: 12px; }

.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 — a centered card, always fully on-screen (mobile-safe).
   No native dialog and no JS, so it works in Brave/Chrome/Safari alike. */
details.confirm { display: inline-block; }
details.confirm > summary {
  list-style: none;
  cursor: pointer;
  font: inherit;
  padding: 3px 10px;
  border: 1px solid var(--btn-border);
  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); }

/* Dim the page behind the open confirm card. */
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: 16px 18px;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  color: var(--fg);
  white-space: normal;
  box-shadow: 0 6px 30px var(--shadow);
  font-size: 14px;
  line-height: 1.45;
  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: 12px; }

/* Very visible countdown for the proof-of-concept reset. */
.reset-banner {
  position: sticky;
  top: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 16px;
  border-bottom: 3px solid var(--error-border);
  background: var(--error-bg);
  color: var(--error-fg);
  text-align: center;
}
.reset-label {
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.reset-countdown {
  font-family: monospace;
  font-size: clamp(34px, 8vw, 64px);
  font-weight: 900;
  line-height: 1;
  padding: 2px 10px;
  border: 2px solid currentColor;
  background: var(--bg);
}
.reset-note {
  flex-basis: 100%;
  font-size: 13px;
  font-weight: bold;
}
.reset-imminent .reset-banner {
  outline: 4px solid var(--error-border);
  outline-offset: -4px;
}

.about-card {
  max-width: 760px;
  border: 1px solid var(--border);
  background: var(--field-bg);
  padding: 12px 14px;
}
.poc-warning {
  border: 1px solid var(--error-border);
  background: var(--error-bg);
  color: var(--error-fg);
  padding: 8px 10px;
}
