/* Datei-Tresor — eigenes Design: Tresor-Stahl + Schloss-Gold */
:root {
  --steel-900: #1e293b;
  --steel-800: #283548;
  --steel-700: #334155;
  --steel-600: #475569;
  --steel-500: #64748b;
  --steel-400: #94a3b8;
  --steel-300: #cbd5e1;
  --steel-200: #e2e8f0;
  --steel-100: #f1f5f9;
  --gold-600: #b8860b;
  --gold-500: #d4a017;
  --gold-400: #e0b94e;
  --gold-300: #f0d588;
  --ok: #15803d;
  --ok-bg: #dcfce7;
  --err: #b91c1c;
  --err-bg: #fee2e2;
  --warn: #b45309;

  --bg: var(--steel-100);
  --bg-elev: #ffffff;
  --bg-sunken: var(--steel-200);
  --text: var(--steel-900);
  --text-soft: var(--steel-600);
  --text-faint: var(--steel-500);
  --border: var(--steel-300);
  --border-strong: var(--steel-400);
  --accent: var(--steel-600);
  --accent-strong: var(--steel-700);
  --gold: var(--gold-600);

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 4px 18px rgba(30, 41, 59, 0.12);
  --shadow-sm: 0 2px 8px rgba(30, 41, 59, 0.08);
  --ring: 0 0 0 3px rgba(212, 160, 23, 0.45);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

[data-theme="dark"] {
  --bg: #0f172a;
  --bg-elev: #1e293b;
  --bg-sunken: #182238;
  --text: #f1f5f9;
  --text-soft: #cbd5e1;
  --text-faint: #94a3b8;
  --border: #334155;
  --border-strong: #475569;
  --accent: #64748b;
  --accent-strong: #94a3b8;
  --gold: var(--gold-400);
  --ok-bg: #14352236;
  --err-bg: #45191936;
  --shadow: 0 4px 22px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  display: flex;
  flex-direction: column;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--gold);
  color: #1e293b;
  padding: 10px 16px;
  border-radius: 0 0 var(--radius-sm) 0;
  z-index: 200;
  font-weight: 700;
}
.skip-link:focus { left: 0; }

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px clamp(14px, 4vw, 28px);
  background: linear-gradient(135deg, var(--steel-700), var(--steel-600));
  color: #fff;
  box-shadow: var(--shadow-sm);
  border-bottom: 2px solid var(--gold);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--gold-500), var(--gold-600));
  color: #1e293b;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.2);
  flex: none;
}
.brand-text { min-width: 0; }
.brand h1 {
  margin: 0;
  font-size: clamp(1.1rem, 3.6vw, 1.45rem);
  letter-spacing: 0.3px;
}
.brand-sub {
  margin: 0;
  font-size: 0.72rem;
  color: var(--steel-200);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Buttons */
.btn {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  cursor: pointer;
  transition: transform .08s ease, background .15s ease, box-shadow .15s ease;
  color: var(--text);
  background: var(--bg-elev);
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }

.btn-primary {
  background: linear-gradient(135deg, var(--gold-500), var(--gold-600));
  color: #1e293b;
  border-color: var(--gold-600);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; filter: none; }

.btn-block { width: 100%; padding: 13px; font-size: 1rem; }

.btn-ghost {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border-color: rgba(255,255,255,0.3);
}
.btn-ghost:hover { background: rgba(255,255,255,0.22); }

.btn-icon {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border-color: rgba(255,255,255,0.3);
  width: 42px; height: 42px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 1.15rem;
}
.btn-icon:hover { background: rgba(255,255,255,0.22); }
.theme-icon-dark { display: none; }
[data-theme="dark"] .theme-icon-light { display: none; }
[data-theme="dark"] .theme-icon-dark { display: inline; }

/* Main */
.app-main {
  flex: 1;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: clamp(16px, 4vw, 28px);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.notice {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 0.9rem;
  color: var(--text-soft);
  overflow-wrap: anywhere;
}
.notice strong { color: var(--text); }
.notice-warn {
  display: block;
  margin-top: 6px;
  color: var(--warn);
  font-weight: 600;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 6px;
  background: var(--bg-sunken);
  padding: 5px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.tab {
  flex: 1;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 11px 8px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.tab.is-active {
  background: var(--bg-elev);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.tab:focus-visible { outline: none; box-shadow: var(--ring); }

/* Panels */
.panel {
  display: none;
  flex-direction: column;
  gap: 16px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(16px, 4vw, 24px);
  box-shadow: var(--shadow-sm);
}
.panel.is-active { display: flex; }
.panel form { display: flex; flex-direction: column; gap: 14px; }

/* Dropzone */
.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-sunken);
  padding: clamp(20px, 6vw, 32px) 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.dropzone:hover, .dropzone:focus-visible {
  border-color: var(--gold);
  background: color-mix(in srgb, var(--gold) 7%, var(--bg-sunken));
  outline: none;
}
.dropzone.is-drag {
  border-color: var(--gold);
  background: color-mix(in srgb, var(--gold) 14%, var(--bg-sunken));
}
.dropzone.has-file { border-style: solid; border-color: var(--accent); }
.dropzone-inner { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.dz-icon { font-size: 2rem; }
.dz-title { margin: 0; font-weight: 600; color: var(--text); }
.dz-hint {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-faint);
  overflow-wrap: anywhere;
  max-width: 100%;
}
.dropzone.has-file .dz-hint { color: var(--accent-strong); font-weight: 600; }

/* Fields */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 0.85rem; font-weight: 600; color: var(--text-soft); }
.input {
  font-family: inherit;
  font-size: 1rem;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
}
.input:focus-visible { outline: none; box-shadow: var(--ring); border-color: var(--gold); }

.pw-wrap { position: relative; display: flex; }
.pw-wrap .input { padding-right: 46px; }
.pw-toggle {
  position: absolute;
  right: 4px; top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 6px 8px;
  border-radius: 8px;
  color: var(--text-faint);
}
.pw-toggle:hover { color: var(--text); }
.pw-toggle:focus-visible { outline: none; box-shadow: var(--ring); }

/* Passwortstärke */
.pw-meter {
  height: 7px;
  background: var(--bg-sunken);
  border-radius: 99px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.pw-meter-bar {
  height: 100%;
  width: 0%;
  background: var(--err);
  transition: width .25s ease, background .25s ease;
  border-radius: 99px;
}
.pw-strength { margin: -6px 0 0; font-size: 0.78rem; color: var(--text-faint); }

/* Progress */
.progress-wrap { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.progress {
  height: 12px;
  background: var(--bg-sunken);
  border-radius: 99px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold-500), var(--gold-400));
  transition: width .2s ease;
  border-radius: 99px;
}
.progress-label {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-soft);
  overflow-wrap: anywhere;
}

/* Result */
.result {
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.result.ok { background: var(--ok-bg); border: 1px solid var(--ok); color: var(--text); }
.result.err { background: var(--err-bg); border: 1px solid var(--err); color: var(--text); }
.result .result-title { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.result.ok .result-title { color: var(--ok); }
.result.err .result-title { color: var(--err); }
.result .dl-btn { align-self: flex-start; }

/* Info card */
.info-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(16px, 4vw, 22px);
  box-shadow: var(--shadow-sm);
}
.info-card h2 { margin: 0 0 10px; font-size: 1.05rem; }
.info-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 7px; }
.info-list li { font-size: 0.88rem; color: var(--text-soft); overflow-wrap: anywhere; }
.info-list code {
  background: var(--bg-sunken);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 0.82em;
}

/* Footer */
.app-footer {
  text-align: center;
  padding: 18px;
  color: var(--text-faint);
  font-size: 0.8rem;
}

/* Toasts */
.toast-wrap {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 300;
  width: min(420px, calc(100vw - 28px));
}
.toast {
  background: var(--steel-800);
  color: #fff;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  font-size: 0.9rem;
  border-left: 4px solid var(--gold);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .25s ease, transform .25s ease;
  overflow-wrap: anywhere;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.toast-ok { border-left-color: var(--ok); }
.toast.toast-err { border-left-color: var(--err); }

@media (max-width: 420px) {
  .brand-sub { display: none; }
  .btn { font-size: 0.9rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
