/* ============================================================
 * Securedashboard v1.1.1 – Design-System
 * Dunkler Petrol/Tuerkis-Look, Glassmorphism mit Licht-Orbs und
 * feinen hellen Punkten, einheitliches Button-System, Sidebar.
 * Ausgeliefert ueber die Route ?p=css (Front-Controller).
 * ============================================================ */

:root {
  --bg1: #0a2e38;
  --bg2: #11505a;
  --bg3: #0d3542;
  --glass: rgba(255, 255, 255, .07);
  --glass-2: rgba(255, 255, 255, .11);
  --line: rgba(255, 255, 255, .15);
  --line-soft: rgba(255, 255, 255, .09);
  --txt: #e8f4f4;
  --mut: rgba(222, 242, 242, .55);
  --teal: #2fbfa4;
  --teal-hi: #3fd6b9;
  --crit: #f87171;
  --high: #fb923c;
  --med:  #facc15;
  --info: #c4b5fd;
  --ok:   #4ade80;
  --r: 14px;
  --card-shadow: 0 8px 30px rgba(0, 10, 15, .25),
                 inset 0 1px 0 rgba(255, 255, 255, .10);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--txt);
  background:
    /* feine helle Punkte (zwei versetzte Raster) */
    radial-gradient(rgba(255, 255, 255, .07) 1px, transparent 1.4px),
    radial-gradient(rgba(160, 240, 220, .05) 1px, transparent 1.4px),
    /* weiche Licht-Glows */
    radial-gradient(1000px 640px at 12% -10%, rgba(63, 214, 185, .20), transparent 60%),
    radial-gradient(850px 620px at 106% 12%, rgba(56, 189, 248, .13), transparent 55%),
    radial-gradient(760px 540px at 46% 118%, rgba(45, 191, 164, .15), transparent 60%),
    radial-gradient(520px 380px at 78% 68%, rgba(140, 220, 255, .07), transparent 65%),
    linear-gradient(150deg, var(--bg1), var(--bg2) 55%, var(--bg3));
  background-size: 46px 46px, 34px 34px, auto, auto, auto, auto, auto;
  background-position: 0 0, 17px 23px, 0 0, 0 0, 0 0, 0 0, 0 0;
  background-attachment: fixed;
}

/* Schwebende Licht-Orbs (Bokeh) */
body::before, body::after {
  content: "";
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(70px);
}
body::before {
  width: 430px; height: 430px;
  left: -120px; top: 16%;
  background: radial-gradient(circle, rgba(63, 214, 185, .22), transparent 70%);
}
body::after {
  width: 380px; height: 380px;
  right: -110px; bottom: -80px;
  background: radial-gradient(circle, rgba(96, 200, 255, .16), transparent 70%);
}
body.login::before { left: 8%; top: 12%; }
body.login::after  { right: 10%; bottom: 8%; }

.topbar, .shell { position: relative; z-index: 1; }

a { color: var(--teal-hi); }

/* ---------- App-Geruest: Topbar + Sidebar + Inhalt ---------- */

.topbar {
  display: flex; align-items: center; gap: .8rem;
  padding: .75rem 1.4rem;
  background: rgba(9, 38, 48, .6);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line-soft);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
  position: sticky; top: 0; z-index: 30;
}
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 700; font-size: 1.02rem; letter-spacing: .2px; }
.brand svg { width: 21px; height: 21px; color: var(--teal-hi); filter: drop-shadow(0 0 6px rgba(63, 214, 185, .55)); }
.brand .ver {
  color: var(--mut); font-weight: 500; font-size: .72rem;
  border: 1px solid var(--line-soft); border-radius: 999px;
  padding: .1rem .55rem; margin-left: .25rem;
  background: rgba(255, 255, 255, .05);
}
.topbar .who { margin-left: auto; color: var(--mut); font-size: .85rem; }

.shell { display: flex; gap: 1.3rem; max-width: 1440px; margin: 1.3rem auto; padding: 0 1.3rem; align-items: flex-start; }

.side {
  flex: 0 0 208px; position: sticky; top: 4.4rem;
  max-height: calc(100vh - 5.6rem); overflow-y: auto;
  background: linear-gradient(165deg, rgba(21, 62, 74, .82), rgba(13, 45, 58, .82));
  border: 1px solid var(--line); border-radius: var(--r);
  padding: .65rem; display: flex; flex-direction: column; gap: .18rem;
  box-shadow: var(--card-shadow);
}
.side a.out { border-top: 1px solid var(--line-soft); border-radius: 0 0 10px 10px; margin-top: .3rem; padding-top: .7rem; color: var(--mut); }
.side a.out:hover { color: var(--txt); }
.side a {
  display: flex; align-items: center; gap: .65rem;
  padding: .58rem .75rem; border-radius: 10px;
  color: var(--txt); text-decoration: none; font-size: .9rem;
  border: 1px solid transparent;
  transition: background .15s ease, border-color .15s ease;
}
.side a svg { width: 17px; height: 17px; opacity: .72; flex: none; transition: opacity .15s ease; }
.side a:hover { background: rgba(255, 255, 255, .07); }
.side a:hover svg { opacity: 1; }
.side a.on {
  background: linear-gradient(160deg, rgba(63, 214, 185, .16), rgba(255, 255, 255, .07));
  border-color: rgba(63, 214, 185, .35); font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .10);
}
.side a.on svg { color: var(--teal-hi); opacity: 1; filter: drop-shadow(0 0 5px rgba(63, 214, 185, .5)); }
.side .gap { flex: 1; min-height: .9rem; }
.side .usr {
  padding: .55rem .75rem .25rem; color: var(--mut); font-size: .76rem;
  border-top: 1px solid var(--line-soft); margin-top: .35rem;
}

main { flex: 1; min-width: 0; margin: 0; padding: 0; }
main > h2:first-child { margin-top: .2rem; }

h2 {
  font-size: .82rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 1.1px;
  color: rgba(232, 244, 244, .82);
  margin: 1.6rem 0 .65rem;
}
h2 .muted { text-transform: none; letter-spacing: normal; font-weight: 400; }

/* ---------- Glas-Karten & KPI-Kacheln ---------- */

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: .9rem; margin-bottom: 1.3rem; }

.card {
  background: var(--glass);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--line); border-radius: var(--r);
  padding: 1rem 1.2rem; text-decoration: none; color: inherit;
  box-shadow: var(--card-shadow);
}
.card > h2:first-child, .card > form > h2:first-child { margin-top: 0; }
.muted.sub { display: block; margin: -.1rem 0 .7rem; }

.kpi { display: flex; align-items: center; gap: .9rem; transition: transform .14s ease, background .14s ease, border-color .14s ease; }
.kpi:hover { transform: translateY(-2px); background: var(--glass-2); border-color: rgba(255, 255, 255, .24); }
.kpi b { font-size: 1.75rem; display: block; line-height: 1.25; text-shadow: 0 0 18px currentColor; }
.kpi .lbl { display: block; }
.kpi .lbl span { display: block; font-size: .84rem; color: var(--mut); }
.kpi-ic {
  flex: none; width: 42px; height: 42px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.05rem; background: rgba(255, 255, 255, .06);
  border: 2px solid currentColor;
  box-shadow: 0 0 14px -2px currentColor, inset 0 0 10px -4px currentColor;
}
.kpi.sev-critical .kpi-ic, .kpi.sev-critical b { color: var(--crit); }
.kpi.sev-high     .kpi-ic, .kpi.sev-high b     { color: var(--high); }
.kpi.sev-medium   .kpi-ic, .kpi.sev-medium b   { color: var(--med); }
.kpi.sev-info     .kpi-ic, .kpi.sev-info b     { color: var(--info); }

/* ---------- Tabellen ---------- */

table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  background: var(--glass);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--line); border-radius: var(--r);
  overflow: hidden; box-shadow: var(--card-shadow);
  margin-bottom: 1.2rem;
}
.card table { background: rgba(5, 26, 34, .35); box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
th, td { padding: .52rem .78rem; text-align: left; font-size: .87rem; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
th {
  background: rgba(255, 255, 255, .055);
  font-weight: 600; font-size: .7rem;
  text-transform: uppercase; letter-spacing: .7px;
  color: rgba(222, 242, 242, .68);
  white-space: nowrap;
}
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(255, 255, 255, .035); }
td a { color: var(--txt); }
td a:hover { color: var(--teal-hi); }
td.nowrap { white-space: nowrap; }
.acked { opacity: .5; }

.th-sort { color: inherit; text-decoration: none; }
.th-sort:hover { color: var(--txt); }
.th-sort.on { color: var(--txt); }
.th-sort .arr { color: var(--teal-hi); font-size: .6rem; margin-left: .25rem; vertical-align: 1px; }

.msglink { color: inherit; text-decoration: none; border-bottom: 1px dotted rgba(222, 242, 242, .35); }
.msglink:hover { border-bottom-color: var(--teal-hi); }

/* ---------- Severity-Pills & Status ---------- */

.pill {
  display: inline-block; border-radius: 999px; padding: .14rem .64rem;
  font-size: .74rem; font-weight: 600; letter-spacing: .3px; white-space: nowrap;
  border: 1px solid transparent;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
}
.pill.sev-critical { color: #fecaca; background: rgba(220, 38, 38, .24); border-color: rgba(248, 113, 113, .5); }
.pill.sev-high     { color: #fed7aa; background: rgba(234, 88, 12, .22); border-color: rgba(251, 146, 60, .5); }
.pill.sev-medium   { color: #fef08a; background: rgba(202, 138, 4, .22);  border-color: rgba(250, 204, 21, .45); }
.pill.sev-info     { color: #ddd6fe; background: rgba(139, 92, 246, .20); border-color: rgba(196, 181, 253, .45); }
.sev { font-weight: 600; white-space: nowrap; }
.st-open { color: var(--high); font-weight: 600; white-space: nowrap; }
.st-ack { color: var(--ok); white-space: nowrap; }

/* ---------- Formulare ---------- */

input, select, textarea {
  font: inherit; color: var(--txt);
  background: rgba(8, 34, 44, .55);
  border: 1px solid var(--line); border-radius: 9px;
  padding: .42rem .6rem;
}
input::placeholder { color: rgba(222, 242, 242, .4); }
input:focus, select:focus { outline: 2px solid rgba(63, 214, 185, .45); outline-offset: 0; border-color: var(--teal); }
select option { background: #0d3542; color: var(--txt); }
input[type="checkbox"] {
  accent-color: var(--teal);
  width: 15px; height: 15px; padding: 0;
  vertical-align: -2px;
}
input[type="checkbox"]:disabled { opacity: .35; }

fieldset {
  border: 1px solid var(--line-soft); border-radius: 11px;
  margin: .9rem 0 0; padding: .5rem .9rem .9rem;
  background: rgba(255, 255, 255, .025);
}
legend { color: var(--mut); font-size: .76rem; text-transform: uppercase; letter-spacing: .8px; padding: 0 .45rem; }

.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1.2rem 0 .7rem; align-items: stretch; }
.filters select, .filters input { font-size: .87rem; }
.filters select, .filters input, .filters button, .filters .btn { height: 2.3rem; padding-top: 0; padding-bottom: 0; }

.card label { display: block; font-size: .85rem; margin: .6rem 0 .2rem; color: var(--mut); }
.card input, .card select, .card textarea { width: 100%; max-width: 560px; }
.card input[type="checkbox"] { width: 15px; }

details { margin-top: .6rem; }
summary { cursor: pointer; color: var(--teal-hi); font-size: .88rem; padding: .2rem 0; }
summary:hover { color: var(--txt); }
details[open] > summary { margin-bottom: .4rem; }

/* ---------- Button-System ---------- */

button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  padding: .45rem .95rem;
  border: 1px solid rgba(63, 214, 185, .4); border-radius: 10px;
  background: linear-gradient(160deg, rgba(47, 191, 164, .92), rgba(32, 152, 130, .92));
  color: #04231f; font-weight: 600; font-size: .87rem; line-height: 1.25;
  cursor: pointer; text-decoration: none;
  box-shadow: 0 3px 12px rgba(20, 120, 100, .35), inset 0 1px 0 rgba(255, 255, 255, .28);
  transition: filter .12s ease, transform .12s ease;
}
button:hover, .btn:hover { filter: brightness(1.1); }
button:active, .btn:active { transform: translateY(1px); }
button:disabled, .btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }

.btn.lg, button.lg { padding: .55rem 1.3rem; font-size: .92rem; }
.btn.sm, button.sm, td .btn, td button { padding: .26rem .66rem; font-size: .78rem; border-radius: 8px; }

.btn.ghost, button.ghost {
  background: rgba(255, 255, 255, .06);
  border-color: var(--line); color: var(--txt); font-weight: 500;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07);
}
.btn.ghost:hover, button.ghost:hover { background: rgba(255, 255, 255, .11); border-color: rgba(255, 255, 255, .3); filter: none; }
.btn.idle { opacity: .4; pointer-events: none; }

.btn.red, button.red {
  background: linear-gradient(160deg, rgba(239, 68, 68, .88), rgba(185, 40, 40, .92));
  border-color: rgba(248, 113, 113, .45); color: #2a0707;
  box-shadow: 0 3px 12px rgba(150, 40, 40, .35), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.btn.amber, button.amber, .ackbtn.amber {
  background: linear-gradient(160deg, rgba(245, 158, 11, .92), rgba(198, 118, 8, .92));
  border-color: rgba(251, 191, 36, .45); color: #2a1602;
  box-shadow: 0 3px 12px rgba(160, 100, 20, .35), inset 0 1px 0 rgba(255, 255, 255, .3);
}
.btn.green { }
.ackbtn { }
form.inline { display: inline-block; margin-right: .25rem; }

/* ---------- Pager (Button-Pills) ---------- */

.pager { margin: 1rem 0; font-size: .85rem; color: var(--mut); display: flex; flex-wrap: wrap; gap: .32rem; align-items: center; }
.pgr {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 2rem; padding: .28rem .55rem;
  border: 1px solid var(--line); border-radius: 9px;
  background: rgba(255, 255, 255, .05);
  color: var(--txt); text-decoration: none; font-size: .82rem;
  transition: background .12s ease, border-color .12s ease;
}
a.pgr:hover { background: rgba(255, 255, 255, .11); border-color: rgba(255, 255, 255, .3); }
.pgr.on {
  background: linear-gradient(160deg, rgba(47, 191, 164, .92), rgba(32, 152, 130, .92));
  border-color: rgba(63, 214, 185, .4); color: #04231f; font-weight: 700;
  box-shadow: 0 3px 10px rgba(20, 120, 100, .35), inset 0 1px 0 rgba(255, 255, 255, .28);
}
.pgr-sep { margin-left: .9rem; }

/* ---------- Banner, Chips, Diverses ---------- */

.banner {
  padding: .65rem 1rem; border-radius: 11px; margin-bottom: 1rem; font-size: .9rem;
  border: 1px solid var(--line); background: var(--glass);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07);
}
.banner.ok   { border-color: rgba(74, 222, 128, .45); color: #bbf7d0; background: rgba(22, 101, 52, .25); }
.banner.warn { border-color: rgba(251, 146, 60, .45); color: #fed7aa; background: rgba(154, 52, 18, .22); }
.banner.err  { border-color: rgba(248, 113, 113, .5); color: #fecaca; background: rgba(153, 27, 27, .25); }
.done { border: 1px solid rgba(74, 222, 128, .45); color: #bbf7d0; background: rgba(22, 101, 52, .25); padding: .6rem 1rem; border-radius: 11px; margin-bottom: 1rem; }
.hint { border: 1px solid rgba(250, 204, 21, .4); color: #fef08a; background: rgba(133, 100, 4, .2); border-radius: 11px; padding: .6rem .9rem; font-size: .88rem; }

.chip {
  display: inline-flex; align-items: center; gap: .5rem;
  background: var(--glass-2); border: 1px solid var(--line); border-radius: 999px;
  padding: .3rem .85rem; font-size: .85rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
}
.chip a { color: var(--mut); text-decoration: none; font-weight: 700; }
.chip a:hover { color: var(--txt); }

.muted { color: var(--mut); font-size: .8rem; }
.ok   { color: var(--ok);  font-weight: 600; }
.bad  { color: var(--crit); font-weight: 600; }
.warnc { color: var(--high); font-weight: 600; }
.filled td { background: rgba(47, 191, 164, .10); }

dl { display: grid; grid-template-columns: 175px 1fr; gap: .34rem .8rem; margin: 0; font-size: .9rem; }
dt { color: var(--mut); }
dd { margin: 0; word-break: break-word; }

pre {
  background: rgba(5, 25, 33, .6); border: 1px solid var(--line); border-radius: 11px;
  padding: .8rem 1rem; font-size: .82rem; white-space: pre-wrap; word-break: break-word;
  max-height: 520px; overflow: auto; margin: .6rem 0 0; color: #d6ecec;
}

/* ---------- Login ---------- */

body.login { display: flex; min-height: 100vh; align-items: center; justify-content: center; }
.login-card {
  position: relative; z-index: 1;
  background: var(--glass); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 18px 60px rgba(0, 10, 15, .45), inset 0 1px 0 rgba(255, 255, 255, .12);
  padding: 2.1rem 2.4rem; width: 330px;
}
.login-card h1 { font-size: 1.15rem; margin: 0 0 1.2rem; display: flex; align-items: center; gap: .55rem; }
.login-card h1 svg { width: 22px; height: 22px; color: var(--teal-hi); filter: drop-shadow(0 0 7px rgba(63, 214, 185, .6)); }
.login-card input { width: 100%; margin: .3rem 0 .9rem; font-size: .95rem; }
.login-card button { width: 100%; padding: .6rem; font-size: .95rem; }
.login-card .err { border: 1px solid rgba(248, 113, 113, .5); color: #fecaca; background: rgba(153, 27, 27, .3); padding: .5rem .8rem; border-radius: 9px; font-size: .88rem; margin-bottom: 1rem; }
.login-card label { font-size: .85rem; color: var(--mut); }

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .side { position: static; flex: none; width: 100%; flex-direction: row; flex-wrap: wrap; }
  .side .gap, .side .usr { display: none; }
  dl { grid-template-columns: 130px 1fr; }
}

label.cb { font-size: .88rem; display: inline-flex; align-items: center; gap: .4rem; color: var(--txt); }

/* Aktionsleisten (Quittierung): Notiz + Button auf gleicher Hoehe */
.actrow { display: flex; flex-wrap: wrap; gap: .5rem; align-items: stretch; margin: .7rem 0; }
.actrow input { width: 280px; height: 2.3rem; padding-top: 0; padding-bottom: 0; }
.actrow button, .actrow .btn { height: 2.3rem; padding-top: 0; padding-bottom: 0; }

.filters label.cb { align-self: center; }
.card details { margin-top: .8rem; }
th input[type="checkbox"], td input[type="checkbox"] { vertical-align: middle; }

/* ---------------------------------------------------- v2.x Sammel-Kacheln */
/* v2.1: zweispaltig; nur high/critical-Sites-Tabelle und Ereignisliste
   bleiben volle Breite. Auf schmalen Screens eine Spalte. */
.bundles { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem;
           align-items: start; margin-bottom: 1.2rem; }
@media (max-width: 900px) { .bundles { grid-template-columns: 1fr; } }
.bundle details.sub { margin: .35rem 0 .35rem .2rem; padding: .3rem .5rem;
                      border-left: 2px solid rgba(128,128,128,.25); }
.bundle details.sub summary { font-size: .95em; }
.bundle details.sub[open] { padding-bottom: .5rem; }
.bundle summary { cursor: pointer; list-style-position: inside; line-height: 1.5; }
.bundle summary:hover { color: var(--accent, #14b8a6); }
.bundle[open] summary { margin-bottom: .6rem; }
.bundle.sev-high { border-left: 3px solid #ea580c; }
.bundle-list { columns: 3 220px; column-gap: 1.5rem; margin: .2rem 0 .8rem; padding-left: 1.2rem; }
.bundle-list li { break-inside: avoid; margin-bottom: .15rem; }
.bundle form { margin-top: .3rem; }
label.inline { display: inline-flex; align-items: center; gap: .35rem; margin: 0; }

/* ------------------------------------------ v2.2 Einstellungs-Unterseiten */
.subtabs { display: flex; flex-wrap: wrap; gap: .3rem; margin: 0 0 1.1rem; }
.subtabs a { padding: .45rem .9rem; border-radius: .5rem; text-decoration: none;
             border: 1px solid rgba(128,128,128,.25); }
.subtabs a.active { font-weight: 600; border-color: currentColor; }
label.remember { display: flex; align-items: center; gap: .4rem;
                 font-size: .9em; margin: .3rem 0 .7rem; }
