/* ============================================================
   Konkordanz — Beglaubigte Übersetzungen DE ⇄ VI
   Designsystem: "Das Dienstsiegel"
   ============================================================ */

:root {
  /* Farben */
  --ink:        #1b1a2e;   /* Tinten-Anthrazit, leicht violettstichig */
  --ink-soft:   #4a4862;   /* gedämpfte Tinte für Sekundärtext */
  --paper:      #f4f4f1;   /* kühles Aktenpapier */
  --paper-pure: #fcfcfa;   /* helle Bogenfläche für Karten/Felder */
  --seal:       #5b3e96;   /* Siegel-Violett (Akzent) */
  --seal-deep:  #432b73;   /* dunkleres Violett für Hover */
  --seal-tint:  #ece6f5;   /* violetter Tint für Chips/Flächen */
  --line:       #ddd9ce;   /* warme Haarlinie */
  --line-soft:  #e9e6dd;
  --good:       #2f6b4a;   /* "fertig" */
  --good-tint:  #e1efe6;
  --warn:       #8a5a12;   /* "zur Freigabe" */
  --warn-tint:  #f5ead2;
  --danger:     #9b2235;   /* Fehler */

  /* Typografie */
  --font-sans: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  /* Maße */
  --r-sm: 4px;
  --r-md: 7px;
  --r-lg: 12px;
  --shadow: 0 1px 2px rgba(27, 26, 46, .04), 0 8px 28px -12px rgba(27, 26, 46, .18);
  --shadow-sm: 0 1px 2px rgba(27, 26, 46, .05);
  --maxw: 1080px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { margin: 0; font-weight: 800; letter-spacing: -0.02em; line-height: 1.12; }
p { margin: 0; }
a { color: var(--seal); text-decoration: none; }
a:hover { text-decoration: underline; }

.mono {
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: .7rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--seal);
}

/* ---------- Topbar ---------- */
.topbar { /* leer = unsichtbar (Login überschreibt den Block) */ }

.topbar__inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: .85rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.brand { display: flex; align-items: center; gap: .6rem; margin-right: auto; }
.brand__mark { display: block; width: 30px; height: 30px; flex: none; }
.brand__name { font-weight: 800; font-size: 1.05rem; letter-spacing: -0.03em; }
.brand__sub  { font-family: var(--font-mono); font-size: .62rem; letter-spacing: .16em;
               text-transform: uppercase; color: var(--ink-soft); display: block; margin-top: -2px; }

.nav { display: flex; align-items: center; gap: 1.4rem; }
.nav a {
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 1.5px solid transparent;
  transition: color .15s, border-color .15s;
}
.nav a:hover { color: var(--seal); border-color: var(--seal); }

/* ---------- Layout ---------- */
main { max-width: var(--maxw); margin: 0 auto; padding: 2.5rem 1.5rem 4rem; }

.page-head { margin-bottom: 1.75rem; }
.page-head h1 { font-size: clamp(1.5rem, 1rem + 1.6vw, 2rem); margin-top: .35rem; }
.page-head__meta { margin-top: .5rem; color: var(--ink-soft); font-size: .92rem; }

/* ---------- Panel ---------- */
.panel {
  background: var(--paper-pure);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel__head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  padding: 1.1rem 1.4rem;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(var(--paper-pure), var(--paper));
}
.panel__title { font-size: 1.05rem; font-weight: 700; letter-spacing: -0.01em; }
.panel__body { padding: 1.4rem; }

/* ---------- Felder ---------- */
.field { display: block; margin-bottom: 1.1rem; }
.field__label {
  display: block; margin-bottom: .4rem;
  font-family: var(--font-mono); font-size: .68rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-soft);
}
.input {
  width: 100%;
  font-family: var(--font-sans);
  font-size: .98rem;
  color: var(--ink);
  background: var(--paper-pure);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: .7rem .8rem;
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: #9a988c; }
.input:focus {
  outline: none;
  border-color: var(--seal);
  box-shadow: 0 0 0 3px var(--seal-tint);
}

/* Segmentierte Richtungswahl */
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label {
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  text-align: center;
  padding: .75rem .6rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--paper-pure);
  font-size: .9rem; font-weight: 500;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s, box-shadow .15s;
}
.segmented label:hover { border-color: #c8c3b4; }
.segmented input:checked + label {
  border-color: var(--seal);
  background: var(--seal-tint);
  color: var(--seal-deep);
  box-shadow: inset 0 0 0 1px var(--seal);
  font-weight: 600;
}
.segmented input:focus-visible + label { box-shadow: 0 0 0 3px var(--seal-tint); }

/* ---------- Dropzone ---------- */
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: .4rem;
  text-align: center;
  padding: 2.2rem 1.5rem;
  border: 1.5px dashed var(--line);
  border-radius: var(--r-md);
  background:
    repeating-linear-gradient(45deg, transparent 0 12px, rgba(91,62,150,.012) 12px 24px),
    var(--paper);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.is-drag { border-color: var(--seal); background: var(--seal-tint); }
.dropzone__input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.dropzone__icon { font-size: 1.6rem; color: var(--seal); line-height: 1; }
.dropzone__title { font-weight: 600; font-size: .98rem; }
.dropzone__hint { color: var(--ink-soft); }
.dropzone__file { color: var(--seal-deep); font-weight: 600; min-height: 1em; text-transform: none; letter-spacing: .02em; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font-family: var(--font-sans); font-size: .95rem; font-weight: 600;
  padding: .72rem 1.3rem;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .15s, transform .1s, box-shadow .15s, border-color .15s;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--seal); color: #fff; box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: var(--seal-deep); text-decoration: none; }
.btn--block { width: 100%; }
.btn--ghost {
  background: transparent; color: var(--ink); border-color: var(--line);
}
.btn--ghost:hover { border-color: var(--seal); color: var(--seal); text-decoration: none; }
.btn--rechnung {
  background: #fff; color: var(--seal-deep); border-color: var(--seal-deep); font-weight: 700;
}
.btn--rechnung:hover { background: var(--seal-deep); color: #fff; text-decoration: none; }
.btn--sm { padding: .42rem .8rem; font-size: .82rem; }

/* Aktions-Icons im Archiv */
.iconbar { display: flex; align-items: center; justify-content: flex-end; gap: .35rem; }
.iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0; margin: 0;
  background: none; border: none; border-radius: 6px; cursor: pointer;
  color: var(--ink-soft); line-height: 0; text-decoration: none;
  transition: color .15s, background .15s;
}
.iconbtn:hover { color: var(--seal); background: var(--seal-tint); text-decoration: none; }
.iconbtn--word { color: #2b579a; }
.iconbtn--pdf { color: #c0392b; }
.iconbtn--danger { color: var(--danger); }
.iconbtn--danger:hover { color: #fff; background: var(--danger); }
.inline-del { display: inline-flex; margin: 0; }

/* ---------- Hinweis / Haftungs-Callout ---------- */
.notice {
  display: flex; gap: .85rem; align-items: flex-start;
  padding: .95rem 1.1rem;
  border: 1px solid var(--seal-tint);
  border-left: 3px solid var(--seal);
  border-radius: var(--r-sm);
  background: var(--seal-tint);
  color: var(--seal-deep);
  font-size: .92rem; line-height: 1.45;
}
.notice__mark { font-weight: 800; flex: none; }

.error {
  margin: 0 0 1.1rem;
  padding: .7rem .9rem;
  border: 1px solid #e7c6cc;
  border-left: 3px solid var(--danger);
  border-radius: var(--r-sm);
  background: #f8e9ec;
  color: var(--danger);
  font-size: .9rem;
}

/* ---------- Entwurfs-Editor (Review) ---------- */
.draft {
  width: 100%;
  min-height: 56vh;
  font-family: var(--font-mono);
  font-size: .85rem;
  line-height: 1.7;
  color: var(--ink);
  background:
    linear-gradient(var(--paper-pure), var(--paper-pure)) padding-box;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 1.1rem 1.2rem;
  resize: vertical;
  tab-size: 2;
}
.draft:focus { outline: none; border-color: var(--seal); box-shadow: 0 0 0 3px var(--seal-tint); }

.legend { display: flex; flex-wrap: wrap; gap: .5rem; margin: .9rem 0 0; }
.tag {
  font-family: var(--font-mono); font-size: .68rem; letter-spacing: .04em;
  padding: .25rem .5rem; border-radius: 999px;
  background: var(--seal-tint); color: var(--seal-deep); border: 1px solid #d9cdee;
}

.actionbar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin-top: 1.3rem; }

/* ---------- Chip (Dateiname/Meta) ---------- */
.chip {
  display: inline-flex; align-items: center; gap: .4rem;
  font-family: var(--font-mono); font-size: .72rem; letter-spacing: .03em;
  padding: .25rem .6rem; border-radius: 999px;
  background: var(--paper); border: 1px solid var(--line); color: var(--ink-soft);
}

/* ---------- Archiv-Tabelle (Register) ---------- */
.ledger { width: 100%; border-collapse: collapse; font-size: .92rem; }
.ledger thead th {
  text-align: left;
  font-family: var(--font-mono); font-weight: 500; font-size: .66rem;
  letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft);
  padding: .5rem .9rem 0.7rem; border-bottom: 1px solid var(--line);
}
.ledger tbody td { padding: .85rem .9rem; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.ledger tbody tr { transition: background .12s; }
.ledger tbody tr:hover { background: var(--paper); }
.ledger .col-id   { font-family: var(--font-mono); color: var(--ink-soft); width: 1%; white-space: nowrap; }
.ledger .col-date { font-family: var(--font-mono); font-size: .8rem; color: var(--ink-soft); white-space: nowrap; }
.ledger .col-file { font-weight: 500; }
.ledger .col-actions { text-align: right; white-space: nowrap; }
.ledger .col-actions a { margin-left: .6rem; }

.status {
  display: inline-flex; align-items: center; gap: .45rem;
  font-family: var(--font-mono); font-size: .68rem; letter-spacing: .08em; text-transform: uppercase;
  padding: .28rem .6rem; border-radius: 999px; border: 1px solid;
}
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status--fertig { color: var(--good); background: var(--good-tint); border-color: #bcdcc8; }
.status--warn   { color: var(--warn); background: var(--warn-tint); border-color: #e6cf9f; }
.status--neu    { color: var(--ink-soft); background: var(--paper); border-color: var(--line); }

/* Tabelle auf kleinen Bildschirmen horizontal scrollbar statt gequetscht */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll .ledger { min-width: 560px; }

/* Leerer Zustand */
.empty { text-align: center; padding: 3.5rem 1rem; color: var(--ink-soft); }
.empty__mark { width: 64px; height: 64px; margin: 0 auto 1rem; opacity: .9; }
.empty p { margin: .3rem 0 1.2rem; }

/* ---------- Login ---------- */
.auth {
  position: relative;
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 2rem 1.25rem;
  overflow: hidden;
}
.auth::before { /* konzentrische Siegel-Ringe als zarter Hintergrund */
  content: "";
  position: absolute; inset: 0;
  background: repeating-radial-gradient(circle at 50% 42%,
    transparent 0 38px, rgba(91,62,150,.045) 38px 39px);
  -webkit-mask-image: radial-gradient(circle at 50% 42%, #000 0%, transparent 62%);
          mask-image: radial-gradient(circle at 50% 42%, #000 0%, transparent 62%);
  pointer-events: none;
}
.auth__card {
  position: relative;
  width: 100%; max-width: 430px;
  background: var(--paper-pure);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 2.4rem 2.1rem 2rem;
  text-align: center;
}
.auth__card::before { /* violette Kopflinie wie auf einer Urkunde */
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--seal), #8a6fc7);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}
.seal { width: 132px; height: 132px; margin: .4rem auto 1.3rem; display: block; }
.auth__title { font-size: 1.5rem; margin: .1rem 0 .15rem; }
.auth__lead { color: var(--ink-soft); font-size: .9rem; margin-bottom: 1.6rem; }
.auth form { text-align: left; }
.auth__foot {
  margin-top: 1.6rem; padding-top: 1.1rem; border-top: 1px solid var(--line-soft);
  font-family: var(--font-mono); font-size: .64rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-soft);
}

/* ---------- Siegel-Animation (einmaliges "Stempeln") ---------- */
@keyframes seal-press {
  0%   { opacity: 0; transform: scale(1.14) rotate(-4deg); }
  60%  { opacity: 1; }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}
@keyframes card-rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.auth__card { animation: card-rise .5s cubic-bezier(.2,.7,.2,1) both; }
.seal { animation: seal-press .7s cubic-bezier(.2,.8,.2,1) .12s both; }
.seal__ring { stroke-dasharray: 402; stroke-dashoffset: 402; animation: ring-draw 1s ease .2s forwards; }
@keyframes ring-draw { to { stroke-dashoffset: 0; } }

/* ---------- Bearbeitungs-Overlay ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 60;
  display: none; align-items: center; justify-content: center;
  background: rgba(244, 244, 241, .82);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.overlay.is-active { display: flex; animation: card-rise .25s ease both; }
.overlay__card { text-align: center; padding: 2rem 2.4rem; max-width: 360px; }
.spinner-seal { width: 78px; height: 78px; margin: 0 auto 1.2rem; display: block; }
.spinner-seal__track { stroke: var(--seal); opacity: .2; }
.spinner-seal__star {
  transform-box: fill-box;
  transform-origin: center;
  animation: seal-spin 1.5s cubic-bezier(.6,.05,.4,.95) infinite;
}
@keyframes seal-spin { to { transform: rotate(360deg); } }
.overlay__title { font-size: 1.2rem; font-weight: 800; letter-spacing: -0.01em; }
.overlay__text { color: var(--ink-soft); font-size: .92rem; margin-top: .4rem; }

@media (prefers-reduced-motion: reduce) {
  .overlay.is-active { animation: none; }
  .spinner-seal__star { animation: none; }
}

/* ---------- Zugänglichkeit ---------- */
:focus-visible { outline: 2px solid var(--seal); outline-offset: 2px; border-radius: 2px; }

@media (prefers-reduced-motion: reduce) {
  .auth__card, .seal, .seal__ring { animation: none; }
  .seal__ring { stroke-dashoffset: 0; }
  * { transition: none !important; }
}

/* ---------- Responsiv ---------- */
@media (max-width: 720px) {
  .topbar__inner { flex-wrap: wrap; gap: .8rem 1.1rem; padding: .75rem 1.1rem; }
  .brand { margin-right: 0; width: 100%; }
  .nav { flex-wrap: wrap; gap: .7rem 1.1rem; }
  main { padding: 1.6rem 1.1rem 3rem; }
  .panel__head, .panel__body { padding-left: 1.1rem; padding-right: 1.1rem; }
  .segmented { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 1.5rem; }
  .auth__card { padding: 2rem 1.4rem 1.6rem; }
}

/* Mehrspaltige Eingabegruppen (Abrechnung/Einstellungen) untereinander */
@media (max-width: 540px) {
  .field[style*="display:flex"] { flex-direction: column; gap: .5rem !important; }
  .field[style*="display:flex"] > span { min-width: 0 !important; width: 100%; }
  .actionbar { flex-direction: column; align-items: stretch; }
  .actionbar .btn { width: 100%; text-align: center; }
}

.selbar { position: sticky; bottom: 0; display: flex; gap: 1rem; align-items: center;
  padding: .8rem 1rem; background: var(--surface, #fff); border-top: 1px solid #ddd9ce; }
