/*
 * SPDX-License-Identifier: Proprietary
 * Copyright (c) 2026 Fondament Ltd. All rights reserved.
 * CONFIDENTIAL — TRADE SECRET. Protected under §17 UWG und §69a UrhG.
 * Fondament OS · Corporate Design (Tokens aus KI-Hausverwaltung/frontend/src/styles/index.css)
 */
@font-face { font-family: 'Public Sans'; font-weight: 100 900; font-display: swap; src: url('/static/fonts/public-sans-latin.woff2') format('woff2'); }
@font-face { font-family: 'Jost'; font-weight: 100 900; font-display: swap; src: url('/static/fonts/jost-latin.woff2') format('woff2'); }

:root {
  --ochre: #9a7b2e; --ochre-deep: #7c6222; --ochre-tint: rgba(154,123,46,.14); --ochre-tint-strong: rgba(154,123,46,.22);
  --ink: #1b1e24; --ink-soft: #565b66; --muted: #8a8f98;
  --surface: #f7f8fa; --panel: #ffffff; --line: #e7e9ec;
  --success: #2f8f5b; --success-bg: #e7f2ec; --danger: #c0392b; --danger-bg: #fbeae7; --warning: #c46a18; --warning-bg: #fbeedd;
  --shadow: 0 16px 34px -20px rgba(30,34,45,.24); --shadow-btn: 0 10px 22px -12px rgba(124,98,34,.55);
  --r: 14px; --r-sm: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--surface); color: var(--ink-soft);
  font: 16px/1.55 'Public Sans', system-ui, -apple-system, 'Segoe UI', sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--ochre-deep); }
h1, h2 { color: var(--ink); margin: 0; letter-spacing: -.01em; }
h1 { font-size: clamp(1.5rem, 3.2vw, 2rem); font-weight: 700; line-height: 1.2; }
h2 { font-size: 1.05rem; font-weight: 650; }
code { font: .85em ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 24px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand img { border-radius: 9px; display: block; }
.wordmark { font-family: 'Jost', 'Public Sans', sans-serif; font-weight: 600; font-size: 1.35rem; letter-spacing: .06em; color: var(--ink); }
.brand-sub { font-size: .9rem; color: var(--muted); padding-left: 10px; border-left: 1px solid var(--line); }
.who { display: flex; align-items: center; gap: 12px; }
.who-name { font-size: .9rem; color: var(--ink); font-weight: 600; }
.who form { margin: 0; }

.wrap { width: 100%; max-width: 920px; margin: 0 auto; padding: 32px 16px 48px; flex: 1; }
.intro { margin: 8px 4px 22px; }
.eyebrow { margin: 0 0 6px; font-size: .75rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--ochre); }
.eyebrow a { text-decoration: none; letter-spacing: .08em; }
.lead { margin: 10px 0 0; max-width: 62ch; }
.muted { color: var(--muted); font-size: .88rem; }
.small { font-size: .82rem; margin: 14px 0 0; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 24px; margin-bottom: 20px; }
.card.login { max-width: 440px; margin: 6vh auto 20px; padding: 32px; }
.card.login h1 { font-size: 1.5rem; }

.form { display: grid; gap: 6px; margin-top: 22px; }
.form label { font-size: .82rem; font-weight: 600; color: var(--ink); margin-top: 8px; }
.form input { font: inherit; color: var(--ink); padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; }
.form input:focus { outline: none; border-color: var(--ochre); box-shadow: 0 0 0 3px var(--ochre-tint); }
.form .btn-primary { margin-top: 18px; }

.btn-primary, .btn-secondary, .btn-ghost { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px;
  border-radius: var(--r-sm); font: 600 .92rem 'Public Sans', sans-serif; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s; }
.btn-primary { background: var(--ochre); color: #fff; border: 1px solid var(--ochre); box-shadow: var(--shadow-btn); }
.btn-primary:hover { background: var(--ochre-deep); border-color: var(--ochre-deep); }
.btn-secondary { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn-secondary:hover { border-color: var(--ochre); }
.btn-ghost { min-height: 36px; padding: 6px 12px; background: transparent; color: var(--ink-soft); border: 1px solid var(--line); }
.btn-ghost:hover { color: var(--ink); border-color: var(--muted); }
:is(.btn-primary, .btn-secondary, .btn-ghost):focus-visible, .drop:focus-visible { outline: 3px solid var(--ochre-tint-strong); outline-offset: 2px; }

.alert { margin-top: 16px; padding: 11px 14px; border-radius: var(--r-sm); background: var(--danger-bg); color: var(--danger); font-size: .9rem; }
.notice { margin-top: 16px; padding: 11px 14px; border-radius: var(--r-sm); background: var(--warning-bg); color: var(--warning); font-size: .9rem; }

.drop { border: 2px dashed #d5d8dd; border-radius: var(--r); padding: 40px 20px; text-align: center; background: var(--surface); transition: border-color .15s, background .15s; }
.drop.over { border-color: var(--ochre); background: var(--ochre-tint); }
.drop-icon { color: var(--ochre); margin-bottom: 6px; }
.drop-title { margin: 0; font-size: 1.12rem; font-weight: 650; color: var(--ink); }
.drop-hint { margin: 4px 0 16px; color: var(--muted); font-size: .9rem; }
.drop-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

.queue-wrap { margin-top: 22px; }
.queue-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.queue { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-height: 420px; overflow-y: auto; }
.qi { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; }
.qi-top { display: flex; justify-content: space-between; gap: 12px; font-size: .88rem; }
.qi-name { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.qi-state { flex-shrink: 0; color: var(--muted); font-variant-numeric: tabular-nums; }
.qi.done .qi-state { color: var(--success); font-weight: 600; }
.qi.error .qi-state { color: var(--danger); font-weight: 600; }
.bar { height: 6px; border-radius: 99px; background: var(--line); margin-top: 8px; overflow: hidden; }
.bar > span { display: block; height: 100%; width: 0; background: var(--ochre); transition: width .2s; }
.qi.done .bar > span { background: var(--success); }
.qi.error .bar > span { background: var(--danger); }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .path { color: var(--ink); word-break: break-all; }
.table .hash { font: .8rem ui-monospace, Menlo, monospace; color: var(--muted); }
.empty { color: var(--muted); margin: 4px 0; }
.pill { font-size: .75rem; font-weight: 600; padding: 3px 9px; border-radius: 99px; }
.pill.ok { background: var(--success-bg); color: var(--success); }
.pill.off { background: var(--danger-bg); color: var(--danger); }

.foot { border-top: 1px solid var(--line); background: var(--panel); padding: 18px 24px; font-size: .8rem; color: var(--muted); text-align: center; }
.trust { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 22px; color: var(--ink-soft); font-weight: 600; margin-bottom: 6px; }
.trust span::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--ochre); margin-right: 8px; vertical-align: middle; }

@media (max-width: 600px) {
  .topbar { padding: 12px 16px; }
  .brand-sub, .who-name { display: none; }
  .card { padding: 18px; }
  .card.login { padding: 24px; }
  .drop { padding: 28px 14px; }
}

/* Admin-Reiter + Zugänge */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: -8px 0 24px; }
.tab { padding: 10px 16px; font-weight: 600; font-size: .92rem; color: var(--ink-soft); text-decoration: none; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--ochre); }
.success { margin: 0 0 20px; padding: 11px 14px; border-radius: var(--r-sm); background: var(--success-bg); color: var(--success); font-size: .9rem; }
.wrap > .alert { margin: 0 0 20px; }
.creds { border-color: var(--ochre); }
.creds-grid { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 14px 0 0; }
.creds-grid dt { font-size: .82rem; font-weight: 600; color: var(--ink); align-self: center; }
.creds-grid dd { margin: 0; }
.creds-grid .pw { font-size: 1.05rem; padding: 4px 10px; user-select: all; }
.form-row { grid-template-columns: 1fr 1fr auto; align-items: end; gap: 12px; margin-top: 14px; }
.form-row > div { display: grid; gap: 6px; }
.form-row label { margin-top: 0; }
.form-row .btn-primary { margin-top: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; }
.actions form { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.pill { background: var(--surface); color: var(--ink-soft); }
.danger-zone > summary { list-style: none; }
.danger-zone > summary::-webkit-details-marker { display: none; }
.btn-ghost.danger { color: var(--danger); }
.btn-ghost.danger:hover { border-color: var(--danger); }
.confirm { display: grid !important; gap: 8px; margin-top: 8px !important; padding: 12px; border: 1px solid var(--danger); border-radius: var(--r-sm); background: var(--danger-bg); max-width: 340px; }
.confirm p { margin: 0; font-size: .85rem; color: var(--ink); }
.confirm input { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.btn-danger { min-height: 40px; padding: 8px 14px; border-radius: var(--r-sm); border: 1px solid var(--danger); background: var(--danger); color: #fff; font: 600 .88rem 'Public Sans', sans-serif; cursor: pointer; }
@media (max-width: 700px) { .form-row { grid-template-columns: 1fr; } }

/* Bereits übermittelt: Löschen + Protokoll */
.row-action { text-align: right; width: 1%; white-space: nowrap; }
.row-action .btn-ghost { font-size: .82rem; }
.table tr.removing { opacity: .4; }
.table tr.row-warn td { background: var(--warning-bg); }
.qi.leaving { opacity: 0; transition: opacity .4s ease; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* Bestätigungsdialog */
.modal { border: 0; border-radius: var(--r); padding: 0; width: min(440px, calc(100vw - 32px)); box-shadow: 0 24px 60px rgba(27,30,36,.28); color: var(--ink); }
.modal::backdrop { background: rgba(27,30,36,.45); }
.modal form { padding: 24px; display: grid; gap: 10px; }
.modal h2 { margin: 0; font-size: 1.15rem; }
.modal p { margin: 0; font-size: .92rem; }
.modal-file { font-weight: 600; word-break: break-all; padding: 10px 12px; background: var(--surface); border-radius: var(--r-sm); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.modal .btn-danger { min-height: 44px; }
.btn-danger:disabled { opacity: .6; cursor: wait; }
/* Handy: Datum unter den Dateinamen statt eigener Spalte, sonst bricht der Pfad buchstabenweise um */
@media (max-width: 600px) {
  #sent .table th:nth-child(3), #sent .table td:nth-child(3) { display: none; }
  #sent .table td.path { word-break: break-word; overflow-wrap: anywhere; }
}

/* Ordnerbaum (Ablage = Spiegel der Ordnerstruktur der Verwaltung) */
.tree { list-style: none; margin: 0; padding: 0; }
.tree .tree { padding-left: 22px; border-left: 1px solid var(--line); margin-left: 9px; }
.tree-row { display: flex; align-items: center; gap: 12px; padding: 7px 4px; border-bottom: 1px solid var(--line); font-size: .9rem; min-height: 44px; }
.tree-dir > details > summary { cursor: pointer; list-style: none; position: relative; padding-left: 18px; }
.tree-dir > details > summary::-webkit-details-marker { display: none; }
.tree-dir > details > summary::before { content: ""; flex: none; width: 0; height: 0; border-left: 5px solid var(--muted); border-top: 4px solid transparent; border-bottom: 4px solid transparent; transition: transform .15s; position: absolute; left: 4px; top: 25px; margin-top: -4px; }
.tree-dir > details[open] > summary::before { transform: rotate(90deg); }
.tree-dir > details > summary:hover { background: var(--surface); }
.tree-dir > details > summary:focus-visible { outline: 3px solid var(--ochre-tint-strong); outline-offset: -3px; }
.tree-dir > details > summary .tree-name { font-weight: 650; }
.tree-name { flex: 1; min-width: 0; color: var(--ink); overflow-wrap: anywhere; display: inline-flex; align-items: center; gap: 8px; }
.tree-icon { flex: none; color: var(--ochre); }
.tree-file .tree-name { padding-left: 18px; }
.tree-meta { color: var(--muted); font-size: .82rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tree-act { flex: none; }
.tree-act .btn-ghost { font-size: .82rem; }
.tree-file.removing, .tree-dir.removing { opacity: .4; }
@media (max-width: 600px) {
  .tree-date { display: none; }
  .tree-row { flex-wrap: wrap; gap: 4px 10px; }
  .tree-name { flex-basis: 100%; }
  .tree-meta { flex: 1; }
}

/* Zugänge: Zugangsdaten-Klappe */
.creds-pop > summary { list-style: none; cursor: pointer; }
.creds-pop > summary::-webkit-details-marker { display: none; }
.creds-pop[open] > summary { border-color: var(--ochre); color: var(--ink); }
.creds-box { margin-top: 8px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); display: grid; gap: 8px; max-width: 360px; }
.creds-box .creds-grid { margin: 0; }
.creds-box p { margin: 0; }
.creds-sub { margin: 18px 0 0; font-size: 1rem; }
.mail-text { width: 100%; box-sizing: border-box; font: .88rem/1.5 'Public Sans', sans-serif; color: var(--ink); padding: 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); resize: vertical; }
.creds-actions { justify-content: flex-start; margin-top: 10px; }
