/* Project-Dash – dunkles Widget-Design */
:root {
  --bg: #08080b;
  --surface: #15151b;
  --surface-2: #1d1d25;
  --surface-3: #262630;
  --border: #23232c;
  --border-strong: #32323e;
  --text: #f2f2f5;
  --text-2: #a9a9b6;
  --muted: #74747f;
  --accent: #8b7cf6;
  --accent-strong: #a597ff;
  --accent-soft: rgb(139 124 246 / 16%);
  --accent-text: #0b0b10;
  --good: #22b14c;
  --warn: #fab219;
  --critical: #e5484d;
  --radius: 22px;
  --radius-sm: 14px;

  /* Gruppenfarben – geprüft auf der dunklen Fläche (OKLCH-Band, Farbsehschwäche) */
  --g-in_arbeit: #9085e9;
  --g-in_verwendung: #199e70;
  --g-pausiert: #c98500;
  --g-eingeschlafen: #5c5c68;
  --g-fertig: #3987e5;
  --g-abgebrochen: #e66767;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 1;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.2; font-weight: 600; }
button, input, select, textarea { font: inherit; color: inherit; }
.boot { padding: 48px; text-align: center; color: var(--muted); }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Kopfzeile ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  padding: 14px max(16px, calc((100vw - 1320px) / 2));
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.brand img { width: 30px; height: 30px; }
.pills { display: flex; gap: 4px; padding: 4px; border-radius: 99px; background: var(--surface); border: 1px solid var(--border); }
.pills a { padding: 7px 16px; border-radius: 99px; color: var(--text-2); font-size: 14px; font-weight: 500; }
.pills a:hover { color: var(--text); }
.pills a.active { background: var(--text); color: var(--bg); }
.top-actions { display: flex; justify-content: flex-end; gap: 8px; }
.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface); cursor: pointer; color: var(--text-2);
}
.icon-btn:hover { color: var(--text); background: var(--surface-2); }
.icon-btn svg { width: 18px; height: 18px; }

main { max-width: 1320px; margin: 0 auto; padding: 18px 16px 72px; }

/* ---------- Buttons & Formulare ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 99px; border: 1px solid var(--border-strong);
  background: transparent; cursor: pointer; font-weight: 500; font-size: 14px; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--text); border-color: var(--text); color: var(--bg); }
.btn.primary:hover { background: #fff; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.danger { color: var(--critical); border-color: color-mix(in srgb, var(--critical) 40%, transparent); }
.btn.ghost { border-color: transparent; }
.btn.small { padding: 5px 11px; font-size: 13px; }
.btn:disabled { opacity: .6; cursor: progress; }
input[type=text], input[type=password], input[type=date], input[type=search], select, textarea {
  width: 100%; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--border-strong);
  background: var(--surface-2); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { min-height: 96px; resize: vertical; }
label.field { display: grid; gap: 6px; font-size: 12px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
label.field > :is(input, select, textarea) { text-transform: none; letter-spacing: 0; font-size: 15px; color: var(--text); }

/* ---------- Begrüßung ---------- */
.hello { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin: 10px 0 22px; }
.hello h1 { font-size: clamp(30px, 4.4vw, 46px); font-weight: 400; letter-spacing: -.025em; }
.hello h1 span { color: var(--muted); }
.hello .summary { color: var(--text-2); font-size: 15px; max-width: 560px; }
.hello .summary b { color: var(--text); font-weight: 600; }

/* ---------- Widgets ---------- */
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; }
.w { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; min-width: 0; }
.w-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.w-head h2 { font-size: 15px; font-weight: 500; display: flex; align-items: center; gap: 9px; }
.w-head h2 svg { width: 18px; height: 18px; color: var(--text-2); }
.w-head .spacer { flex: 1; }
.w-head .link { color: var(--muted); font-size: 13px; }
.w-head .link:hover { color: var(--text); }
.span-3 { grid-column: span 3; } .span-4 { grid-column: span 4; } .span-5 { grid-column: span 5; }
.span-7 { grid-column: span 7; } .span-8 { grid-column: span 8; } .span-12 { grid-column: span 12; }

/* Kennzahlen */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.kpi { display: grid; align-content: start; gap: 10px; padding: 18px 20px; text-align: left; cursor: pointer; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.kpi:hover { border-color: var(--border-strong); }
.kpi .label { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; }
.kpi .label i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.kpi b { font-size: 34px; font-weight: 500; letter-spacing: -.03em; line-height: 1; }
.kpi b small { font-size: 18px; color: var(--muted); font-weight: 400; }
.kpi .sub { font-size: 12px; color: var(--muted); }

/* Aktivitäts-Diagramm */
.hero-num { display: flex; align-items: baseline; gap: 10px; margin: -4px 0 12px; }
.hero-num b { font-size: 30px; font-weight: 500; letter-spacing: -.03em; }
.delta { font-size: 13px; color: var(--text-2); }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .axis-label { fill: var(--muted); font-size: 11px; }
.chart .bar { fill: var(--surface-3); transition: fill .15s; }
.chart .bar.on { fill: var(--accent); }
.chart .bar.now { fill: var(--accent-strong); }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + .bar, .chart .bar.hover { fill: var(--accent-strong); }
.tooltip {
  position: absolute; pointer-events: none; z-index: 5; transform: translate(-50%, calc(-100% - 10px));
  background: var(--surface-3); border: 1px solid var(--border-strong); border-radius: 10px;
  padding: 7px 10px; font-size: 12px; white-space: nowrap; opacity: 0; transition: opacity .1s;
}
.tooltip.show { opacity: 1; }
.tooltip b { display: block; font-size: 13px; }

/* Listen in Widgets */
.list { list-style: none; margin: 0; padding: 0; display: grid; }
.list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); min-width: 0; }
.list li:first-child { border-top: none; padding-top: 2px; }
.list .ico { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); }
.list .ico svg { width: 15px; height: 15px; }
.list .ico.critical { color: var(--critical); background: color-mix(in srgb, var(--critical) 14%, transparent); }
.list .ico.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); }
.list .ico.info { color: var(--text-2); }
.list .body { flex: 1; min-width: 0; }
.list .title { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.list .sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.list .end { font-size: 12px; color: var(--muted); white-space: nowrap; }
.list a.body:hover .title { text-decoration: underline; text-underline-offset: 3px; }
.all-good { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 14px; padding: 6px 0; }
.all-good svg { width: 18px; height: 18px; color: var(--good); }

/* Websites-Widget */
.uptime-head { display: flex; align-items: baseline; gap: 8px; margin: -4px 0 14px; }
.uptime-head b { font-size: 30px; font-weight: 500; letter-spacing: -.03em; }
.site-dots { display: flex; flex-wrap: wrap; gap: 6px; }
.site-dot { width: 22px; height: 22px; border-radius: 7px; background: color-mix(in srgb, var(--good) 75%, var(--surface)); }
.site-dot.down { background: var(--critical); }
.site-dot.unknown { background: var(--surface-3); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; flex: none; }
.dot.up { background: var(--good); }
.dot.down { background: var(--critical); }

/* ---------- Board (Drag & Drop) ---------- */
.board-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.board-head h2 { font-size: 15px; font-weight: 500; }
.board-head .hint { color: var(--muted); font-size: 13px; }
.board-head .spacer { flex: 1; }
.board-head input[type=search] { width: 220px; padding: 8px 14px; border-radius: 99px; background: var(--surface-2); }
.board-head select { width: auto; padding: 8px 12px; border-radius: 99px; }
.board { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.col { display: flex; flex-direction: column; min-width: 0; border-radius: 16px; background: var(--surface-2); border: 1px solid transparent; transition: border-color .12s, background .12s; }
.col-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 8px; font-size: 13px; font-weight: 500; }
.col-head i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; }
.col-head .count { color: var(--muted); font-weight: 400; margin-left: auto; }
.col-body { display: grid; gap: 6px; padding: 0 6px 8px; max-height: 460px; overflow-y: auto; align-content: start; min-height: 64px; scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
.col.drop-ok { border-color: var(--c); background: color-mix(in srgb, var(--c) 10%, var(--surface-2)); }
.col.drop-no { opacity: .45; }
.col-empty { padding: 14px 8px; text-align: center; font-size: 12px; color: var(--muted); }
.card {
  position: relative; display: grid; gap: 5px; padding: 10px 11px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border); cursor: grab; user-select: none;
}
.card:hover { border-color: var(--border-strong); }
.card.dragging { opacity: .35; }
.card .name { font-size: 13px; font-weight: 500; line-height: 1.3; padding-right: 22px; overflow-wrap: anywhere; }
.card .meta { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); min-width: 0; }
.card .meta .cat { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .meta .when { margin-left: auto; white-space: nowrap; }
.card .note { font-size: 11px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .note.warn { color: var(--warn); }
.card .more { position: absolute; top: 6px; right: 5px; width: 24px; height: 24px; border-radius: 8px; border: none; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.card .more:hover { background: var(--surface-2); color: var(--text); }
.card .more svg { width: 15px; height: 15px; }
.trash {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, calc(100% + 40px)); z-index: 30;
  display: flex; align-items: center; gap: 10px; padding: 14px 24px; border-radius: 99px;
  background: var(--surface-3); border: 1px dashed var(--border-strong); color: var(--text-2);
  transition: transform .18s, background .12s, border-color .12s; font-size: 14px;
}
.trash svg { width: 18px; height: 18px; }
.trash.show { transform: translate(-50%, 0); }
.trash.over { background: color-mix(in srgb, var(--critical) 22%, var(--surface-3)); border-color: var(--critical); color: var(--text); }
.hidden-link { margin-top: 12px; font-size: 13px; color: var(--muted); }
.hidden-link button { background: none; border: none; color: var(--text-2); cursor: pointer; padding: 0; text-decoration: underline; text-underline-offset: 3px; }

/* Kontextmenü */
.menu {
  position: fixed; z-index: 40; min-width: 210px; padding: 6px; border-radius: 14px;
  background: var(--surface-3); border: 1px solid var(--border-strong); box-shadow: 0 16px 40px rgb(0 0 0 / 45%);
}
.menu button, .menu a { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 9px; border: none; background: none; text-align: left; font-size: 13px; cursor: pointer; }
.menu button:hover, .menu a:hover { background: var(--surface-2); }
.menu button:disabled { opacity: .4; cursor: default; background: none; }
.menu i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.menu hr { border: none; border-top: 1px solid var(--border-strong); margin: 5px 4px; }
.menu .danger { color: var(--critical); }
.menu svg, .back svg { width: 16px; height: 16px; flex: none; }

/* ---------- Tabelle Erreichbarkeit ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 10px 0 18px; }
.page-head h1 { font-size: clamp(26px, 3.4vw, 36px); font-weight: 400; letter-spacing: -.02em; }
.page-head .spacer { flex: 1; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 12px 14px; text-align: left; border-top: 1px solid var(--border); vertical-align: middle; }
thead th { border-top: none; font-size: 12px; color: var(--muted); font-weight: 500; }
tr.down td { background: color-mix(in srgb, var(--critical) 7%, transparent); }
td .err { color: var(--critical); font-size: 13px; }
td a:hover { text-decoration: underline; text-underline-offset: 3px; }
.cert-warn { color: var(--warn); }
.cert-bad { color: var(--critical); }

/* ---------- Detailseite ---------- */
.back { display: inline-flex; align-items: center; gap: 6px; margin: 6px 0 4px; font-size: 14px; color: var(--text-2); }
.back:hover { color: var(--text); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 99px; font-size: 12px; font-weight: 500; background: var(--surface-2); color: var(--text-2); }
.chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.detail { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.detail form.w, .detail .w { display: grid; gap: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.site-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); }
.site-row:first-child { border-top: none; }
.site-row .url { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.inline-form { display: flex; gap: 8px; }
.inline-form input { flex: 1; }
.log { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.log li { display: grid; gap: 2px; padding-left: 14px; border-left: 2px solid var(--border-strong); font-size: 14px; }
.log .when { font-size: 12px; color: var(--muted); }
.row-actions { display: flex; gap: 8px; justify-content: space-between; flex-wrap: wrap; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login form { width: min(380px, 100%); display: grid; gap: 16px; padding: 30px; background: var(--surface); border: 1px solid var(--border); border-radius: 24px; }
.login .brand { justify-content: center; font-size: 19px; }
.login .error { color: var(--critical); font-size: 14px; min-height: 1em; }

/* ---------- Dialog & Toast ---------- */
dialog { border: 1px solid var(--border-strong); border-radius: 22px; padding: 0; background: var(--surface); color: var(--text); width: min(460px, calc(100vw - 32px)); }
dialog::backdrop { background: rgb(0 0 0 / 60%); backdrop-filter: blur(3px); }
dialog form { display: grid; gap: 16px; padding: 24px; }
dialog h2 { font-size: 18px; font-weight: 500; }
dialog .actions { display: flex; justify-content: flex-end; gap: 8px; }
#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 50;
  display: flex; align-items: center; gap: 14px; padding: 10px 12px 10px 18px; border-radius: 99px;
  background: var(--text); color: var(--bg); font-size: 14px; font-weight: 500; transition: .2s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#toast.error { background: var(--critical); color: #fff; }
#toast button { border: none; background: var(--bg); color: var(--text); border-radius: 99px; padding: 5px 12px; cursor: pointer; font-size: 13px; }
#toast:not(:has(button)) { padding-right: 18px; }

/* ---------- Responsiv ---------- */
@media (max-width: 1180px) {
  .board { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .span-3, .span-4, .span-5 { grid-column: span 6; }
  .span-7, .span-8 { grid-column: span 12; }
}
@media (max-width: 900px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .detail { grid-template-columns: 1fr; }
  .top { grid-template-columns: 1fr auto; }
  .top .pills { grid-column: 1 / -1; grid-row: 2; justify-self: center; }
}
@media (max-width: 640px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid > * { grid-column: span 12 !important; }
  .board { grid-template-columns: 1fr; }
  .col-body { max-height: 320px; }
  .grid2 { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
  .board-head input[type=search] { width: 100%; }
  .w { padding: 16px; }
}
