/**
 * Archive UI Kit – Design-System hinter dem Lage-Monitor
 * Orientierung: 911-pagers (Next.js) + shadcn/ui CSS-Variable-Architektur
 * Primärfarben/Typo 1:1 aus dem Archive-Theme übernommen.
 */

:root,
.archive-ui,
.lage-cluster-simple,
.lagebild-briefing--cluster-primary,
.home-page--cluster {
    --font-sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
    --font-serif: Georgia, "Times New Roman", serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

    --background: #d8d9d5;
    --foreground: #1d2222;
    --card: #e7e4dc;
    --card-foreground: #1d2222;
    --popover: #e7e4dc;
    --popover-foreground: #1d2222;
    --primary: #202525;
    --primary-foreground: #f1eee7;
    --secondary: #c9cbc7;
    --secondary-foreground: #242929;
    --muted: #ccceca;
    --muted-foreground: #606765;
    --accent: #c1c4c1;
    --accent-foreground: #1d2222;
    --destructive: #71383a;
    --border: #9fa3a0;
    --input: #898e8b;
    --ring: #71383a;

    --archiveBurgundy: #71383a;
    --archiveStone: #e7e4dc;
    --archiveAluminum: #c7cac7;
    --archiveWindow: #252b2b;
    --archiveCream: #f1eee7;
    --archiveAmber: #f0bd60;
    --archiveHighlight: #ffcf40;
    --archivePlot: #bfc2bf;

    --radius: 0.25rem;
    --shadow-dialog: 8px 8px #0e12122e;
    --transition: 0.14s ease;
}

/* —— Primitives —— */

.aui-btn {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 32px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 0;
    background: transparent;
    color: var(--foreground);
    font-family: var(--font-sans);
    font-size: 0.78rem;
    font-weight: 650;
    line-height: 1;
    cursor: pointer;
    transition: color var(--transition), background-color var(--transition), border-color var(--transition), transform var(--transition);
}

.aui-btn:hover {
    color: var(--primary-foreground);
    background: var(--foreground);
    border-color: var(--foreground);
}

.aui-btn:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--archiveBurgundy) 35%, transparent);
    outline-offset: 2px;
}

.aui-btn:active {
    transform: translateY(1px);
}

.aui-btn--primary {
    background: var(--foreground);
    border-color: var(--foreground);
    color: var(--primary-foreground);
}

.aui-btn--primary:hover {
    background: var(--archiveWindow);
    border-color: var(--archiveWindow);
}

.aui-btn--ghost {
    background: transparent;
}

.aui-icon-btn {
    appearance: none;
    position: relative;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 999px;
    border: 1px solid #858c89;
    background: transparent;
    color: var(--archiveCream);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: color var(--transition), background-color var(--transition), border-color var(--transition), transform var(--transition);
    font-size: 1.05rem;
}

.aui-icon-btn:hover,
.aui-icon-btn[aria-expanded="true"] {
    color: var(--archiveWindow);
    background: var(--archiveCream);
    border-color: var(--archiveCream);
}

.aui-icon-btn.is-active,
.aui-icon-btn.is-filtered {
    color: #f7f3ea;
    background: var(--archiveBurgundy);
    border-color: var(--archiveBurgundy);
}

.aui-icon-btn:active {
    transform: translateY(1px);
}

.aui-icon-btn:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--archiveBurgundy) 35%, transparent);
    outline-offset: 2px;
}

.aui-badge {
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 9px;
    border: 1px solid var(--archiveWindow);
    background: var(--archiveAmber);
    color: var(--archiveWindow);
    font-family: var(--font-mono);
    font-size: 0.58rem;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    display: inline-grid;
    place-items: center;
}

.aui-badge--alert {
    background: #e12631;
    border-color: var(--archiveWindow);
    color: #fff;
}

.aui-kicker {
    margin: 0;
    color: var(--archiveBurgundy);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-size: 0.66rem;
    font-weight: 700;
}

.aui-title {
    margin: 0;
    font-family: var(--font-serif);
    font-size: 1.7rem;
    font-weight: 650;
    color: var(--archiveBurgundy);
    letter-spacing: -0.01em;
}

.aui-input {
    width: 100%;
    min-height: 38px;
    border: 1px solid var(--foreground);
    border-radius: 0;
    background: #ffffff4d;
    color: var(--foreground);
    font-family: var(--font-mono);
    font-size: 0.84rem;
    padding: 0 11px;
}

.aui-input:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--archiveBurgundy) 35%, transparent);
    outline-offset: 0;
}

.aui-tabs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    gap: 0;
}

.aui-tab {
    min-width: 0;
    min-height: 42px;
    border: 1px solid var(--foreground);
    background: #fff3;
    color: var(--foreground);
    border-radius: 0;
    padding: 8px 12px;
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    transition: color 0.12s, background-color 0.12s;
}

.aui-tab + .aui-tab {
    border-left: 0;
}

.aui-tab.is-active,
.aui-tab:hover {
    color: #f7f3ea;
    background: var(--archiveWindow);
}

.aui-tab__count {
    min-width: 19px;
    height: 19px;
    padding: 0 4px;
    border-radius: 10px;
    border: 1px solid;
    background: var(--archiveAmber);
    color: var(--archiveWindow);
    font-family: var(--font-mono);
    font-size: 0.6rem;
    line-height: 19px;
    text-align: center;
    font-weight: 700;
}

.aui-dialog {
    background: var(--popover);
    color: var(--popover-foreground);
    border: 1px solid var(--foreground);
    box-shadow: var(--shadow-dialog);
}

.aui-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.55rem;
    border: 1px solid var(--foreground);
    background: var(--archiveStone);
    color: var(--foreground);
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 700;
}

.aui-chip--search {
    background: var(--archiveHighlight);
}

.aui-pill {
    --sourceCarrierColor: var(--archiveBurgundy);
    min-height: 46px;
    color: inherit;
    background: color-mix(in srgb, var(--archiveStone) 74%, transparent);
    border: 1px solid color-mix(in srgb, var(--border) 82%, transparent);
    border-radius: 999px;
    align-items: center;
    gap: 9px;
    padding: 5px 12px 5px 7px;
    display: inline-flex;
    max-width: 100%;
    box-shadow: inset 0 1px #ffffff57;
    font-family: var(--font-mono);
}

.aui-pill__icon {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    border-radius: 50%;
    background: var(--sourceCarrierColor);
    color: #f7f3ea;
    display: grid;
    place-items: center;
    font-size: 0.85rem;
    box-shadow: inset 0 0 0 1px #ffffff24, 0 1px #1d222233;
}

.aui-pill__text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.15;
}

.aui-ledger {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.aui-ledger thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    height: 45px;
    background: #bdc0bd;
    color: #4d5553;
    border-bottom: 1px solid var(--foreground);
    padding: 0 18px;
    text-align: left;
    vertical-align: middle;
    white-space: nowrap;
    font-size: 0.61rem;
    font-weight: 700;
    letter-spacing: 0.11em;
    text-transform: uppercase;
    font-family: var(--font-sans);
}

.aui-ledger tbody tr {
    border-bottom: 1px solid var(--border);
}

.aui-ledger tbody tr:hover {
    background: color-mix(in srgb, var(--archiveStone) 42%, transparent);
}

.aui-ledger td {
    padding: 19px 18px;
    vertical-align: top;
    font-size: 1rem;
    line-height: 1.5;
}

.aui-meta-label {
    display: block;
    color: #aeb4b1;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 700;
}

.aui-meta-value {
    display: block;
    margin-top: 0.2rem;
    color: var(--archiveCream);
    font-family: var(--font-mono);
    font-size: 0.84rem;
    font-weight: 500;
    letter-spacing: 0.11em;
    text-transform: uppercase;
    line-height: 1.2;
}

.aui-meta-value strong {
    color: #fff;
    font-weight: 700;
}

/* full-bleed helper like archiveMasthead / timelineSection */
.aui-bleed {
    width: 100dvw;
    margin-left: calc(50% - 50dvw);
}
