/*
 * AREA-NET Corporate Design.
 * Tokens uebernommen aus GIT/bewertungswidget/public/css/admin.css,
 * Quelle: bewertungswidget/styleguide.md (Figma "Corporate Design").
 *
 * Bewusst KEINE Webfonts: der Proxy laedt keine externe Ressource — das ist
 * dieselbe Linie wie im Produkt selbst.
 */

:root {
    --color-primary: #c61932;
    --color-primary-darken: #aa1733;
    --color-secondary: #10284a;
    --color-secondary-darken: #0a182c;
    --color-text: #303030;
    --color-bg: #ececec;
    --color-white: #ffffff;

    --space-1: 15px;
    --space-2: 30px;
    --space-3: 45px;
    --space-4: 60px;

    --radius-interactive: 2px;
    --radius-non-interactive: 0px;

    --font-headings: "Plus Jakarta Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-body: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

    --muted: rgba(48, 48, 48, 0.65);
    --border: #cfcfcf;
    --border-soft: #e0e0e0;
    --surface-alt: #f7f7f7;
    --success: #137333;
    --success-soft: #e6f4ea;
    --warning: #b06000;
    --warning-soft: #fff4e5;
    --danger: #c61932;
    --danger-soft: #fbe6ea;
    --input-h: 42px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font: 400 16px/28px var(--font-body);
    background: var(--color-bg);
    color: var(--color-text);
}

a { color: var(--color-secondary); }
a:hover { color: var(--color-primary); }

h1, h2, h3 { font-family: var(--font-headings); margin: 0 0 var(--space-1); }
h1 { font-size: 28px; line-height: 38px; font-weight: 600; }
h2 { font-size: 20px; line-height: 30px; font-weight: 600; margin-top: var(--space-2); }
h3 { font-size: 17px; line-height: 26px; font-weight: 600; }

.skip-link {
    position: absolute; left: -9999px; top: 0;
    background: var(--color-white); padding: var(--space-1); z-index: 10;
}
.skip-link:focus { left: 0; }

/* ── Kopf und Navigation ──────────────────────────────────────────────── */

.topbar {
    background: var(--color-secondary);
    color: var(--color-white);
    padding: 0 var(--space-1);
}
.topbar__inner {
    max-width: 1200px; margin: 0 auto;
    display: flex; align-items: center; gap: var(--space-2);
    min-height: 60px; flex-wrap: wrap;
}
.topbar__brand {
    font-family: var(--font-headings); font-weight: 600; font-size: 17px;
    color: var(--color-white); text-decoration: none;
}
.topbar__brand span { color: rgba(255, 255, 255, .6); font-weight: 400; }
.topbar nav { display: flex; gap: var(--space-1); flex-wrap: wrap; flex: 1; }
.topbar nav a {
    color: rgba(255, 255, 255, .85); text-decoration: none;
    padding: 6px 0; border-bottom: 2px solid transparent; font-size: 15px;
}
.topbar nav a:hover, .topbar nav a.is-active {
    color: var(--color-white); border-bottom-color: var(--color-primary);
}
.topbar__user { font-size: 14px; color: rgba(255, 255, 255, .7); display: flex; align-items: center; gap: 10px; }
.topbar__user button {
    display: inline-flex; align-items: center; justify-content: center;
    background: none; border: 1px solid rgba(255, 255, 255, .35);
    color: var(--color-white); height: 30px; padding: 0 10px;
    border-radius: var(--radius-interactive); cursor: pointer;
    font-family: inherit; font-size: 13px; line-height: 1.2;
}
.topbar__user button:hover { border-color: var(--color-white); }

/* ── Layout ───────────────────────────────────────────────────────────── */

main { max-width: 1200px; margin: 0 auto; padding: var(--space-2) var(--space-1) var(--space-4); }

.card {
    background: var(--color-white);
    border-radius: var(--radius-non-interactive);
    padding: var(--space-2);
    margin-bottom: var(--space-1);
}
.card--narrow { max-width: 560px; }

.grid { display: grid; gap: var(--space-1); margin-bottom: var(--space-1); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

.tile { background: var(--color-white); padding: var(--space-1) var(--space-2); }
.tile__value { font-family: var(--font-headings); font-size: 34px; line-height: 44px; font-weight: 600; }
.tile__label { color: var(--muted); font-size: 14px; }
.tile--warn .tile__value { color: var(--warning); }
.tile--danger .tile__value { color: var(--danger); }
.tile--ok .tile__value { color: var(--success); }

/* ── Tabellen ─────────────────────────────────────────────────────────── */

table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
th { font-weight: 600; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
tbody tr:hover { background: var(--surface-alt); }
td.num, th.num { text-align: right; }
.table-wrap { overflow-x: auto; }

code, .mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    background: var(--surface-alt);
    padding: 2px 5px;
}

/* ── Formulare ────────────────────────────────────────────────────────── */

.field { margin-bottom: var(--space-1); }
.field label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.field .hint { color: var(--muted); font-size: 13px; line-height: 20px; margin-top: 4px; }

input[type="text"], input[type="password"], input[type="date"], input[type="number"],
input[type="search"], select, textarea {
    width: 100%;
    height: var(--input-h);
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-interactive);
    /* font-family statt der font-Kurzschreibweise: `font: inherit` wuerde
       line-height mit zuruecksetzen und die Textlage in der Box verschieben. */
    font-family: inherit;
    font-size: 15px;
    background: var(--color-white);
    color: var(--color-text);
}
textarea { height: auto; padding: 10px; min-height: 90px; line-height: 24px; }
input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--color-secondary);
    outline-offset: 1px;
    border-color: var(--color-secondary);
}

/*
 * Zentrierung ueber Flexbox statt line-height: unabhaengig von
 * Schriftmetrik und Elementtyp, und es gibt keine Kurzschreibweise mehr,
 * die line-height still zuruecksetzen koennte. Gilt gleichermassen fuer
 * <a class="btn"> und <button class="btn">.
 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: var(--input-h);
    padding: 0 20px;
    border: 1px solid transparent;
    border-radius: var(--radius-interactive);
    background: var(--color-primary);
    color: var(--color-white);
    font-family: inherit;
    font-size: 15px;
    line-height: 1.2;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
}
.btn:hover { background: var(--color-primary-darken); color: var(--color-white); text-decoration: underline; }
.btn--secondary { background: var(--color-secondary); }
.btn--secondary:hover { background: var(--color-secondary-darken); }
.btn--ghost { background: transparent; color: var(--color-text); border-color: var(--border); }
.btn--ghost:hover { background: var(--surface-alt); color: var(--color-text); }
.btn--small { height: 32px; padding: 0 12px; font-size: 14px; }

.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: var(--space-1); }
.filterbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: var(--space-1); }
.filterbar .field { margin: 0; min-width: 180px; }

/* ── Meldungen ────────────────────────────────────────────────────────── */

.flash { padding: 12px var(--space-1); margin-bottom: var(--space-1); border-left: 4px solid; }
.flash--success { background: var(--success-soft); border-color: var(--success); }
.flash--error { background: var(--danger-soft); border-color: var(--danger); }
.flash--warning { background: var(--warning-soft); border-color: var(--warning); }

.notice { padding: 12px var(--space-1); border-left: 4px solid var(--border); background: var(--surface-alt); margin-bottom: var(--space-1); }
.notice--warn { background: var(--warning-soft); border-color: var(--warning); }
.notice--danger { background: var(--danger-soft); border-color: var(--danger); }

.badge {
    display: inline-block; padding: 2px 9px; font-size: 13px; line-height: 20px;
    border-radius: var(--radius-interactive); white-space: nowrap;
}
.badge--ok { background: var(--success-soft); color: var(--success); }
.badge--warn { background: var(--warning-soft); color: var(--warning); }
.badge--err { background: var(--danger-soft); color: var(--danger); }
.badge--neutral { background: var(--surface-alt); color: var(--muted); }

.muted { color: var(--muted); }
.small { font-size: 14px; line-height: 22px; }
.empty { color: var(--muted); padding: var(--space-2); text-align: center; }

.secret {
    display: block; width: 100%; padding: 12px;
    background: var(--surface-alt); border: 1px dashed var(--border);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 15px; word-break: break-all; line-height: 24px;
}

.logtail {
    background: #1d1f21; color: #d9dbdc; padding: var(--space-1);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px; line-height: 20px;
    max-height: 480px; overflow: auto; white-space: pre-wrap; word-break: break-all;
}

footer {
    max-width: 1200px; margin: 0 auto; padding: var(--space-1);
    color: var(--muted); font-size: 13px;
    border-top: 1px solid var(--border-soft);
}

/* ── Anmeldung ────────────────────────────────────────────────────────── */

.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: var(--space-1); }
.login-card { background: var(--color-white); padding: var(--space-3) var(--space-2); width: 100%; max-width: 420px; }
.login-card h1 { font-size: 22px; line-height: 32px; }
.login-card .btn { width: 100%; }
