/* =====================================================================
   Rechnungsverwaltung — Desktop
   Visual identity taken over 1:1 from the browser version:
   near-black ink on warm paper grey, 10px radii, quiet borders.
   ===================================================================== */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --ink: #0a0a0a;
  --paper: #f5f5f3;
  --card: #ffffff;
  --line: #e8e8e4;
  --line-soft: #f0f0ee;
  --muted: #888888;
  --muted-2: #666666;
  --green: #1a7a4a;
  --green-bg: #d4f5e9;
  --amber: #9a6500;
  --amber-bg: #fff4d6;
  --red: #c0392b;
  --red-bg: #ffe0e0;

  /* Culoarea dominanta, aleasa de utilizator (langa selectorul de limba).
     --green/--amber/--red de mai sus sunt culori de STATUS (platit/deschis/
     restant) si n-au nicio legatura cu asta — nu se ating la schimbarea
     accentului. */
  --accent: #D08B2C;
}
[data-accent="amber"]  { --accent: #D08B2C; }
[data-accent="teal"]   { --accent: #1D9E75; }
[data-accent="blue"]   { --accent: #378ADD; }
[data-accent="green"]  { --accent: #5DB84A; }
[data-accent="purple"] { --accent: #7F77DD; }
[data-accent="red"]    { --accent: #D85A30; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  overflow-y: scroll;
}

button, input, select, textarea { font-family: inherit; }
button { cursor: pointer; }

/* ---------------- Topbar ---------------- */
/* Grafit adânc cu un degrade fin, tăiat jos de o linie teal — aceeași
   nuanță ca "Wise Quick Pay" de pe factură, ca aplicația și documentul
   să pară făcute de aceeași mână. */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px 24px;
  color: #fff;
  background: linear-gradient(180deg, #1b1b1f 0%, #101013 55%, #0b0b0d 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .06),
    0 10px 28px -14px rgba(0, 0, 0, .55);
  -webkit-app-region: drag;
}

/* firul de lumină de sub bară — in culoarea de accent aleasa */
.topbar::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--accent) 0%, transparent) 0%,
    color-mix(in srgb, var(--accent) 55%, transparent) 22%,
    color-mix(in srgb, var(--accent) 55%, transparent) 78%,
    color-mix(in srgb, var(--accent) 0%, transparent) 100%);
}

.topbar button, .topbar input { -webkit-app-region: no-drag; }

.tb-logo { display: flex; align-items: center; gap: 13px; }

.tb-logo img {
  width: 36px; height: 36px; object-fit: contain;
  border-radius: 9px;
  background: rgba(255, 255, 255, .05);
  padding: 3px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .09);
}

.tb-title {
  font-size: 14.5px; font-weight: 600; letter-spacing: -.01em;
  line-height: 1.25;
}

.tb-sub {
  font-size: 10px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .11em;
  color: rgba(255, 255, 255, .38);
  margin-top: 2px;
}

.tb-actions { display: flex; gap: 8px; align-items: center; }

/* butoane discrete, fără dreptunghiuri albe care sar în ochi */
.topbar .btn-ghost {
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .12);
  color: rgba(255, 255, 255, .9);
  padding: 7px 14px;
  font-size: 12.5px;
  border-radius: 8px;
  transition: background .16s, border-color .16s, color .16s;
}
.topbar .btn-ghost:hover {
  background: rgba(255, 255, 255, .11);
  border-color: rgba(255, 255, 255, .22);
  color: #fff;
}
.topbar .btn-ghost:active { background: rgba(255, 255, 255, .07); }
.topbar .btn-ghost:focus-visible {
  outline: 2px solid rgba(0, 185, 160, .8);
  outline-offset: 2px;
}

/* indicator de salvare: un punct care spune starea fără să citești */
.save-state {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11px; font-weight: 500;
  color: rgba(255, 255, 255, .4);
  padding-right: 10px;
  transition: color .2s;
}
.save-state::before {
  content: '';
  width: 6px; height: 6px; border-radius: 50%;
  background: #00b9a0;
  box-shadow: 0 0 0 3px rgba(0, 185, 160, .16);
  transition: background .2s, box-shadow .2s;
}
.save-state.busy { color: rgba(255, 212, 121, .95); }
.save-state.busy::before {
  background: #ffd479;
  box-shadow: 0 0 0 3px rgba(255, 212, 121, .18);
  animation: pulse 1.1s ease-in-out infinite;
}
.save-state.error { color: #ff9a8f; }
.save-state.error::before {
  background: #ff6b5c;
  box-shadow: 0 0 0 3px rgba(255, 107, 92, .2);
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: .35; }
}

/* ---------------- Layout ---------------- */

.main { max-width: 1020px; margin: 0 auto; padding: 22px 16px 60px; }

.tabs {
  display: flex; gap: 3px;
  background: #e9e9e5;
  border-radius: 11px; padding: 4px; margin-bottom: 22px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .045);
}
.tab {
  flex: 1; padding: 10px 0; text-align: center;
  font-size: 13px; font-weight: 500; letter-spacing: -.005em;
  border: none; background: none; border-radius: 8px;
  color: var(--muted-2);
  transition: background .16s, color .16s, box-shadow .16s;
}
.tab:hover { color: var(--ink); background: rgba(255, 255, 255, .55); }
.tab.active {
  background: #fff; color: var(--ink); font-weight: 600;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, .07),
    0 0 0 1px rgba(0, 0, 0, .035),
    inset 0 -2px 0 var(--accent);
}
.tab.active:hover { background: #fff; }
.tab:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }

.section { display: none; }
.section.active { display: block; animation: fade .16s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

/* ---------------- Cards ---------------- */

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 20px; margin-bottom: 16px;
}
.card-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; }
.card-t { font-size: 15px; font-weight: 600; }
.danger-card { border-color: #f0d6d2; }

.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.metric { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.m-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.m-value { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.m-sub { font-size: 11px; color: #aaa; margin-top: 3px; }

/* ---------------- Tables ---------------- */

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; padding: 8px 0; color: var(--muted);
  font-weight: 500; font-size: 11px; text-transform: uppercase;
  border-bottom: 1px solid var(--line);
}
td { padding: 11px 0; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafaf9; }
.num { font-variant-numeric: tabular-nums; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.b-paid { background: var(--green-bg); color: var(--green); }
.b-open { background: var(--amber-bg); color: var(--amber); }
.b-late { background: var(--red-bg); color: var(--red); }
.b-draft { background: var(--line-soft); color: var(--muted); }

/* ---------------- Buttons ---------------- */

.btn {
  padding: 9px 16px; border-radius: 8px; font-size: 13px; font-weight: 500;
  border: 1px solid #ddd; background: #fff; color: var(--ink);
}
.btn:hover { background: var(--paper); }
.btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.btn:disabled { opacity: .45; cursor: default; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { filter: brightness(0.9); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-ghost { background: #fff; color: var(--ink); }
.btn-danger { border-color: #f0c8c2; color: var(--red); }
.btn-danger:hover { background: var(--red-bg); }

.mini {
  padding: 4px 9px; border: 1px solid #e0e0e0; background: #fff;
  border-radius: 6px; font-size: 12px; margin-left: 3px;
}
.mini:hover { background: var(--line-soft); }
.mini.del:hover { background: var(--red-bg); border-color: #f5c6c6; }

.row-end { display: flex; justify-content: flex-end; gap: 8px; }
.row-gap { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mt { margin-top: 14px; }

/* ---------------- Forms ---------------- */

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 4px; }
.fg { display: flex; flex-direction: column; gap: 5px; }
.fg.full { grid-column: 1 / -1; }
.fg label { font-size: 12px; color: var(--muted-2); font-weight: 500; }
.fg input, .fg select {
  padding: 8px 10px; border: 1px solid #ddd; border-radius: 8px; font-size: 13px; background: #fff;
}
.fg input:focus, .fg select:focus, .search:focus, .pos-desc:focus, .pos-preis:focus {
  outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(10,10,10,.07);
}
.fg input[readonly] { background: var(--paper); color: var(--muted-2); }

.search { padding: 8px 12px; border: 1px solid #ddd; border-radius: 8px; font-size: 13px; width: 260px; }

.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted-2); margin-top: 12px; }
.check input { width: 15px; height: 15px; accent-color: var(--accent); }

.muted { font-size: 13px; color: var(--muted-2); line-height: 1.6; margin-bottom: 14px; }
.muted.small { font-size: 12px; margin: 0; }
.empty { text-align: center; padding: 32px; color: #aaa; }

.banner {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: var(--amber-bg); color: var(--amber);
  padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 13px;
}
.banner[hidden] { display: none; }

.pill {
  font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 20px;
  background: var(--line-soft); color: var(--muted);
}
.pill.ok { background: var(--green-bg); color: var(--green); }

/* ---------------- Positions ---------------- */

.pos-row { display: grid; grid-template-columns: 1fr 150px 36px; gap: 8px; align-items: start; margin-bottom: 8px; }
.pos-head {
  display: grid; grid-template-columns: 1fr 150px 36px; gap: 8px;
  margin-bottom: 6px; font-size: 12px; color: var(--muted); font-weight: 500;
}
.pos-head span:nth-child(2) { text-align: right; }
.pos-desc {
  padding: 8px; border: 1px solid #ddd; border-radius: 8px; font-size: 13px;
  resize: vertical; min-height: 56px;
}
.pos-preis {
  padding: 8px; border: 1px solid #ddd; border-radius: 8px; font-size: 13px;
  height: 38px; text-align: right;
}
.pos-del { background: #fff; border: 1px solid #f5c6c6; color: var(--red); border-radius: 8px; height: 38px; }
.pos-del:hover { background: var(--red-bg); }
.pos-empty { color: #aaa; font-size: 13px; padding: 16px; text-align: center; }

.form-total {
  display: flex; justify-content: flex-end; align-items: baseline; gap: 16px;
  padding: 12px 4px; border-top: 1px solid var(--line); margin-top: 8px;
}
.ft-label { font-size: 14px; font-weight: 600; }
.ft-value { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------------- Clients ---------------- */

.client-card {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--line-soft);
}
.client-card:last-child { border-bottom: none; }
.cc-name { font-size: 14px; font-weight: 600; }
.cc-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------------- Wise ---------------- */

.dropzone {
  background: #f8f8f6; border: 1px dashed #ccc; border-radius: 10px;
  padding: 24px; text-align: center; margin-bottom: 16px;
}
.dropzone .muted { margin-top: 10px; }
.help { margin-top: 16px; font-size: 12px; color: var(--muted-2); }
.help summary { cursor: pointer; font-weight: 500; }
.help ol { margin: 10px 0 0 18px; line-height: 1.8; }

.notice { padding: 13px 15px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; line-height: 1.5; }
.notice.ok { background: var(--green-bg); color: var(--green); }
.notice.warn { background: var(--amber-bg); color: var(--amber); }
.notice.err { background: var(--red-bg); color: var(--red); }

/* ---------------- Settings ---------------- */

.asset-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.asset-box { border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.asset-label { font-size: 12px; color: var(--muted-2); font-weight: 500; margin-bottom: 10px; }
.asset-preview {
  height: 96px; border-radius: 8px; background: var(--paper);
  display: flex; align-items: center; justify-content: center; margin-bottom: 12px;
}
.asset-preview img { max-height: 80px; max-width: 90%; object-fit: contain; }

.path-row {
  display: flex; justify-content: space-between; align-items: center; gap: 14px;
  padding: 12px 0; border-bottom: 1px solid var(--line-soft);
}
.path-row:last-child { border-bottom: none; }
.path-label { font-size: 12px; color: var(--muted-2); font-weight: 500; }
.path-value {
  font-size: 12px; color: var(--muted); margin-top: 3px;
  word-break: break-all; font-family: 'Consolas', 'Courier New', monospace;
}
.app-footer { text-align: center; font-size: 11px; color: #bbb; padding: 8px 0 20px; }

/* ---------------- Modals ---------------- */

.modal-ov {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4);
  z-index: 100; align-items: center; justify-content: center; padding: 20px;
}
.modal-ov.open { display: flex; }
.modal-bx {
  background: #fff; border-radius: 14px; padding: 24px;
  width: 520px; max-width: 100%; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.modal-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.modal-t { font-size: 17px; font-weight: 600; }
.modal-bx .fg { margin-bottom: 14px; }
.modal-bx .form-grid { margin-bottom: 18px; }

.mail-summary {
  background: var(--paper); border-radius: 10px; padding: 14px;
  font-size: 13px; line-height: 1.7; margin-bottom: 16px;
}
.mail-summary b { font-variant-numeric: tabular-nums; }
.mail-attach {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--muted-2);
  background: var(--green-bg); color: var(--green);
  padding: 10px 12px; border-radius: 8px; margin-bottom: 14px;
}

/* ---------------- Toasts ---------------- */

.toasts {
  position: fixed; right: 18px; bottom: 18px; z-index: 200;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
}
.toast {
  background: var(--ink); color: #fff; padding: 11px 16px;
  border-radius: 9px; font-size: 13px; max-width: 380px;
  box-shadow: 0 8px 24px rgba(0,0,0,.22);
  animation: rise .18s ease-out;
}
.toast.ok { background: #14663d; }
.toast.err { background: #a5322a; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------------- Invoice preview sheet ---------------- */

.preview-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 12px; flex-wrap: wrap; }

#preview-area { display: flex; justify-content: center; }
#preview-area .empty { width: 100%; }

.inv-sheet {
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  padding: 40px 46px; width: 760px; max-width: 100%;
  font-size: 14px; color: var(--ink);
  box-shadow: 0 2px 10px rgba(0,0,0,.04);
}
.ih { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; gap: 24px; }
.ih-logo { width: 74px; height: 74px; object-fit: contain; margin-bottom: 10px; display: block; }
.ih-name { font-size: 21px; font-weight: 700; }
.ih-beruf { font-size: 11px; color: var(--muted); }
.dtbl { font-size: 11px; border-collapse: collapse; }
.dtbl td { padding: 2px 0; border: none; vertical-align: top; }
.dtbl td:first-child { color: #3a3a3a; padding-right: 16px; white-space: nowrap; }
.absender { font-size: 10px; color: var(--muted); margin-top: 6px; }
.abs-line { border: none; border-top: .5px solid #d8d8d8; width: 40%; margin: 4px 0 12px; }
.parties { display: flex; justify-content: space-between; margin-bottom: 18px; gap: 24px; }
.empf-name { font-size: 15px; font-weight: 700; }
.empf-addr { font-size: 13px; color: #3a3a3a; line-height: 1.6; margin-top: 3px; }
.inv-title-block { text-align: right; }
.inv-title { font-size: 20px; font-weight: 700; white-space: nowrap; }
.inv-title-sub { font-size: 10px; color: var(--muted); margin-top: 4px; line-height: 1.3; }
.anrede { font-size: 13px; color: #3a3a3a; line-height: 1.6; margin-bottom: 16px; }
.ptbl { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; }
.ptbl thead th {
  background: #f5f5f5; color: var(--muted); font-weight: 500; padding: 9px 8px;
  border: none; border-bottom: .8px solid var(--ink); text-transform: none; font-size: 12px;
}
.ptbl tbody td {
  padding: 11px 8px; border-bottom: .5px solid var(--line);
  vertical-align: top; color: var(--ink); word-wrap: break-word;
}
.stbl { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; margin-bottom: 6px; }
.stbl td { padding: 6px 8px; border: none; text-align: right; }
.stbl .s-saldo td { font-weight: 700; border-top: .8px solid var(--ink); font-size: 16px; padding-top: 10px; }
.wichtig {
  background: var(--ink); color: #fff; text-align: center;
  padding: 11px; border-radius: 5px; font-size: 13px; margin-bottom: 16px;
}
.sep { border: none; border-top: .5px solid #d8d8d8; margin: 0 0 14px; }
.bank-wrap { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; gap: 24px; }
.bank-info { font-size: 13px; color: #3a3a3a; line-height: 1.7; }
.bank-label { font-size: 10px; color: var(--muted); letter-spacing: .05em; margin-bottom: 6px; }
.qr-box { text-align: center; }
.qr-label { font-size: 9px; color: var(--muted); margin-bottom: 5px; }
.qr-img { width: 88px; height: 88px; object-fit: contain; }
.qr-wise { font-size: 10px; color: #00b9a0; font-weight: 700; margin-top: 4px; }
.qr-sub { font-size: 9px; color: var(--muted); }
.par19 { background: #f5f5f5; border-radius: 5px; padding: 10px 14px; font-size: 12px; color: #555; margin-bottom: 16px; }
.gruss { font-size: 13px; color: #3a3a3a; line-height: 1.6; }
.seite { text-align: right; font-size: 8px; color: #bbb; margin-top: 24px; border-top: .5px solid #eee; padding-top: 6px; }

/* ---------------- Responsive ---------------- */

@media (max-width: 860px) {
  .metrics { grid-template-columns: 1fr 1fr; }
  .form-grid, .asset-row { grid-template-columns: 1fr; }
  .search { width: 180px; }
  .tabs { flex-wrap: wrap; }
  .tab { flex: 1 1 30%; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------------- Alternative Sendewege ---------------- */

.alt-send {
  margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line);
  font-size: 13px;
}
.alt-send summary { cursor: pointer; font-weight: 500; color: var(--muted-2); }
.alt-send summary:hover { color: var(--ink); }
.alt-note { margin: 12px 0 !important; }
.alt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.alt-grid .btn { text-align: left; }
@media (max-width: 560px) { .alt-grid { grid-template-columns: 1fr; } }

/* ---------------- Einrichtung direkt im Sende-Dialog ---------------- */

.field-hint {
  font-size: 11px; color: var(--muted);
  margin-top: 5px; min-height: 14px;
}
.field-hint.ok { color: var(--green); }

.mail-setup {
  background: #f8f8f6;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 14px 12px;
  margin-bottom: 14px;
}
.mail-setup[hidden] { display: none; }
#mail-cc-row[hidden] { display: none; }
.mail-setup .fg { margin-bottom: 10px; }
.setup-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}

/* ---------------- Sprachumschalter ---------------- */

.lang-switch { position: relative; }

.lang-btn {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 11px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 8px;
  color: rgba(255, 255, 255, .9);
  font-size: 12px; font-weight: 600; letter-spacing: .03em;
  transition: background .16s, border-color .16s;
}
.lang-btn:hover { background: rgba(255, 255, 255, .11); border-color: rgba(255, 255, 255, .22); }
.lang-btn:focus-visible { outline: 2px solid rgba(0, 185, 160, .8); outline-offset: 2px; }
.lang-btn .flag { width: 18px; height: 12px; border-radius: 2px; display: block; box-shadow: 0 0 0 1px rgba(255,255,255,.15); }
.lang-code { min-width: 16px; text-align: left; }

.lang-menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: #fff; border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .18), 0 0 0 1px rgba(0, 0, 0, .06);
  padding: 6px; min-width: 168px; z-index: 80;
}
.lang-menu[hidden] { display: none; }
.lang-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border-radius: 7px; border: none; background: none;
  font-size: 13px; color: var(--ink); text-align: left; white-space: nowrap;
}
.lang-item:hover { background: var(--paper); }
.lang-item.active { background: #eef8f6; font-weight: 600; }
.lang-item .flag { width: 20px; height: 13px; border-radius: 2px; flex-shrink: 0; box-shadow: 0 0 0 1px rgba(0,0,0,.08); }
.lang-item .lang-name { flex: 1; }
.lang-item .lang-code2 { font-size: 10px; color: var(--muted); font-weight: 600; }

/* ---------------- Culoarea de accent ---------------- */

.color-switch { position: relative; }

.color-btn {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 11px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 8px;
  transition: background .16s, border-color .16s;
}
.color-btn:hover { background: rgba(255, 255, 255, .11); border-color: rgba(255, 255, 255, .22); }
.color-btn:focus-visible { outline: 2px solid rgba(255, 255, 255, .8); outline-offset: 2px; }
.color-btn .swatch {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 1px rgba(255,255,255,.3);
}

.color-menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: #fff; border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .18), 0 0 0 1px rgba(0, 0, 0, .06);
  padding: 6px; min-width: 168px; z-index: 80;
}
.color-menu[hidden] { display: none; }
.color-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border-radius: 7px; border: none; background: none;
  font-size: 13px; color: var(--ink); text-align: left; white-space: nowrap;
}
.color-item:hover { background: var(--paper); }
.color-item.active { background: var(--paper); font-weight: 600; }
.color-item .swatch { width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 0 1px rgba(0,0,0,.12); }
.color-item .color-name { flex: 1; }

/* ---------------- App-Passwort-Karte (Zugang) ---------------- */

.pw-card {
  margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line);
}
.pw-status-row { display: flex; align-items: center; gap: 9px; }
.pw-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  background: #d8d8d4; box-shadow: 0 0 0 3px rgba(0,0,0,.04);
}
.pw-dot.ready { background: var(--green); box-shadow: 0 0 0 3px rgba(26,122,74,.14); }
.pw-status-text { font-size: 13px; color: var(--muted-2); }

.pw-form {
  margin-top: 14px; padding: 14px;
  background: #f8f8f6; border: 1px solid var(--line); border-radius: 10px;
}
.pw-form .fg { margin-bottom: 10px; }
.pw-form[hidden] { display: none; }

.pw-history { margin-top: 14px; font-size: 12.5px; }
.pw-history summary { cursor: pointer; color: var(--muted-2); font-weight: 500; }
.pw-history summary:hover { color: var(--ink); }
.pw-history ul { list-style: none; margin: 10px 0 0; padding: 0; }
.pw-history li {
  padding: 7px 0; border-bottom: 1px solid var(--line-soft);
  color: var(--muted); display: flex; align-items: center; gap: 7px;
}
.pw-history li:last-child { border-bottom: none; }
.pw-history li::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: #ccc; flex-shrink: 0; }
.pw-history li.act-removed::before { background: #e3a9a2; }
.pw-history li.act-restored::before { background: #7fc4a8; }

/* toast with a separate "Rückgängig" (undo) action */
.toast-action {
  display: flex; align-items: center; gap: 12px;
}
.toast-action button {
  background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .28);
  color: #fff; padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 600;
  flex-shrink: 0;
}
.toast-action button:hover { background: rgba(255, 255, 255, .26); }

.tb-slogan { font-size: 11px; font-weight: 500; color: rgba(255,255,255,.42); letter-spacing: .01em; margin-left: 10px; padding-left: 10px; border-left: 1px solid rgba(255,255,255,.16); white-space: nowrap; }
.tb-version { font-size: 10.5px; font-weight: 500; color: rgba(255,255,255,.32); letter-spacing: .02em; margin-left: 2px; }

/* ---------------- USt-IdNr. / Umsatzsteuer ---------------- */

.check-inline { margin-top: 0; margin-bottom: 8px; }
.notice.mt { margin-top: 14px; }

/* defalcarea din formular, sub total */
.form-vat {
  display: flex; justify-content: flex-end; gap: 16px;
  font-size: 12.5px; color: var(--muted);
  padding: 2px 4px;
}
.form-vat span:last-child { font-variant-numeric: tabular-nums; min-width: 92px; text-align: right; }
.form-vat[hidden] { display: none; }

/* ---------------- Erststart: Willkommen & Einrichtung ---------------- */

.welcome-ov { background: rgba(10, 10, 12, .72); }
.welcome-bx { width: 620px; padding: 30px; }

.welcome-head { display: flex; align-items: center; gap: 15px; margin-bottom: 22px; }
.welcome-mark {
  width: 46px; height: 46px; border-radius: 11px; flex-shrink: 0;
  background: linear-gradient(145deg, #2c2c33, #131316);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; letter-spacing: .05em;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14);
}
.welcome-title { font-size: 19px; font-weight: 600; letter-spacing: -.01em; }
.welcome-sub { font-size: 13px; color: var(--muted-2); margin-top: 3px; line-height: 1.5; }

.welcome-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.welcome-card {
  display: flex; flex-direction: column; gap: 6px; text-align: left;
  padding: 17px; border: 1px solid var(--line); border-radius: 11px;
  background: #fff; transition: border-color .16s, box-shadow .16s, transform .16s;
}
.welcome-card:hover {
  border-color: #c9c9c4;
  box-shadow: 0 4px 14px rgba(0,0,0,.07);
  transform: translateY(-1px);
}
.welcome-card:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.wc-title { font-size: 14px; font-weight: 600; }
.wc-text { font-size: 12.5px; color: var(--muted-2); line-height: 1.5; }

.welcome-lang {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-size: 12px; color: var(--muted);
  border-top: 1px solid var(--line-soft); padding-top: 16px;
}
.welcome-lang select {
  padding: 5px 9px; border: 1px solid #ddd; border-radius: 7px; font-size: 12.5px; background: #fff;
}

.setup-step { font-size: 12px; color: var(--muted); font-weight: 500; }
.setup-page { margin-bottom: 6px; }
.setup-note { margin: 8px 0 0 !important; }
.setup-foot {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line-soft);
}

/* eticheta discreta cat timp ruleaza pe date de exemplu */
.demo-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  background: rgba(255, 212, 121, .16); color: #ffd479;
  border: 1px solid rgba(255, 212, 121, .3);
  padding: 3px 9px; border-radius: 20px; margin-left: 4px;
}
.demo-badge[hidden] { display: none; }

@media (max-width: 620px) {
  .welcome-choices { grid-template-columns: 1fr; }
  .welcome-bx { padding: 22px; }
}

/* ---------------- XRechnung-Leser ---------------- */
.xr-tag { font-size: 11px; color: var(--muted-2); letter-spacing: .03em; }
.xr-drop { border: 1.5px dashed var(--line); border-radius: 10px; padding: 36px 20px; text-align: center; cursor: pointer; background: var(--card); transition: border-color .15s, background .15s; }
.xr-drop.hover { border-color: var(--ink); background: var(--line-soft); }
.xr-drop p { margin: 4px 0; color: var(--muted-2); }
.xr-drop .xr-big { color: var(--ink); font-size: 16px; margin-bottom: 6px; }
.xr-pick { margin-top: 10px; display: inline-block; }
.xr-center { text-align: center; margin-top: 12px; }
.xr-link { background: none; border: none; color: var(--muted-2); text-decoration: underline; font-size: 12px; padding: 4px; }
#xr-paste-area { margin-top: 10px; }
#xr-paste { width: 100%; height: 140px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; font-family: Consolas, monospace; font-size: 12px; resize: vertical; margin-bottom: 8px; }
.xr-error { margin-top: 14px; padding: 12px 14px; background: var(--red-bg); border-left: 3px solid var(--red); color: var(--red); font-size: 13px; border-radius: 6px; }
.xr-badges { display: flex; align-items: center; gap: 10px; margin: 6px 0 16px; flex-wrap: wrap; }
.xr-badge { font-size: 11px; letter-spacing: .04em; padding: 4px 9px; border-radius: 6px; color: var(--green); background: var(--green-bg); font-weight: 600; }
.xr-filename { font-size: 12px; color: var(--muted-2); }
.xr-card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 28px 26px; }
.xr-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: 18px; margin-bottom: 20px; }
.xr-title { font-size: 24px; font-weight: 600; }
.xr-num { font-size: 13px; color: var(--muted-2); margin-top: 6px; }
.xr-meta { text-align: right; font-size: 13px; color: var(--muted-2); line-height: 1.7; }
.xr-meta b { color: var(--ink); }
.xr-parties { display: flex; gap: 28px; flex-wrap: wrap; margin-bottom: 22px; }
.xr-party { flex: 1; min-width: 220px; }
.xr-party h3, .xr-pay h3 { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-2); font-weight: 600; margin-bottom: 8px; }
.xr-name { font-size: 15px; font-weight: 600; margin-bottom: 3px; }
.xr-line { color: var(--muted-2); line-height: 1.5; }
.xr-mono { font-size: 12px; color: var(--muted-2); margin-top: 4px; }
.xr-items { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
.xr-items th { text-align: left; font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-2); border-bottom: 1px solid var(--ink); padding: 6px 8px 8px; }
.xr-items td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.xr-items .num { text-align: right; white-space: nowrap; }
.xr-totals { margin-left: auto; width: 280px; max-width: 100%; }
.xr-row { display: flex; justify-content: space-between; padding: 5px 0; }
.xr-row.grand { border-top: 1.5px solid var(--ink); margin-top: 6px; padding-top: 10px; font-weight: 700; font-size: 16px; }
.xr-pay { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.xr-row2 { font-size: 13px; margin-bottom: 3px; }
.xr-row2 .k { color: var(--muted-2); display: inline-block; min-width: 110px; }
#xr-raw { margin-top: 14px; background: #1c1f26; color: #d9dce1; padding: 16px; border-radius: 8px; font-size: 11px; line-height: 1.6; max-height: 420px; overflow: auto; white-space: pre-wrap; word-break: break-all; }

.xr-toclient { margin-top: 10px; }
.xr-arow { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.xr-arow:last-child { border-bottom: none; }
.xr-aname { font-weight: 600; }
.xr-ameta { font-size: 12px; color: var(--muted-2); margin-top: 2px; }

/* ---------------- Ecran ingust (telefon, fereastra foarte mica) ----------------
   Sub 640 px bara de sus se rupe pe doua randuri, iar taburile se deruleaza
   orizontal in loc sa impinga pagina peste latimea ecranului. */
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; gap: 10px; padding: 10px 16px; }
  .tb-slogan { display: none; }
  .tb-actions { flex-wrap: wrap; width: 100%; }
  .tabs { overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: 0 0 auto; padding: 10px 12px; white-space: nowrap; }
  .search { width: 100%; }
  .welcome-bx { padding: 22px 18px; }
  /* tabelul de facturi se deruleaza in card, nu impinge pagina */
  .card:has(> table) { overflow-x: auto; }
  .card:has(> table) > table { min-width: 640px; }
  /* bara inalta pe doua randuri ar ocupa o treime din ecran daca ar ramane lipita sus */
  .topbar { position: static; }
}
