/*
 * QuickLogin Vault — stylesheet
 * Loaded as an external file so the CSP can stay at `style-src 'self'`.
 * No inline `style=""` attributes exist anywhere in this project.
 */

:root {
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-light: rgba(59, 130, 246, 0.15);
  --secondary: #8b5cf6;
  --secondary-hover: #7c3aed;
  --bg: #f1f5f9;
  --surface: #ffffff;
  --text-main: #0f172a;
  --text-muted: #59677b; /* 5.0:1 on --bg, 5.6:1 on --surface (WCAG AA) */
  --border: #e2e8f0;
  --danger: #dc2626;
  --danger-light: rgba(220, 38, 38, 0.1);
  --success: #047857;
  --success-light: rgba(4, 120, 87, 0.12);
  --warning: #b45309;
  --warning-light: rgba(180, 83, 9, 0.12);
  --focus: #1d4ed8;
  --strength-0: #dc2626;
  --strength-1: #b45309;
  --strength-2: #1d4ed8;
  --strength-3: #047857;
  --strength-4: #065f46;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.02);
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

.dark-mode {
  --primary: #60a5fa;
  --primary-hover: #93c5fd;
  --primary-light: rgba(96, 165, 250, 0.2);
  --bg: #0f172a;
  --surface: #1e293b;
  --text-main: #f8fafc;
  --text-muted: #a3b1c6; /* 7.0:1 on --surface, 6.4:1 on --bg (WCAG AA) */
  --border: #334155;
  --danger: #fca5a5;
  --danger-light: rgba(248, 113, 113, 0.15);
  --success: #6ee7b7;
  --success-light: rgba(52, 211, 153, 0.15);
  --warning: #fcd34d;
  --warning-light: rgba(252, 211, 77, 0.15);
  --focus: #93c5fd;
  --strength-0: #fca5a5;
  --strength-1: #fcd34d;
  --strength-2: #93c5fd;
  --strength-3: #6ee7b7;
  --strength-4: #34d399;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.4);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text-main);
  margin: 0;
  padding: 24px;
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
  min-height: 100vh;
}

/* `hidden` must win over the display rules below. */
[hidden] {
  display: none !important;
}

/* ------------------------------------------------------------------ *
 * Focus visibility (WCAG 2.4.7 / F-17)
 * ------------------------------------------------------------------ */

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 6px;
}

input:focus,
button:focus {
  outline: none; /* replaced by the :focus-visible ring above */
}

input:focus-visible,
button:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 2000;
  background: var(--primary);
  color: #ffffff;
  padding: 12px 18px;
  border-radius: 0 0 var(--radius-sm) 0;
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  left: 0;
}

/* ------------------------------------------------------------------ *
 * Boot error (shown only when the app never booted)
 * ------------------------------------------------------------------ */

.boot-error {
  max-width: 840px;
  margin: 0 auto 24px;
  padding: 24px;
  border: 1px solid var(--danger);
  border-left-width: 6px;
  border-radius: var(--radius-sm);
  background: var(--danger-light);
  color: var(--text-main);
}

.boot-error h2 {
  margin-top: 0;
  font-size: 18px;
}

.boot-error code,
.boot-error pre {
  font-family: var(--font-mono);
  font-size: 13px;
}

.boot-error pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  overflow-x: auto;
}

/* Visible until app.js marks the document as ready. */
.boot-error {
  display: block;
}

html.qlv-ready .boot-error {
  display: none;
}

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

.app-container {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(300px, 380px) 1fr;
  align-items: stretch;
  gap: 32px;
}

.panel-add {
  position: sticky;
  top: 24px;
  align-self: start;
}

.panel-vault {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}

/* Right column stretches to match the left column's height instead of
   collapsing to its own (often much shorter) content height. */
.panel-vault > .card {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.topbar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.topbar-brand {
  text-align: center;
  padding: 0 16px;
  order: 2;
}

h1 {
  font-size: 36px;
  font-weight: 800;
  color: var(--text-main);
  margin: 0 0 16px 0;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.02em;
  transition: font-size 0.2s ease, margin 0.2s ease;
}

p.subtitle {
  color: var(--text-muted);
  font-size: 16px;
  margin: 0 auto;
  max-width: 540px;
}

.header-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  order: 1;
}

main {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* ------------------------------------------------------------------ *
 * Notice banner
 * ------------------------------------------------------------------ */

.notice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--warning);
  background: var(--warning-light);
  color: var(--text-main);
  font-size: 14px;
}

.notice svg {
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--warning);
}

.notice p {
  margin: 0;
}

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

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  border: 1px solid var(--border);
  transition: box-shadow 0.3s ease;
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}

.card-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.card-title svg {
  color: var(--primary);
  stroke-width: 2.5;
}

.badge {
  background: var(--primary-light);
  color: var(--primary);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid var(--border);
  white-space: nowrap;
}

/* ------------------------------------------------------------------ *
 * Vault search
 * ------------------------------------------------------------------ */

.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 20px;
}

.search-wrapper svg {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

input[type="search"] {
  width: 100%;
  padding: 12px 14px 12px 44px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-main);
  font-family: var(--font-sans);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

input[type="search"]::-webkit-search-cancel-button {
  cursor: pointer;
}

input[type="search"]:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-light);
  background: var(--surface);
  outline-offset: 0;
}

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

.form-group {
  margin-bottom: 14px;
  position: relative;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 12px 104px 12px 14px;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  background: var(--bg);
  color: var(--text-main);
  font-family: var(--font-sans);
}

input[type="text"]:focus-visible,
input[type="password"]:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-light);
  background: var(--surface);
  outline-offset: 0;
}

input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.icon-btn {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.icon-btn-left {
  right: 56px;
}

.icon-btn:hover {
  color: var(--primary);
  background: var(--primary-light);
}

/* ------------------------------------------------------------------ *
 * Generator panel + range slider
 * ------------------------------------------------------------------ */

.generator-panel {
  margin: 0 0 14px;
  padding: 12px 16px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.generator-legend {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0 6px;
}

.length-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.length-row label {
  margin-bottom: 0;
}

.length-stepper {
  display: flex;
  align-items: center;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
}

.stepper-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-main);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.stepper-btn:hover:not(:disabled) {
  background: var(--primary-light);
  color: var(--primary);
}

.stepper-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.length-stepper output {
  min-width: 44px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
}

.entropy-readout {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

.entropy-readout sub {
  font-size: 10px;
}

/* ------------------------------------------------------------------ *
 * Strength meter
 * ------------------------------------------------------------------ */

.strength-meter {
  --meter-color: var(--border);
  height: 8px;
  background: var(--border);
  margin-top: 8px;
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  gap: 3px;
}

.strength-meter[data-score="0"] {
  --meter-color: var(--strength-0);
}
.strength-meter[data-score="1"] {
  --meter-color: var(--strength-1);
}
.strength-meter[data-score="2"] {
  --meter-color: var(--strength-2);
}
.strength-meter[data-score="3"] {
  --meter-color: var(--strength-3);
}
.strength-meter[data-score="4"] {
  --meter-color: var(--strength-4);
}

.strength-segment {
  flex: 1;
  height: 100%;
  background: transparent;
  transition: background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.strength-segment.is-filled {
  background: var(--meter-color);
}

.strength-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

#strength-text {
  color: var(--text-muted);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 28px;
  font-size: 16px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  width: 100%;
  font-family: var(--font-sans);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease,
    background-color 0.2s ease, color 0.2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: #ffffff;
  box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 12px -2px rgba(59, 130, 246, 0.4);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text-main);
  border-color: var(--border);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-icon {
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease,
    color 0.2s ease;
}

.btn-icon:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-2px);
  color: var(--primary);
}

.btn-icon:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-icon--accent {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

/* ------------------------------------------------------------------ *
 * Stats
 * ------------------------------------------------------------------ */

.stats-banner {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 0;
}

.stat-card {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 20px;
  text-align: center;
  border: 1px solid var(--border);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
}

.stat-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 6px;
  line-height: 1.2;
}

.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-weight: 600;
}

/* ------------------------------------------------------------------ *
 * Vault entries
 * ------------------------------------------------------------------ */

.entries-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 10px;
  flex: 1;
  min-height: 0;
}

.entries-list.is-empty {
  justify-content: center;
}

.entry-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: slideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  transition: box-shadow 0.3s ease, transform 0.3s ease, border-color 0.3s ease;
}

.entry-item:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

/* Staggered entrance without inline styles. */
.entries-list > .entry-item:nth-child(1) { animation-delay: 0ms; }
.entries-list > .entry-item:nth-child(2) { animation-delay: 40ms; }
.entries-list > .entry-item:nth-child(3) { animation-delay: 80ms; }
.entries-list > .entry-item:nth-child(4) { animation-delay: 120ms; }
.entries-list > .entry-item:nth-child(5) { animation-delay: 160ms; }
.entries-list > .entry-item:nth-child(6) { animation-delay: 200ms; }
.entries-list > .entry-item:nth-child(7) { animation-delay: 240ms; }
.entries-list > .entry-item:nth-child(8) { animation-delay: 280ms; }
.entries-list > .entry-item:nth-child(9) { animation-delay: 320ms; }
.entries-list > .entry-item:nth-child(n + 10) { animation-delay: 360ms; }

.entry-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.entry-service-wrapper {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.entry-info {
  flex: 1;
  min-width: 0;
}

.entry-icon {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 700;
  font-size: 20px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.entry-service {
  font-weight: 700;
  font-size: 18px;
  color: var(--text-main);
  overflow-wrap: anywhere;
}

.entry-meta {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 2px;
}

.entry-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.entry-data-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 18px;
  font-size: 14px;
  transition: border-color 0.2s ease;
}

.entry-data-row:hover {
  border-color: var(--primary);
}

.entry-label {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  width: 80px;
  flex-shrink: 0;
  letter-spacing: 0.05em;
}

.entry-value {
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-right: auto;
  flex-grow: 1;
  min-width: 0;
}

.entry-value.is-masked {
  letter-spacing: 2px;
}

.entry-edit-input {
  flex: 1;
  width: 100%;
  min-width: 0;
  padding: 8px 12px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text-main);
  font-family: var(--font-sans);
}

/* Off-screen helper used by the legacy clipboard fallback. */
.copy-shim {
  position: fixed;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.entry-edit-input:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-light);
  outline-offset: 0;
}

.btn-mini-copy {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 14px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: var(--font-sans);
}

.btn-mini-copy:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

.btn-mini-copy.copied {
  background: var(--success-light);
  color: var(--success);
  border-color: var(--success);
}

.delete-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.delete-btn:hover {
  background: var(--danger-light);
  color: var(--danger);
  transform: rotate(5deg);
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 60px 20px;
  font-size: 16px;
}

.empty-state svg {
  width: 64px;
  height: 64px;
  color: var(--border);
  margin-bottom: 20px;
  opacity: 0.6;
}

/* ------------------------------------------------------------------ *
 * Lock panel + save status
 * ------------------------------------------------------------------ */

.lock-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  padding: 48px 20px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}

.lock-panel svg {
  width: 40px;
  height: 40px;
  color: var(--primary);
}

.lock-panel h3 {
  margin: 0;
  font-size: 18px;
  color: var(--text-main);
}

.lock-panel p {
  margin: 0;
  max-width: 420px;
}

.lock-panel .btn {
  width: auto;
  margin-top: 8px;
}

.save-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.save-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}

.save-status.is-saving .save-dot {
  background: var(--warning);
}

/* ------------------------------------------------------------------ *
 * Footer actions
 * ------------------------------------------------------------------ */

.footer-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 28px;
  border-top: 1px solid var(--border);
  padding-top: 28px;
}

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

.toast-container {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 1000;
  pointer-events: none;
  width: 90%;
  max-width: 420px;
}

.toast {
  background: var(--surface);
  color: var(--text-main);
  padding: 16px 24px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  transform: translateY(24px) scale(0.95);
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border);
  overflow-wrap: anywhere;
}

.toast.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.toast svg {
  flex-shrink: 0;
}

.toast.success {
  border-color: var(--success);
  box-shadow: 0 10px 15px -3px rgba(4, 120, 87, 0.2);
}

.toast.success svg {
  color: var(--success);
}

.toast.error {
  border-color: var(--danger);
  box-shadow: 0 10px 15px -3px rgba(220, 38, 38, 0.2);
}

.toast.error svg {
  color: var(--danger);
}

.toast.warning {
  border-color: var(--warning);
  box-shadow: 0 10px 15px -3px rgba(180, 83, 9, 0.2);
}

.toast.warning svg {
  color: var(--warning);
}

/* ------------------------------------------------------------------ *
 * Dialog
 * ------------------------------------------------------------------ */

.dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  background: var(--surface);
  color: var(--text-main);
  box-shadow: var(--shadow-lg);
  width: min(440px, calc(100vw - 32px));
}

.dialog::backdrop {
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
}

.dialog-body {
  padding: 28px;
}

.dialog-body h2 {
  margin: 0 0 8px;
  font-size: 20px;
}

.dialog-hint {
  margin: 0 0 20px;
  font-size: 14px;
  color: var(--text-muted);
}

.dialog-error {
  margin: 0 0 16px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--danger);
  background: var(--danger-light);
  color: var(--danger);
  font-size: 14px;
  font-weight: 600;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
}

.dialog input[type="password"] {
  padding-right: 16px;
}

.dialog .input-wrapper input[type="password"],
.dialog .input-wrapper input[type="text"] {
  padding-right: 48px;
}

.dialog-actions .btn {
  width: auto;
  padding: 12px 20px;
  font-size: 15px;
}

/* ------------------------------------------------------------------ *
 * Onboarding wizard (step 1-2: choose mode, create master password)
 * ------------------------------------------------------------------ */

.onboarding-dialog {
  position: relative;
  width: min(480px, calc(100vw - 32px));
}

.dialog-skip {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.dialog-skip:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.dialog-skip svg {
  width: 16px;
  height: 16px;
}

.stepper-dots {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 20px;
}

.stepper-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
  transition: width 150ms ease, border-radius 150ms ease;
}

.stepper-dot.is-active {
  width: 20px;
  border-radius: 4px;
  background: var(--primary);
}

.stepper-dot.is-done {
  background: var(--primary);
}

.stepper-connector {
  flex: 1;
  height: 2px;
  max-width: 32px;
  background: var(--border);
}

.stepper-connector.is-done {
  background: var(--primary);
}

.onboarding-choices {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.onboarding-choice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  width: 100%;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
}

.onboarding-choice:hover {
  border-color: var(--primary);
}

.onboarding-choice[aria-pressed="true"] {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 0 0 1px var(--primary);
}

.onboarding-choice-icon {
  color: var(--primary);
}

.onboarding-choice-title {
  font-weight: 600;
  font-size: 15px;
}

.onboarding-choice-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ------------------------------------------------------------------ *
 * Onboarding spotlight tour (step 3: generate + save the first entry)
 * ------------------------------------------------------------------ */

.onboarding-spotlight {
  position: fixed;
  inset: 0;
  z-index: 1500;
  pointer-events: none;
}

.onboarding-highlight {
  position: fixed;
  border-radius: 10px;
  outline: 2px solid var(--primary);
  outline-offset: 4px;
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.72);
  transition: top 200ms ease, left 200ms ease, width 200ms ease, height 200ms ease;
}

.onboarding-tooltip {
  position: fixed;
  max-width: 280px;
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-main);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  transition: top 200ms ease, left 200ms ease;
}

.onboarding-tooltip p {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.5;
}

.onboarding-tooltip-skip {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.onboarding-tooltip-skip:hover {
  color: var(--primary);
}

/* ------------------------------------------------------------------ *
 * SVG defaults
 * ------------------------------------------------------------------ */

svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
  stroke: currentColor;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

/* Desktop app shell: the whole app fits the viewport with no page-level
   scrollbar. The header collapses into a slim bar, and the add-credential
   panel and the credential list scroll internally instead of the page. */
@media (min-width: 901px) {
  html,
  body {
    height: 100%;
  }

  body {
    height: 100vh;
    padding: 12px 24px;
    overflow: hidden;
  }

  .app-container {
    height: 100%;
    gap: 14px;
    overflow: hidden;
  }

  .topbar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-shrink: 0;
  }

  .topbar-brand {
    text-align: left;
    padding: 0;
    order: 1;
  }

  .topbar-brand h1 {
    font-size: 22px;
    margin: 0;
  }

  .topbar-brand .subtitle {
    display: none;
  }

  .header-actions {
    order: 2;
  }

  .notice {
    flex-shrink: 0;
  }

  .main-grid {
    flex: 1;
    min-height: 0;
    gap: 24px;
  }

  .panel-add {
    position: static;
    align-self: stretch;
    overflow-y: auto;
  }

  .panel-vault {
    min-height: 0;
  }

  .entries-list {
    overflow-y: auto;
  }
}

@media (max-width: 900px) {
  .main-grid {
    grid-template-columns: 1fr;
  }

  .panel-add {
    position: static;
  }
}

@media (max-width: 768px) {
  .app-container,
  main {
    gap: 24px;
  }

  .card {
    padding: 24px;
  }

  .stats-banner {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  body {
    padding: 16px;
  }

  h1 {
    font-size: 28px;
  }

  .entry-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .entry-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .entry-data-row {
    flex-wrap: wrap;
  }

  .entry-label {
    width: 100%;
  }
}

/* ------------------------------------------------------------------ *
 * Preferences
 * ------------------------------------------------------------------ */

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

@media (forced-colors: active) {
  h1 {
    background: none;
    -webkit-text-fill-color: CanvasText;
    color: CanvasText;
  }

  .strength-segment {
    border: 1px solid CanvasText;
  }

  .strength-segment.is-filled {
    background: Highlight;
  }

  .toast,
  .card,
  .entry-item,
  .btn,
  .btn-icon {
    border: 1px solid CanvasText;
  }
}
