/* ============================================================
   PassPlus — design system

   Tokens live in tokens.css (PR 3.1). Import them so both vanilla pages
   and the React islands under apps/web/ render with the same palette.
   ============================================================ */

@import './tokens.css';

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-600); }

img { max-width: 100%; display: block; }

::selection { background: var(--primary-50); color: var(--primary-600); }

/* ============================================================
   App shell — dark sidebar + light content
   ============================================================ */

.app {
  display: grid;
  grid-template-columns: 256px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  padding: 12px 12px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  font-size: 13.5px;
}

/* Top: workspace switcher (replaces old brand block) */
.sidebar .ws-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  position: relative;
  user-select: none;
}
.sidebar .ws-switch:hover { background: var(--sidebar-bg-2); }
.sidebar .ws-switch[aria-expanded="true"] { background: var(--sidebar-bg-2); }
.sidebar .ws-switch .ws-mark {
  width: 24px; height: 24px;
  border-radius: 6px;
  flex-shrink: 0;
  display: inline-grid;
  place-items: center;
  color: white;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.sidebar .ws-switch .ws-chev {
  color: var(--sidebar-text-2);
  font-size: 11px;
  margin-left: 2px;
}
.sidebar .ws-switch .logo {
  width: 24px; height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Workspace dropdown */
.sidebar .ws-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: white;
  border: 1px solid var(--sidebar-border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(11, 18, 32, 0.14);
  padding: 4px;
  z-index: 200;
}
.sidebar .ws-dd-h {
  padding: 8px 10px 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sidebar-text-2);
  font-weight: 600;
}
.sidebar .ws-item {
  display: flex !important;
  align-items: center;
  gap: 10px;
  padding: 8px 10px !important;
  border-radius: 8px;
  text-decoration: none !important;
  color: var(--sidebar-active) !important;
  background: transparent !important;
  margin: 1px 0 !important;
  font-weight: 500 !important;
}
.sidebar .ws-item:hover { background: var(--sidebar-bg-2) !important; }
.sidebar .ws-item.active { background: var(--sidebar-bg-2) !important; }
.sidebar .ws-item .ws-mark {
  width: 26px; height: 26px;
  border-radius: 6px;
  flex-shrink: 0;
  display: inline-grid;
  place-items: center;
  color: white;
  font-size: 11px;
  font-weight: 700;
}
.sidebar .ws-item .ws-mark-empty {
  background: white !important;
  border: 1px dashed var(--sidebar-border);
  color: var(--sidebar-text-2) !important;
  font-weight: 400;
}
.sidebar .ws-item .ws-item-meta {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 1px;
}
.sidebar .ws-item .ws-item-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--sidebar-active);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar .ws-item .ws-item-plan {
  font-size: 11px;
  color: var(--sidebar-text-2);
  font-weight: 400;
}
.sidebar .ws-item .ws-check {
  color: var(--sidebar-active);
  font-size: 13px;
  font-weight: 700;
}
.sidebar .ws-divider {
  height: 1px;
  background: var(--sidebar-border);
  margin: 4px 6px;
}
.sidebar .ws-item-add .ws-item-name { color: var(--sidebar-text); }
.sidebar .ws-switch .name {
  flex: 1; min-width: 0;
  color: var(--sidebar-active);
  font-weight: 600;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar .ws-switch .plan-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--sidebar-bg-2);
  border: 1px solid var(--sidebar-border);
  color: var(--sidebar-text);
}
.sidebar .ws-switch .add-btn {
  width: 22px; height: 22px;
  border: 0; background: transparent;
  cursor: pointer;
  border-radius: 6px;
  color: var(--sidebar-text);
  display: inline-grid; place-items: center;
  font-size: 16px; line-height: 1;
}
.sidebar .ws-switch .add-btn:hover { background: var(--sidebar-bg-2); color: var(--sidebar-active); }

/* Search field */
.sidebar .ws-search-wrap {
  position: relative;
  margin: 4px 0 8px;
}
.sidebar .ws-search {
  width: 100%;
  border: 1px solid var(--sidebar-border);
  background: white;
  border-radius: 8px;
  padding: 7px 36px 7px 30px;
  font-size: 13px;
  font-family: inherit;
  color: var(--sidebar-active);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M11.5 11.5L14 14M7 12a5 5 0 1 1 0-10 5 5 0 0 1 0 10z' stroke='%23a1a1aa' fill='none' stroke-width='1.5' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: 9px center;
  background-size: 14px;
}
.sidebar .ws-search:focus { outline: 0; border-color: var(--text-muted); }
.sidebar .ws-search-kbd {
  position: absolute;
  right: 8px; top: 50%; transform: translateY(-50%);
  font-size: 10.5px;
  color: var(--sidebar-text-2);
  background: var(--sidebar-bg-2);
  border: 1px solid var(--sidebar-border);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: var(--font-mono);
  pointer-events: none;
}

/* Bottom workspace card */
.sidebar .ws-bottom {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
}
.sidebar .ws-bottom:hover { background: var(--sidebar-bg-2); }
.sidebar .ws-bottom .avatar {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  display: grid; place-items: center;
  color: white; font-size: 10px; font-weight: 700;
  flex-shrink: 0;
}
.sidebar .ws-bottom .meta {
  flex: 1; min-width: 0;
  font-size: 12.5px;
  color: var(--sidebar-active);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar .ws-bottom .chev { color: var(--sidebar-text-2); font-size: 14px; }

/* Brand logo: <img> injected by app.js into [data-brand-logo] elements.
   The asset is an icon+wordmark combo (~4:1), so we override any fixed
   square sizing the host context applied (e.g., the 28×28 .logo class in
   the marketing nav) and let the image keep its aspect by height. */
[data-brand-logo] {
  display: inline-flex !important;
  background: transparent !important;
  border-radius: 0 !important;
  width: auto !important;
  overflow: hidden;
  line-height: 0;
  color: inherit;
}
[data-brand-logo] svg,
[data-brand-logo] .brand-logo-img {
  width: auto;
  height: 100%;
  max-height: 32px;
  display: block;
}
/* Marketing nav stretches a bit taller for the wordmark to read clearly. */
.marketing .nav .brand [data-brand-logo] { height: 32px; }
.marketing .nav .brand [data-brand-logo] .brand-logo-img { max-height: 32px; }
/* Auth-shell card brand sits above the H1 and reads at a smaller scale. */
.auth-shell .brand [data-brand-logo] { height: 24px; }
.auth-shell .brand [data-brand-logo] .brand-logo-img { max-height: 24px; }

.sidebar .nav-section {
  margin-top: 14px;
  padding: 4px 10px 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sidebar-text-2);
  font-weight: 600;
}

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--sidebar-text);
  font-size: 13px;
  font-weight: 500;
  margin: 0;
  text-decoration: none;
}

.sidebar nav a:hover {
  background: var(--sidebar-bg-2);
  color: var(--sidebar-active);
}

.sidebar nav a.active {
  background: var(--sidebar-bg-2);
  color: var(--sidebar-active);
  font-weight: 600;
}

.sidebar nav a .icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: inline-grid;
  place-items: center;
  font-size: 14px;
  color: var(--sidebar-text-2);
}

.sidebar nav a:hover .icon, .sidebar nav a.active .icon { color: var(--sidebar-active); }

.sidebar .spacer { flex: 1; min-height: 8px; }

/* main column */

.main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.topbar .crumbs {
  color: var(--text-muted);
  font-size: 13px;
}

.topbar .crumbs span { color: var(--text); font-weight: 500; }

.topbar .grow { flex: 1; }

.content {
  padding: 24px 28px 48px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}

/* ============================================================
   Common components
   ============================================================ */

.btn {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13.5px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background .12s, border-color .12s, transform .05s;
}

.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-600); border-color: var(--primary-600); }

.btn-ghost {
  background: transparent;
  border-color: transparent;
}
.btn-ghost:hover { background: var(--surface-2); }

.btn-danger {
  color: var(--danger);
  border-color: var(--border-strong);
}
.btn-danger:hover { background: var(--danger-50); border-color: var(--danger); }

.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 6px; }
.btn-lg { padding: 11px 18px; font-size: 14.5px; border-radius: 10px; }

.btn-block { display: flex; width: 100%; justify-content: center; }

/* form */

.field { margin-bottom: 14px; }
.field > label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 5px;
}
.field > .hint {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 5px;
}

.input, .select, .textarea {
  width: 100%;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text);
  transition: border-color .12s, box-shadow .12s;
}

.input:focus, .select:focus, .textarea:focus {
  outline: 0;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-50);
}

.textarea { resize: vertical; min-height: 80px; }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.color-input {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 4px 10px 4px 4px;
  background: var(--surface);
}
.color-input input[type="color"] {
  appearance: none;
  border: 0;
  background: none;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  padding: 0;
  cursor: pointer;
}
.color-input span {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

/* card */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: var(--sh-1);
}

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

.card-h h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.card-h .sub {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.section {
  display: grid;
  gap: 16px;
}

/* table */

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
}

.table th, .table td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.table th {
  font-weight: 500;
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.table tbody tr:hover { background: var(--surface-2); }

.table .num { text-align: right; font-variant-numeric: tabular-nums; }

.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--sh-1);
}

.table-card thead th:first-child { padding-left: 20px; }
.table-card tbody td:first-child { padding-left: 20px; }
.table-card thead th:last-child  { padding-right: 20px; }
.table-card tbody td:last-child  { padding-right: 20px; }

/* badges */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

.badge-success { background: var(--success-50); color: var(--success); }
.badge-warning { background: var(--warning-50); color: var(--warning); }
.badge-danger  { background: var(--danger-50);  color: var(--danger); }
.badge-info    { background: var(--info-50);    color: var(--info); }
.badge-primary { background: var(--primary-50); color: var(--primary-600); }

.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* stat tiles */

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}
@media (max-width: 1000px) { .stats { grid-template-columns: repeat(2, 1fr); } }

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  box-shadow: var(--sh-1);
}
.stat .label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.stat .value { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; margin: 4px 0 6px; font-variant-numeric: tabular-nums; }
.stat .delta { font-size: 12px; font-weight: 500; }
.stat .delta.up { color: var(--success); }
.stat .delta.down { color: var(--danger); }

/* page header */

.page-h {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.page-h h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.015em;
}
.page-h .sub { color: var(--text-muted); font-size: 14px; margin-top: 4px; }

/* tabs */

.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.tabs a {
  padding: 10px 14px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs a:hover { color: var(--text); }
.tabs a.active {
  color: var(--text);
  border-bottom-color: var(--primary);
}

/* avatar */
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #ec4899);
  display: inline-grid; place-items: center;
  color: white; font-weight: 600; font-size: 12px;
  flex-shrink: 0;
}

/* empty state */
.empty {
  text-align: center;
  padding: 56px 24px;
  color: var(--text-muted);
}
.empty .icon {
  width: 56px; height: 56px;
  border-radius: 14px;
  background: var(--surface-2);
  display: inline-grid; place-items: center;
  margin-bottom: 14px;
  color: var(--text-subtle);
}
.empty h3 { margin: 0 0 4px; font-size: 16px; color: var(--text); font-weight: 600; }
.empty p { margin: 0 0 14px; font-size: 13.5px; }

/* toast */
.toast-host {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
}
.toast {
  background: var(--text);
  color: white;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  box-shadow: var(--sh-3);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toast-in .2s ease-out;
}
.toast .dot { background: var(--success); }
.toast.error .dot { background: var(--danger); }
@keyframes toast-in {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

/* utility */
.row { display: flex; gap: 10px; align-items: center; }
.col { display: flex; flex-direction: column; }
.gap-4 { gap: 4px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.muted { color: var(--text-muted); }
.subtle { color: var(--text-subtle); }
.strong { font-weight: 600; }
.grow { flex: 1; }
.right { text-align: right; }
.mono { font-family: var(--font-mono); font-size: 12px; }
.divider { height: 1px; background: var(--border); margin: 16px 0; border: 0; }
.nowrap { white-space: nowrap; }

/* ============================================================
   Marketing landing
   ============================================================ */

.marketing {
  background:
    radial-gradient(1200px 600px at 80% -20%, rgba(91,91,243,.18), transparent 60%),
    radial-gradient(900px 600px at -10% 10%, rgba(236,72,153,.10), transparent 60%),
    var(--bg);
}

.marketing .nav-bar {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 1;
}
.marketing .nav {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 32px;
  max-width: 1200px;
  margin: 0 auto;
}
.marketing .nav .brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; color: var(--text);
  font-size: 15px;
}
.marketing .nav .brand .logo {
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), #8a8aff);
  display: grid; place-items: center;
  color: white; font-weight: 800; font-size: 14px;
}
.marketing .nav .grow { flex: 1; }

.hero {
  max-width: 1100px;
  margin: 0 auto;
  padding: 64px 32px 80px;
  text-align: center;
}
.hero .pill {
  display: inline-flex; gap: 6px; align-items: center;
  background: var(--surface); border: 1px solid var(--border);
  padding: 5px 12px; border-radius: 999px;
  font-size: 12.5px; color: var(--text-muted);
  margin-bottom: 18px;
}
.hero h1 {
  font-size: 56px;
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin: 0 0 16px;
  font-weight: 800;
}
.hero h1 .grad {
  background: linear-gradient(90deg, var(--primary), #ec4899);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p {
  font-size: 18px;
  color: var(--text-muted);
  max-width: 660px;
  margin: 0 auto 28px;
  line-height: 1.5;
}
.hero .cta { display: inline-flex; gap: 10px; }

@media (max-width: 700px) { .hero h1 { font-size: 38px; } }

.feature-grid {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 32px 80px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
@media (max-width: 900px) { .feature-grid { grid-template-columns: 1fr; } }

.feature {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
}
.feature .ico {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--primary-50); color: var(--primary-600);
  display: grid; place-items: center;
  margin-bottom: 12px;
}
.feature h3 { margin: 0 0 6px; font-size: 15px; font-weight: 600; }
.feature p { margin: 0; color: var(--text-muted); font-size: 13.5px; line-height: 1.5; }

.types-strip {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 28px 32px;
}
.types-strip .inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; gap: 10px; flex-wrap: wrap; justify-content: center;
}
.type-chip {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
}

/* ============================================================
   Auth pages (signup/login)
   ============================================================ */

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  background:
    radial-gradient(1000px 500px at 50% -10%, rgba(91,91,243,.15), transparent 60%),
    var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  box-shadow: var(--sh-2);
}
.auth-card .brand {
  display: flex; gap: 10px; align-items: center;
  font-weight: 700; margin-bottom: 22px;
}
.auth-card .brand .logo {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), #8a8aff);
  display: grid; place-items: center; color: white; font-weight: 800;
}
.auth-card h1 { margin: 0 0 4px; font-size: 22px; letter-spacing: -0.01em; }
.auth-card .sub { color: var(--text-muted); font-size: 13.5px; margin-bottom: 20px; }
.auth-card .foot { margin-top: 18px; font-size: 13px; color: var(--text-muted); text-align: center; }

/* ============================================================
   Template designer (the flagship)
   ============================================================ */

.designer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 460px;
  gap: 20px;
  align-items: start;
}
@media (max-width: 1100px) { .designer { grid-template-columns: 1fr; } }

.designer .preview-col {
  position: sticky;
  top: 84px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.wallet-switch {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  gap: 2px;
  align-self: center;
}
.wallet-switch button {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: 7px;
  cursor: pointer;
  font-family: inherit;
}
.wallet-switch button.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--sh-1);
}

.phone-frame {
  background: linear-gradient(180deg, #2a3041, #181d2c);
  border-radius: 36px;
  padding: 14px;
  box-shadow: var(--sh-3);
  width: 360px;
  margin: 0 auto;
}
.phone-frame .screen {
  background: #fff;
  border-radius: 24px;
  height: 600px;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* ============================================================
   Wallet pass mocks
   ============================================================ */

/* Apple Wallet pass */
.aw-screen {
  background: #f3f4f6;
  height: 100%;
  display: flex;
  flex-direction: column;
  font-family: -apple-system, "SF Pro Display", system-ui, sans-serif;
}
.aw-bar {
  padding: 14px 16px 8px;
  font-size: 14px;
  font-weight: 600;
  color: #111;
  display: flex; align-items: center; justify-content: space-between;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
}
.aw-pass {
  margin: 16px;
  border-radius: 14px;
  padding: 14px 16px;
  color: white;
  background: var(--pass-bg, #1a73e8);
  box-shadow: 0 6px 18px rgba(0,0,0,.15);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.aw-pass .head {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px;
  font-weight: 600;
  opacity: .95;
}
.aw-pass .head .logo {
  width: 28px; height: 28px;
  background: rgba(255,255,255,.25);
  border-radius: 6px;
  display: grid; place-items: center;
  font-size: 12px;
  font-weight: 800;
}
.aw-pass .head .head-r { margin-left: auto; text-align: right; }
.aw-pass .head .head-r .lbl { font-size: 9px; opacity: .75; letter-spacing: .08em; }
.aw-pass .head .head-r .val { font-size: 16px; font-weight: 700; }
.aw-pass .primary { font-size: 22px; font-weight: 700; line-height: 1.1; }
.aw-pass .row { display: flex; justify-content: space-between; gap: 12px; }
.aw-pass .field-mini .lbl { font-size: 9px; opacity: .75; letter-spacing: .08em; text-transform: uppercase; }
.aw-pass .field-mini .val { font-size: 13px; font-weight: 600; }
.aw-pass .barcode {
  background: white;
  color: black;
  padding: 14px;
  border-radius: 6px;
  text-align: center;
}
.aw-pass .barcode .qr-mock {
  width: 110px; height: 110px;
  background:
    repeating-linear-gradient(0deg, #000 0 6px, #fff 6px 12px),
    repeating-linear-gradient(90deg, #000 0 6px, #fff 6px 12px);
  background-blend-mode: difference;
  margin: 0 auto 6px;
  border-radius: 4px;
}
.aw-pass .barcode .code {
  font-family: var(--font-mono);
  font-size: 11px;
  color: #444;
  letter-spacing: 0.05em;
}

/* Google Wallet pass */
.gw-screen {
  background: #f1f3f4;
  height: 100%;
  display: flex; flex-direction: column;
  font-family: "Google Sans", "Roboto", system-ui, sans-serif;
}
.gw-bar {
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  padding: 12px 16px;
  display: flex; align-items: center; gap: 10px;
  font-size: 16px; font-weight: 500; color: #202124;
}
.gw-bar .pill {
  margin-left: auto;
  background: #e8f0fe; color: #1967d2;
  padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 500;
}
.gw-pass {
  margin: 14px;
  background: var(--pass-bg, #1a73e8);
  color: white;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,.10);
  display: flex; flex-direction: column; gap: 14px;
}
.gw-pass .gw-head {
  display: flex; align-items: center; gap: 10px;
}
.gw-pass .gw-head .logo {
  width: 36px; height: 36px;
  background: rgba(255,255,255,.22);
  border-radius: 8px;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 800;
}
.gw-pass .gw-head .titles .issuer { font-size: 11px; opacity: .85; letter-spacing: .04em; }
.gw-pass .gw-head .titles .program { font-size: 14px; font-weight: 600; }
.gw-pass .gw-pts {
  display: flex; align-items: baseline; gap: 6px;
}
.gw-pass .gw-pts .lbl { font-size: 11px; opacity: .85; letter-spacing: .04em; text-transform: uppercase; }
.gw-pass .gw-pts .val { font-size: 28px; font-weight: 700; letter-spacing: -0.01em; }
.gw-pass .gw-meta { display: flex; gap: 18px; }
.gw-pass .gw-meta .lbl { font-size: 11px; opacity: .85; }
.gw-pass .gw-meta .val { font-size: 13px; font-weight: 600; }
.gw-pass .gw-barcode {
  background: white; color: black; border-radius: 8px; padding: 12px; text-align: center;
}
.gw-pass .gw-barcode .qr-mock {
  width: 110px; height: 110px;
  background:
    repeating-linear-gradient(0deg, #000 0 6px, #fff 6px 12px),
    repeating-linear-gradient(90deg, #000 0 6px, #fff 6px 12px);
  background-blend-mode: difference;
  margin: 0 auto 6px;
  border-radius: 4px;
}
.gw-pass .gw-barcode .code {
  font-family: var(--font-mono); font-size: 11px; color: #5f6368; letter-spacing: 0.04em;
}

/* ============================================================
   Type picker grid
   ============================================================ */
.type-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
@media (max-width: 900px) { .type-grid { grid-template-columns: 1fr; } }

.type-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  cursor: pointer;
  transition: border-color .12s, transform .08s, box-shadow .12s;
  text-align: left;
  font-family: inherit;
  color: var(--text);
}
.type-card:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-50);
}

.type-card .ico {
  width: 38px; height: 38px;
  background: var(--primary-50); color: var(--primary-600);
  border-radius: 10px;
  display: grid; place-items: center;
  margin-bottom: 12px;
}

.type-card h4 {
  margin: 0 0 4px;
  font-size: 14px; font-weight: 600;
}
.type-card p {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.45;
}

/* event log */

.log {
  display: flex;
  flex-direction: column;
}
.log-item {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px dashed var(--border);
  align-items: flex-start;
}
.log-item:last-child { border-bottom: 0; }
.log-item .ico {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-muted);
  display: grid; place-items: center;
  font-size: 13px;
}
.log-item .ico.success { background: var(--success-50); color: var(--success); }
.log-item .ico.info { background: var(--info-50); color: var(--info); }
.log-item .ico.warn { background: var(--warning-50); color: var(--warning); }
.log-item .ico.danger { background: var(--danger-50); color: var(--danger); }
.log-item .body { font-size: 13.5px; }
.log-item .body .meta { color: var(--text-muted); font-size: 12.5px; margin-top: 2px; }
.log-item .ts { color: var(--text-subtle); font-size: 12px; white-space: nowrap; }

/* split layout */
.split-2 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 18px;
  align-items: start;
}
@media (max-width: 1000px) { .split-2 { grid-template-columns: 1fr; } }

/* responsive sidebar */
@media (max-width: 800px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
}

/* ============================================================
   Language switcher
   ============================================================ */
.lang-switch {
  appearance: none;
  -webkit-appearance: none;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 28px 6px 10px;
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'><path d='M2 4l3 3 3-3' stroke='%235b6478' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.sidebar .lang-switch {
  background: transparent;
  border-color: var(--sidebar-border);
  color: var(--sidebar-active);
  width: 100%;
  padding-right: 10px;
}
.sidebar .lang-switch option { background: var(--sidebar-bg); color: var(--sidebar-active); }

/* ============================================================
   Toggle switch
   ============================================================ */
.toggle {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle .slider {
  position: absolute; inset: 0;
  background: var(--border-strong);
  border-radius: 22px;
  cursor: pointer;
  transition: background .15s;
}
.toggle .slider::before {
  content: '';
  position: absolute;
  height: 16px; width: 16px;
  left: 3px; top: 3px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0,0,0,.2);
  transition: transform .15s;
}
.toggle input:checked + .slider { background: var(--success); }
.toggle input:checked + .slider::before { transform: translateX(18px); }
.toggle input:disabled + .slider { opacity: .55; cursor: not-allowed; }

.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.toggle-row:last-child { border-bottom: 0; }
.toggle-row .lbl { font-size: 13.5px; }
.toggle-row .lbl small { display: block; color: var(--text-muted); font-size: 12px; margin-top: 2px; }

/* chip-style multi-input */
.tags-input {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 6px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  min-height: 40px;
}
.tags-input .chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--primary-50); color: var(--primary-600);
  border-radius: 6px;
  font-size: 12.5px; font-weight: 500;
  padding: 4px 8px;
}
.tags-input .chip .x { cursor: pointer; opacity: .6; font-weight: 700; }
.tags-input .chip .x:hover { opacity: 1; }
.tags-input input {
  border: 0; outline: 0;
  flex: 1; min-width: 100px;
  padding: 4px 6px;
  font-size: 13px;
  font-family: inherit;
  background: transparent;
  color: var(--text);
}

/* ============================================================
   Modal dialog
   ============================================================ */
dialog.modal {
  border: 0;
  border-radius: var(--r-lg);
  padding: 0;
  max-width: 520px;
  width: calc(100% - 32px);
  background: var(--surface);
  box-shadow: var(--sh-3);
  color: var(--text);
}
dialog.modal::backdrop {
  background: rgba(11, 18, 32, 0.45);
  backdrop-filter: blur(2px);
}
dialog.modal .modal-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 22px 24px 12px;
  gap: 16px;
}
dialog.modal .modal-head h3 { margin: 0 0 4px; font-size: 17px; font-weight: 600; }
dialog.modal .modal-head .sub { font-size: 13px; color: var(--text-muted); }
dialog.modal .modal-close {
  appearance: none; background: transparent; border: 0;
  color: var(--text-muted); font-size: 18px; cursor: pointer;
  width: 32px; height: 32px; border-radius: 8px;
  display: inline-grid; place-items: center;
}
dialog.modal .modal-close:hover { background: var(--surface-2); color: var(--text); }
dialog.modal .modal-body { padding: 8px 24px 4px; }
dialog.modal .modal-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 16px 24px 22px;
  margin-top: 6px;
}

/* CSV upload drop zone */
.upload-zone {
  border: 2px dashed var(--border-strong);
  border-radius: 12px;
  padding: 28px 18px;
  text-align: center;
  background: var(--surface-2);
  transition: border-color .15s, background .15s;
}
.upload-zone.has-file { border-style: solid; border-color: var(--success); background: var(--success-50); }
.upload-zone.dragover { border-color: var(--primary); background: var(--primary-50); }
.upload-zone .uz-ico {
  width: 44px; height: 44px;
  margin: 0 auto 10px;
  border-radius: 10px;
  background: var(--surface);
  display: grid; place-items: center;
  font-size: 22px;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.upload-zone .uz-fname { font-size: 14px; font-weight: 600; color: var(--text); margin-top: 6px; }
.upload-zone .uz-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.upload-zone .btn { margin-top: 4px; }
