:root,
html[data-theme="dark"] {
  --bg: #0b1220;
  --bg-2: #0f192b;
  --surface: #121f36;
  --surface-2: #16263f;
  --border: #213450;
  --text: #e6edf6;
  --muted: #93a4bd;
  --primary: #3b82f6;
  --primary-d: #2563eb;
  --accent: #10b981;
  --danger: #ef4444;
  --warn: #f59e0b;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(0, 0, 0, .35);
  --body-gradient: radial-gradient(1200px 800px at 80% -10%, #14233f 0, var(--bg) 55%);
  --overlay: rgba(2, 6, 16, .65);
  --focus-ring: rgba(59, 130, 246, .2);
  --track-bg: rgba(255, 255, 255, .08);
  --warn-bg: rgba(245, 158, 11, .12);
  --warn-border: #6b4a12;
  --warn-text: #ffd591;
  --error-bg: rgba(239, 68, 68, .12);
  --error-border: #5b2330;
  --error-text: #ffb4b4;
  --danger-ghost-text: #ff8a8a;
  --danger-ghost-border: #5b2330;
  --badge-bg: rgba(59, 130, 246, .12);
  --badge-history-bg: rgba(245, 158, 11, .12);
  --color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #f4f6fb;
  --bg-2: #eef1f7;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #d8dee9;
  --text: #1e293b;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-d: #1d4ed8;
  --accent: #059669;
  --danger: #dc2626;
  --warn: #d97706;
  --shadow: 0 8px 30px rgba(15, 23, 42, .08);
  --body-gradient: radial-gradient(1200px 800px at 80% -10%, #e2e8f0 0, var(--bg) 55%);
  --overlay: rgba(15, 23, 42, .35);
  --focus-ring: rgba(37, 99, 235, .18);
  --track-bg: rgba(15, 23, 42, .08);
  --warn-bg: rgba(245, 158, 11, .14);
  --warn-border: #fcd34d;
  --warn-text: #92400e;
  --error-bg: rgba(220, 38, 38, .1);
  --error-border: #fecaca;
  --error-text: #991b1b;
  --danger-ghost-text: #b91c1c;
  --danger-ghost-border: #fecaca;
  --badge-bg: rgba(37, 99, 235, .1);
  --badge-history-bg: rgba(217, 119, 6, .12);
  --color-scheme: light;
}

@media (prefers-color-scheme: light) {
  html[data-theme="system"] {
    --bg: #f4f6fb;
    --bg-2: #eef1f7;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --border: #d8dee9;
    --text: #1e293b;
    --muted: #64748b;
    --primary: #2563eb;
    --primary-d: #1d4ed8;
    --accent: #059669;
    --danger: #dc2626;
    --warn: #d97706;
    --shadow: 0 8px 30px rgba(15, 23, 42, .08);
    --body-gradient: radial-gradient(1200px 800px at 80% -10%, #e2e8f0 0, var(--bg) 55%);
    --overlay: rgba(15, 23, 42, .35);
    --focus-ring: rgba(37, 99, 235, .18);
    --track-bg: rgba(15, 23, 42, .08);
    --warn-bg: rgba(245, 158, 11, .14);
    --warn-border: #fcd34d;
    --warn-text: #92400e;
    --error-bg: rgba(220, 38, 38, .1);
    --error-border: #fecaca;
    --error-text: #991b1b;
    --danger-ghost-text: #b91c1c;
    --danger-ghost-border: #fecaca;
    --badge-bg: rgba(37, 99, 235, .1);
    --badge-history-bg: rgba(217, 119, 6, .12);
    --color-scheme: light;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  background: var(--body-gradient);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  color-scheme: var(--color-scheme);
}
h1 { font-size: 1.5rem; margin: 0 0 2px; }
h2 { font-size: 1.05rem; margin: 0; }
a { color: var(--primary); }
.muted { color: var(--muted); margin: 2px 0 0; }
.grow { flex: 1; min-width: 0; }

/* ---------- buttons & inputs ---------- */
.btn {
  appearance: none; border: 1px solid transparent; border-radius: 10px;
  padding: 10px 16px; font-size: .92rem; font-weight: 600; cursor: pointer;
  background: var(--surface-2); color: var(--text); transition: .15s; line-height: 1;
}
.btn:hover { filter: brightness(1.12); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.primary { background: linear-gradient(135deg, var(--primary), var(--primary-d)); color: #fff; }
.btn.ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger.ghost { background: transparent; color: var(--danger-ghost-text); border-color: var(--danger-ghost-border); }
.btn.block { width: 100%; }
.btn.sm { padding: 7px 11px; font-size: .82rem; border-radius: 8px; }
.icon-btn {
  background: transparent; border: none; color: var(--muted); font-size: 1.1rem;
  cursor: pointer; width: 36px; height: 36px; border-radius: 8px;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.input, select.input {
  width: 100%; background: var(--bg-2); border: 1px solid var(--border);
  color: var(--text); border-radius: 10px; padding: 11px 12px; font-size: .95rem;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus-ring); }
.input.narrow { max-width: 90px; }
.input.search { margin-bottom: 14px; }
select.input {
  appearance: none;
  cursor: pointer;
  color-scheme: var(--color-scheme);
  background-color: var(--bg-2);
  color: var(--text);
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2393a4bd' d='M2.5 4.5 6 8l3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
select.input option,
select.input optgroup {
  background-color: var(--surface);
  color: var(--text);
}
html[data-theme="light"] select.input option,
html[data-theme="light"] select.input optgroup {
  background-color: var(--surface);
  color: var(--text);
}
@media (prefers-color-scheme: light) {
  html[data-theme="system"] select.input option,
  html[data-theme="system"] select.input optgroup {
    background-color: var(--surface);
    color: var(--text);
  }
}
input[type="date"].input { color-scheme: var(--color-scheme); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: .8rem; color: var(--muted); font-weight: 600; }
.field-hint { font-size: .74rem; color: var(--muted); }
.field-control { display: flex; align-items: stretch; gap: 8px; }
.field-control .input { min-width: 0; }
.field-control textarea.input { resize: vertical; }
.copy-btn {
  flex-shrink: 0; align-self: flex-start; width: 32px; height: 32px; min-width: 32px;
  padding: 0; display: grid; place-items: center; border: 1px solid var(--border);
  border-radius: 8px; background: transparent; color: var(--muted); font-size: .95rem;
  cursor: pointer; line-height: 1;
}
.copy-btn svg { display: block; width: 16px; height: 16px; }
.copy-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-action-btn.visibility-btn {
  flex-shrink: 0; align-self: flex-start; width: 32px; height: 32px; min-width: 32px;
  padding: 0; display: grid; place-items: center; border: 1px solid var(--border);
  border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; line-height: 1;
}
.icon-action-btn.visibility-btn svg { display: block; width: 16px; height: 16px; }
.icon-action-btn.visibility-btn:hover { background: var(--surface-2); color: var(--text); }
.field-actions { display: flex; gap: 6px; flex-shrink: 0; align-items: flex-start; }
.field-control .field-actions { align-self: flex-start; }
.secret-value { font-variant-numeric: tabular-nums; letter-spacing: 0.04em; }
@media (hover: none), (max-width: 860px) {
  .copyable-mobile { cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .field-control .input.copyable-mobile,
  .field-control textarea.input.copyable-mobile {
    cursor: pointer;
  }
  .detail-value.copyable-mobile:active,
  .code-value.copyable-mobile:active {
    opacity: 0.72;
  }
}
.search-options { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.search-toggle { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .88rem; cursor: pointer; }
.search-toggle input { accent-color: var(--primary); }
.search-list { display: flex; flex-direction: column; gap: 10px; }
.search-row {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
  cursor: pointer; transition: border-color .15s, background .15s;
}
.search-row:hover { border-color: var(--primary); background: var(--surface-2); }
.search-row .badge {
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--primary); background: var(--badge-bg); border-radius: 999px; padding: 4px 8px;
}
.search-row .badge.history { color: var(--warn); background: var(--badge-history-bg); }
.search-row .match-lines { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.search-row .match-line { font-size: .84rem; color: var(--muted); }
.search-status { font-size: .84rem; color: var(--muted); margin-bottom: 10px; }
.settings-form .settings-status { margin: 0; min-height: 1.2rem; }
.theme-options { display: flex; flex-direction: column; gap: 10px; }
.theme-option {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--bg-2); cursor: pointer;
}
.theme-option:hover { border-color: var(--primary); }
.theme-option.active { border-color: var(--primary); background: var(--surface-2); box-shadow: 0 0 0 1px var(--primary); }
.theme-option input { margin-top: 3px; accent-color: var(--primary); }
.theme-option-copy { display: flex; flex-direction: column; gap: 2px; }
.theme-option-title { font-weight: 700; }
.theme-option-hint { font-size: .82rem; color: var(--muted); }
.theme-glass-wrap { margin-top: 4px; padding-top: 14px; border-top: 1px solid var(--border); }
.password-tools {
  display: flex; flex-direction: column; gap: 8px; padding: 10px;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px;
}
.password-strength { display: flex; flex-direction: column; gap: 7px; }
.password-strength-track { height: 4px; background: var(--track-bg); border-radius: 999px; overflow: hidden; }
.password-strength-bar { height: 100%; border-radius: 999px; transition: width .2s, background .2s; }
.password-strength-status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .88rem; }
.password-strength-icon {
  display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%;
  color: #fff; font-weight: 800; font-size: .78rem; line-height: 1;
}
.password-strength.weak .password-strength-bar,
.password-strength.weak .password-strength-icon { background: #dc2626; }
.password-strength.fair .password-strength-bar,
.password-strength.fair .password-strength-icon { background: #f59e0b; }
.password-strength.good .password-strength-bar,
.password-strength.good .password-strength-icon { background: #84cc16; }
.password-strength.very-strong .password-strength-bar,
.password-strength.very-strong .password-strength-icon,
.password-strength.strong .password-strength-bar,
.password-strength.strong .password-strength-icon { background: #16a34a; }
.password-options { display: flex; flex-wrap: wrap; gap: 8px 12px; }
.check-option { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .8rem; }
.symbol-picker { display: flex; flex-direction: column; gap: 8px; }
.symbol-grid { display: flex; flex-wrap: wrap; gap: 7px; }
.symbol-grid.hidden { display: none; }
.symbol-token {
  min-width: 34px; min-height: 30px; padding: 4px 9px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  cursor: pointer; font-weight: 700;
}
.symbol-token.active { background: var(--primary); border-color: var(--primary-d); color: #fff; }

.row { display: flex; align-items: center; }
.row.gap { gap: 10px; }
.row.end { justify-content: flex-end; }
.row.wrap { flex-wrap: wrap; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 12px; }
.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-card {
  width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; padding: 28px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 12px;
}
.brand-lg { text-align: center; margin-bottom: 8px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.logo {
  display: inline-block; font-weight: 800; letter-spacing: 2px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  font-size: 2rem;
}
.logo.sm { font-size: 1.2rem; letter-spacing: 1.5px; }
.brand-logo { display: block; max-width: 260px; width: 100%; height: auto; object-fit: contain; }
.brand-logo.auth { max-width: 240px; }
.brand-mark { width: 34px; height: 34px; object-fit: contain; flex: 0 0 auto; }
.brand-mark.sm { width: 28px; height: 28px; }
.brand-inline { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; color: var(--text); letter-spacing: .01em; }
.brand-name { white-space: nowrap; }
.brand-transition-notice {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--border));
  color: var(--text);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: .82rem;
  text-align: center;
}
.brand-banner {
  display: block; width: 100%; border-radius: 14px; border: 1px solid var(--border);
  background: var(--bg-2); object-fit: cover;
}
.brand-banner.auth-banner { max-height: 150px; object-fit: contain; }
.auth-card h1 { text-align: center; }
.auth-card .muted { text-align: center; font-size: .9rem; }
.fineprint { font-size: .78rem; color: var(--muted); text-align: center; margin: 4px 0 0; }
.form-error {
  background: var(--error-bg); border: 1px solid var(--error-border); color: var(--error-text);
  padding: 9px 12px; border-radius: 9px; font-size: .85rem;
}

/* ---------- app shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; flex-shrink: 0; background: var(--bg-2); border-right: 1px solid var(--border);
  padding: 18px 14px; display: flex; flex-direction: column; gap: 10px; position: sticky; top: 0; height: 100vh;
}
.brand { padding: 6px 8px 12px; }
.signed-in { color: var(--muted); font-size: .78rem; margin-top: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; min-height: 0; overflow-y: auto; }
.nav-group-label {
  color: var(--muted); font-size: .68rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; padding: 14px 12px 4px;
}
.nav-group-label:first-child { padding-top: 4px; }
.snav-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px;
  background: transparent; border: none; color: var(--muted); cursor: pointer; font-size: .92rem;
  font-weight: 600; text-align: left; width: 100%;
}
.snav-item.child { padding-left: 28px; font-size: .88rem; }
.snav-item:hover { background: var(--surface); color: var(--text); }
.snav-item.active { background: var(--surface-2); color: var(--text); }
.snav-item .nav-icon { font-size: 1.05rem; width: 20px; text-align: center; flex-shrink: 0; }
.side-foot { margin-top: auto; flex-shrink: 0; }

.nav-more-overlay { align-items: flex-end; padding: 0; }
.nav-more-sheet {
  width: 100%; max-height: 78vh; background: var(--surface); border-top: 1px solid var(--border);
  border-radius: 16px 16px 0 0; box-shadow: var(--shadow); display: flex; flex-direction: column;
  animation: nav-more-slide .22s ease-out;
}
@keyframes nav-more-slide {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.nav-more-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 18px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.nav-more-head h2 { font-size: 1rem; }
.nav-more-body { padding: 8px 10px 16px; overflow-y: auto; flex: 1; min-height: 0; }
.nav-more-foot {
  padding: 10px 18px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border); text-align: center; flex-shrink: 0;
}

.tool-card { display: flex; align-items: flex-start; gap: 14px; cursor: pointer; }
.tool-back { margin-bottom: 10px; padding-left: 0; }
.tool-card:hover { border-color: var(--primary); }
.tool-card-icon { font-size: 1.5rem; line-height: 1; flex-shrink: 0; }
.tool-card-body { min-width: 0; }
.tool-card .card-sub { white-space: normal; }

.tool-quick-save-panel {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tool-quick-save-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.tool-quick-save-title {
  margin: 0;
  font-size: 1rem;
}
.tool-quick-save-note {
  min-height: 3.2em;
  resize: vertical;
}
.tool-saved-section {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.tool-saved-title {
  margin: 0 0 12px;
  font-size: 1rem;
}
.tool-history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.tool-history-row {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface-2, var(--surface));
}
.tool-history-row-tooltip {
  position: absolute;
  top: -10px;
  right: 12px;
  z-index: 2;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 0.75rem;
  line-height: 1.3;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
@media (hover: hover) and (pointer: fine) {
  .tool-history-row:hover .tool-history-row-tooltip {
    opacity: 1;
    transform: translateY(0);
  }
}
.tool-history-row-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.tool-history-tool-label {
  font-weight: 600;
  flex: 1 1 auto;
}
.tool-history-field {
  display: grid;
  grid-template-columns: minmax(80px, 120px) 1fr;
  gap: 8px 12px;
  align-items: start;
}
.tool-history-field-label {
  color: var(--muted);
  font-size: 0.85rem;
  padding-top: 2px;
}
.tool-history-field-body {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.tool-history-value {
  flex: 1 1 auto;
  min-width: 0;
  word-break: break-all;
  font-family: var(--mono, ui-monospace, monospace);
  font-size: 0.92rem;
}
.tool-history-value.secret-value { cursor: pointer; }
.tool-history-timestamp-mobile {
  margin-left: auto;
  font-size: 0.85rem;
  color: var(--muted);
}
.tool-history-timestamp-mobile summary {
  cursor: pointer;
  color: var(--primary);
}
.tool-history-page-card { display: flex; flex-direction: column; gap: 16px; }
.tool-history-page-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.tool-history-filter-field,
.tool-history-search-field { max-width: 360px; margin: 0; }
.tool-history-search-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.tool-history-search-row .tool-history-search {
  flex: 1 1 auto;
  min-width: 0;
}
.tool-history-search-clear { flex: 0 0 auto; }
.tool-history-page-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 8px;
  padding: 4px 0 8px;
}
.tool-history-page-list .tool-history-row {
  border-left-width: 4px;
  border-left-color: var(--primary);
  padding: 16px 18px;
  gap: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.tool-history-page-list .tool-history-row[data-tool-id="password"] {
  border-left-color: #e8b923;
}
.tool-history-page-list .tool-history-row[data-tool-id="ip-info"] {
  border-left-color: #4dabf7;
}
.tool-history-page-list .tool-history-row[data-tool-id="card-lookup"] {
  border-left-color: #9775fa;
}
.tool-history-page-list .tool-history-row-head {
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--border);
}
.tool-history-page-list .tool-history-field {
  padding: 8px 10px;
  border-radius: calc(var(--radius) - 4px);
  background: var(--surface-2, var(--bg-2));
}
.tool-history-page-list .tool-history-details-panel {
  margin-top: 2px;
  padding-top: 12px;
}
.tool-history-loading,
.tool-history-empty { margin: 0; }
.tool-history-delete { margin-left: auto; }
.tool-history-details-panel {
  margin-top: 4px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}
.tool-history-details-panel summary {
  cursor: pointer;
  color: var(--primary);
  font-size: 0.9rem;
  font-weight: 600;
  user-select: none;
}
.tool-history-details-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
}
.tool-history-details-heading {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.tool-history-detail-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ip-info-tool { display: flex; flex-direction: column; gap: 16px; }
.ip-info-title { margin: 0 0 12px; font-size: 1.15rem; }
.ip-info-form { margin-bottom: 4px; }
.ip-info-form .input { flex: 1; min-width: 200px; }
.ip-info-status.error { color: var(--danger); }
.ip-info-header-line { font-size: 1.05rem; font-weight: 700; margin: 0; }
.ip-info-section { margin-top: 8px; }
.ip-info-section summary {
  font-weight: 700; cursor: pointer; text-decoration: underline; margin-bottom: 10px;
}
.ip-info-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.ip-info-table, .ip-info-table th, .ip-info-table td { border: 1px solid var(--border); }
.ip-info-table th, .ip-info-table td { padding: 8px; text-align: left; vertical-align: top; word-break: break-word; white-space: pre-wrap; }
.ip-info-table th { background: var(--bg-2); }
.ip-info-map-container { width: 100%; position: relative; }
.ip-info-map-container iframe { width: 100%; height: 600px; border: 0; }
.ip-info-map-instructions { font-weight: 700; margin-bottom: 10px; }
.ip-info-flag { vertical-align: middle; margin-left: 2px; }
.ip-info-results { display: flex; flex-direction: column; gap: 14px; }

.card-lookup-tool {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 16px;
}
.card-lookup-fireworks {
  position: absolute; inset: 0; pointer-events: none; z-index: 5;
}
.card-lookup-fireworks canvas { display: block; width: 100%; height: 100%; }
.card-lookup-lead { margin: 0; }
.card-lookup-input-wrap {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 12px;
}
.card-lookup-input-brand {
  width: 72px; height: 28px; object-fit: contain; flex-shrink: 0;
  border-radius: 6px; background: var(--bg-2); padding: 2px 4px;
}
.card-lookup-input {
  flex: 1; max-width: 420px;
  font-size: 1.15rem; text-align: center; letter-spacing: 0.04em; padding: 14px 16px;
}
.card-lookup-feedback {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.card-lookup-feedback .card-lookup-validation { width: 100%; max-width: 420px; }
.card-lookup-status.error { color: var(--danger); }
.card-lookup-details:empty { display: none; }
.card-lookup-wallet:not([hidden]) { display: flex; justify-content: center; }
.card-lookup-wallet[hidden] { display: none; }
.card-wallet-card {
  position: relative; width: 100%; max-width: 340px; aspect-ratio: 1.586;
  padding: 22px 20px 18px; border-radius: 18px; color: #fff;
  display: flex; flex-direction: column; justify-content: space-between; gap: 12px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, .28), inset 0 1px 0 rgba(255, 255, 255, .18);
  overflow: hidden;
}
.card-wallet-card::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at 20% 0%, rgba(255, 255, 255, .22), transparent 45%),
    radial-gradient(circle at 100% 100%, rgba(0, 0, 0, .18), transparent 50%);
}
.card-wallet-card > * { position: relative; z-index: 1; }
.card-wallet-card.scheme-visa {
  background: linear-gradient(135deg, #1a237e 0%, #283593 38%, #3949ab 100%);
}
.card-wallet-card.scheme-mastercard {
  background: linear-gradient(135deg, #1a1a2e 0%, #4a1942 45%, #c0392b 100%);
}
.card-wallet-card.scheme-amex {
  background: linear-gradient(135deg, #004d40 0%, #00695c 42%, #00838f 100%);
}
.card-wallet-card.scheme-discover {
  background: linear-gradient(135deg, #3e2723 0%, #bf360c 55%, #ff6f00 100%);
}
.card-wallet-card.scheme-diners {
  background: linear-gradient(135deg, #263238 0%, #37474f 50%, #546e7a 100%);
}
.card-wallet-card.scheme-generic {
  background: linear-gradient(135deg, #1e293b 0%, #334155 55%, #475569 100%);
}
.card-wallet-top { display: flex; align-items: center; min-height: 36px; }
.card-wallet-bank-logo {
  max-height: 32px; max-width: 120px; object-fit: contain;
  filter: brightness(0) invert(1); opacity: .95;
}
.card-wallet-bank-initials {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 999px;
  font-size: .82rem; font-weight: 800; letter-spacing: .04em;
  background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .28);
}
.card-wallet-bank-initials[hidden] { display: none; }
.card-wallet-bank-logo[hidden] { display: none; }
.card-wallet-chip { width: 44px; height: 32px; object-fit: contain; border-radius: 6px; }
.card-wallet-number {
  font-family: "Courier New", Courier, monospace; font-size: 1.15rem; font-weight: 600;
  letter-spacing: .12em; text-shadow: 0 1px 2px rgba(0, 0, 0, .35); margin-top: 4px;
}
.card-wallet-bottom {
  display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto;
  gap: 2px 12px; align-items: end;
}
.card-wallet-issuer {
  grid-column: 1; font-size: .78rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; opacity: .95; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-wallet-meta {
  grid-column: 1; font-size: .72rem; opacity: .82; letter-spacing: .03em;
}
.card-wallet-scheme {
  grid-column: 2; grid-row: 1 / span 2; align-self: end;
  width: 56px; height: 22px; object-fit: contain; opacity: .95;
}
.card-lookup-issuer-cell { display: inline-flex; align-items: center; gap: 8px; }
.card-lookup-issuer-logo {
  width: 24px; height: 24px; object-fit: contain; border-radius: 4px;
  background: var(--bg); padding: 2px;
}
.card-lookup-issuer-initials {
  display: grid; place-items: center; width: 24px; height: 24px; border-radius: 999px;
  font-size: .65rem; font-weight: 800; background: var(--bg-2); border: 1px solid var(--border);
}
.card-lookup-issuer-initials[hidden],
.card-lookup-issuer-logo[hidden] { display: none; }
.card-lookup-panel {
  display: flex; flex-direction: column; gap: 14px;
  opacity: 0; transform: translateY(8px); transition: opacity .35s ease, transform .35s ease;
  padding: 14px; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius);
}
.card-lookup-panel.show { opacity: 1; transform: translateY(0); }
.card-lookup-brand-header {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.card-lookup-brand-logo {
  width: 120px; height: 40px; object-fit: contain; border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
}
.card-lookup-brand-name {
  font-size: .85rem; font-weight: 700; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase;
}
.card-lookup-table { margin-top: 0; }
.card-lookup-validation {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin: 0; min-height: 2.4em; padding: 10px 14px; border-radius: 12px;
  font-size: 1rem; font-weight: 700; opacity: 0; transform: scale(0.96);
  transition: opacity .25s ease, transform .25s ease, background .25s ease, border-color .25s ease;
}
.card-lookup-validation.success,
.card-lookup-validation.failure { opacity: 1; transform: scale(1); }
.card-lookup-validation.success {
  color: #2dd4a8; background: rgba(45, 212, 168, .08); border: 1px solid rgba(45, 212, 168, .35);
}
.card-lookup-validation.failure {
  color: var(--danger); background: rgba(180, 60, 60, .08); border: 1px solid rgba(180, 60, 60, .35);
}
.card-lookup-validation-icon {
  display: grid; place-items: center; width: 1.6em; height: 1.6em; border-radius: 999px;
  font-size: .95rem; font-weight: 800; flex-shrink: 0;
}
.card-lookup-validation.success .card-lookup-validation-icon {
  background: rgba(45, 212, 168, .18);
}
.card-lookup-validation.failure .card-lookup-validation-icon {
  background: rgba(180, 60, 60, .18);
}
.card-lookup-validation.anim-success {
  animation: card-lookup-glow 1.2s ease-in-out infinite alternate, card-lookup-pop .35s ease;
}
.card-lookup-validation.anim-failure {
  animation: card-lookup-shake .45s ease, card-lookup-vibrate .55s ease .05s;
}
.card-lookup-disclaimer { margin: 0; font-size: .82rem; }
.card-lookup-actions { justify-content: center; }

@keyframes card-lookup-shake {
  0%, 100% { transform: translateX(0) scale(1); }
  20% { transform: translateX(-6px) scale(1.02); }
  40% { transform: translateX(6px) scale(1.02); }
  60% { transform: translateX(-4px) scale(1.01); }
  80% { transform: translateX(4px) scale(1.01); }
}
@keyframes card-lookup-vibrate {
  0%, 100% { transform: translateX(0); }
  10% { transform: translateX(-1px); }
  20% { transform: translateX(1px); }
  30% { transform: translateX(-1px); }
  40% { transform: translateX(1px); }
  50% { transform: translateX(-1px); }
  60% { transform: translateX(1px); }
  70% { transform: translateX(0); }
}
@keyframes card-lookup-glow {
  0% { box-shadow: 0 0 0 rgba(45, 212, 168, 0); }
  100% { box-shadow: 0 0 16px rgba(45, 212, 168, .35); }
}
@keyframes card-lookup-pop {
  0% { transform: scale(0.92); }
  60% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

@media (max-width: 560px) {
  .card-lookup-input-wrap { flex-direction: column; }
  .card-lookup-input-brand { width: 88px; height: 32px; }
  .card-lookup-input { max-width: none; width: 100%; }
}

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
.content { padding: 26px; max-width: 1100px; width: 100%; margin: 0 auto; }
.bottom-nav { display: none; }

.page { display: flex; flex-direction: column; gap: 18px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
}
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.account-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.account-card .card-body { display: flex; align-items: center; gap: 12px; padding: 16px; cursor: pointer; }
.account-card .card-actions { display: flex; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--border); background: var(--bg-2); }
.avatar {
  width: 42px; height: 42px; border-radius: 11px; flex-shrink: 0; display: grid; place-items: center;
  font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--primary), var(--accent));
}
.card-title { font-weight: 700; }
.card-sub { color: var(--muted); font-size: .84rem; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.empty { text-align: center; color: var(--muted); padding: 40px 20px; display: flex; flex-direction: column; gap: 14px; align-items: center; }

/* ---------- banner ---------- */
.banner {
  border-radius: 12px; padding: 12px 16px; font-size: .9rem; cursor: pointer; border: 1px solid;
}
.banner.warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-text); }
.banner.auth-warning { cursor: default; text-align: left; }

/* ---------- KPIs ---------- */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.kpi { display: flex; flex-direction: column; gap: 4px; }
.kpi.clickable { cursor: pointer; }
.kpi.clickable:hover { border-color: var(--primary); }
.kpi-value { font-size: 1.4rem; font-weight: 800; }
.kpi-label { color: var(--muted); font-size: .82rem; }

/* ---------- quick entry ---------- */
.quick-entry { display: flex; flex-direction: column; gap: 12px; }
.quick-title { font-weight: 700; }
.quick-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr 1.4fr auto; gap: 10px; align-items: start; }
.qf { display: flex; gap: 8px; }
.qf.from-to { align-items: center; }
.qf.amount { gap: 6px; }
.qf.comments { grid-column: span 1; }
.add-btn { align-self: stretch; }
.swap { flex-shrink: 0; }

/* ---------- transactions list ---------- */
.txn-list { display: flex; flex-direction: column; gap: 8px; }
.txn-row {
  display: flex; align-items: center; gap: 12px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px;
}
.txn-main { flex: 1; min-width: 0; cursor: pointer; }
.txn-flow { display: flex; align-items: center; gap: 8px; font-weight: 600; flex-wrap: wrap; }
.txn-arrow { color: var(--muted); }
.txn-acct.pending { color: var(--warn); }
.txn-meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .8rem; margin-top: 5px; flex-wrap: wrap; }
.txn-comment { font-style: italic; }
.txn-amount { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chip { background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 2px 9px; font-size: .72rem; }
.chip.warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-text); }

/* ---------- pending ---------- */
.pending-list { display: flex; flex-direction: column; gap: 10px; }
.pending-card { display: flex; align-items: center; gap: 12px; }

/* ---------- users ---------- */
.user-invite-row .input { max-width: 320px; }
.invite-panel {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px; display: flex; flex-direction: column; gap: 2px;
}
.code-value {
  font-family: Consolas, "Courier New", monospace; letter-spacing: .02em;
}
.user-list { display: flex; flex-direction: column; gap: 8px; }
.user-row {
  display: flex; align-items: center; gap: 12px; border: 1px solid var(--border);
  border-radius: 12px; padding: 12px; background: var(--bg-2);
}
.user-row-detail {
  flex-direction: column; align-items: stretch; gap: 12px;
}
.user-row-head { display: flex; align-items: center; gap: 12px; width: 100%; }
.user-detail-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px 16px; width: 100%;
}
.user-detail-cell { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.user-detail-label { font-size: 12px; color: var(--muted); }
.user-detail-value { font-size: 14px; word-break: break-word; }
.user-detail-value.warn { color: var(--warn-text); }
.settings-form .settings-status.warn { color: var(--warn-text); }
.user-detail-cell-wide { grid-column: 1 / -1; }
.storage-breakdown { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.storage-breakdown-total { font-size: 14px; font-weight: 600; }
.storage-breakdown-over .storage-breakdown-total { color: var(--warn-text); }
.storage-breakdown-rows { display: flex; flex-direction: column; gap: 4px; }
.storage-breakdown-row { font-size: 13px; }
.storage-breakdown-value { font-variant-numeric: tabular-nums; color: var(--text); }
.storage-bar {
  display: flex; width: 100%; height: 12px; border-radius: 999px; overflow: hidden;
  background: color-mix(in srgb, var(--border) 70%, transparent);
  border: 1px solid var(--border);
}
.storage-bar-used { height: 100%; min-width: 0; border-radius: 999px; transition: width 0.2s ease, background 0.2s ease; }
.storage-breakdown-over .storage-bar { border-color: color-mix(in srgb, var(--warn-border) 80%, var(--border)); }
.storage-breakdown-warn { margin: 0; color: var(--warn-text); }
.storage-settings-mount { margin-top: 4px; }
.server-info-page { gap: 16px; }
.server-info-hero { gap: 16px; }
.server-info-section { gap: 16px; }
.server-info-metrics {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}
.server-info-metric {
  display: flex; flex-direction: column; gap: 4px; min-width: 0;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px;
}
.server-info-metric-label,
.server-info-metric-note { color: var(--muted); font-size: 12px; }
.server-info-metric-value { font-size: 1.35rem; font-variant-numeric: tabular-nums; word-break: break-word; }
.server-total-storage-bar { height: 16px; }
.server-info-grid { align-items: start; }
.server-info-subsection { display: flex; flex-direction: column; gap: 8px; }
.server-info-subsection h3 { margin: 0; font-size: 1rem; }
.server-info-chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.server-info-list { margin: 0; padding-left: 1.15rem; color: var(--text); }
.server-info-list li { margin: 4px 0; }
.server-info-migration-list {
  display: flex; flex-direction: column; gap: 4px;
  max-height: 260px; overflow: auto; padding-right: 4px;
}
.server-info-migration-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 6px 8px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px;
  font-family: Consolas, "Courier New", monospace; font-size: .84rem;
}
.account-content-card { display: flex; flex-direction: column; gap: 20px; }
.account-access-banner { margin-bottom: 4px; }
.check-printing-section { display: flex; flex-direction: column; gap: 12px; }
.check-logo-field { margin-top: 4px; }
.check-logo-preview-wrap {
  display: flex; align-items: center; justify-content: flex-start;
  min-height: 56px; padding: 8px 0;
}
.check-logo-preview {
  max-width: 180px; max-height: 72px; object-fit: contain;
  border-radius: 8px; border: 1px solid var(--border); background: var(--bg-2);
}
.check-logo-detail-row { align-items: center; }
.user-row-actions { width: 100%; justify-content: space-between; align-items: end; }
.copyable-view { cursor: pointer; }
.detail-value.copyable-view:hover,
.code-value.copyable-view:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); border-radius: 6px; }
.detail-value-link { cursor: pointer; color: var(--accent); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.detail-value-link:hover { text-decoration-color: var(--accent); }
.about-tabs { margin-bottom: 16px; }
.about-tabs .btn.active { background: var(--surface-2); border-color: var(--primary); color: var(--text); }
.about-legal p + p { margin-top: 12px; }
.about-panel-host { display: flex; flex-direction: column; gap: 16px; }
.card-valid-label { color: var(--ok-text, #1a7f37); font-weight: 700; }
.card-invalid-label { color: var(--danger, #c62828); font-weight: 700; }
.history-list { display: flex; flex-direction: column; gap: 10px; }
.history-row {
  display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--border);
  border-radius: 12px; padding: 12px; background: var(--bg-2);
}

/* ---------- modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: var(--overlay); backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 16px; z-index: 50;
}
.modal {
  width: 100%; max-width: 560px; max-height: 90vh; overflow: auto; background: var(--surface);
  border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); }
.modal-body { padding: 18px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.detail-list { display: flex; flex-direction: column; gap: 2px; }
.detail-row { display: grid; grid-template-columns: 150px 1fr auto; gap: 12px; align-items: start; padding: 9px 0; border-bottom: 1px solid var(--border); }
.detail-label { color: var(--muted); font-size: .85rem; }
.detail-value { font-weight: 600; text-align: right; word-break: break-word; white-space: pre-wrap; }

.security-questions-section {
  grid-column: 1 / -1; display: flex; flex-direction: column; gap: 12px;
  padding: 14px; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius);
}
.security-question-list { display: flex; flex-direction: column; gap: 12px; }
.security-question-card {
  display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: start;
  padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
}

/* ---------- share ---------- */
.share-list { display: flex; flex-direction: column; gap: 2px; margin-bottom: 6px; }
.share-row { display: grid; grid-template-columns: auto 150px 1fr; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.share-label { color: var(--muted); font-size: .85rem; }
.share-value { word-break: break-word; }

/* ---------- reports ---------- */
.report-card { display: flex; flex-direction: column; gap: 14px; }
.about-version { margin: 8px 0 0; font-size: 0.9rem; }
.about-feedback-lead { margin: 0; line-height: 1.55; }
.about-feedback-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.about-feedback-actions {
  display: flex;
  justify-content: flex-start;
}
.about-feedback-message { min-height: 140px; }
.about-feedback-thanks {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.about-feedback-thanks-lead {
  margin: 0;
  font-weight: 600;
}
.about-feedback-submitted {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 4px);
  background: var(--surface-2, var(--bg-2));
}
.about-feedback-submitted-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.about-feedback-submitted-label {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
}
.about-feedback-submitted-value {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
}
.report-head h2 { margin-bottom: 2px; }
.bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: 160px 1fr auto; align-items: center; gap: 12px; }
.bar-label { font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { background: var(--bg-2); border-radius: 999px; height: 10px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 999px; }
.bar-fill.neg { background: linear-gradient(90deg, #b45309, var(--danger)); }
.bar-value { font-size: .82rem; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--muted); }

.mini-table { display: flex; flex-direction: column; }
.mini-row { display: grid; grid-template-columns: 120px 1fr auto; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); align-items: center; }
.mini-amt { font-weight: 700; font-variant-numeric: tabular-nums; }
.mini-flow { color: var(--muted); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-date { color: var(--muted); font-size: .8rem; }
.pair-net { margin: 4px 0 10px; }

.ledger { overflow-x: auto; }
.ledger-body { display: flex; flex-direction: column; min-width: 560px; }
.ledger-row, .ledger .head { display: grid; grid-template-columns: 110px 1.4fr 90px 110px 1.4fr; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); align-items: center; }
.lc.amt { font-weight: 700; font-variant-numeric: tabular-nums; }
.lc.note, .lc.flow { color: var(--muted); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ledger-summary { margin-bottom: 8px; font-size: .85rem; }

/* ---------- toasts ---------- */
.toast-root { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 100; align-items: center; }
.toast {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow); font-size: .88rem;
  opacity: 0; transform: translateY(10px); transition: .25s; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { border-color: #1c5e44; }
.toast-error { border-color: #5b2330; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .sidebar { display: none; }
  .topbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg-2); z-index: 20; }
  .content { padding: 16px 14px calc(118px + env(safe-area-inset-bottom)); }
  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: var(--bg-2);
    border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    justify-content: space-around; z-index: 30;
  }
  .bnav-item {
    display: flex; flex-direction: column; align-items: center; gap: 3px; background: transparent;
    border: none; color: var(--muted); cursor: pointer; font-size: .66rem; font-weight: 600; padding: 4px 8px;
  }
  .bnav-item .nav-icon { font-size: 1.15rem; }
  .bnav-item.active { color: var(--primary); }
  .quick-grid { grid-template-columns: 1fr 1fr; }
  .qf.from-to, .qf.comments, .add-btn { grid-column: 1 / -1; }
  .form-grid { grid-template-columns: 1fr; }
  .field-control { align-items: flex-start; }
  .detail-row { grid-template-columns: 1fr auto; }
  .detail-value { grid-column: 1 / -1; grid-row: 2; text-align: left; }
  .detail-row .field-actions,
  .detail-row .copy-btn { grid-column: 2; grid-row: 1 / span 2; }
  .security-question-card { grid-template-columns: 1fr; }
  .security-question-card .row.end { justify-content: flex-start; }
  .bar-row { grid-template-columns: 110px 1fr; }
  .bar-value { grid-column: 2; text-align: right; }
  .share-row { grid-template-columns: auto 1fr; }
  .share-value { grid-column: 2; }
  .mini-row { grid-template-columns: 1fr auto; }
  .mini-flow { grid-column: 1 / -1; order: 3; }
}

/* ---------- liquid glass (iOS 26-inspired) ---------- */
html[data-glass="on"] {
  --glass-blur: 22px;
  --glass-saturate: 165%;
  --glass-radius: 20px;
  --glass-highlight: rgba(255, 255, 255, 0.42);
  --glass-shadow: 0 10px 40px rgba(15, 23, 42, 0.14);
  --radius: 18px;
}

html[data-glass="on"][data-theme="dark"],
html[data-glass="on"][data-theme="system"] {
  --surface: rgba(255, 255, 255, 0.08);
  --surface-2: rgba(255, 255, 255, 0.12);
  --bg-2: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.18);
  --overlay: rgba(4, 8, 18, 0.45);
  --glass-shadow: 0 12px 42px rgba(0, 0, 0, 0.35);
  --body-gradient:
    radial-gradient(900px 620px at 12% -8%, rgba(59, 130, 246, 0.34), transparent 58%),
    radial-gradient(760px 540px at 88% 4%, rgba(16, 185, 129, 0.22), transparent 55%),
    radial-gradient(680px 520px at 72% 92%, rgba(168, 85, 247, 0.2), transparent 58%),
    linear-gradient(160deg, #0a1020 0%, #101828 45%, #0b1220 100%);
}

html[data-glass="on"][data-theme="light"] {
  --surface: rgba(255, 255, 255, 0.58);
  --surface-2: rgba(255, 255, 255, 0.72);
  --bg-2: rgba(255, 255, 255, 0.45);
  --border: rgba(255, 255, 255, 0.82);
  --overlay: rgba(15, 23, 42, 0.22);
  --glass-shadow: 0 10px 36px rgba(15, 23, 42, 0.12);
  --body-gradient:
    radial-gradient(900px 620px at 10% -5%, rgba(96, 165, 250, 0.35), transparent 58%),
    radial-gradient(760px 540px at 92% 8%, rgba(52, 211, 153, 0.28), transparent 55%),
    radial-gradient(680px 520px at 68% 96%, rgba(196, 181, 253, 0.32), transparent 58%),
    linear-gradient(160deg, #eef2ff 0%, #f8fafc 42%, #eef1f7 100%);
}

@media (prefers-color-scheme: light) {
  html[data-glass="on"][data-theme="system"] {
    --surface: rgba(255, 255, 255, 0.58);
    --surface-2: rgba(255, 255, 255, 0.72);
    --bg-2: rgba(255, 255, 255, 0.45);
    --border: rgba(255, 255, 255, 0.82);
    --overlay: rgba(15, 23, 42, 0.22);
    --glass-shadow: 0 10px 36px rgba(15, 23, 42, 0.12);
    --body-gradient:
      radial-gradient(900px 620px at 10% -5%, rgba(96, 165, 250, 0.35), transparent 58%),
      radial-gradient(760px 540px at 92% 8%, rgba(52, 211, 153, 0.28), transparent 55%),
      radial-gradient(680px 520px at 68% 96%, rgba(196, 181, 253, 0.32), transparent 58%),
      linear-gradient(160deg, #eef2ff 0%, #f8fafc 42%, #eef1f7 100%);
  }
}

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  html[data-glass="on"] .card,
  html[data-glass="on"] .sidebar,
  html[data-glass="on"] .auth-card,
  html[data-glass="on"] .modal,
  html[data-glass="on"] .txn-row,
  html[data-glass="on"] .search-row,
  html[data-glass="on"] .user-row,
  html[data-glass="on"] .history-row,
  html[data-glass="on"] .invite-panel,
  html[data-glass="on"] .security-questions-section,
  html[data-glass="on"] .security-question-card,
  html[data-glass="on"] .password-tools,
  html[data-glass="on"] .theme-option,
  html[data-glass="on"] .toast,
  html[data-glass="on"] .topbar,
  html[data-glass="on"] .bottom-nav,
  html[data-glass="on"] .account-card .card-actions,
  html[data-glass="on"] .modal-head {
    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  }
}

html[data-glass="on"] .card,
html[data-glass="on"] .auth-card,
html[data-glass="on"] .modal,
html[data-glass="on"] .txn-row,
html[data-glass="on"] .search-row,
html[data-glass="on"] .user-row,
html[data-glass="on"] .history-row,
html[data-glass="on"] .invite-panel,
html[data-glass="on"] .security-question-card,
html[data-glass="on"] .theme-option {
  border-radius: var(--glass-radius);
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-highlight);
}

html[data-glass="on"] .sidebar,
html[data-glass="on"] .topbar,
html[data-glass="on"] .bottom-nav {
  background: var(--surface) !important;
  border-color: var(--border);
  box-shadow: inset 0 1px 0 var(--glass-highlight);
}

html[data-glass="on"] .sidebar {
  border-right: 1px solid var(--border);
}

html[data-glass="on"] .bottom-nav {
  border-top: 1px solid var(--border);
}

html[data-glass="on"] .input,
html[data-glass="on"] select.input {
  background-color: var(--bg-2);
  border-color: var(--border);
  box-shadow: inset 0 1px 0 var(--glass-highlight);
}
html[data-glass="on"] select.input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2393a4bd' d='M2.5 4.5 6 8l3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

html[data-glass="on"] .btn.primary {
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

html[data-glass="on"] .btn.ghost {
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 1px 0 var(--glass-highlight);
}

html[data-glass="on"] .snav-item.active,
html[data-glass="on"] .bnav-item.active {
  background: var(--surface-2);
  border-radius: 12px;
  box-shadow: inset 0 1px 0 var(--glass-highlight);
}

html[data-glass="on"] .modal-overlay {
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
}

html[data-glass="on"] .avatar {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 8px 20px rgba(37, 99, 235, 0.25);
}

/* ---------- file attachments ---------- */
.attachment-section { margin-top: 18px; display: flex; flex-direction: column; gap: 12px; }
.file-list { display: flex; flex-direction: column; gap: 10px; }
.file-row {
  display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center;
  padding: 10px 12px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px;
}
.file-thumb {
  width: 56px; height: 56px; border-radius: 10px; object-fit: cover; background: var(--surface);
  border: 1px solid var(--border); display: flex; align-items: center; justify-content: center;
  font-size: .75rem; color: var(--muted); overflow: hidden;
}
.file-thumb.placeholder { font-size: 1rem; }
.file-icon { font-size: .72rem; font-weight: 700; color: var(--muted); }
.file-preview { display: flex; justify-content: center; }
.file-preview-modal { width: 100%; min-height: 120px; }
.file-preview-img { max-width: 100%; max-height: 320px; border-radius: 12px; border: 1px solid var(--border); }
.file-preview-frame { width: 100%; min-height: 420px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.file-preview-text {
  width: 100%; max-height: 420px; overflow: auto; padding: 12px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); font-size: .85rem; white-space: pre-wrap;
  word-break: break-word;
}
.file-preview-media { width: 100%; max-height: 420px; border-radius: 12px; }

.preview-loading { text-align: center; padding: 4px 0 8px; }
.preview-loading-status { min-height: 1.4em; margin: 0 0 10px; }
.spinner {
  width: 40px; height: 40px; margin: 0 auto 14px;
  border: 3px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: spin 0.85s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.preview-progress-track {
  height: 5px; margin: 0 0 14px; overflow: hidden;
  background: var(--border); border-radius: 999px;
}
.preview-progress-bar {
  height: 100%; width: 0; background: var(--primary); border-radius: 999px;
  transition: width 0.25s ease;
}
.preview-progress-bar.indeterminate {
  width: 35% !important; transition: none;
  animation: preview-progress-slide 1.1s ease-in-out infinite;
}
@keyframes preview-progress-slide {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(380%); }
}

.backup-progress-wrap { margin: 12px 0 0; }
.backup-progress-track {
  height: 5px; margin: 0 0 8px; overflow: hidden;
  background: var(--border); border-radius: 999px;
}
.backup-progress-bar {
  height: 100%; width: 0; background: var(--primary); border-radius: 999px;
  transition: width 0.25s ease;
}
.backup-sections { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.check-row { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: .92rem; }
.check-row input { accent-color: var(--primary); }
.backup-mode-fieldset { border: none; padding: 0; margin: 0 0 12px; display: flex; flex-direction: column; gap: 8px; }
.backup-mode-fieldset legend { margin-bottom: 4px; }

.preview-fullscreen-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column; background: var(--bg);
}
.preview-fullscreen-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; border-bottom: 1px solid var(--border); background: var(--surface);
}
.preview-fullscreen-title {
  font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.preview-fullscreen-body {
  flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center;
  padding: 8px; overflow: auto;
}
.file-preview-fullscreen { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.file-preview-img-full { max-width: 100%; max-height: 100%; border-radius: 8px; object-fit: contain; }
.file-preview-frame-full { width: 100%; height: 100%; min-height: 60vh; border: none; border-radius: 8px; background: var(--surface); }
.file-preview-media-full { width: 100%; max-height: 100%; border-radius: 8px; object-fit: contain; }

.pdf-ios-panel { text-align: center; padding: 12px 8px 4px; max-width: 360px; margin: 0 auto; }
.pdf-ios-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 14px;
  background: var(--badge-bg); color: var(--primary); font-weight: 700; font-size: .85rem;
}

.media-gallery-overlay {
  position: fixed; inset: 0; z-index: 110;
  display: flex; flex-direction: column; background: #0a0a0a; color: #f5f5f5;
  outline: none;
}
.media-gallery-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top));
  background: rgba(0, 0, 0, 0.72); border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.media-gallery-head-text {
  min-width: 0; display: flex; flex-direction: column; gap: 2px;
}
.media-gallery-title {
  font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.media-gallery-counter { font-size: .78rem; opacity: .65; }
.media-gallery-close { color: #f5f5f5; }
.media-gallery-stage {
  flex: 1; min-height: 0; position: relative; display: flex; align-items: stretch;
}
.media-gallery-content {
  flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center;
  padding: 8px 44px; touch-action: pan-y pinch-zoom;
}
.media-gallery-slide {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
}
.media-gallery-img,
.media-gallery-video {
  max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px;
}
.media-gallery-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 40px; height: 56px; border: none; border-radius: 10px;
  background: rgba(255, 255, 255, 0.12); color: #fff; font-size: 1.6rem; line-height: 1;
  cursor: pointer; backdrop-filter: blur(4px);
}
.media-gallery-nav:disabled { opacity: 0.25; cursor: default; }
.media-gallery-nav-prev { left: 8px; }
.media-gallery-nav-next { right: 8px; }
.media-gallery-loading,
.media-gallery-error {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; text-align: center; padding: 16px;
}
.media-gallery-hint {
  margin: 0; padding: 8px 12px 12px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  text-align: center; opacity: .55; color: #ccc;
}
@media (max-width: 768px) {
  .media-gallery-content { padding: 8px 36px; }
  .media-gallery-nav { width: 34px; height: 48px; font-size: 1.4rem; }
  .media-gallery-hint { font-size: .72rem; }
}

.vault-breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin: 0 0 1rem; font-size: .9rem; }
.vault-breadcrumb-sep { color: var(--muted); }
.vault-breadcrumb-link {
  background: none; border: none; padding: 0; color: var(--accent); cursor: pointer; font: inherit;
}
.vault-breadcrumb-link:hover { text-decoration: underline; }
.vault-breadcrumb-current { color: var(--text); font-weight: 600; }
.folder-card .avatar { background: rgba(255, 193, 7, .12); }
.folder-picker-list { display: flex; flex-direction: column; gap: .5rem; max-height: 360px; overflow: auto; }
.folder-picker-item { justify-content: flex-start; width: 100%; }

.note-body-input {
  min-height: 220px; resize: vertical;
  font-family: ui-monospace, "Cascadia Code", "Consolas", monospace;
  line-height: 1.5;
}
.note-display-toggle {
  display: inline-flex; align-items: center; gap: .45rem; font-size: .85rem; color: var(--muted); cursor: pointer;
}
.note-editor-toolbar {
  display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .65rem;
}
.note-toolbar-btn { min-width: 2rem; font-weight: 600; }
.note-mode-toggle { display: inline-flex; gap: .25rem; }
.note-mode-toggle .btn.active {
  background: rgba(255, 255, 255, .1);
  border-color: var(--accent);
  color: var(--text);
}
.note-view-title {
  font-size: 1.05rem; font-weight: 600; padding: .35rem 0; color: var(--text);
}
.note-view-plain {
  margin: 0; padding: .85rem 1rem; white-space: pre-wrap; word-break: break-word;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: rgba(255, 255, 255, .02); font-family: inherit; line-height: 1.55;
}
.note-edit-pane { margin-top: .25rem; }
.note-preview {
  margin-top: .75rem; padding: .85rem 1rem; border: 1px solid var(--border);
  border-radius: var(--radius); background: rgba(255, 255, 255, .02); line-height: 1.55;
}
.note-preview h1, .note-preview h2, .note-preview h3 { margin: .6rem 0 .35rem; }
.note-preview p { margin: .35rem 0; }
.note-preview ul, .note-preview ol { margin: .35rem 0 .35rem 1.2rem; }
.note-preview code { background: rgba(255, 255, 255, .06); padding: .1rem .3rem; border-radius: 4px; }
.note-preview pre { overflow: auto; padding: .65rem; background: rgba(0, 0, 0, .25); border-radius: var(--radius); }
.note-access-banner { margin: 0 0 1rem; }
.note-access-hint { margin: 0; padding: .35rem 0; font-size: .88rem; }
.note-access-summary {
  display: block; width: 100%; text-align: left; background: none; border: none; padding: .35rem 0;
  color: var(--muted); font: inherit; cursor: pointer;
}
.note-access-summary:hover { color: var(--text); }
.note-access-list { margin-top: .35rem; padding: .5rem .65rem; border: 1px solid var(--border); border-radius: var(--radius); }
.note-access-row { font-size: .88rem; padding: .2rem 0; color: var(--text); }

.app-version-wrap { margin-top: .75rem; }
.app-version-wrap.center { text-align: center; }
.app-version {
  display: inline-block;
  font-size: .68rem;
  letter-spacing: .04em;
  color: var(--muted);
  opacity: .85;
  user-select: none;
}
.app-version-mobile {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(52px + env(safe-area-inset-bottom));
  z-index: 29;
  padding: .35rem .75rem;
  text-align: center;
  background: var(--bg-2);
  border-top: 1px solid var(--border);
}
@media (max-width: 860px) {
  .sidebar .app-version-wrap { display: none; }
  .app-version-mobile { display: block; }
}
.user-limit-col { display: flex; flex-direction: column; gap: .25rem; min-width: 120px; }
.user-limit-col .input.sm { padding: .35rem .5rem; font-size: .82rem; }

/* ---------- check printing ---------- */
@font-face {
  font-family: "MICR E13B";
  src: url("/fonts/micr-e13b.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
}

.check-paper-advisory { margin: 8px 0 12px; }
.check-settings-form .full-width { grid-column: 1 / -1; }
.check-settings-toggles { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.check-write-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.check-preview-card { overflow: auto; }
.check-preview-host {
  overflow: auto; padding: 12px; background: #f3f4f6; border-radius: 12px;
  border: 1px solid var(--border);
}
.check-style-note {
  margin: 0 0 .5rem;
  font-size: .85rem;
  font-weight: 700;
  color: var(--text);
}
.check-settings-preview-host { margin-top: .5rem; }
.check-style-preview { display: flex; flex-direction: column; gap: .4rem; }
.check-style-preview-label {
  font-size: .82rem;
  font-weight: 700;
  color: var(--text);
}
.check-style-preview-frame {
  width: min(100%, 360px);
  height: 154px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}
.check-style-preview-scale {
  width: 8.5in;
  height: 3.5in;
  transform: scale(.42);
  transform-origin: top left;
}
.check-register-list { display: flex; flex-direction: column; gap: 10px; }
.check-register-row { padding: 14px; }
.check-register-amt { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

.check-print-page {
  position: relative; width: 8.5in; height: 11in; background: #fff; color: #111;
  overflow: hidden; margin: 0 auto;
}
.check-slot { position: absolute; overflow: hidden; }
.check-slot-inner { width: 100%; height: 100%; display: flex; flex-direction: column; }
.check-face {
  position: relative; flex: 1 1 auto; min-height: 0; padding: .22in .28in .48in;
  box-sizing: border-box; color: #111; overflow: hidden;
  display: flex; flex-direction: column;
  font-variant-numeric: tabular-nums;
}
.check-face-body {
  flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0;
  position: relative; z-index: 1;
}
.check-face.no-border { border: none !important; }
.check-style-classicMarble {
  background: transparent;
  border: none;
  border-radius: 0;
}
.check-style-professionalBlue {
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding-top: .34in;
  padding-bottom: .58in;
}
.check-style-minimalPlain {
  background: transparent;
  border: none;
  border-radius: 0;
  padding-left: .28in;
}
.check-header { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; }
.check-header.classic { min-height: .72in; }
.check-header.pro { display: grid; grid-template-columns: 1.25fr 1fr .95fr; gap: 10px; align-items: start; }
.check-header.minimal { justify-content: space-between; align-items: flex-start; padding-bottom: .1in; border-bottom: 2px solid #111; }
.check-minimal-left { display: flex; gap: 10px; align-items: center; min-width: 0; }
.check-bank-row.minimal {
  display: flex; gap: 10px; align-items: center; margin-top: .08in;
  padding-bottom: .06in; border-bottom: 1px solid #111;
}
.check-payer { display: flex; gap: 10px; align-items: center; min-width: 0; }
.check-payer-name, .check-bank-name { font-weight: 700; line-height: 1.15; color: #111; }
.check-payer-addr, .check-bank-addr { color: #111; font-size: .78em; }
.check-address-block { min-width: 0; }
.check-logo-block { display: inline-flex; gap: 8px; align-items: center; min-width: 0; color: #111; }
.check-logo-block.centered { flex-direction: column; gap: 3px; justify-content: flex-start; }
.check-logo-text { font-weight: 700; line-height: 1.15; color: #111; }
.check-bank-center { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.check-meta { text-align: right; white-space: nowrap; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.check-meta .check-date-line { white-space: nowrap; }
.check-number { font-weight: 700; font-size: 1.05em; color: #111; }
.check-date-label { font-size: .72em; font-weight: 700; text-decoration: underline; color: #111; }
.check-date-line { font-size: .86em; margin-top: 2px; color: #111; }
.check-date-line.strong { font-size: 1.02em; font-weight: 700; }
.check-amount-fig.pro-head { margin-top: 8px; font-weight: 700; font-variant-numeric: tabular-nums; font-size: 1.05em; }
.check-pay-row {
  display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: end;
  margin-top: .18in; padding-bottom: .08in; border-bottom: 1px solid #111;
}
.check-style-classicMarble .check-pay-row { border-bottom-color: rgba(17,17,17,.35); }
.check-pay-row.pro { grid-template-columns: auto 1fr; align-items: center; margin-top: .2in; border-bottom-color: transparent; }
.check-pay-row.minimal { grid-template-columns: auto 1fr auto; margin-top: .14in; border-bottom-width: 2px; }
.check-pay-label, .check-label { font-size: .72em; color: #111; max-width: .9in; line-height: 1.1; }
.check-payee { font-weight: 700; font-size: 1.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #111; }
.check-amount-box {
  background: rgba(255,255,255,.65); border: 1px solid #111; padding: 4px 10px;
  font-weight: 700; font-variant-numeric: tabular-nums; min-width: 1.1in; text-align: right; color: #111;
}
.check-amount-fig { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; color: #111; }
.check-style-minimalPlain .check-amount-fig {
  border: 1px solid #111; padding: 2px 8px; min-width: .95in; text-align: right;
}
.check-words-row { display: flex; gap: 8px; align-items: baseline; margin-top: .09in; min-height: 1.1em; }
.check-words-row.pro { margin-top: .08in; }
.check-words-row.minimal { margin-top: .12in; }
.check-words { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #111; }
.check-words-suffix { font-size: .82em; color: #111; }
.check-footer { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-top: auto; padding-top: .12in; }
.check-footer.pro { display: grid; grid-template-columns: 1fr auto; align-items: end; }
.check-footer.minimal { margin-top: auto; padding-top: .16in; }
.check-bank-block { display: flex; gap: 8px; align-items: center; font-weight: 600; color: #111; }
.check-logo { max-height: .48in; max-width: .95in; object-fit: contain; flex: 0 0 auto; }
.check-logo.bank { max-height: .46in; }
.check-memo { font-size: .78em; color: #111; align-self: end; }
.check-signature-block { text-align: center; margin-left: auto; min-width: 2.15in; align-self: end; }
.check-signature-line {
  width: 100%; border-bottom: 2px solid #111; min-height: .38in;
}
.check-signature-label { font-size: .62em; color: #111; margin-top: 3px; letter-spacing: .02em; }
.check-micr {
  position: absolute; left: 50%; bottom: .02in; transform: translateX(-50%);
  letter-spacing: .055em; white-space: nowrap; z-index: 2;
  display: flex; align-items: flex-end; justify-content: center; gap: 0;
}
.micr-line { font-family: "MICR E13B", "Courier New", monospace; line-height: 1; }
.micr-digit { font-size: 1.08em; transform: translateY(.02em); }
.micr-sym { font-size: 1.48em; line-height: .85; display: inline-block; transform: translateY(.045em); }
.micr-gap { display: inline-block; flex: 0 0 auto; }
.check-stub-page {
  position: absolute;
  overflow: hidden;
}
.check-stub {
  width: 100%;
  height: 100%;
  border-top: 2px solid #111;
  padding: .16in .08in .02in;
  margin: 0;
  font-size: .9em;
  color: #111;
  background: #fff;
}
.check-stub-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: .06in;
  margin-bottom: .07in;
  border-bottom: 1px solid #cbd5e1;
}
.check-stub-grid {
  display: grid;
  grid-template-columns: .7in 1.2fr .75in 1fr;
  gap: .05in .12in;
  align-items: baseline;
}
.check-stub-grid span {
  font-size: .82em;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #334155;
}
.check-stub-grid strong {
  color: #111;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 960px) {
  .check-write-grid { grid-template-columns: 1fr; }
}

@media print {
  @page { size: letter; margin: 0; }
  html, body { margin: 0; padding: 0; }
  body.check-print-body { margin: 0; background: #fff; }
  body.check-print-body .check-print-page { box-shadow: none; margin: 0; }
  .check-preview-host { background: #fff; border: none; padding: 0; }
  .check-face,
  .check-face *:not(img) {
    color: #000 !important;
  }
  .check-signature-line { border-bottom-color: #000 !important; border-bottom-width: 2px !important; }
  .check-pay-row,
  .check-style-minimalPlain .check-bank-row.minimal { border-bottom-color: #000 !important; }
  .check-style-minimalPlain { border-color: #000 !important; }
}

/* ---------- check layout editor ---------- */
.check-layout-section { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.check-layout-section .section-head.compact h3 { margin: 0 0 .25rem; font-size: 1rem; }
.check-layout-editor { display: flex; flex-direction: column; gap: 12px; }
.check-layout-desktop-note {
  margin: 0; padding: 10px 12px; border-radius: 10px;
  background: rgba(59, 130, 246, .08); border: 1px solid rgba(59, 130, 246, .25);
  color: var(--text); font-size: .88rem; line-height: 1.4;
}
.check-layout-desktop-note.emphasis {
  background: rgba(245, 158, 11, .12); border-color: rgba(245, 158, 11, .35);
}
.check-layout-toolbar {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; justify-content: space-between;
}
.check-layout-body {
  display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 16px; align-items: start;
}
.check-layout-canvas-host {
  overflow: visible; padding: 12px; background: #f3f4f6; border-radius: 12px; border: 1px solid var(--border);
}
.check-layout-canvas-scale {
  width: min(100%, 620px); margin: 0 auto;
}
.check-layout-canvas-inner {
  position: relative; margin: 0 auto; background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.check-layout-preview-layer { width: 100%; height: 100%; pointer-events: none; }
.check-layout-overlay-layer {
  position: absolute; inset: 0; z-index: 2;
}
.check-layout-field {
  position: absolute; box-sizing: border-box;
  border: 2px dashed rgba(59, 130, 246, .55); border-radius: 4px;
  background: rgba(59, 130, 246, .06); cursor: move; touch-action: none;
}
.check-layout-field.selected { border-color: rgba(37, 99, 235, .95); background: rgba(59, 130, 246, .12); }
.check-layout-field.hidden-field { opacity: .45; border-style: dotted; }
.check-layout-field-label {
  position: absolute; top: 2px; left: 4px; font-size: 9px; font-weight: 700;
  color: rgba(37, 99, 235, .85); pointer-events: none; line-height: 1;
}
.check-layout-handle {
  position: absolute; width: 10px; height: 10px; background: #2563eb; border: 1px solid #fff;
  border-radius: 2px; z-index: 3;
}
.check-layout-handle-nw { top: -5px; left: -5px; cursor: nwse-resize; }
.check-layout-handle-ne { top: -5px; right: -5px; cursor: nesw-resize; }
.check-layout-handle-sw { bottom: -5px; left: -5px; cursor: nesw-resize; }
.check-layout-handle-se { bottom: -5px; right: -5px; cursor: nwse-resize; }
.check-layout-sidebar { display: flex; flex-direction: column; gap: 8px; }
.check-layout-field-list { display: flex; flex-direction: column; gap: 6px; }
.check-layout-field-row { display: flex; gap: 8px; align-items: center; font-size: .88rem; cursor: pointer; }
.check-layout-actions { flex-wrap: wrap; }
.check-face-body-custom { position: absolute; inset: 0; }
.check-face.check-face-custom,
.check-face.check-face-custom.check-style-professionalBlue,
.check-face.check-face-custom.check-style-minimalPlain {
  padding: 0;
  position: relative;
}
.check-custom-field {
  position: absolute; box-sizing: border-box; overflow: hidden;
}
.check-custom-field-payeeRow {
  display: flex;
  align-items: center;
}
.check-custom-field .check-pay-row {
  margin-top: 0;
  margin-bottom: 0;
  padding-bottom: 0;
  width: 100%;
  height: 100%;
  align-items: center;
  box-sizing: border-box;
}
.check-custom-field .check-pay-row.pro,
.check-custom-field .check-pay-row.minimal {
  margin-top: 0;
}
.check-custom-field .check-pay-label,
.check-custom-field .check-label,
.check-custom-field .check-payee {
  line-height: 1.15;
  align-self: center;
}
.check-custom-field .check-payee {
  overflow: hidden;
  text-overflow: ellipsis;
}
.check-custom-field-checkNumber,
.check-custom-field-date,
.check-custom-field-amountFigures {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  text-align: right;
}
.check-custom-field-checkNumber > *,
.check-custom-field-date > *,
.check-custom-field-amountFigures > * {
  text-align: right;
  max-width: 100%;
}
.check-custom-field-amountFigures .check-amount-box,
.check-custom-field-amountFigures .check-amount-fig {
  margin-left: auto;
}
.check-custom-field-micr-positioned {
  display: flex; align-items: flex-end; justify-content: center;
}
.check-custom-field .check-micr,
.check-custom-field-micr-positioned .check-micr {
  position: relative; left: auto; bottom: auto; transform: none;
  width: 100%; justify-content: center;
}
@media (max-width: 768px) {
  .check-layout-body { grid-template-columns: 1fr; }
  .check-layout-canvas-scale { width: 100%; }
  .check-layout-canvas-inner { transform: scale(.55); transform-origin: top center; margin-bottom: -40%; }
}
@media print {
  .check-custom-field { position: absolute !important; }
}

/* Check Layout Studio */
.check-layout-studio-page { max-width: none; }
.check-layout-studio {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.check-studio-panel h2 {
  margin: 0 0 10px;
  font-size: 1rem;
}
.check-studio-panel {
  padding: 16px;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #ddd);
  border-radius: 8px;
}
.check-studio-letter-host {
  padding: 16px;
  background: #e8e4dc;
  border-radius: 6px;
}
.check-studio-letter-viewport {
  overflow: hidden;
  width: 100%;
  height: calc(var(--letter-preview-scale, 1) * 4in);
}
.check-studio-letter-frame {
  margin: 0 auto;
  box-shadow: 0 4px 24px rgba(0, 0, 0, .15);
  background: #fff;
  width: calc(var(--letter-preview-scale, 1) * 8.5in);
}
.check-studio-letter-scale {
  transform: scale(var(--letter-preview-scale, 1));
  transform-origin: top left;
  width: 8.5in;
}
.check-studio-micr-preview {
  font-family: "MICR E13B", "Courier New", monospace;
  font-size: 1.35rem;
  padding: 12px 16px;
  background: #f6f4ef;
  border: 1px solid #ccc;
  border-radius: 6px;
  letter-spacing: .055em;
  overflow-x: auto;
  white-space: nowrap;
}
.check-studio-micr-preview .check-micr {
  position: static;
  transform: none;
  display: inline-flex;
}
.check-studio-layout-panel .check-layout-editor { margin-top: 8px; }
.check-studio-copy-row { align-items: center; }
@media (max-width: 900px) {
  .check-studio-letter-viewport {
    height: calc(var(--letter-preview-scale, 1) * 3.5in);
  }
}
