/* Tiện ích Văn phòng Pro v5.5 — Mobile-First Static Keygen Web App Stylesheet
 * Zero external fonts/CDNs. Designed for zero horizontal overflow from 360px to desktop. */

:root {
  --bg: #F4F6FA;
  --surface: #FFFFFF;
  --surface-2: #F8FAFC;
  --border: #E2E8F0;
  --border-strong: #CBD5E1;
  --text: #0F172A;
  --text-2: #475569;
  --text-muted: #64748B;

  --primary: #1D4ED8;
  --primary-hover: #1E40AF;
  --primary-soft: #EFF6FF;
  --primary-border: #93C5FD;

  --success: #059669;
  --success-hover: #047857;
  --success-soft: #ECFDF5;
  --success-border: #A7F3D0;

  --amber: #D97706;
  --amber-soft: #FFFBEB;
  --amber-border: #FCD34D;

  --indigo: #4F46E5;
  --indigo-soft: #EEF2FF;

  --danger: #DC2626;
  --danger-hover: #B91C1C;
  --danger-soft: #FEF2F2;
  --danger-border: #FECACA;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-card: 0 4px 16px -4px rgba(15, 23, 42, 0.07), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-modal: 0 20px 44px -10px rgba(15, 23, 42, 0.25);

  --radius-card: 16px;
  --radius-md: 12px;
  --radius-sm: 9px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

[data-theme="dark"] {
  --bg: #0B1120;
  --surface: #131C31;
  --surface-2: #1A2540;
  --border: #24324F;
  --border-strong: #33466B;
  --text: #F1F5F9;
  --text-2: #CBD5E1;
  --text-muted: #94A3B8;

  --primary: #3B82F6;
  --primary-hover: #2563EB;
  --primary-soft: rgba(59, 130, 246, 0.16);
  --primary-border: rgba(96, 165, 250, 0.55);

  --success: #10B981;
  --success-hover: #059669;
  --success-soft: rgba(16, 185, 129, 0.14);
  --success-border: rgba(52, 211, 153, 0.4);

  --amber: #F59E0B;
  --amber-soft: rgba(245, 158, 11, 0.14);
  --amber-border: rgba(251, 191, 36, 0.45);

  --indigo: #818CF8;
  --indigo-soft: rgba(129, 140, 248, 0.15);

  --danger: #EF4444;
  --danger-hover: #DC2626;
  --danger-soft: rgba(239, 68, 68, 0.14);
  --danger-border: rgba(248, 113, 113, 0.4);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-card: 0 6px 20px -4px rgba(0, 0, 0, 0.38);
  --shadow-modal: 0 24px 50px rgba(0, 0, 0, 0.6);
}

*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

.hidden { display: none !important; }

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

.shrink-0 { flex-shrink: 0; }
.muted { color: var(--text-muted); }

/* Main Centered Mobile Container */
.app-shell {
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  padding: 12px 14px 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Top Bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  flex-shrink: 0;
  display: block;
}

.brand-text {
  min-width: 0;
  flex: 1;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.brand-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ver-pill {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid var(--primary-border);
}

.brand-sub {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-green { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.dot-amber { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); }
.dot-muted { background: var(--text-muted); }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
  position: relative;
}

.icon-btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.icon-btn:active { transform: scale(0.95); }

.icon-btn-sm { width: 34px; height: 34px; border-radius: 9px; }

.vault-badge-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1.5px solid var(--surface);
}

.ico { width: 19px; height: 19px; }
.ico-lg { width: 26px; height: 26px; }
.ico-md { width: 20px; height: 20px; }
.ico-sm { width: 17px; height: 17px; }
.ico-xs { width: 14px; height: 14px; }

/* Theme icon visibility */
.ico-sun { display: none; }
.ico-moon { display: block; }
[data-theme="dark"] .ico-sun { display: block; }
[data-theme="dark"] .ico-moon { display: none; }

/* Alert Banner */
.alert-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 13px;
  border-radius: var(--radius-md);
  font-size: 13px;
}

.alert-banner p { margin: 3px 0 0; color: var(--text-2); }

.alert-warn {
  background: var(--amber-soft);
  border: 1px solid var(--amber-border);
  color: var(--amber);
}

/* Segmented Tabs */
.seg-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border-radius: 13px;
  background: var(--border);
  background: color-mix(in srgb, var(--border) 70%, transparent);
}

.seg-tab {
  min-height: 40px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-2);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  padding: 0 8px;
  transition: background-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.seg-tab.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.tab-count {
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
}

/* Cards & Stacks */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 15px;
  box-shadow: var(--shadow-card);
  min-width: 0;
}

.stack-md { display: flex; flex-direction: column; gap: 13px; }
.stack-sm { display: flex; flex-direction: column; gap: 10px; }

.card-hero {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.hero-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.hero-blue {
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid var(--primary-border);
}

.card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text);
}

.card-desc {
  margin: 3px 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.4;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

/* Mini Switch (Setup PEM / Restore Vault) */
.mini-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 13px;
}

.mini-tab {
  min-height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 0 8px;
  transition: all 0.15s ease;
}

.mini-tab.active {
  background: var(--primary-soft);
  border-color: var(--primary-border);
  color: var(--primary);
}

/* File Drop Picker */
.file-drop {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1.5px dashed var(--border-strong);
  background: var(--surface-2);
  color: var(--primary);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.file-drop:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.file-drop-text {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.collapse-box {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  background: var(--surface-2);
}

.collapse-box summary {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}

.collapse-box[open] summary {
  margin-bottom: 8px;
}

.fp-chip {
  margin-top: 13px;
  padding-top: 11px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}

.fp-label { color: var(--text-muted); }

.fp-code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
}

/* Unlock Card */
.unlock-card {
  padding: 22px 16px 18px;
}

.unlock-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 16px;
}

.unlock-head .hero-icon {
  width: 52px;
  height: 52px;
  border-radius: 15px;
  margin-bottom: 10px;
}

.unlock-links {
  margin-top: 15px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.sep-dot { color: var(--border-strong); }

/* 2x2 Preset Chips Grid */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.preset-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 8px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  min-width: 0;
  transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.1s ease;
}

.preset-chip:active { transform: scale(0.98); }

.preset-ico {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.preset-ico .ico-sm { width: 15px; height: 15px; }

.preset-ico-amber { background: var(--amber-soft); color: var(--amber); }
.preset-ico-blue { background: var(--primary-soft); color: var(--primary); }
.preset-ico-green { background: var(--success-soft); color: var(--success); }
.preset-ico-indigo { background: var(--indigo-soft); color: var(--indigo); }

.preset-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.preset-name {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preset-sub {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

/* Active Preset Accents */
.preset-chip.active {
  background: var(--primary-soft);
  border-color: var(--primary);
}

.preset-chip.active[data-preset="trial"] {
  background: var(--amber-soft);
  border-color: var(--amber);
}

.preset-chip.active[data-preset="pro_life"] {
  background: var(--success-soft);
  border-color: var(--success);
}

.custom-panel {
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.custom-panel .grid-2 {
  align-items: end;
}

.field-mini-hint {
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Form Controls */
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.field-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
}

.chip-hint {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.req-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--amber-soft);
  color: var(--amber);
  flex-shrink: 0;
}

.req-pill.pill-blue {
  background: var(--primary-soft);
  color: var(--primary);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.grid-2 .btn {
  padding: 0 10px;
  gap: 6px;
  font-size: 13.5px;
}

.grid-customer {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 8px;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.input {
  width: 100%;
  min-width: 0;
  height: 44px;
  min-height: 44px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 16px; /* Prevents iOS Safari auto-zoom on focus */
  line-height: 1.3;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input::placeholder {
  color: var(--text-muted);
  opacity: 0.78;
  font-size: 13px;
}

.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.input.has-end { padding-right: 36px; }

.input-pin {
  height: 48px;
  min-height: 48px;
  text-align: center;
  letter-spacing: 0.08em;
}

.mono-input {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.mono-sm {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.45;
}

.textarea {
  height: auto;
  min-height: 76px;
  resize: vertical;
  word-break: break-all;
}

.select-input {
  appearance: auto;
  height: 44px;
  min-height: 44px;
  padding: 0 10px;
  font-size: 14px;
  line-height: 40px;
}

.input-end-btn {
  position: absolute;
  right: 4px;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.input-end-btn:hover { color: var(--text); background: var(--surface-2); }

.input-action-row {
  display: flex;
  align-items: stretch;
  gap: 6px;
  width: 100%;
}

.input-action-row .input { flex: 1; min-width: 0; }

.btn-paste {
  flex-shrink: 0;
  min-height: 44px;
  padding: 0 11px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--primary);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn-paste:hover { background: var(--primary-soft); border-color: var(--primary-border); }
.btn-paste:active { transform: scale(0.97); }

/* Live Field Status */
.field-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  min-height: 18px;
}

.status-ok { color: var(--success); font-weight: 600; }
.status-info { color: var(--primary); font-weight: 600; }
.status-err { color: var(--danger); font-weight: 600; }
.status-warn { color: var(--amber); font-weight: 600; }

.inline-err {
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  border: 1px solid var(--danger-border);
  color: var(--danger);
  font-size: 13px;
  font-weight: 500;
}

/* Buttons */
.btn {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border-radius: var(--radius-md);
  border: 1.5px solid transparent;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease, opacity 0.15s ease;
  white-space: nowrap;
}

.btn:active { transform: scale(0.985); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-lg { min-height: 48px; font-size: 15px; }

.btn-primary {
  background: linear-gradient(180deg, #2563EB 0%, var(--primary) 100%);
  color: #FFFFFF;
  box-shadow: 0 4px 12px -2px rgba(29, 78, 216, 0.35);
}
.btn-primary:hover { background: var(--primary-hover); }

.btn-success {
  background: var(--success);
  color: #FFFFFF;
}
.btn-success:hover { background: var(--success-hover); }

.btn-outline {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--border-strong); background: var(--surface); }

.btn-danger {
  background: var(--danger);
  color: #FFFFFF;
}
.btn-danger:hover { background: var(--danger-hover); }

.btn-danger-soft {
  background: var(--danger-soft);
  border-color: var(--danger-border);
  color: var(--danger);
}

.link-btn {
  border: none;
  background: transparent;
  color: var(--primary);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 4px 2px;
  cursor: pointer;
}

.link-danger { color: var(--danger); }

.inline-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.mini-action {
  border: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 7px;
  cursor: pointer;
}

.mini-action:hover { color: var(--primary); border-color: var(--primary-border); }

.btn-chip {
  height: 30px;
  padding: 0 9px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.btn-chip:hover { border-color: var(--primary-border); color: var(--primary); }
.btn-chip-danger:hover { border-color: var(--danger-border); color: var(--danger); }

/* Result Key Card */
.result-card {
  border-color: var(--success-border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: fadeSlide 0.2s ease;
}

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.result-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 700;
  color: var(--success);
}

.result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.meta-pill {
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 7px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta-pill-amber { background: var(--amber-soft); border-color: var(--amber-border); color: var(--amber); }
.meta-pill-blue { background: var(--primary-soft); border-color: var(--primary-border); color: var(--primary); }
.meta-pill-green { background: var(--success-soft); border-color: var(--success-border); color: var(--success); }
.meta-pill-mono { font-family: var(--font-mono); }

.key-preview {
  width: 100%;
  max-height: 92px;
  overflow-y: auto;
  overflow-x: hidden;
  word-break: break-all;
  overflow-wrap: anywhere;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.48;
  padding: 10px 11px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  user-select: all;
  -webkit-user-select: all;
}

/* Verifier Result Box */
.verify-box {
  border-radius: var(--radius-md);
  padding: 12px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.verify-box.verdict-ok { border-color: var(--success-border); background: var(--success-soft); }
.verify-box.verdict-warn { border-color: var(--amber-border); background: var(--amber-soft); }
.verify-box.verdict-err { border-color: var(--danger-border); background: var(--danger-soft); }

.verdict-head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 700;
}

.verdict-ok .verdict-head { color: var(--success); }
.verdict-warn .verdict-head { color: var(--amber); }
.verdict-err .verdict-head { color: var(--danger); }

.verdict-msg {
  margin: 0;
  font-size: 13px;
  color: var(--text-2);
}

.verdict-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid rgba(100, 116, 139, 0.2);
}

.verdict-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
}

.verdict-k { color: var(--text-muted); flex-shrink: 0; }
.verdict-v {
  color: var(--text);
  font-weight: 600;
  text-align: right;
  min-width: 0;
  word-break: break-word;
}

/* History List */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.hist-item {
  padding: 10px 11px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.hist-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.hist-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.hist-mid {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hist-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.hist-date {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hist-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Footer */
.app-footer {
  text-align: center;
  padding: 8px 4px 4px;
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

.footer-sub { font-size: 11px; opacity: 0.85; }

/* Modal Bottom Sheet */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}

.modal-sheet {
  width: 100%;
  max-width: 410px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 10px 16px 18px;
  box-shadow: var(--shadow-modal);
  animation: sheetUp 0.2s ease;
}

.modal-handle {
  width: 38px;
  height: 4px;
  border-radius: 99px;
  background: var(--border-strong);
  margin: 0 auto 10px;
}

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

.modal-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.vault-info-box {
  padding: 11px 12px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 4px;
}

.vault-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
}

.confirm-text {
  margin: 0;
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.5;
}

/* Floating Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: max(18px, calc(env(safe-area-inset-bottom) + 12px));
  transform: translateX(-50%);
  z-index: 200;
  max-width: calc(100vw - 28px);
  padding: 10px 16px;
  border-radius: 999px;
  background: #0F172A;
  color: #F8FAFC;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  text-align: center;
  pointer-events: none;
  animation: fadeSlide 0.18s ease;
}

[data-theme="dark"] .toast {
  background: #F1F5F9;
  color: #0F172A;
}

/* Subtle Shake for Wrong PIN */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
.shake { animation: shake 0.32s ease; }

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

.toast { animation-name: toastPop; }
@keyframes toastPop {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

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

/* Extra Polish for Narrow 360px-380px Devices */
@media (max-width: 385px) {
  .app-shell { padding: 10px 10px 24px; gap: 10px; }
  .card { padding: 13px; }
  .preset-chip { padding: 9px 7px; gap: 6px; }
  .preset-ico { width: 26px; height: 26px; border-radius: 7px; }
  .preset-ico .ico-sm { width: 15px; height: 15px; }
  .preset-name { font-size: 12px; letter-spacing: -0.02em; }
  .preset-sub { font-size: 10.5px; }
  .seg-tab { font-size: 13px; }
  .btn { font-size: 13.5px; padding: 0 10px; }
  .grid-2 .btn { font-size: 12.5px; padding: 0 6px; gap: 5px; }
  .grid-2 .btn .ico-sm { width: 15px; height: 15px; }
}

/* Desktop Centering Enhancement */
@media (min-width: 520px) {
  .app-shell { padding-top: 24px; }
  .modal-backdrop { align-items: center; }
}
