/* Claude Bridge — interface d'administration (sans dépendance externe, compatible CSP stricte) */

:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #f7f8fc;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e3e6ee;
  --border-strong: #cdd3e0;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef0ff;
  --on-accent: #ffffff;
  --success: #15803d;
  --success-soft: #e6f6ec;
  --warn: #b45309;
  --warn-soft: #fef3e0;
  --danger: #c02626;
  --danger-soft: #fdeaea;
  --info: #1d4ed8;
  --info-soft: #e8f0fe;
  --violet: #6d28d9;
  --violet-soft: #f1eafe;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 6px 20px rgba(15, 23, 42, .05);
  --radius: 14px;
  --radius-sm: 10px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0d13;
    --surface: #131722;
    --surface-2: #181d2a;
    --text: #e8eaf1;
    --muted: #8f98ae;
    --border: #252b3b;
    --border-strong: #343c52;
    --accent: #818cf8;
    --accent-hover: #9aa3fa;
    --accent-soft: #1f2340;
    --on-accent: #0b0d13;
    --success: #4ade80;
    --success-soft: #12281c;
    --warn: #fbbf24;
    --warn-soft: #2e2410;
    --danger: #f87171;
    --danger-soft: #331717;
    --info: #7aa7ff;
    --info-soft: #14203a;
    --violet: #b794f6;
    --violet-soft: #251a3d;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0b0d13;
  --surface: #131722;
  --surface-2: #181d2a;
  --text: #e8eaf1;
  --muted: #8f98ae;
  --border: #252b3b;
  --border-strong: #343c52;
  --accent: #818cf8;
  --accent-hover: #9aa3fa;
  --accent-soft: #1f2340;
  --on-accent: #0b0d13;
  --success: #4ade80;
  --success-soft: #12281c;
  --warn: #fbbf24;
  --warn-soft: #2e2410;
  --danger: #f87171;
  --danger-soft: #331717;
  --info: #7aa7ff;
  --info-soft: #14203a;
  --violet: #b794f6;
  --violet-soft: #251a3d;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 15px/1.55 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.25; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 1.65rem; font-weight: 700; }
h2 { font-size: 1.05rem; font-weight: 650; }
h3 { font-size: .98rem; font-weight: 650; margin: 1.4rem 0 .4rem; }
p { margin: 0 0 .6rem; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.1rem 0; }
code, .mono { font-family: var(--mono); font-size: .88em; }
code { background: var(--surface-2); border: 1px solid var(--border); padding: .08em .38em; border-radius: 6px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
[hidden] { display: none !important; }

.muted { color: var(--muted); }
.text-danger { color: var(--danger); }
.center-text { text-align: center; }
.mt { margin-top: 1.2rem; }
.row { display: flex; align-items: center; }
.gap { gap: .6rem; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.stack-lg { display: flex; flex-direction: column; gap: 1.35rem; }

/* Icônes */
.icon { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.2em; }
.icon-xl { width: 46px; height: 46px; color: var(--muted); stroke-width: 1.4; }
.logo-bg { fill: var(--accent); }
.logo-stroke { fill: none; stroke: var(--on-accent); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.theme-sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-sun { display: inline-block; }
  :root:not([data-theme="light"]) .theme-moon { display: none; }
}
:root[data-theme="dark"] .theme-sun { display: inline-block; }
:root[data-theme="dark"] .theme-moon { display: none; }

/* Marque */
.brand { display: flex; align-items: center; gap: .65rem; font-weight: 700; font-size: 1.05rem; color: var(--text); letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand-logo { width: 34px; height: 34px; flex: none; }
.brand-center { justify-content: center; margin-bottom: 1.4rem; font-size: 1.2rem; }

/* Structure application */
.shell { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 1.4rem;
  padding: 1.4rem 1rem; background: var(--surface); border-right: 1px solid var(--border);
}
.nav { display: flex; flex-direction: column; gap: .2rem; }
.nav-link {
  display: flex; align-items: center; gap: .7rem; padding: .62rem .8rem; border-radius: var(--radius-sm);
  color: var(--muted); font-weight: 550;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: .7rem; }
.user-chip { display: flex; align-items: center; gap: .6rem; padding: .5rem .6rem; border-radius: var(--radius-sm); background: var(--surface-2); min-width: 0; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: .85rem; flex: none; }
.user-mail { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .85rem; color: var(--muted); }
.sidebar-actions { display: flex; gap: .4rem; }
.sidebar-actions form { display: contents; }
.sidebar-actions .btn { flex: 1; }

.main { min-width: 0; }
.content { max-width: 1120px; margin: 0 auto; padding: 2rem 2rem 4rem; display: flex; flex-direction: column; gap: 1.25rem; }
.topbar, .tabbar { display: none; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.page-head p { margin: .3rem 0 0; }
.head-badges { display: flex; gap: .4rem; flex-wrap: wrap; }
.crumbs { font-size: .85rem; margin: 0 0 .3rem !important; }
.flashes { display: flex; flex-direction: column; gap: .6rem; }

/* Cartes */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.3rem; box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .9rem; flex-wrap: wrap; }
.card h2 { margin-bottom: .7rem; }
.card-head h2 { margin: 0; }
.link-arrow { display: inline-flex; align-items: center; gap: .3rem; font-size: .9rem; font-weight: 550; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
.grid-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1.25rem; }
.form-card { max-width: 760px; }
.empty { text-align: center; color: var(--muted); padding: 1.6rem 0; margin: 0; }
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .5rem; padding: 3rem 1.3rem; }

/* Statistiques */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.25rem; }
.stat { display: flex; flex-direction: column; gap: .25rem; }
.stat-label { color: var(--muted); font-size: .85rem; font-weight: 550; }
.stat-value { font-size: 2rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.stat-value small { font-size: 1rem; color: var(--muted); font-weight: 500; }
.stat-value.is-danger { color: var(--danger); }
.chart { width: 100%; height: auto; display: block; }
.bar { fill: var(--accent); }
.bar-empty { fill: var(--border); }
.chart-label { fill: var(--muted); font-size: 11px; }
.chart-value { fill: var(--text); font-size: 11px; font-weight: 600; }

/* Listes */
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem 0; border-top: 1px solid var(--border); }
.list-item:first-child { border-top: 0; padding-top: 0; }
.list-main { display: flex; flex-direction: column; min-width: 0; }
.list-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-main .muted { font-size: .85rem; }
.checklist { list-style: none; margin: .8rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.checklist .icon { color: var(--success); margin-right: .35rem; }
.root-info { margin: 0; display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }

/* Boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; padding: .6rem 1rem;
  font: inherit; font-weight: 600; line-height: 1.2; border-radius: var(--radius-sm); border: 1px solid transparent;
  cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, transform .05s;
  background: var(--surface-2); color: var(--text); white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); }
.btn-danger-text { color: var(--danger); }
.btn-sm { padding: .42rem .7rem; font-size: .88rem; }
.btn-icon { padding: .5rem; }
.btn-block { width: 100%; }
.btn.is-done { border-color: var(--success); color: var(--success); }

/* Formulaires */
.field { display: flex; flex-direction: column; gap: .4rem; min-width: 0; border: 0; padding: 0; margin: 0; }
.label { font-weight: 600; font-size: .9rem; padding: 0; }
.optional { color: var(--muted); font-weight: 400; }
.help { color: var(--muted); font-size: .84rem; margin: 0; }
.input {
  width: 100%; padding: .68rem .85rem; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder { color: var(--muted); opacity: .7; }
.input[readonly] { background: var(--surface-2); }
.input-code { text-align: center; font-family: var(--mono); font-size: 1.5rem; letter-spacing: .3em; padding: .8rem; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 2.2rem; }
.check { display: flex; align-items: flex-start; gap: .6rem; cursor: pointer; }
.check input { margin-top: .3rem; accent-color: var(--accent); width: 1rem; height: 1rem; }
.form-actions { display: flex; justify-content: flex-end; gap: .6rem; flex-wrap: wrap; }
.copy-row { display: flex; gap: .6rem; align-items: center; }
.copy-row .input, .copy-row .secret { flex: 1; min-width: 0; }
.secret { padding: .65rem .85rem; letter-spacing: .08em; overflow-wrap: anywhere; }

.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.choice { position: relative; cursor: pointer; }
.choice input { position: absolute; opacity: 0; inset: 0; }
.choice-body { display: flex; flex-direction: column; gap: .2rem; height: 100%; padding: .85rem 1rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); transition: border-color .15s, background .15s; }
.choice-body small { color: var(--muted); }
.choice input:checked + .choice-body { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); }
.choice input:focus-visible + .choice-body { outline: 2px solid var(--accent); outline-offset: 2px; }
.warn-box { background: var(--warn-soft); border: 1px solid var(--warn); border-radius: var(--radius-sm); padding: .9rem 1rem; }
.warn-box .help { margin: .5rem 0 0 1.6rem; color: var(--text); }

/* Alertes et badges */
.alert { padding: .8rem 1rem; border-radius: var(--radius-sm); border: 1px solid; font-size: .93rem; }
.alert-success { background: var(--success-soft); border-color: var(--success); color: var(--text); }
.alert-error { background: var(--danger-soft); border-color: var(--danger); color: var(--text); }
.alert-warning { background: var(--warn-soft); border-color: var(--warn); color: var(--text); }
.alert-info { background: var(--info-soft); border-color: var(--info); color: var(--text); }
.badge { display: inline-flex; align-items: center; gap: .4rem; padding: .18rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 650; white-space: nowrap; }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-violet { background: var(--violet-soft); color: var(--violet); }
.badge-muted { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }

/* Connecteurs */
.connector { display: flex; flex-direction: column; gap: .9rem; }
.connector.is-inactive { opacity: .8; }
.connector-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .8rem; }
.connector-title { min-width: 0; }
.connector-title h3 { margin: 0; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; }
.connector-title p { margin: .15rem 0 0; font-size: .88rem; }
.badges { display: flex; flex-wrap: wrap; gap: .4rem; }
.meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; margin: 0; padding-top: .9rem; border-top: 1px solid var(--border); }
.meta dt { color: var(--muted); font-size: .78rem; }
.meta dd { margin: 0; font-weight: 600; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; }
.card-actions { display: flex; justify-content: space-between; align-items: center; gap: .6rem; margin-top: auto; }
.card-actions.wrap { flex-wrap: wrap; justify-content: flex-start; margin-top: 1.2rem; }
.kv { margin: 0; display: flex; flex-direction: column; }
.kv > div { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem 0; border-top: 1px solid var(--border); }
.kv > div:first-child { border-top: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-weight: 550; overflow-wrap: anywhere; }
.token-card { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); }
.token-card h2 { display: flex; align-items: center; gap: .5rem; }
.code-block { position: relative; margin: .5rem 0; }
.code-block .btn { position: absolute; top: .5rem; right: .5rem; background: var(--surface); }
.code { margin: 0; padding: 1rem 5.6rem 1rem 1rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow-x: auto; font-size: .85rem; }
.code code { background: none; border: 0; padding: 0; white-space: pre; }
.manual-key { margin: .8rem 0 1rem; }
.manual-key summary { cursor: pointer; color: var(--accent); font-weight: 550; }
.manual-key[open] summary { margin-bottom: .6rem; }

/* Interrupteur */
.switch { display: inline-flex; align-items: center; gap: .6rem; background: none; border: 0; padding: .2rem 0; cursor: pointer; font: inherit; color: var(--text); font-weight: 550; }
.switch-track { width: 42px; height: 24px; border-radius: 999px; background: var(--border-strong); position: relative; transition: background .2s; flex: none; }
.switch-thumb { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .2s; }
.switch[aria-checked="true"] .switch-track { background: var(--success); }
.switch[aria-checked="true"] .switch-thumb { transform: translateX(18px); }

/* Tableaux */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; color: var(--muted); font-weight: 600; font-size: .8rem; padding: .5rem .8rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: .7rem .8rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.col-actions { text-align: right; white-space: nowrap; }
.col-actions form { display: inline-block; }
.cell-target { max-width: 320px; }
.clip { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.detail { display: block; color: var(--muted); font-size: .82rem; }
.actor { display: inline-block; margin-right: .4rem; padding: .05rem .45rem; border-radius: 6px; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.actor-mcp { background: var(--accent-soft); color: var(--accent); }
.actor-admin { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.filters { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 1rem; align-items: end; }
.filters-actions { display: flex; gap: .5rem; }
.pagination { display: flex; align-items: center; justify-content: space-between; margin-top: 1rem; }

/* Dialogues */
.dialog { border: 1px solid var(--border); border-radius: 18px; padding: 1.5rem; width: min(92vw, 440px); background: var(--surface); color: var(--text); box-shadow: 0 24px 60px rgba(0, 0, 0, .35); }
.dialog-wide { width: min(92vw, 520px); }
.dialog::backdrop { background: rgba(10, 12, 20, .55); backdrop-filter: blur(3px); }
.dialog h3 { margin: 0 0 .6rem; font-size: 1.1rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1.2rem; }

/* Pages d'authentification */
body.bare { min-height: 100vh; background: radial-gradient(900px 500px at 15% -10%, var(--accent-soft), transparent 60%), radial-gradient(700px 400px at 100% 110%, var(--accent-soft), transparent 60%), var(--bg); }
.bare-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2rem 1rem; gap: 1.2rem; }
.bare-card { width: min(100%, 430px); background: var(--surface); border: 1px solid var(--border); border-radius: 22px; box-shadow: var(--shadow); padding: 2rem; display: flex; flex-direction: column; gap: 1rem; }
.bare-foot { color: var(--muted); font-size: .82rem; margin: 0; }
.auth-title { text-align: center; font-size: 1.35rem; }
.bare-card .muted { margin: 0; }
.error-code { font-size: 3.4rem; font-weight: 800; color: var(--accent); margin: 0; line-height: 1; }
.qr-box { display: grid; place-items: center; padding: 1rem; background: #fff; border-radius: var(--radius); border: 1px solid var(--border); width: fit-content; margin: 0 auto; }
.qr-box canvas { display: block; width: 220px; height: 220px; image-rendering: pixelated; }
.codes { list-style: none; margin: 1rem 0; padding: 1rem; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem 1.5rem; background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: var(--radius); font-size: 1.05rem; letter-spacing: .05em; }

/* Mobile */
@media (max-width: 1000px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters .field:first-child { grid-column: 1 / -1; }
  .filters-actions { grid-column: 1 / -1; }
}

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .topbar {
    display: flex; position: sticky; top: 0; z-index: 20; align-items: center; justify-content: space-between;
    padding: .7rem 1rem; padding-top: max(.7rem, env(safe-area-inset-top));
    background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
  }
  .topbar-actions { display: flex; gap: .2rem; }
  .topbar-actions form { display: contents; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
    background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); border-top: 1px solid var(--border);
    padding: .35rem .3rem calc(.35rem + env(safe-area-inset-bottom));
  }
  .tab { display: flex; flex-direction: column; align-items: center; gap: .15rem; padding: .35rem .2rem; font-size: .68rem; font-weight: 600; color: var(--muted); border-radius: 10px; }
  .tab:hover { text-decoration: none; }
  .tab .icon { width: 1.4rem; height: 1.4rem; }
  .tab[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
  .content { padding: 1.2rem 1rem calc(5.5rem + env(safe-area-inset-bottom)); }
  h1 { font-size: 1.4rem; }
  .cards { grid-template-columns: minmax(0, 1fr); }
  .grid-form, .choice-grid { grid-template-columns: minmax(0, 1fr); }
  .page-head > .btn { width: 100%; }

  /* Tableaux -> cartes */
  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack tr { padding: .7rem 0; border-bottom: 1px solid var(--border); }
  .table-stack tbody tr:last-child { border-bottom: 0; }
  .table-stack tbody tr:hover { background: none; }
  .table-stack td { display: flex; justify-content: space-between; gap: 1rem; padding: .25rem 0; border: 0; text-align: right; }
  .table-stack td::before { content: attr(data-label); color: var(--muted); font-size: .8rem; font-weight: 600; text-align: left; flex: none; }
  .table-stack td.col-actions { justify-content: flex-end; padding-top: .5rem; }
  .table-stack td.col-actions::before { content: none; }
  .cell-target { max-width: none; }
  .cell-target .clip { max-width: 55vw; }
}

@media (max-width: 480px) {
  .stat-value { font-size: 1.6rem; }
  .bare-card { padding: 1.5rem 1.2rem; }
  .meta { grid-template-columns: 1fr 1fr; }
  .meta > div:last-child { grid-column: 1 / -1; }
  .copy-row { flex-direction: column; align-items: stretch; }
  .codes { grid-template-columns: minmax(0, 1fr); }
  .filters { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

@media print {
  .sidebar, .topbar, .tabbar { display: none; }
}
