/* vault — Mobile First */
:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-2: #334155;
  --border: #475569;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent-strong: #0ea5e9;
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text);
  font-size: 16px; -webkit-font-smoothing: antialiased;
  min-height: 100vh; min-height: 100dvh;
}

body {
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* Layout */
.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px 80px;
}

header.app-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
header.app-header h1 {
  margin: 0; font-size: 18px; font-weight: 700;
  letter-spacing: -.01em;
}
header.app-header .session-info {
  font-size: 12px; color: var(--muted);
}

/* Cards & Lists */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}

.list-item {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background .15s;
}
.list-item:active { background: var(--surface-2); }
.list-item .meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.list-item .title { font-weight: 600; font-size: 15px; }

/* Forms — large touch targets */
input, textarea, select {
  width: 100%; padding: 14px 16px;
  font-size: 16px;        /* prevents iOS zoom */
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  outline: none;
  font-family: inherit;
}
input:focus, textarea:focus { border-color: var(--accent); }

label {
  display: block;
  margin: 14px 0 6px;
  font-weight: 600; font-size: 14px;
  color: var(--text);
}
label .hint { color: var(--muted); font-weight: 400; font-size: 12px; }

textarea { min-height: 88px; resize: vertical; }

button {
  display: block; width: 100%; padding: 14px;
  font-size: 16px; font-weight: 600;
  background: var(--accent-strong); color: #fff;
  border: none; border-radius: 10px;
  cursor: pointer; transition: opacity .15s;
  font-family: inherit;
  min-height: 48px;
}
button:active { opacity: .85; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
button.danger { background: var(--danger); }
button.compact { width: auto; padding: 10px 16px; min-height: 40px; font-size: 14px; }

/* FAB für Add */
.fab {
  position: fixed;
  bottom: calc(20px + env(safe-area-inset-bottom));
  right: 20px;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--accent-strong); color: #fff;
  font-size: 28px; line-height: 56px; text-align: center;
  border: none; cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
  z-index: 100;
  padding: 0;
}

/* Modal */
.modal-bg {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .7);
  z-index: 200;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal-bg.center { align-items: center; }
.modal-bg.hidden { display: none; }
.modal {
  background: var(--surface);
  border-radius: 16px 16px 0 0;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  width: 100%; max-width: 480px;
  max-height: 92vh; overflow-y: auto;
  box-shadow: 0 -8px 32px rgba(0,0,0,.5);
}
.modal-bg.center .modal { border-radius: 16px; max-height: 88vh; }
.modal h2 { margin: 0 0 12px; font-size: 18px; }

/* Tabs */
.tabs {
  display: flex; gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 16px;
}
.tabs button {
  flex: 1; background: transparent; color: var(--muted);
  font-size: 14px; padding: 10px; min-height: auto;
  border-radius: 6px;
}
.tabs button.active { background: var(--accent-strong); color: #fff; }

/* Status */
.banner { padding: 12px 14px; border-radius: 8px; margin-bottom: 12px; font-size: 14px; }
.banner.error { background: rgba(239,68,68,.15); color: #fca5a5; border: 1px solid rgba(239,68,68,.3); }
.banner.success { background: rgba(16,185,129,.15); color: #6ee7b7; border: 1px solid rgba(16,185,129,.3); }
.banner.warn { background: rgba(245,158,11,.15); color: #fcd34d; border: 1px solid rgba(245,158,11,.3); }
.banner.info { background: rgba(56,189,248,.1); color: #7dd3fc; border: 1px solid rgba(56,189,248,.3); }

/* Code/Mono */
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; word-break: break-all; }

.qr-box {
  background: #fff; padding: 12px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  margin: 12px 0;
}
.qr-box svg { display: block; width: 100%; height: auto; }

/* Empty state */
.empty {
  text-align: center; padding: 48px 24px;
  color: var(--muted);
}
.empty .icon { font-size: 48px; margin-bottom: 12px; }

.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* Audit Row */
.audit-row {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.audit-row .ts { color: var(--muted); font-size: 11px; }
.audit-row .action { font-weight: 600; }

/* Login screen */
.login-wrap {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 22px;
}
.login-card h1 { margin: 0 0 4px; font-size: 24px; text-align: center; }
.login-card .sub { text-align: center; color: var(--muted); font-size: 14px; margin-bottom: 20px; }

/* Responsive: Tablet+ */
@media (min-width: 600px) {
  .container { max-width: 600px; padding: 24px; }
  header.app-header { border-radius: 0 0 12px 12px; }
}

/* No-select for sensitive fields */
.no-select { user-select: none; -webkit-user-select: none; }
