:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1e222b;
  --line: #2a2f3a;
  --text: #e6e9ef;
  --text-muted: #9aa4b2;
  --accent: #4ea1ff;
  --critical: #ff5f56;
  --medium: #f0b429;
  --long: #38b26c;
  --radius: 10px;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f7f9; --panel: #ffffff; --panel-2: #f0f2f5; --line: #dde1e7;
    --text: #14171c; --text-muted: #5b6472;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.55 ui-sans-serif, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--panel); border-right: 1px solid var(--line);
  padding: 18px 12px; display: flex; flex-direction: column; gap: 4px;
}
.brand { font-weight: 700; font-size: 17px; padding: 6px 10px 16px; letter-spacing: .2px; }
.sidebar a {
  display: block; padding: 8px 10px; border-radius: 8px; color: var(--text);
  font-size: 14px;
}
.sidebar a:hover { background: var(--panel-2); text-decoration: none; }
.sidebar a.active { background: var(--panel-2); color: var(--accent); font-weight: 600; }
.sidebar .spacer { flex: 1; }
.who { font-size: 12px; color: var(--text-muted); padding: 8px 10px; }

main { padding: 24px 28px 60px; max-width: 1200px; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 22px 0 10px; }
.sub { color: var(--text-muted); font-size: 13px; margin: 0 0 18px; }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 12px;
}
.grid { display: grid; gap: 14px; }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .cols-3, .cols-2 { grid-template-columns: 1fr; }
}

.pill {
  display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--text-muted);
}
.pill.critical { color: var(--critical); border-color: var(--critical); }
.pill.medium   { color: var(--medium);   border-color: var(--medium); }
.pill.long     { color: var(--long);     border-color: var(--long); }
.pill.overdue  { color: #fff; background: var(--critical); border-color: var(--critical); }

.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.muted { color: var(--text-muted); font-size: 13px; }

input, select, textarea, button {
  font: inherit; color: var(--text); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px;
}
textarea { width: 100%; min-height: 70px; resize: vertical; }
input[type=checkbox] { width: auto; }
button { cursor: pointer; }
button.primary { background: var(--accent); color: #06121f; border-color: var(--accent); font-weight: 600; }
button.ghost { background: transparent; color: var(--text-muted); }
button.danger { background: transparent; color: var(--critical); border-color: transparent; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.form-grid .wide { grid-column: 1 / -1; }
form.inline { display: inline; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--text-muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }

.task { border-bottom: 1px solid var(--line); padding: 9px 0; }
.task:last-child { border-bottom: 0; }
.task .title { font-weight: 500; }
.task .meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.prio { width: 4px; align-self: stretch; border-radius: 2px; background: var(--line); }

.cal { width: 100%; border-collapse: collapse; table-layout: fixed; }
.cal th { text-align: center; font-size: 11px; }
.cal td {
  vertical-align: top; height: 96px; border: 1px solid var(--line); padding: 4px;
  font-size: 12px;
}
.cal td.other { opacity: .35; }
.cal td.today { outline: 2px solid var(--accent); outline-offset: -2px; }
.cal .daynum { color: var(--text-muted); font-size: 11px; }
.cal .ev { display: block; margin-top: 3px; padding: 1px 4px; border-radius: 4px;
  background: var(--panel-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal .ev.crit { background: var(--critical); color: #fff; }

details.adder > summary { cursor: pointer; color: var(--accent); font-size: 14px; margin-bottom: 10px; }
mark { background: #f0b42933; color: inherit; }

#map { height: calc(100vh - 130px); min-height: 420px; border-radius: var(--radius); }
.layer-tree { font-size: 13px; }
.layer-tree label { display: block; padding: 3px 0; cursor: pointer; }
.layer-tree .group { color: var(--text-muted); font-size: 11px; text-transform: uppercase;
  margin-top: 10px; }
.error { background: #ff5f5622; border: 1px solid var(--critical); color: var(--critical);
  padding: 9px 12px; border-radius: 8px; font-size: 14px; margin-bottom: 12px; }

.login-wrap { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login-card { width: 100%; max-width: 340px; }
.login-card input { width: 100%; margin-bottom: 10px; }
.login-card button { width: 100%; }
