/* FingHub Panel. One stylesheet, no framework, no inline styles (strict CSP). */

:root {
    --bg: #0d1117;
    --bg-raised: #151b23;
    --bg-sunken: #0a0e14;
    --border: #262d38;
    --border-strong: #3a4553;
    --text: #e6edf3;
    --text-dim: #9aa6b2;
    --text-faint: #6e7a87;
    --accent: #3fb6a8;
    --accent-dim: #2a7d74;
    --ok: #4ec38a;
    --warn: #e2b341;
    --error: #ef6b6b;
    --radius: 8px;
    --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
    --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

@media (prefers-color-scheme: light) {
    :root {
        --bg: #f6f7f9;
        --bg-raised: #ffffff;
        --bg-sunken: #eceef1;
        --border: #dfe3e8;
        --border-strong: #c3cad3;
        --text: #1b2027;
        --text-dim: #5a646f;
        --text-faint: #8a939d;
        --accent: #1f8d80;
        --accent-dim: #166b61;
        --ok: #1f8a54;
        --warn: #96690a;
        --error: #c23b3b;
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font: 15px/1.6 var(--sans);
    color: var(--text);
    background: var(--bg);
    -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .6rem; font-weight: 600; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; margin-top: 0; }
h3 { font-size: .95rem; color: var(--text-dim); text-transform: uppercase;
     letter-spacing: .04em; }
p { margin: 0 0 .8rem; }
code, kbd, pre { font-family: var(--mono); font-size: .86em; }
code { background: var(--bg-sunken); padding: .12em .38em; border-radius: 4px;
       border: 1px solid var(--border); }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.5rem 0; }

/* --- shell --------------------------------------------------------------- */

.shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 220px;
    flex: 0 0 220px;
    background: var(--bg-raised);
    border-right: 1px solid var(--border);
    padding: 1rem .75rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.brand { display: flex; align-items: center; gap: .55rem; padding: .25rem .5rem 0;
         font-weight: 650; letter-spacing: -.01em; }
.brand .dot { width: 10px; height: 10px; border-radius: 50%;
              background: var(--accent); flex: 0 0 10px; }
.brand small { display: block; font-weight: 400; font-size: .72rem;
               color: var(--text-faint); letter-spacing: 0; }

.nav { display: flex; flex-direction: column; gap: 1px; }
.nav a {
    display: flex; justify-content: space-between; align-items: center; gap: .5rem;
    padding: .45rem .6rem; border-radius: 6px; color: var(--text-dim);
    font-size: .92rem;
}
.nav a:hover { background: var(--bg-sunken); color: var(--text);
               text-decoration: none; }
.nav a[aria-current="page"] { background: var(--bg-sunken); color: var(--text);
                              box-shadow: inset 2px 0 0 var(--accent); }
.nav .count { font-size: .75rem; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.nav-group { margin-top: .4rem; padding: 0 .6rem .2rem; font-size: .68rem;
             text-transform: uppercase; letter-spacing: .08em;
             color: var(--text-faint); }

.sidebar-foot { margin-top: auto; border-top: 1px solid var(--border);
                padding-top: .75rem; font-size: .8rem; color: var(--text-faint); }
.sidebar-foot .who { color: var(--text-dim); display: block;
                     overflow-wrap: anywhere; }

.main { flex: 1 1 auto; min-width: 0; padding: 1.5rem 1.75rem 4rem; }
.main > header { margin-bottom: 1.25rem; display: flex; flex-wrap: wrap;
                 gap: .75rem; align-items: flex-start;
                 justify-content: space-between; }
.main > header .actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.subtitle { color: var(--text-dim); margin: 0; font-size: .92rem; }

/* --- cards and grids ----------------------------------------------------- */

.card {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.2rem;
    margin-bottom: 1.1rem;
}
.card > h2 { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; }
.card > h2 .hint { font-size: .8rem; font-weight: 400; color: var(--text-faint); }
.card-note { color: var(--text-dim); font-size: .88rem; }

/* Ein Bereich ohne Schreibrecht: sichtbar und lesbar, aber erkennbar nicht
   zum Anfassen. fieldset.offen ist nur dazu da, dass die Vorlage ueberall
   dieselbe Klammer setzen kann. */
fieldset.offen, fieldset.gesperrt {
    border: 0; margin: 0; padding: 0; min-width: 0;
}
fieldset.gesperrt { opacity: .62; }
fieldset.gesperrt input, fieldset.gesperrt select, fieldset.gesperrt textarea,
fieldset.gesperrt button { cursor: not-allowed; }
fieldset.gesperrt .button-row button, fieldset.gesperrt button.primary,
fieldset.gesperrt button.danger {
    background: var(--bg-raised); border-color: var(--border);
    color: var(--text-faint);
}
.gesperrt-marke { margin: 0 0 .7rem; }

/* Eine Zuweisung zum Wegklicken: sieht wie eine Marke aus, ist aber ein
   Knopf, weil ein Klick darauf etwas aendert. */
.chip {
    display: inline-flex; align-items: center; gap: .3rem;
    background: var(--bg-raised); border: 1px solid var(--border);
    border-radius: 999px; padding: .1rem .55rem; margin: 0 .25rem .25rem 0;
    font-size: .78rem; font-family: var(--mono); color: var(--text);
    cursor: pointer;
}
.chip:hover { border-color: var(--danger); color: var(--danger); }

fieldset.bereiche {
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: .9rem 1rem; margin: 1rem 0;
}
fieldset.bereiche legend { padding: 0 .4rem; }
fieldset.bereiche .check { margin-bottom: .55rem; }

/* Trennt zwei Bereiche einer Seite, die nicht dasselbe tun - hier die
   Datenbanksicherung auf dem Server und die Vollsicherung ausserhalb. */
h2.section { font-size: 1rem; text-transform: uppercase;
             letter-spacing: .06em; color: var(--text-dim);
             margin: 2rem 0 .3rem; padding-top: 1.4rem;
             border-top: 1px solid var(--border); }
h2.section:first-of-type { margin-top: 0; }
.section-note { color: var(--text-dim); font-size: .9rem;
                max-width: 62rem; margin: 0 0 1.1rem; }

.grid { display: grid; gap: 1.1rem; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

.tiles { display: grid; gap: .75rem;
         grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
         margin-bottom: 1.1rem; }
.tile { background: var(--bg-raised); border: 1px solid var(--border);
        border-radius: var(--radius); padding: .85rem 1rem; }
.tile .label { font-size: .74rem; text-transform: uppercase;
               letter-spacing: .06em; color: var(--text-faint); }
.tile .value { font-size: 1.5rem; font-weight: 600;
               font-variant-numeric: tabular-nums; line-height: 1.2; }
.tile .sub { font-size: .8rem; color: var(--text-dim); }

/* --- tables -------------------------------------------------------------- */

.table-wrap { overflow-x: auto; margin: 0 -1.2rem -1.1rem;
              padding: 0 1.2rem 1.1rem; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--border);
         vertical-align: top; }
th { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em;
     color: var(--text-faint); font-weight: 600; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--bg-sunken); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.nowrap, th.nowrap { white-space: nowrap; }
.table-empty { color: var(--text-faint); padding: 1rem .6rem; font-size: .9rem; }

/* --- badges and status --------------------------------------------------- */

.badge {
    display: inline-flex; align-items: center; gap: .33rem;
    font-size: .74rem; font-weight: 600; padding: .14rem .5rem;
    border-radius: 100px; border: 1px solid var(--border-strong);
    color: var(--text-dim); white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%;
                 background: currentColor; }
.badge.plain::before { display: none; }
.badge.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.badge.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.badge.error { color: var(--error); border-color: color-mix(in srgb, var(--error) 40%, transparent); }
.badge.muted { color: var(--text-faint); }
.badge.accent { color: var(--accent); border-color: var(--accent-dim); }

/* --- meters (no inline styles: discrete width classes) ------------------- */

.meter { height: 6px; background: var(--bg-sunken); border-radius: 100px;
         overflow: hidden; border: 1px solid var(--border); margin-top: .35rem; }
.meter > span { display: block; height: 100%; background: var(--accent);
                border-radius: 100px; }
.meter.warn > span { background: var(--warn); }
.meter.error > span { background: var(--error); }
.w-0 { width: 0; } .w-5 { width: 5%; } .w-10 { width: 10%; } .w-15 { width: 15%; }
.w-20 { width: 20%; } .w-25 { width: 25%; } .w-30 { width: 30%; }
.w-35 { width: 35%; } .w-40 { width: 40%; } .w-45 { width: 45%; }
.w-50 { width: 50%; } .w-55 { width: 55%; } .w-60 { width: 60%; }
.w-65 { width: 65%; } .w-70 { width: 70%; } .w-75 { width: 75%; }
.w-80 { width: 80%; } .w-85 { width: 85%; } .w-90 { width: 90%; }
.w-95 { width: 95%; } .w-100 { width: 100%; }

/* --- forms --------------------------------------------------------------- */

form { margin: 0; }
fieldset { border: 0; padding: 0; margin: 0 0 1rem; }
legend { padding: 0; font-weight: 600; margin-bottom: .4rem; }
label { display: block; font-size: .85rem; color: var(--text-dim);
        margin-bottom: .25rem; }
label .req { color: var(--error); }

input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="search"], select, textarea {
    width: 100%; padding: .48rem .6rem; font: inherit; font-size: .92rem;
    color: var(--text); background: var(--bg-sunken);
    border: 1px solid var(--border-strong); border-radius: 6px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible,
button:focus-visible, a:focus-visible {
    outline: 2px solid var(--accent); outline-offset: 1px;
}
input[aria-invalid="true"] { border-color: var(--error); }
textarea { min-height: 5rem; resize: vertical; }
select { appearance: none; background-image: none; }
input::placeholder, textarea::placeholder { color: var(--text-faint); }

.field { margin-bottom: .85rem; }
.field .help { font-size: .79rem; color: var(--text-faint); margin-top: .25rem; }
.field .error { font-size: .81rem; color: var(--error); margin-top: .25rem; }
.field-row { display: grid; gap: .85rem;
             grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

.check { display: flex; gap: .55rem; align-items: flex-start;
         margin-bottom: .5rem; }
.check input { width: auto; margin: .3rem 0 0; flex: 0 0 auto; }
.check label { margin: 0; color: var(--text); font-size: .9rem; }
.check .help { display: block; color: var(--text-faint); font-size: .79rem; }

button, .btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    padding: .45rem .85rem; font: inherit; font-size: .89rem; font-weight: 550;
    color: var(--text); background: var(--bg-sunken);
    border: 1px solid var(--border-strong); border-radius: 6px; cursor: pointer;
    text-decoration: none;
}
button:hover, .btn:hover { border-color: var(--accent); text-decoration: none; }
button.primary, .btn.primary { background: var(--accent-dim);
    border-color: var(--accent-dim); color: #fff; }
button.primary:hover, .btn.primary:hover { background: var(--accent);
    border-color: var(--accent); }
button.danger, .btn.danger { color: var(--error);
    border-color: color-mix(in srgb, var(--error) 45%, transparent); }
button.danger:hover { background: color-mix(in srgb, var(--error) 14%, transparent);
    border-color: var(--error); }
button.small, .btn.small { padding: .25rem .55rem; font-size: .8rem; }
button[disabled] { opacity: .5; cursor: not-allowed; }
.button-row { display: flex; gap: .55rem; flex-wrap: wrap; align-items: center;
              margin-top: .9rem; }
.inline-form { display: inline; }

/* --- flash and callouts -------------------------------------------------- */

.flash { display: flex; gap: .6rem; align-items: flex-start;
         border: 1px solid var(--border-strong); border-left-width: 3px;
         background: var(--bg-raised); border-radius: 6px;
         padding: .65rem .85rem; margin-bottom: .75rem; font-size: .91rem; }
.flash.ok { border-left-color: var(--ok); }
.flash.warn { border-left-color: var(--warn); }
.flash.error { border-left-color: var(--error); }

.callout { border: 1px solid var(--border); border-left: 3px solid var(--border-strong);
           background: var(--bg-sunken); border-radius: 6px; padding: .7rem .9rem;
           font-size: .89rem; color: var(--text-dim); margin-bottom: 1rem; }
.callout.warn { border-left-color: var(--warn); }
.callout.error { border-left-color: var(--error); }
.callout.accent { border-left-color: var(--accent); }
.callout strong { color: var(--text); }
.callout p:last-child { margin-bottom: 0; }

/* --- misc ---------------------------------------------------------------- */

dl.facts { display: grid; grid-template-columns: auto 1fr; gap: .3rem .9rem;
           margin: 0; font-size: .89rem; }
dl.facts dt { color: var(--text-faint); white-space: nowrap; }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }
dl.facts dd.mono { font-family: var(--mono); font-size: .84rem; }

pre.log { background: var(--bg-sunken); border: 1px solid var(--border);
          border-radius: 6px; padding: .8rem; overflow-x: auto;
          max-height: 32rem; overflow-y: auto; font-size: .8rem;
          line-height: 1.5; white-space: pre; margin: 0; }

.secret { font-family: var(--mono); font-size: 1rem; background: var(--bg-sunken);
          border: 1px dashed var(--accent-dim); border-radius: 6px;
          padding: .7rem .9rem; overflow-wrap: anywhere; user-select: all; }

.qr { background: #fff; padding: .6rem; border-radius: 6px; display: inline-block;
      line-height: 0; }

.ext-grid { display: grid; gap: .3rem .9rem;
            grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); }
.ext-grid .check { margin-bottom: .15rem; }

.tabs { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: .9rem;
        border-bottom: 1px solid var(--border); }
.tabs a { padding: .35rem .7rem; border-radius: 6px 6px 0 0; font-size: .87rem;
          color: var(--text-dim); border: 1px solid transparent;
          border-bottom: 0; margin-bottom: -1px; }
.tabs a[aria-current="page"] { background: var(--bg-raised);
    border-color: var(--border); color: var(--text); }

.muted { color: var(--text-faint); }
.dim { color: var(--text-dim); }
.mono { font-family: var(--mono); }
.small { font-size: .83rem; }
.right { text-align: right; }
.stack > * + * { margin-top: .85rem; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: .5rem; top: .5rem; background: var(--bg-raised);
              padding: .5rem .8rem; border-radius: 6px; z-index: 10; }

/* --- narrow screens ------------------------------------------------------ */

@media (max-width: 820px) {
    .shell { flex-direction: column; }
    .sidebar { width: auto; flex: none; border-right: 0;
               border-bottom: 1px solid var(--border); }
    .nav { flex-direction: row; flex-wrap: wrap; }
    .nav a { padding: .35rem .6rem; }
    .nav-group { display: none; }
    .sidebar-foot { margin-top: .5rem; }
    .main { padding: 1.1rem 1rem 3rem; }
    .table-wrap { margin: 0 -1.2rem; padding: 0 1.2rem; }
}

/* --- code editor --------------------------------------------------------- */

textarea.editor {
    min-height: 26rem;
    line-height: 1.5;
    font-size: .82rem;
    white-space: pre;
    overflow-wrap: normal;
    overflow-x: auto;
    tab-size: 4;
}

input[type="file"] {
    width: 100%; padding: .4rem; font: inherit; font-size: .88rem;
    color: var(--text-dim); background: var(--bg-sunken);
    border: 1px dashed var(--border-strong); border-radius: 6px;
}
input[type="file"]::file-selector-button {
    font: inherit; font-size: .85rem; margin-right: .6rem;
    padding: .3rem .7rem; border-radius: 5px; cursor: pointer;
    color: var(--text); background: var(--bg-raised);
    border: 1px solid var(--border-strong);
}

/* Nur fuer Screenreader sichtbar (z. B. Beschriftung der Serverauswahl). */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
           overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
