/* ERIT Lizenzverwaltung — "Ledger" identity: cool slate + petrol/teal, serif display,
   monospace for keys. Self-contained (system fonts only, no external requests). */

:root {
    --ink: #0e1a24;
    --ink-2: #3a4a57;
    --ink-3: #6b7a86;
    --line: #e2e6ea;
    --line-2: #eef1f3;
    --bg: #f4f6f7;
    --surface: #ffffff;
    --petrol: #0f766e;
    --petrol-d: #115e57;
    --petrol-l: #d7ecea;
    --accent: #14b8a6;

    --ok: #0f766e;
    --ok-bg: #d7ecea;
    --warn: #9a6700;
    --warn-bg: #fbefc8;
    --danger: #b42318;
    --danger-bg: #fbe6e3;
    --muted-bg: #eef1f3;

    --slate-900: #0b1620;
    --slate-800: #122231;
    --slate-700: #1b3242;

    --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, serif;
    --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --mono: ui-monospace, 'SF Mono', 'Cascadia Code', 'Consolas', 'Liberation Mono', monospace;

    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(14, 26, 36, .04), 0 8px 24px rgba(14, 26, 36, .06);
    --shadow-lg: 0 24px 60px rgba(11, 22, 32, .28);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    font-family: var(--sans);
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.muted { color: var(--ink-3); }
.mono { font-family: var(--mono); }

h1 { font-family: var(--serif); font-size: 1.7rem; font-weight: 600; margin: 0; letter-spacing: -.01em; }
h2 { font-family: var(--serif); font-size: 1.12rem; font-weight: 600; margin: 0; }

/* ===== Login ===== */
.login-view {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 24px;
    background:
        radial-gradient(1200px 500px at 50% -10%, #e7f1f0 0%, transparent 60%),
        var(--bg);
}
.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 32px;
}
.login-title { font-size: 1.5rem; margin: 18px 0 4px; }
.login-hint { margin: 0 0 20px; font-size: .9rem; }
.login-foot { font-size: .8rem; }
.brand--login { margin-bottom: 6px; }

/* ===== Brand ===== */
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
    width: 38px; height: 38px;
    display: grid; place-items: center;
    background: linear-gradient(160deg, var(--accent), var(--petrol-d));
    color: #fff;
    font-family: var(--serif);
    font-size: 1.3rem;
    border-radius: 10px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.25);
}
.brand-name { font-family: var(--serif); font-weight: 700; font-size: 1.15rem; line-height: 1; }
.brand-sub { font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); margin-top: 3px; }

/* ===== Shell ===== */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }

.sidebar {
    background: var(--slate-900);
    color: #c9d6df;
    display: flex;
    flex-direction: column;
    padding: 22px 16px;
    gap: 26px;
    position: sticky;
    top: 0;
    height: 100vh;
}
.sidebar .brand-sub { color: #7b8c99; }
.sidebar .brand-name { color: #fff; }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
    display: flex; align-items: center; gap: 11px;
    padding: 11px 13px;
    border: 0; border-radius: var(--radius-sm);
    background: transparent; color: #aab8c2;
    font: inherit; font-size: .94rem; text-align: left;
    cursor: pointer; transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav-item.is-active { background: var(--petrol); color: #fff; }
.nav-ico { font-size: .9rem; width: 16px; text-align: center; opacity: .9; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.who { font-size: .8rem; color: #8da0ac; word-break: break-all; font-family: var(--mono); }

.main { padding: 30px 36px 60px; max-width: 1180px; }

/* ===== View head ===== */
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.view-head p { margin: 5px 0 0; font-size: .9rem; }

/* ===== KPIs ===== */
.kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 24px; }
.kpi {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
}
.kpi-val { font-family: var(--serif); font-size: 2rem; font-weight: 600; line-height: 1; }
.kpi-label { font-size: .8rem; color: var(--ink-3); margin-top: 8px; }
.kpi--accent .kpi-val { color: var(--petrol); }
.kpi--warn .kpi-val { color: var(--warn); }
.kpi--danger .kpi-val { color: var(--danger); }

/* ===== Panels / grid ===== */
.grid-2 { display: grid; grid-template-columns: 3fr 2fr; gap: 18px; align-items: start; }
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.panel-head { padding: 16px 18px; border-bottom: 1px solid var(--line-2); }

/* ===== Activity ===== */
.activity { padding: 6px 0; max-height: 360px; overflow: auto; }
.activity-row { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--line-2); }
.activity-row:last-child { border-bottom: 0; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot-ISSUE { background: var(--petrol); }
.dot-RENEW { background: var(--accent); }
.dot-REVOKE { background: var(--danger); }
.activity-main { flex: 1; min-width: 0; }
.activity-org { font-weight: 600; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-meta { font-size: .78rem; color: var(--ink-3); }
.activity-time { font-size: .76rem; color: var(--ink-3); white-space: nowrap; }

/* ===== Key card ===== */
.key-card { padding: 18px; }
.key-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; font-size: .88rem; }
.key-row + .key-row { border-top: 1px solid var(--line-2); }
.fingerprint { font-family: var(--mono); font-size: .76rem; color: var(--ink-2); word-break: break-all; text-align: right; }

/* ===== Toolbar / chips / search ===== */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
    padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px;
    background: var(--surface); color: var(--ink-2); font: inherit; font-size: .84rem; cursor: pointer;
    transition: all .14s;
}
.chip:hover { border-color: var(--petrol); color: var(--petrol); }
.chip.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }
.search {
    padding: 9px 13px; border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: var(--surface); font: inherit; font-size: .9rem; min-width: 220px;
}
.search:focus, input:focus, textarea:focus, select:focus { outline: 2px solid var(--petrol-l); outline-offset: 1px; border-color: var(--petrol); }

/* ===== Table ===== */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
thead th {
    text-align: left; font-size: .74rem; letter-spacing: .06em; text-transform: uppercase;
    color: var(--ink-3); font-weight: 600; padding: 13px 18px; border-bottom: 1px solid var(--line); background: #fafbfc;
}
tbody td { padding: 14px 18px; border-bottom: 1px solid var(--line-2); font-size: .9rem; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; transition: background .12s; }
tbody tr.clickable:hover { background: #f7fafa; }
.cell-strong { font-weight: 600; }
.cell-sub { font-size: .78rem; color: var(--ink-3); }
.num { font-variant-numeric: tabular-nums; }

/* ===== Badges ===== */
.badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; border-radius: 999px; font-size: .76rem; font-weight: 600; white-space: nowrap;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-active { color: var(--ok); background: var(--ok-bg); }
.badge-expiring { color: var(--warn); background: var(--warn-bg); }
.badge-expired { color: var(--danger); background: var(--danger-bg); }
.badge-revoked { color: var(--danger); background: var(--danger-bg); }
.badge-superseded { color: var(--ink-3); background: var(--muted-bg); }

/* ===== Buttons ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 10px 16px; border-radius: var(--radius-sm); border: 1px solid transparent;
    font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; transition: all .14s; white-space: nowrap;
}
.btn--primary { background: var(--petrol); color: #fff; }
.btn--primary:hover { background: var(--petrol-d); }
.btn--ghost { background: transparent; border-color: var(--line); color: var(--ink-2); }
.btn--ghost:hover { border-color: var(--ink-3); color: var(--ink); }
.sidebar .btn--ghost { border-color: rgba(255,255,255,.15); color: #aab8c2; }
.sidebar .btn--ghost:hover { border-color: rgba(255,255,255,.3); color: #fff; }
.btn--danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn--danger:hover { background: var(--danger-bg); }
.btn--sm { padding: 7px 12px; font-size: .82rem; }
.btn--block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ===== Forms ===== */
.form { display: flex; flex-direction: column; gap: 15px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.field input, .field textarea, .field select {
    padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
    font: inherit; font-size: .92rem; font-weight: 400; color: var(--ink); background: var(--surface);
}
.field textarea { resize: vertical; min-height: 70px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-error { background: var(--danger-bg); color: var(--danger); padding: 9px 12px; border-radius: var(--radius-sm); font-size: .84rem; }

/* ===== Modal ===== */
.modal-root { position: fixed; inset: 0; background: rgba(11,22,32,.5); display: grid; place-items: center; padding: 20px; z-index: 50; backdrop-filter: blur(2px); }
.modal {
    width: 100%; max-width: 520px; max-height: 90vh; overflow: auto;
    background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.modal--wide { max-width: 640px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--line-2); }
.modal-head h2 { font-size: 1.25rem; }
.modal-body { padding: 24px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 18px 24px; border-top: 1px solid var(--line-2); background: #fafbfc; }
.modal-close { background: none; border: 0; font-size: 1.4rem; color: var(--ink-3); cursor: pointer; line-height: 1; }

/* ===== Key reveal (after mint) ===== */
.keyout {
    font-family: var(--mono); font-size: .82rem; background: var(--slate-900); color: #d7ecea;
    padding: 16px; border-radius: var(--radius-sm); word-break: break-all; line-height: 1.5; max-height: 160px; overflow: auto;
}
/* Short activation code — shown large and spaced, the way Adobe/JetBrains present a key. */
.keyout--code {
    font-size: 1.5rem; font-weight: 600; letter-spacing: .12em; text-align: center;
    word-break: normal; max-height: none; padding: 22px 16px;
}
.keyout-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.note { background: var(--petrol-l); color: var(--petrol-d); padding: 12px 14px; border-radius: var(--radius-sm); font-size: .85rem; margin-top: 16px; }
.note--warn { background: var(--warn-bg); color: var(--warn); }

/* ===== Detail drawer rows ===== */
.dl { display: grid; grid-template-columns: 130px 1fr; gap: 8px 16px; font-size: .88rem; margin-bottom: 18px; }
.dl dt { color: var(--ink-3); }
.dl dd { margin: 0; font-weight: 500; }
.events { border-top: 1px solid var(--line-2); padding-top: 14px; }
.event { display: flex; gap: 10px; padding: 8px 0; font-size: .84rem; }
.event-action { font-weight: 700; min-width: 64px; }

/* ===== Seats (online activation) ===== */
.seats { border-top: 1px solid var(--line-2); padding-top: 14px; margin-top: 16px; }
.seats-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.seat-list { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.seat-row {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px;
    border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface-2, #fafafa);
}
.seat-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.seat-dot--on { background: var(--accent, #0f766e); }
.seat-dot--off { background: var(--ink-3); opacity: .5; }
.seat-main { flex: 1; min-width: 0; }
.seat-name { font-weight: 600; font-size: .88rem; }
.seat-fp { font-family: var(--mono); font-size: .72rem; color: var(--ink-3); word-break: break-all; margin-top: 2px; }

/* ===== Empty state ===== */
.empty { padding: 50px 20px; text-align: center; color: var(--ink-3); }
.empty-ico { font-size: 2rem; opacity: .35; }
.empty p { margin: 10px 0 0; }

/* ===== Toasts ===== */
.toasts { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: 10px; z-index: 60; }
.toast {
    background: var(--slate-900); color: #fff; padding: 12px 18px; border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg); font-size: .88rem; animation: toast-in .2s ease;
}
.toast--err { background: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 900px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; }
    .nav { flex-direction: row; flex-wrap: wrap; }
    .sidebar-foot { margin: 0 0 0 auto; flex-direction: row; align-items: center; }
    .kpis { grid-template-columns: repeat(2, 1fr); }
    .grid-2 { grid-template-columns: 1fr; }
    .main { padding: 20px; }
}
