/* Mobile Credential Manager — aligned with the TWN4 Studio console language.
   Read docs/UI-DESIGN-SYSTEM.md before changing tokens or shared components. */

:root {
  --shell: #09090b;
  --bg: #f6f7f9;
  --surface: #fff;
  --surface-alt: #fafafa;
  --border: #e5e7eb;
  --border-strong: #d4d4d8;
  --control-border: #a1a1aa;

  --text: #18181b;
  --text-muted: #71717a;
  --text-faint: #8b8b94;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --primary-ink: #1d4ed8;
  --danger: #b91c1c;
  --danger-soft: #fef2f2;
  --danger-ink: #991b1b;
  --success: #15803d;
  --success-soft: #f0fdf4;
  --success-ink: #166534;
  --warning: #a16207;
  --warning-soft: #fffbeb;
  --warning-ink: #92400e;

  --radius: 8px;
  --radius-sm: 6px;
  --measure: 1360px;
  --shadow: 0 1px 2px rgba(24, 24, 27, 0.025);
  --shadow-lg: 0 16px 40px rgba(9, 9, 11, 0.2);
  --sidebar-width: 270px;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }
html {
  min-width: 320px;
  background: var(--bg);
  scrollbar-gutter: stable;
  scrollbar-color: var(--border-strong) var(--bg);
}

body {
  margin: 0;
  font: 14px/1.45 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 28px; line-height: 1.25; }
h2 { font-size: 19px; }
h3 { font-size: 15px; }
p { margin: 0; }
[hidden] { display: none !important; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--primary); color: #fff; padding: 10px 16px; border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; }

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

/* ------------------------------------------------------------------ shell */

.shell { display: flex; min-height: 100vh; background: var(--bg); }

.sidebar {
  width: var(--sidebar-width);
  flex: 0 0 var(--sidebar-width);
  background: var(--surface);
  color: var(--text);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 30;
}

.brand { display: block; padding: 24px 22px 21px; color: inherit; }
.brand:hover { text-decoration: none; }
.brand-name { color: var(--text); font-size: 15px; font-weight: 650; letter-spacing: -.015em; }
.brand-sub { margin-top: 3px; color: var(--text-muted); font-size: 10px; font-weight: 600; letter-spacing: .11em; text-transform: uppercase; }

.nav { padding: 4px 14px; flex: 1; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.nav-label { margin: 18px 9px 6px; color: var(--text-muted); font-size: 10px; font-weight: 650; letter-spacing: .12em; text-transform: uppercase; }

.nav-item {
  display: flex; align-items: center; gap: 14px;
  min-height: 42px; margin: 2px 0; padding: 9px 12px; color: var(--text-muted);
  font-size: 13px; font-weight: 500; border-radius: var(--radius-sm); cursor: pointer;
}
.nav-item:hover { background: var(--surface-alt); text-decoration: none; color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary-ink); font-weight: 600; }
.nav-item svg { width: 20px; height: 20px; flex: 0 0 20px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.nav-item.active svg { color: var(--primary); }

.nav-group-toggle { width: 100%; background: none; border: 0; font: inherit; text-align: left; }
.nav-group-toggle .chevron { margin-left: auto; transition: transform 0.15s ease; }
.nav-group.open .chevron { transform: rotate(180deg); }
.nav-sub { display: none; padding-bottom: 4px; }
.nav-group.open .nav-sub { display: block; }
.nav-sub .nav-item { padding-left: 46px; font-size: 12px; }

.sidebar-foot { padding: 15px 22px 19px; border-top: 1px solid var(--border); font-size: 11px; color: var(--text-muted); }
.sidebar-version { margin-top: 8px; overflow-wrap: anywhere; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint); margin-right: 7px; }
.dot.ok { background: var(--success); }
.dot.warn { background: var(--warning); }
.dot.bad { background: var(--danger); }

/* -------------------------------------------------------------- main area */

.main {
  flex: 1; min-width: 0; min-height: 100vh; margin: 0;
  display: flex; flex-direction: column; overflow: clip;
  background: var(--bg); border-radius: 0;
}

/*
 * The topbar and the content share one measure and one centring rule, so the
 * account menu stays aligned with the page heading below it at every width.
 */
.topbar {
  display: flex; align-items: center; justify-content: flex-end; gap: 12px;
  padding: 14px 32px; min-height: 64px;
  width: 100%; max-width: var(--measure); margin: 0 auto;
}

.account { position: relative; }
.account-button {
  background: transparent; border: 1px solid transparent; font: inherit; color: var(--text-muted);
  cursor: pointer; min-height: 40px; padding: 5px 9px; border-radius: var(--radius-sm);
  display: flex; align-items: center; gap: 8px;
}
.account-button:hover { background: var(--surface); border-color: var(--border); }
.account-avatar { display: grid; width: 28px; height: 28px; place-items: center; flex: 0 0 28px; color: var(--primary-ink); background: var(--primary-soft); border-radius: 50%; font-size: 12px; font-weight: 600; }
.account-menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 6px; z-index: 40;
}
.account-meta { padding: 10px 12px; color: var(--text-muted); font-size: 12px; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.account-meta strong, .account-meta span { display: block; }
.account-meta strong { margin-bottom: 2px; color: var(--text); font-size: 13px; }
.account-menu button {
  display: block; width: 100%; text-align: left; background: none; border: 0;
  font: inherit; padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer; color: var(--text);
}
.account-menu button:hover { background: var(--surface-alt); }
.account-menu button.danger { color: var(--danger); }
.mobile-scrim { display: none; border: 0; cursor: pointer; }

.content { padding: 4px 32px 56px; max-width: var(--measure); width: 100%; margin: 0 auto; }
.content:focus { outline: none; }

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 22px; flex-wrap: wrap; margin-bottom: 24px;
}
.breadcrumb { font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ------------------------------------------------------------------ cards */

.card {
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border); box-shadow: var(--shadow); padding: 22px 24px; margin-bottom: 18px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 16px;
}
.card-head h2 { font-size: 19px; }
.card-sub { color: var(--text-muted); font-size: 13px; margin: -10px 0 18px; }
.card-head > div > .card-sub { margin: 4px 0 0; }

/* Cards carry their own bottom margin; a grid of them needs the same, or the
   next card sits flush against the bottom row. */
.grid { display: grid; gap: 16px; margin-bottom: 18px; }
.grid > .card { margin-bottom: 0; }
.grid-stats { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-dash { grid-template-columns: minmax(240px, 1fr) minmax(420px, 2.2fr); align-items: start; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 20px; align-items: start; }
.sticky-card { position: sticky; top: 20px; }

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

.stat { min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 19px 20px; }
.stat-label { font-size: 13px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.stat-value { font-size: 32px; font-weight: 650; margin: 7px 0 12px; line-height: 1.05; letter-spacing: -.035em; }
.stat-bar { height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; display: flex; }
.stat-bar span { display: block; height: 100%; }
.stat-legend { display: flex; gap: 16px; margin-top: 10px; font-size: 12px; color: var(--text-muted); }
.stat-legend i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.stat-foot { color: var(--text-faint); font-size: 12px; }
.metric { display: flex; justify-content: space-between; gap: 18px; padding: 13px 0; border-bottom: 1px solid var(--border); }
.metric:last-child { border-bottom: 0; }
.metric span { color: var(--text-muted); }
.metric strong { text-align: right; }

.deployment-monitor-status { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; margin: 0 0 18px; }
.deployment-live-status { margin: 0; color: var(--text-muted); font-size: 13px; }
.deployment-monitor-status .field-help { margin: 0; }
.deployment-site { display: block; margin: -5px 0 18px; font-size: 13px; overflow-wrap: anywhere; }
.deployment-details { gap: 8px 14px; }
.deployment-check-note { margin: 0 0 16px; color: var(--text-muted); font-size: 13px; }
.deployment-history-block { margin-top: 14px; }
.deployment-history { display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 3px; }
.deployment-hour { height: 24px; border-radius: 2px; background: var(--border); }
.deployment-hour-healthy { background: var(--success); }
.deployment-hour-partial { background: var(--warning); }
.deployment-hour-failed { background: var(--danger); }
.deployment-history-scale { display: flex; justify-content: space-between; margin-top: 6px; font-size: 11px; color: var(--text-faint); }
.deployment-history-details { margin-top: 14px; font-size: 13px; }
.deployment-history-details summary { cursor: pointer; color: var(--primary); }
.deployment-history-details .table-wrap { margin-top: 12px; }

/* --------------------------------------------------------------- controls */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; font: inherit; font-size: 13px; font-weight: 600; padding: 8px 16px; border-radius: var(--radius-sm);
  border: 1px solid transparent; cursor: pointer; background: none; color: var(--text);
  white-space: nowrap; line-height: 1.4;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn[aria-disabled="true"] { opacity: 0.65; cursor: default; }
.btn[aria-disabled="true"]:hover { background: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-outline { border-color: var(--primary); color: var(--primary); }
.btn-outline:hover:not(:disabled) { background: var(--primary-soft); }
.btn-danger { border-color: var(--danger); color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: var(--danger-soft); }
.btn-plain { border-color: var(--border-strong); color: var(--text-muted); }
.btn-plain:hover:not(:disabled) { background: var(--surface-alt); }
.btn-sm { min-height: 34px; padding: 5px 12px; font-size: 12px; }
.btn-icon { width: 36px; padding: 8px; }

.link-action {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: none; border: 0; border-bottom: 1px solid var(--border);
  font: inherit; color: var(--primary); padding: 13px 4px; cursor: pointer; text-align: left;
}
.link-action:last-child { border-bottom: 0; }
.link-action:hover:not(:disabled) { color: var(--primary-hover); }
.link-action:disabled { color: var(--text-faint); cursor: not-allowed; }
.link-action.danger { color: var(--danger); }
.link-action .glyph { width: 18px; text-align: center; font-size: 15px; }

.field { margin-bottom: 16px; }
.field label, .field-label {
  display: block; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 6px; font-weight: 650;
}
input:not([type]), input[type="text"], input[type="email"], input[type="password"], input[type="date"],
input[type="number"], input[type="url"], input[type="search"], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface);
  min-height: 42px; border: 1px solid var(--control-border); border-radius: var(--radius-sm); padding: 9px 12px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
input:disabled, select:disabled, textarea:disabled { color: var(--text-faint); background: var(--surface-alt); }
input[type="color"] { width: 56px; height: 40px; padding: 3px; border: 1px solid var(--control-border); border-radius: var(--radius-sm); background: var(--surface); }
textarea { min-height: 130px; resize: vertical; font: 13px/1.55 var(--mono); tab-size: 2; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%); background-position: calc(100% - 18px) 18px, calc(100% - 13px) 18px; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 36px; }

.checkbox { display: flex; align-items: flex-start; gap: 9px; color: var(--text-muted); cursor: pointer; }
.checkbox input { flex: 0 0 auto; width: 16px; height: 16px; accent-color: var(--primary); margin: 2px 0 0; }

.access-scope { min-width: 0; margin: 0 0 18px; padding: 0; border: 0; }
.access-scope > legend {
  margin-bottom: 8px; color: var(--text-muted); font-size: 11px; font-weight: 500;
  letter-spacing: .06em; text-transform: uppercase;
}
.access-scope-option {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; margin-bottom: 8px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); cursor: pointer;
}
.access-scope-option:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.access-scope-option input { flex: 0 0 auto; margin-top: 3px; accent-color: var(--primary); }
.access-scope-option span, .access-scope-option strong, .access-scope-option small { display: block; }
.access-scope-option small { margin-top: 2px; color: var(--text-muted); line-height: 1.45; }
.access-location-groups { margin: 12px 0 4px; padding-left: 28px; }
.access-location-group { padding: 12px 0; border-top: 1px solid var(--border); }
.access-location-group h4 { display: flex; gap: 8px; align-items: center; margin-bottom: 9px; font-size: 13px; }
.access-location { margin: 7px 0; }
.access-location-archived { color: var(--text-faint); }
.credential-access-control { min-width: 0; margin-bottom: 18px; }
.credential-access-default {
  display: grid; grid-template-columns: max-content minmax(0, 1fr); align-items: baseline; gap: 12px;
  margin: 0; padding: 11px 13px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface-alt);
}
.credential-access-default dt {
  color: var(--text-muted); font-size: 11px; font-weight: 650;
  letter-spacing: .06em; text-transform: uppercase;
}
.credential-access-default dd { min-width: 0; margin: 0; text-align: right; overflow-wrap: anywhere; }
.credential-access-disclosure { margin-top: 0; }
.credential-access-disclosure .access-scope { margin-bottom: 0; }

.field-error { color: var(--danger); font-size: 12px; margin-top: 5px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 18px; }
.form-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }

.user-search-control { position: relative; }
.user-search-results {
  position: absolute; z-index: 20; top: calc(100% + 4px); right: 0; left: 0;
  max-height: 260px; overflow-y: auto; padding: 4px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); box-shadow: var(--shadow-lg);
  scrollbar-gutter: stable; scrollbar-width: thin;
}
.user-search-option {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px;
  width: 100%; padding: 9px 10px; border: 0; border-radius: 3px;
  color: var(--text); background: transparent; font: inherit; text-align: left; cursor: pointer;
}
.user-search-option strong { min-width: 0; overflow-wrap: anywhere; }
.user-search-option span { color: var(--text-muted); font-size: 12px; overflow-wrap: anywhere; }
.user-search-option span:not(.mono) { grid-column: 1; }
.user-search-option .mono { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
.user-search-option:hover, .user-search-option.is-active { background: var(--primary-soft); }
.user-search-option[aria-selected="true"] strong::after { content: " · selected"; color: var(--primary); font-size: 11px; font-weight: 500; }

.searchbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.searchbar input[type="search"] { max-width: 360px; }
.searchbar .spacer { margin-left: auto; }
.filter-control { width: auto; min-width: 150px; }
.filter-field { display: grid; gap: 4px; min-width: 150px; }
.filter-field > span { color: var(--text-muted); font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.filter-field > input, .filter-field > select { width: 100%; }
.filter-field-search { flex: 1 1 260px; max-width: 360px; }
.pager { display: flex; align-items: center; gap: 10px; color: var(--text-muted); font-size: 13px; }
.pager:not(:has(button:not(:disabled))) { display: none; }

/* ----------------------------------------------------------------- tables */

.table-wrap {
  overflow-x: auto; margin: 0 -24px; padding: 0 24px;
  scrollbar-gutter: stable; scrollbar-width: thin;
  scrollbar-color: var(--border-strong) var(--surface-scroll-track, var(--surface));
}
.table-wrap::-webkit-scrollbar-track {
  background: var(--surface-scroll-track, var(--surface));
}
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; font-weight: 400; color: var(--text-muted); font-size: 13px;
  padding: 11px 16px 11px 0; border-bottom: 1px solid var(--border); white-space: nowrap;
}
td { padding: 14px 16px 14px 0; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--surface-alt); }
td.mono, .mono { font-family: var(--mono); font-size: 13px; }
td.shrink { width: 1%; white-space: nowrap; }

.empty { padding: 42px 16px; text-align: center; color: var(--text-muted); }
.empty-icon { margin-bottom: 10px; color: #d4d4d8; font-size: 34px; line-height: 1; }
.empty h3 { margin-bottom: 7px; color: var(--text); }
.empty p { max-width: 520px; margin: 0 auto 17px; }

/* ------------------------------------------------------------ definitions */

.definitions { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 12px 30px; align-items: baseline; }
.definitions dt { color: var(--text-muted); font-size: 13px; }
.definitions dd { min-width: 0; margin: 0; overflow-wrap: anywhere; }

.credential-history { margin-top: 24px; }
.credential-history h3 { margin-bottom: 12px; font-size: 15px; }
.credential-history-list { margin: 0; padding: 0; list-style: none; }
.credential-history-list li { padding: 14px 0; border-top: 1px solid var(--border); }

/* ------------------------------------------------------------------ chips */

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px;
  border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap;
  background: var(--surface-alt); color: var(--text-muted);
}
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip-active { background: var(--success-soft); color: var(--success-ink); }
.chip-scheduled { background: var(--primary-soft); color: var(--primary-ink); }
.chip-suspended { background: var(--warning-soft); color: var(--warning-ink); }
.chip-expired, .chip-revoked { background: var(--danger-soft); color: var(--danger-ink); }
.chip-plain::before { display: none; }
.chip-offset { margin-left: 10px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 7px; }
.tag { display: inline-flex; padding: 3px 9px; color: var(--text-muted); background: var(--surface-alt); border: 1px solid var(--border); border-radius: 999px; font-size: 12px; }

/* ------------------------------------------------------------------ alerts */

.alert { border: 1px solid transparent; border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 16px; font-size: 13px; line-height: 1.5; }
.alert strong { display: block; margin-bottom: 3px; }
.alert-info { border-color: #bfdbfe; background: var(--primary-soft); color: var(--primary-ink); }
.alert-warn { border-color: #fde68a; background: var(--warning-soft); color: var(--warning-ink); }
.alert-error { border-color: #fecaca; background: var(--danger-soft); color: var(--danger-ink); }
.alert-success { border-color: #bbf7d0; background: var(--success-soft); color: var(--success-ink); }
.alert ul { margin: 6px 0 0; padding-left: 20px; }
.alert-spaced { margin-top: 18px; }

/* ------------------------------------------------------------- pass card */

.pass-art {
  width: 190px; height: 120px; border-radius: var(--radius); flex: 0 0 190px;
  background: #1f2933; color: #fff; padding: 14px; position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between;
}
.pass-art .art-name { font-size: 13px; font-weight: 600; position: relative; }
.pass-art .art-layout { font-size: 12px; font-weight: 500; opacity: 0.85; position: relative; }

.pass-block { display: flex; gap: 32px; align-items: flex-start; flex-wrap: wrap; }
.pass-block .definitions { flex: 1 1 320px; }
.pass-block .pass-actions { flex: 0 0 230px; }

/* --------------------------------------------------------------- layouts */

.tabs {
  display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--border);
  margin: -4px 0 18px; padding: 0;
}
.tab {
  background: none; border: 0; border-bottom: 2px solid transparent; font: inherit;
  color: var(--text-muted); padding: 10px 16px; cursor: pointer; min-width: 0;
  overflow-wrap: anywhere;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; }

.steps { margin: 0; padding-left: 20px; color: var(--text-muted); line-height: 1.9; font-size: 13px; }
.steps strong { color: var(--text); }

.user-detail-block { display: flex; gap: 32px; align-items: flex-start; flex-wrap: wrap; }
.user-detail-block .definitions { flex: 1 1 320px; }

.heading-copy-button {
  display: inline; border: 0; padding: 0; background: transparent;
  color: inherit; font: inherit; text-align: left; cursor: pointer;
  max-width: 100%; overflow-wrap: anywhere;
}

.photo-control { display: flex; flex-direction: column; align-items: center; gap: 12px; flex: 0 0 auto; }
.holder-photo {
  width: 96px; height: 96px; border-radius: 8px; object-fit: cover;
  background: var(--surface-alt); border: 1px solid var(--border); display: block;
}
.holder-photo-empty {
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 600; color: var(--text-faint); letter-spacing: 0.02em;
}
.photo-actions { display: flex; flex-direction: column; gap: 8px; align-items: stretch; width: 96px; }
.photo-actions .btn { padding: 5px 8px; font-size: 12px; }

.sourced-fields {
  background: var(--surface-alt); border-radius: var(--radius-sm);
  padding: 14px 16px; margin-bottom: 20px;
}
.sourced-fields .field-label { margin-bottom: 10px; }

.standard-field {
  display: grid;
  grid-template-columns: minmax(160px, 1.1fr) minmax(120px, 1fr) minmax(120px, 1fr) 130px;
  gap: 12px; align-items: center;
  padding: 11px 12px; border-radius: var(--radius-sm); border: 1px solid transparent;
}
.standard-field:nth-child(odd) { background: var(--surface-alt); }
.standard-field.on { border-color: var(--primary-soft); background: var(--primary-soft); }
.standard-field .checkbox strong { font-weight: 500; color: var(--text); }
.standard-field-source { font-size: 12px; }
.standard-field-label, .standard-field-display { padding: 6px 10px; font-size: 13px; }

@media (max-width: 720px) {
  .standard-field { grid-template-columns: 1fr; gap: 8px; }
}

.divider { border: 0; border-top: 1px solid var(--border); margin: 26px 0 22px; }

.field-editor { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; margin-bottom: 12px; background: var(--surface-alt); }
.field-editor-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.field-editor-head .drag { color: var(--text-faint); font-size: 16px; }
.field-editor-head .title { font-weight: 600; flex: 1; }
.field-editor .form-row { gap: 0 14px; }
.field-editor .field { margin-bottom: 12px; }

/* ----------------------------------------------------------------- chart */

.chart { width: 100%; height: 200px; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .series { fill: none; stroke: var(--primary); stroke-width: 2; }
.chart .point { fill: var(--primary); }
.chart text { font-size: 11px; fill: var(--text-faint); }

/* ----------------------------------------------------------------- modal */

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(32, 33, 36, 0.5);
  display: flex; align-items: center; justify-content: center; padding: 24px; z-index: 60;
}
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg);
  width: min(640px, 100%); max-height: 88vh; overflow-y: auto; padding: 26px 28px;
  scrollbar-gutter: stable; scrollbar-width: thin;
  scrollbar-color: var(--border-strong) var(--surface);
}
.modal::-webkit-scrollbar-track { background: var(--surface); }
.modal h2 { margin-bottom: 6px; }
.modal-message { color: var(--text-muted); line-height: 1.6; }
.modal-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; }

/* ----------------------------------------------------------------- toast */

.toasts { position: fixed; right: 24px; bottom: 24px; display: flex; flex-direction: column; gap: 10px; z-index: 80; }
.toast {
  background: #202124; color: #fff; padding: 13px 18px; border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); font-size: 13px; max-width: 460px; line-height: 1.5;
}
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }

/* ------------------------------------------------------------- auth pages */

.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: var(--bg);
}
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; width: min(430px, 100%); }
.auth-brand { display: flex; align-items: center; gap: 13px; margin-bottom: 30px; text-align: left; }
.auth-mark { display: grid; width: 38px; height: 38px; place-items: center; flex: 0 0 38px; color: #fff; background: var(--primary); border-radius: var(--radius); font-weight: 700; }
.auth-brand strong { display: block; font-size: 15px; }
.auth-brand span { display: block; margin-top: 2px; color: var(--text-muted); font-size: 12px; }
.auth-card h1 { font-size: 22px; margin-bottom: 6px; }
.auth-card .auth-sub { color: var(--text-muted); margin: 0 0 26px; font-size: 13px; line-height: 1.6; }
.auth-card .btn-primary { width: 100%; }
.password-rules { font-size: 12px; color: var(--text-muted); margin: -8px 0 18px; line-height: 1.6; }

/* ------------------------------------------------------------- claim page */

.claim-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: var(--shell);
}
.claim-card { background: var(--surface); border: 1px solid rgba(255, 255, 255, .1); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 40px; width: min(430px, 100%); text-align: center; }
.claim-brand { display: flex; align-items: center; justify-content: center; gap: 9px; margin-bottom: 26px; color: var(--text-muted); font-size: 12px; }
.claim-brand span { display: grid; width: 28px; height: 28px; place-items: center; color: #fff; background: var(--primary); border-radius: var(--radius-sm); font-size: 10px; font-weight: 700; }
.claim-brand strong { color: var(--text); font-size: 13px; }
.claim-card h1 { font-size: 22px; margin-bottom: 8px; }
.claim-art { width: 100%; max-width: 300px; aspect-ratio: 1.6; margin: 0 auto 24px; border-radius: var(--radius); background: #1f2933; color: #fff; padding: 20px; display: flex; flex-direction: column; justify-content: space-between; text-align: left; position: relative; overflow: hidden; }
.claim-art .art-name { font-size: 17px; font-weight: 600; position: relative; }
.claim-art .art-layout { font-size: 13px; font-weight: 500; opacity: .85; position: relative; }
.claim-card .alert { text-align: left; }
.save-button img { display: block; height: 52px; margin: 0 auto; }
.claim-action { width: 100%; padding: 14px 20px; font-size: 15px; }
.wallet-buttons { display: flex; flex-direction: column; gap: 12px; }
.secondary-wallet { display: contents; }
.claim-qr { margin-top: 26px; }
.claim-qr p { margin-bottom: 12px; }
.claim-qr img { width: 190px; max-width: 100%; height: auto; border-radius: 8px; }
.claim-meta { margin-top: 22px; font-size: 12px; color: var(--text-faint); line-height: 1.7; }

/* ----------------------------------------------------------------- misc */

.loading { padding: 60px; text-align: center; color: var(--text-muted); }
.spinner { display: inline-block; width: 18px; height: 18px; margin-right: 9px; vertical-align: -4px; border: 2px solid var(--border-strong); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.danger-text { color: var(--danger); }
.warning-text { color: var(--warning); }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.stack > * + * { margin-top: 16px; }
.inline-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.title-with-status { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.card-flush { margin-bottom: 0; }
.stat-legend-tight { margin-top: 4px; }
.subtle-note { margin-top: 14px; color: var(--text-faint); font-size: 12px; line-height: 1.55; }
.field-help { margin-top: 5px; color: var(--text-faint); font-size: 12px; line-height: 1.5; }
.field-help-spaced { margin: -8px 0 18px; }
.card-head-compact { margin-bottom: 10px; }
.textarea-compact { min-height: 84px; }
.checkbox-stack { display: flex; flex-direction: column; gap: 10px; justify-content: flex-end; padding-bottom: 10px; }
.field-file-meta { margin-top: 8px; }
.import-result { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--border); }
.import-result > .alert:last-child { margin-bottom: 0; }
.front-field-note { margin-top: 4px; color: var(--text-faint); font-size: 11px; }
.problem-overflow { margin-top: 6px; }
.qr-action { margin-top: 22px; text-align: center; }
.reader-actions { margin-top: 18px; }
.reader-location-field { margin: 18px 0 0; }
.editor-split { display: grid; grid-template-columns: minmax(280px, 1.4fr) minmax(240px, 1fr); gap: 32px; align-items: start; }
.filter-date { width: auto; }
.card-intro { margin-top: 16px; }
.configuration-meta { margin-top: 6px; }
.claim-qr-copy { font-size: 13px; }
.detail-heading { display: flex; align-items: center; gap: 14px; }
.secret-box {
  font-family: var(--mono); font-size: 13px; word-break: break-all; background: var(--surface-alt);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 13px 15px; margin: 12px 0;
}

/* ------------------------------------------------------ physical-card keys */

.card-key-vault-status .definitions { max-width: 760px; }
.card-key-vault-summary { margin-top: 0; padding: 0 18px; }
.card-key-vault-summary > summary { padding: 14px 0; }
.card-key-vault-summary[open] > summary { margin-bottom: 12px; border-bottom: 1px solid var(--border); }
.card-key-alert-actions { margin-top: 12px; }
.card-key-name-cell { display: grid; gap: 3px; min-width: 220px; max-width: 360px; }
.card-key-name-cell > * { min-width: 0; overflow-wrap: anywhere; }
.card-key-name-cell a { font-weight: 600; }
.card-key-name-cell .faint { font-size: 12px; line-height: 1.45; }
.card-key-material-source { margin-top: 4px; }
.card-key-import-panel {
  min-width: 0; margin: 12px 0 18px; padding: 16px 18px 1px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-alt);
}
.card-key-import-panel[hidden] { display: none; }
.card-key-secret-input { font-family: var(--mono); letter-spacing: .04em; }
.card-key-version-actions { min-width: 250px; flex-wrap: nowrap; }
.card-key-description { max-width: 760px; overflow-wrap: anywhere; }

/* --------------------------------------------------------- card profiles */

.card-profile-definition-editor { display: grid; gap: 20px; }
.page-head > :first-child,
.card-profile-editor-section .card-head > *,
.card-profile-summary-group .card-head > *,
.card-profile-subitem-head > * { min-width: 0; }
.page-head h1,
.card-profile-summary-group .card-head h3,
.card-profile-subitem-head h4 { overflow-wrap: anywhere; }
.card-profile-editor-section {
  min-width: 0; padding: 24px 28px; background: var(--surface);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-profile-card-sub { margin: 4px 0 0; max-width: 760px; line-height: 1.55; }
.card-profile-key-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px; margin-bottom: 18px;
}
.card-profile-key-binding {
  min-width: 0; margin: 0 0 18px; padding: 16px 18px 2px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
}
.card-profile-key-binding > legend { padding: 0 7px; font-weight: 600; color: var(--text); }
.card-profile-key-binding .mono { font-size: 12px; }
.card-profile-checkbox-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 20px; margin: 4px 0 18px;
}
.card-profile-item {
  min-width: 0; margin-top: 14px; overflow: clip;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface);
}
.card-profile-item-heading {
  margin: 0; padding: 15px 18px; font-weight: 600;
  background: var(--surface-alt); overflow-wrap: anywhere;
}
.card-profile-item-body { min-width: 0; padding: 20px; }
.card-profile-item-actions,
.card-profile-subitem-head,
.card-profile-form-footer {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.card-profile-item-actions { margin-bottom: 18px; }
.card-profile-subitem {
  min-width: 0; margin: 12px 0; padding: 16px 18px 2px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-alt);
}
.card-profile-subitem-head { margin-bottom: 14px; }
.card-profile-group-label,
.card-profile-section-heading { margin: 22px 0 12px; }
.card-profile-group-label {
  color: var(--text-muted); font-size: 11px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
}
.card-profile-block-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px; margin-bottom: 16px;
}
.card-profile-block {
  min-width: 0; padding: 14px 14px 0; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface);
}
.card-profile-block-number { margin-bottom: 12px; font-weight: 600; }
.card-profile-fixed-grid { margin-top: 14px; }
.card-profile-fixed-panel {
  min-width: 0; padding: 14px 16px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface-alt);
}
.card-profile-fixed-panel h3,
.card-profile-fixed-panel strong { display: block; margin-bottom: 8px; }
.card-profile-fixed-panel .definitions { gap: 6px 18px; }
.card-profile-originality { margin-bottom: 18px; }
.card-profile-irreversible-warning { margin-top: 14px; }
.card-profile-form-footer {
  position: sticky; bottom: 12px; z-index: 5; justify-content: flex-end;
  margin-top: 20px; padding: 14px 16px; border: 1px solid var(--border-strong);
  border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-lg);
}
.card-profile-summary-group {
  min-width: 0; padding: 18px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface-alt);
  --surface-scroll-track: var(--surface-alt);
}
.card-profile-summary-group .table-wrap { margin-right: -18px; margin-left: -18px; padding-right: 18px; padding-left: 18px; }
.card-profile-binding-summary { display: grid; gap: 3px; min-width: 220px; overflow-wrap: anywhere; }
.card-profile-current-tag { margin-left: 9px; vertical-align: middle; }
.card-profile-revision-meta { margin-bottom: 18px; }
.card-profile-hash { max-width: 340px; overflow-wrap: anywhere; word-break: break-all; }

.card-profile-setup-progress {
  min-width: 0; margin-bottom: 14px; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow);
}
.card-profile-setup-progress-list {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px; margin: 0; padding: 0; list-style: none;
}
.card-profile-setup-progress-item { min-width: 0; border-bottom: 2px solid var(--border); }
.card-profile-setup-progress-item.current { border-bottom-color: var(--primary); }
.card-profile-setup-progress-item.complete { border-bottom-color: var(--primary-soft); }
.card-profile-setup-progress-item > div,
.card-profile-setup-progress-item > button {
  display: grid; width: 100%; min-width: 0; gap: 3px; padding: 7px 6px 8px;
  border: 0; background: none; color: var(--text-muted); font: inherit; text-align: left;
}
.card-profile-setup-progress-item > button { cursor: pointer; }
.card-profile-setup-progress-item > button:hover { color: var(--primary); background: var(--surface-alt); }
.card-profile-setup-progress-label { display: flex; min-width: 0; align-items: center; gap: 7px; font-weight: 500; }
.card-profile-setup-progress-label > :last-child { min-width: 0; overflow-wrap: anywhere; }
.card-profile-setup-progress-number {
  display: grid; width: 20px; height: 20px; place-items: center; flex: 0 0 20px;
  border: 1px solid var(--border-strong); border-radius: 50%; font-size: 11px;
}
.card-profile-setup-progress-item.current .card-profile-setup-progress-label { color: var(--primary-ink); }
.card-profile-setup-progress-item.current .card-profile-setup-progress-number { border-color: var(--primary); background: var(--primary-soft); }
.card-profile-setup-progress-state { color: var(--text-faint); font-size: 10px; text-transform: uppercase; letter-spacing: .05em; }
.card-profile-setup-status { min-height: 20px; margin: 0 2px 10px; color: var(--text-muted); font-size: 12px; }
.physical-card-write-card { display: flex; min-height: 380px; flex-direction: column; }
.physical-card-write-message-slot { min-height: 68px; }
.physical-card-write-body-slot { min-height: 170px; }
.physical-card-write-body-slot > p { margin-bottom: 16px; }
.physical-card-write-body-slot .loading { padding: 20px 0; }
.physical-card-write-card .physical-card-write-details { gap: 7px 24px; }
.physical-card-write-action-slot { min-height: 42px; margin-top: auto; }
.card-profile-setup-resources { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.card-profile-setup-caveat { color: var(--warning-ink); }
.card-profile-setup-standard-keys {
  display: grid; gap: 0; margin: 0; padding: 0; list-style: none;
  border-top: 1px solid var(--border);
}
.card-profile-setup-standard-keys li {
  display: grid; grid-template-columns: minmax(140px, .7fr) minmax(0, 1.3fr);
  gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--border);
}
.card-profile-setup-standard-keys span { color: var(--text-muted); }
.card-profile-setup-standard-keys strong { overflow-wrap: anywhere; font-weight: 500; }
.card-profile-setup-advanced > h3 { margin: 20px 0 10px; font-size: 14px; }
.card-profile-setup-key-source { margin: 0; }
.card-profile-setup-resource {
  min-width: 0; padding: 16px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface-alt);
}
.card-profile-setup-resource-head { display: flex; min-width: 0; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-profile-setup-resource-head > div { min-width: 0; }
.card-profile-setup-resource-head h3,
.card-profile-setup-resource-head p { overflow-wrap: anywhere; }
.card-profile-setup-resource .field { margin-bottom: 12px; }
.advanced-disclosure,
.card-profile-setup-advanced { margin-top: 12px; border-top: 1px solid var(--border); }
.advanced-disclosure > summary,
.card-profile-setup-advanced > summary {
  padding: 12px 0 4px; color: var(--primary-ink); font-weight: 500; cursor: pointer;
}
.advanced-disclosure[open] > summary,
.card-profile-setup-advanced[open] > summary { margin-bottom: 10px; }
.policy-security-disclosure { padding: 0; overflow: clip; }
.policy-security-disclosure > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 15px 20px; cursor: pointer; font-weight: 600;
}
.policy-security-disclosure > summary::marker { color: var(--text-faint); }
.policy-security-body { padding: 16px 20px 20px; border-top: 1px solid var(--border); }
.policy-security-body > p { margin-bottom: 16px; }

/* Settings inventory and reader configuration */
.settings-key-identity,
.settings-key-purpose,
.settings-key-status { display: grid; align-items: start; gap: 4px; min-width: 0; }
.settings-key-identity strong { font-weight: 600; overflow-wrap: anywhere; }
.settings-key-identity .mono { color: var(--text-muted); overflow-wrap: anywhere; }
.settings-key-identity .field-help,
.settings-key-purpose .field-help,
.settings-key-status .field-help { margin: 0; }
.settings-status .card-head { margin-bottom: 12px; }
.settings-status-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.settings-status-item {
  min-width: 0; padding: 14px 15px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface-alt);
}
.settings-status-item-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.settings-status-item-head strong { min-width: 0; font-size: 13px; }
.settings-status-item p { margin-top: 8px; color: var(--text-muted); font-size: 12px; line-height: 1.45; }
.settings-attention .alert:last-child { margin-bottom: 0; }
.card.settings-disclosure { padding: 0; overflow: clip; }
.settings-disclosure > summary {
  padding: 17px 22px; color: var(--text); cursor: pointer;
}
.settings-disclosure > summary::marker { color: var(--text-faint); }
.settings-disclosure-heading { display: inline-grid; gap: 3px; margin-left: 5px; vertical-align: top; }
.settings-disclosure-heading strong { font-size: 15px; }
.settings-disclosure-heading .field-help { margin: 0; font-weight: 400; }
.physical-card-access-disclosure > summary,
.physical-card-setup-disclosure > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.physical-card-access-disclosure .settings-disclosure-heading,
.physical-card-setup-disclosure .settings-disclosure-heading { min-width: 0; flex: 1; }
.settings-disclosure-body { padding: 0 22px; border-top: 1px solid var(--border); }
.settings-detail-section { min-width: 0; padding: 20px 0; }
.settings-detail-section + .settings-detail-section { border-top: 1px solid var(--border); }
.settings-detail-section .card-head { margin-bottom: 14px; }
.settings-detail-section .card-head h2 { font-size: 15px; }
.settings-detail-section .card-sub { margin: -7px 0 16px; }
.settings-detail-section > :last-child { margin-bottom: 0; }

.credential-type-revision-fields { min-width: 0; margin: 0; padding: 0; border: 0; }
.credential-type-revision-fields > .settings-detail-section:first-child { padding-top: 0; }
.credential-type-fixed-field {
  display: grid; gap: 3px; margin-bottom: 14px; padding: 13px 15px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-alt);
}
.credential-type-fixed-field > div { display: flex; align-items: center; gap: 10px; }
.credential-type-field-editor { background: var(--surface); }
.credential-type-required-field { align-self: center; margin: 8px 0 16px; }
.credential-type-carrier-panel { background: var(--surface); }
.credential-type-mappings {
  margin: 12px 0 14px; padding-top: 12px; border-top: 1px solid var(--border);
}
.credential-type-mappings > h4 { margin-bottom: 10px; font-size: 13px; }
.credential-type-mapping {
  margin: 12px 0; padding: 14px 15px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-alt);
}
.credential-type-mapping-location { grid-template-columns: repeat(2, minmax(100px, 180px)); }
.credential-type-mapping-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: -4px;
}
.credential-type-mapping-foot .field-help { margin: 0; }
.credential-type-revision-actions { justify-content: flex-end; padding-bottom: 20px; }
.credential-type-retry-note { margin-top: 14px; color: var(--warning-ink); }

.card-profile-setup-policy { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.card-profile-setup-policy h4,
.card-profile-setup-handover h3 { margin: 0 0 5px; font-size: 14px; }
.card-profile-setup-handover { padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-alt); }
.card-profile-setup-secret-list { display: grid; gap: 4px; }
.card-profile-setup-download { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; margin: 18px 0; }
.card-profile-setup-download .field-help { margin: 0; }
.card-profile-setup-reader-package { margin: 18px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.card-profile-setup-reader-package > h3 { margin: 0; padding: 13px 0; font-size: 14px; font-weight: 600; }
.card-profile-setup-reader-package-body { padding: 2px 0 15px; }
.card-profile-setup-reader-package-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.card-profile-setup-reader-package-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 8px; }
.card-profile-setup-reader-package .field-help { margin: 0; }
.card-profile-setup-actions .field-help { flex: 1 0 100%; margin-top: 0; }
.card-profile-setup-ledger .table-wrap { margin-top: -6px; }
.card-profile-setup-review { margin-bottom: 22px; }
.card-profile-setup-issues { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.card-profile-setup-issues li { display: grid; min-width: 0; gap: 3px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.card-profile-setup-issues .mono { overflow-wrap: anywhere; color: var(--text-muted); font-size: 12px; }

.scan-list { list-style: none; margin: 0; padding: 0; }
.scan-list li { display: flex; gap: 14px; align-items: baseline; padding: 12px 0; border-bottom: 1px solid var(--border); }
.scan-list li:last-child { border-bottom: 0; }
.scan-list .when { font-family: var(--mono); font-size: 12px; color: var(--text-faint); flex: 0 0 66px; }
.scan-list .what { flex: 1; min-width: 0; }
.scan-list .reason { font-size: 12px; color: var(--text-muted); }

.credential-print-preview {
  display: grid; place-items: center; min-height: 360px; padding: 32px;
  border: 1px solid var(--border); background: var(--surface-alt);
}
.credential-print-label {
  box-sizing: border-box; display: flex; width: 85.6mm; height: 54mm; max-width: 100%;
  flex-direction: column; justify-content: center; padding: 8mm;
  border: .3mm solid #d4d4d8; border-radius: 3.18mm; background: #fff; color: #18181b;
}
.credential-print-type { overflow: hidden; color: #52525b; font-size: 3.2mm; white-space: nowrap; text-overflow: ellipsis; }
.credential-print-number { margin-top: auto; font-size: 7mm; font-weight: 650; letter-spacing: .25mm; white-space: nowrap; }
.credential-print-caption { margin-top: 1.5mm; color: #71717a; font-size: 2.8mm; }

@media (max-width: 1050px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-dash, .split { grid-template-columns: 1fr; }
  .sticky-card { position: static; }
  .card-profile-key-grid { grid-template-columns: 1fr; }
  .card-profile-setup-resources { grid-template-columns: 1fr; }
  .settings-status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform 0.2s ease; z-index: 30; box-shadow: var(--shadow-lg); }
  .shell.nav-open .sidebar { transform: none; }
  .shell.nav-open .mobile-scrim { position: fixed; z-index: 20; inset: 0; display: block; background: rgba(32,33,36,.35); }
  .main { min-height: 100vh; margin: 0; border-radius: 0; }
  .content, .topbar { padding-left: 20px; padding-right: 20px; }
  .nav-toggle { display: inline-flex !important; }
  .editor-split { grid-template-columns: 1fr; }
  .pass-block .pass-actions { flex: 1 1 100%; }
}

@media (max-width: 650px) {
  h1 { font-size: 24px; }
  .topbar { min-height: 56px; padding-top: 10px; padding-bottom: 10px; }
  .account-label { display: none; }
  .content { padding-top: 2px; padding-bottom: 36px; }
  .page-head { gap: 16px; margin-bottom: 20px; }
  .card { padding: 20px; }
  .table-wrap { margin: 0 -20px; padding: 0 20px; }
  .grid-2, .grid-3, .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .credential-access-default { grid-template-columns: 1fr; gap: 3px; }
  .credential-access-default dd { text-align: left; }
  .grid-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 15px; }
  .stat-value { margin: 6px 0 9px; font-size: 28px; }
  .stat-legend { gap: 5px 10px; flex-wrap: wrap; font-size: 11px; }
  .definitions { grid-template-columns: 1fr; gap: 3px; }
  .definitions dd { margin-bottom: 8px; }
  .modal-backdrop { padding: 12px; }
  .modal { padding: 22px 20px; }
  .auth-page, .claim-page { padding: 14px; }
  .auth-card { padding: 30px 24px; }
  .claim-card { padding: 30px 24px; }
  .toasts { right: 14px; bottom: 14px; left: 14px; }
  .toast { max-width: none; }
  .searchbar { align-items: stretch; }
  .searchbar > .filter-field { width: 100%; max-width: none; flex: 1 1 100%; }
  .searchbar > .checkbox { width: 100%; }
  .searchbar > .btn { flex: 1 1 auto; }
  .searchbar input[type="search"], .filter-control, .filter-date { width: 100%; max-width: none; }
  .searchbar .spacer { display: none; }
  .pager { width: 100%; justify-content: space-between; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1 1 auto; }
  .page-actions .mobile-block,
  .form-actions .mobile-block { flex: 1 1 100%; }
  .user-detail-block, .pass-block { gap: 22px; }
  .photo-control { width: 100%; }
  .scan-list li { align-items: flex-start; flex-wrap: wrap; }
  .scan-list .what { flex-basis: calc(100% - 90px); }
  .claim-qr img { width: min(190px, 100%); height: auto; }
  .card-profile-editor-section { padding: 20px; }
  .card-profile-checkbox-grid { grid-template-columns: 1fr; }
  .card-profile-item-body { padding: 16px; }
  .card-profile-subitem { padding: 14px 14px 1px; }
  .card-profile-form-footer { position: static; }
  .card-profile-form-footer .btn { flex: 1 1 auto; }
  .card-profile-summary-group { padding: 15px; }
  .card-profile-summary-group .table-wrap { margin-right: -15px; margin-left: -15px; padding-right: 15px; padding-left: 15px; }
  .card-key-import-panel { padding-right: 14px; padding-left: 14px; }
  .card-profile-setup-progress { padding-right: 12px; padding-left: 12px; }
  .card-profile-setup-progress-item > div,
  .card-profile-setup-progress-item > button { justify-items: center; }
  .card-profile-setup-progress-label { justify-content: center; }
  .card-profile-setup-progress-label > :last-child {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
  }
  .card-profile-setup-standard-keys li { grid-template-columns: 1fr; gap: 3px; }
  .card-profile-setup-download .btn { width: 100%; }
  .card-profile-setup-reader-package-grid { grid-template-columns: 1fr; gap: 0; }
  .card-profile-setup-reader-package-actions .btn { width: 100%; }
  .card-profile-setup-actions .btn { flex: 1 1 auto; }
  .settings-status-grid { grid-template-columns: 1fr; }
  .settings-disclosure > summary { padding: 16px 20px; }
  .settings-disclosure-body { padding-right: 20px; padding-left: 20px; }

  .table-wrap:has(> .responsive-table:not(.sr-only)) { overflow: visible; margin: 0; padding: 0; }
  .responsive-table:not(.sr-only),
  .responsive-table:not(.sr-only) tbody,
  .responsive-table:not(.sr-only) tr,
  .responsive-table:not(.sr-only) td { display: block; width: 100%; }
  .responsive-table:not(.sr-only) thead {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
  }
  .responsive-table:not(.sr-only) tbody { display: grid; gap: 10px; }
  .responsive-table:not(.sr-only) tbody tr {
    min-width: 0; padding: 8px 12px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); background: var(--surface);
  }
  .responsive-table:not(.sr-only) tbody td {
    display: grid; grid-template-columns: minmax(88px, .75fr) minmax(0, 1.25fr);
    align-items: start; gap: 12px; padding: 7px 0; border: 0;
    white-space: normal; overflow-wrap: anywhere;
  }
  .responsive-table:not(.sr-only) tbody td::before {
    content: attr(data-label); min-width: 0; color: var(--text-muted);
    font-size: 11px; font-family: var(--font); font-weight: 600;
    letter-spacing: .04em; text-transform: uppercase;
  }
  .responsive-table:not(.sr-only) tbody td > .chip { justify-self: start; }
  .responsive-table:not(.sr-only) tbody td[data-label=""] { grid-template-columns: 1fr; }
  .responsive-table:not(.sr-only) tbody td[data-label=""]::before { display: none; }
  .responsive-table:not(.sr-only) tbody td.shrink { width: 100%; white-space: normal; }
}

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

@media print {
  @page { size: 85.6mm 54mm; margin: 0; }
  html, body { width: 85.6mm; height: 54mm; margin: 0; background: #fff; }
  body { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .sidebar, .topbar, .mobile-scrim, .credential-print-controls { display: none !important; }
  .shell, .main, .content, #view, .credential-print-page, .credential-print-preview {
    display: block; width: 85.6mm; min-width: 0; max-width: none; height: 54mm; min-height: 0;
    padding: 0; margin: 0; overflow: hidden; border: 0; background: #fff; box-shadow: none;
  }
  .credential-print-label { max-width: none; border-color: transparent; }
}

.nav-toggle { display: none; margin-right: auto; }
.nav-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Holder photo framing uses the shared dialog and its responsive width. */
.photo-crop-editor { display: grid; gap: 12px; min-width: 0; }
.photo-crop-preview {
  display: block; width: min(100%, 280px); height: auto; aspect-ratio: 1;
  justify-self: center; border: 1px solid var(--control-border); border-radius: var(--radius-sm);
  background: var(--surface-alt); touch-action: none; cursor: grab;
}
.photo-crop-preview:active { cursor: grabbing; }
.photo-crop-preview[aria-disabled="true"] { cursor: wait; }
.photo-crop-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; }
.photo-crop-field label { font-size: 12px; font-weight: 600; }
.photo-crop-field output { font-size: 12px; color: var(--text-muted); }
.photo-crop-field input[type="range"] { grid-column: 1 / -1; width: 100%; min-width: 0; min-height: 32px; padding: 0; accent-color: var(--primary); }
.photo-crop-editor .field-help { margin: 0; }
.photo-crop-editor > .btn { justify-self: start; }
.photo-control-status { max-width: 180px; margin: 0; text-align: center; }
.mobile-badge-artwork-crop-preview {
  width: min(100%, 620px); aspect-ratio: 720 / 454;
}
.mobile-badge-artwork-current {
  display: block; width: min(100%, 516px); height: auto; aspect-ratio: 720 / 454;
  margin-bottom: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-alt); object-fit: cover;
}
.mobile-badge-artwork-actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px;
}
.mobile-badge-artwork-panel .field-help { max-width: 720px; }
