/* --------------------------------------------------------------------------
   Monero Webinterface
   Bewusst ohne externe Schriften, CDNs oder Trackerskripte: der Browser
   laedt ausschliesslich Dateien von deinem eigenen Server.
   -------------------------------------------------------------------------- */

:root {
  --bg:            #F7F6F3;
  --surface:       #FFFFFF;
  --surface-2:     #F0EEE9;
  --border:        #E1DDD4;
  --border-strong: #C9C2B4;
  --ink:           #1E1C18;
  --ink-2:         #4C463D;
  --muted:         #7A7264;
  --accent:        #A85200;
  --accent-ink:    #FFFFFF;
  --accent-soft:   #F6E9DA;
  --in:            #26663C;
  --in-soft:       #E4F0E7;
  --out:           #8A4B12;
  --out-soft:      #F6EADC;
  --danger:        #9E1339;
  --danger-soft:   #FAE5EB;
  --warn:          #8A6100;
  --warn-soft:     #F8EFD6;
  --radius:        10px;
  --shadow:        0 1px 2px rgba(30,28,24,.05), 0 6px 20px rgba(30,28,24,.06);

  --f-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --f-mono: ui-monospace, "SF Mono", "Cascadia Mono", "JetBrains Mono", Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:            #131210;
    --surface:       #1C1A16;
    --surface-2:     #232019;
    --border:        #322E26;
    --border-strong: #4A4438;
    --ink:           #ECE7DC;
    --ink-2:         #CBC4B5;
    --muted:         #948C7E;
    --accent:        #E8933C;
    --accent-ink:    #1A1509;
    --accent-soft:   #2B2317;
    --in:            #7FC48D;
    --in-soft:       #172318;
    --out:           #E0A468;
    --out-soft:      #2A2115;
    --danger:        #E9829B;
    --danger-soft:   #2D1A1F;
    --warn:          #DFB55A;
    --warn-soft:     #292213;
    --shadow:        0 1px 2px rgba(0,0,0,.35), 0 6px 20px rgba(0,0,0,.28);
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-ui);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.break { word-break: break-all; }

/* ------------------------------------------------------------------ Topbar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1000px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 650;
  letter-spacing: .01em;
  color: var(--accent);
}
.brand span { color: var(--ink); }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 550;
  padding: 4px 11px 4px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.pill[data-state="ok"]   { color: var(--in);     background: var(--in-soft);   border-color: transparent; }
.pill[data-state="sync"] { color: var(--warn);   background: var(--warn-soft); border-color: transparent; }
.pill[data-state="err"]  { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.pill[data-state="sync"] .dot { animation: pulse 1.6s ease-in-out infinite; }

@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .3 } }
@media (prefers-reduced-motion: reduce) { .pill[data-state="sync"] .dot { animation: none } }

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

.wrap {
  max-width: 1000px;
  margin: 0 auto;
  padding: 24px 20px 72px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.panel .card + .card { margin-top: 18px; }

.card-label {
  margin: 0;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}

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

.hint { margin: 10px 0 0; font-size: 13.5px; color: var(--muted); }

/* ----------------------------------------------------------------- Guthaben */

.balance-card { padding: 24px; }
.balance {
  margin: 10px 0 18px;
  font-family: var(--f-mono);
  font-size: clamp(30px, 7vw, 44px);
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.balance .pending-note { font-family: var(--f-ui); font-size: .42em; font-weight: 500; color: var(--muted); }
.balance .unit { font-size: .45em; color: var(--muted); margin-left: .35em; font-weight: 500; }

.balance-split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.balance-split > div { background: var(--surface); padding: 11px 14px; }
.balance-split .k {
  display: block;
  font-size: 11px;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
}
.balance-split .v {
  display: block;
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  font-weight: 550;
  margin-top: 2px;
}

.skeleton {
  display: inline-block;
  background: var(--surface-2);
  border-radius: 6px;
  animation: shimmer 1.4s ease-in-out infinite;
}
.skeleton-lg { width: 280px; max-width: 70%; height: 1em; vertical-align: middle; }
@keyframes shimmer { 0%,100% { opacity: 1 } 50% { opacity: .45 } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none } }

/* --------------------------------------------------------------------- Sync */

.sync-card { border-color: var(--border-strong); }
.sync-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.sync-head .mono { font-size: 13px; color: var(--muted); }
.sync-row { display: grid; grid-template-columns: 56px 1fr auto; align-items: center; gap: 12px; margin-top: 9px; }
.sync-name { font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.sync-num { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.bar-fill.wait { background: var(--border-strong); }
.bar-fill.done { background: var(--in); }
.bar { height: 7px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width .5s ease; }

/* Breite als Klasse statt als style-Attribut. Die Content-Security-Policy
   erlaubt kein Inline-CSS, und das soll sie auch nicht. */
.w-0{width:0%}.w-1{width:1%}.w-2{width:2%}.w-3{width:3%}.w-4{width:4%}.w-5{width:5%}.w-6{width:6%}.w-7{width:7%}.w-8{width:8%}.w-9{width:9%}
.w-10{width:10%}.w-11{width:11%}.w-12{width:12%}.w-13{width:13%}.w-14{width:14%}.w-15{width:15%}.w-16{width:16%}.w-17{width:17%}.w-18{width:18%}.w-19{width:19%}
.w-20{width:20%}.w-21{width:21%}.w-22{width:22%}.w-23{width:23%}.w-24{width:24%}.w-25{width:25%}.w-26{width:26%}.w-27{width:27%}.w-28{width:28%}.w-29{width:29%}
.w-30{width:30%}.w-31{width:31%}.w-32{width:32%}.w-33{width:33%}.w-34{width:34%}.w-35{width:35%}.w-36{width:36%}.w-37{width:37%}.w-38{width:38%}.w-39{width:39%}
.w-40{width:40%}.w-41{width:41%}.w-42{width:42%}.w-43{width:43%}.w-44{width:44%}.w-45{width:45%}.w-46{width:46%}.w-47{width:47%}.w-48{width:48%}.w-49{width:49%}
.w-50{width:50%}.w-51{width:51%}.w-52{width:52%}.w-53{width:53%}.w-54{width:54%}.w-55{width:55%}.w-56{width:56%}.w-57{width:57%}.w-58{width:58%}.w-59{width:59%}
.w-60{width:60%}.w-61{width:61%}.w-62{width:62%}.w-63{width:63%}.w-64{width:64%}.w-65{width:65%}.w-66{width:66%}.w-67{width:67%}.w-68{width:68%}.w-69{width:69%}
.w-70{width:70%}.w-71{width:71%}.w-72{width:72%}.w-73{width:73%}.w-74{width:74%}.w-75{width:75%}.w-76{width:76%}.w-77{width:77%}.w-78{width:78%}.w-79{width:79%}
.w-80{width:80%}.w-81{width:81%}.w-82{width:82%}.w-83{width:83%}.w-84{width:84%}.w-85{width:85%}.w-86{width:86%}.w-87{width:87%}.w-88{width:88%}.w-89{width:89%}
.w-90{width:90%}.w-91{width:91%}.w-92{width:92%}.w-93{width:93%}.w-94{width:94%}.w-95{width:95%}.w-96{width:96%}.w-97{width:97%}.w-98{width:98%}.w-99{width:99%}
.w-100{width:100%}
@media (prefers-reduced-motion: reduce) { .bar-fill { transition: none } }

/* --------------------------------------------------------------------- Tabs */

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); }
.tab {
  appearance: none;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font: inherit;
  font-size: 14.5px;
  font-weight: 550;
  padding: 9px 14px;
  margin-bottom: -1px;
  cursor: pointer;
  border-radius: 6px 6px 0 0;
}
.tab:hover { color: var(--ink); background: var(--surface-2); }
.tab.is-active { color: var(--accent); border-bottom-color: var(--accent); background: transparent; }

.panel { display: none; }
.panel.is-active { display: block; }

/* ---------------------------------------------------------------- Segmented */

.seg { display: inline-flex; background: var(--surface-2); border-radius: 7px; padding: 2px; gap: 2px; }
.seg-btn {
  appearance: none; border: 0; background: transparent; color: var(--muted);
  font: inherit; font-size: 13px; font-weight: 550;
  padding: 4px 11px; border-radius: 5px; cursor: pointer;
}
.seg-btn.is-active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* ------------------------------------------------------------------ Tabelle */

.table-scroll { overflow-x: auto; margin: 0 -20px -20px; padding: 0 20px; }
table.tx { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 14.5px; }
table.tx th {
  text-align: left; font-size: 11px; letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--border);
}
table.tx td { padding: 11px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.tx tr:last-child td { border-bottom: 0; }
table.tx td.empty { text-align: center; color: var(--muted); padding: 28px 10px; }

.arrow {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 8px; font-size: 14px; font-weight: 700;
}
.arrow.in  { background: var(--in-soft);  color: var(--in); }
.arrow.out { background: var(--out-soft); color: var(--out); }

.amount { font-family: var(--f-mono); font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.amount.in  { color: var(--in); }
.amount.out { color: var(--ink); }
.fee { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }

.badge {
  display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 9px;
  border-radius: 999px; white-space: nowrap;
}
.badge.ok      { background: var(--in-soft);     color: var(--in); }
.badge.pending { background: var(--warn-soft);   color: var(--warn); }
.badge.failed  { background: var(--danger-soft); color: var(--danger); }

.txid { font-family: var(--f-mono); font-size: 12.5px; color: var(--muted); }
.txid button {
  appearance: none; border: 0; background: transparent; color: var(--accent);
  font: inherit; font-size: 12px; cursor: pointer; padding: 0 0 0 8px;
}

/* ---------------------------------------------------------------- Empfangen */

.receive { display: flex; gap: 22px; align-items: flex-start; flex-wrap: wrap; margin-top: 14px; }
.qr-box {
  flex: none; background: #FFFFFF; padding: 10px; border-radius: 8px;
  border: 1px solid var(--border); line-height: 0;
}
.qr-box img { display: block; width: 180px; height: 180px; image-rendering: pixelated; }
.receive-body { flex: 1 1 260px; min-width: 0; }
.addr {
  font-size: 14px; word-break: break-all; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 8px; padding: 11px 13px; margin: 0 0 12px;
}
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; }

/* ------------------------------------------------------------------ Formular */

label {
  display: block; font-size: 13px; font-weight: 600; color: var(--ink-2);
  margin: 16px 0 6px;
}
input[type="text"], input[type="password"], select {
  width: 100%; font: inherit; font-size: 15px;
  color: var(--ink); background: var(--bg);
  border: 1px solid var(--border-strong); border-radius: 8px;
  padding: 10px 12px;
}
input.mono { font-family: var(--f-mono); font-size: 14px; }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
input[aria-invalid="true"] { border-color: var(--danger); }

.field-note { min-height: 18px; margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.field-note.ok  { color: var(--in); }
.field-note.bad { color: var(--danger); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .grid-2 { grid-template-columns: 1fr } }

.check { display: flex; align-items: center; gap: 9px; margin: 18px 0 0; font-weight: 500; color: var(--ink-2); }
.check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }

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

.btn {
  appearance: none; font: inherit; font-weight: 600; font-size: 14.5px;
  border-radius: 8px; padding: 10px 18px; cursor: pointer;
  border: 1px solid transparent; text-decoration: none; display: inline-block;
  line-height: 1.3;
}
.btn-sm { font-size: 13px; padding: 6px 12px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn-ghost { background: transparent; color: var(--ink-2); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-danger { background: var(--danger); color: #FFFFFF; }
.btn-danger:hover:not(:disabled) { filter: brightness(1.08); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
#sendForm .btn-primary { margin-top: 20px; }

/* --------------------------------------------------------------------- Modal */

.modal {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(12,10,8,.6);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal[hidden] { display: none; }
.modal-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 24px; max-width: 460px; width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.modal-card h2 { margin: 0 0 10px; font-size: 20px; }
.modal-warn {
  margin: 0 0 18px; font-size: 13.5px; color: var(--danger);
  background: var(--danger-soft); border-radius: 8px; padding: 10px 13px;
}
.confirm-list { margin: 0 0 22px; display: flex; flex-direction: column; gap: 1px; background: var(--border);
  border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.confirm-list > div { background: var(--surface); padding: 10px 13px; display: flex; justify-content: space-between; gap: 14px; }
.confirm-list dt { font-size: 12.5px; color: var(--muted); flex: none; }
.confirm-list dd { margin: 0; font-size: 14px; text-align: right; min-width: 0; }
.confirm-list .sum { background: var(--surface-2); font-weight: 650; }
.modal-btns { display: flex; gap: 10px; justify-content: flex-end; }

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

.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 80; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--surface); border: 1px solid var(--border-strong);
  border-left: 3px solid var(--accent);
  border-radius: 8px; padding: 11px 15px; font-size: 14px; max-width: 380px;
  box-shadow: var(--shadow);
}
.toast.err { border-left-color: var(--danger); }
.toast.ok  { border-left-color: var(--in); }

/* --------------------------------------------------------------------- Login */

.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 32px; width: 100%; max-width: 380px; box-shadow: var(--shadow);
}
.login-card .brand { margin-bottom: 20px; }
.login-card h1 { margin: 0 0 20px; font-size: 22px; }
.login-card .btn { width: 100%; margin-top: 22px; }
.login-foot { margin: 18px 0 0; font-size: 12.5px; color: var(--muted); text-align: center; }

.alert { border-radius: 8px; padding: 10px 13px; font-size: 14px; margin: 0 0 6px; }
.alert-error { background: var(--danger-soft); color: var(--danger); }

/* Unsichtbares Hilfsfeld fuer den Kopier-Fallback, ebenfalls ohne Inline-Style. */
.offscreen { position: fixed; top: -9999px; left: -9999px; opacity: 0; }