/* ==========================================================================
   Quantarête — sign-in, account and back office styles
   Brand colours match main.css (sampled from the logo).
   ========================================================================== */

:root {
  --navy: #171034;
  --navy-deep: #0d0922;
  --navy-soft: #251c4d;
  --blue-dark: #1c4f9c;
  --blue: #297abc;
  --blue-light: #38aadf;
  --crimson: #9c1c27;
  --crimson-bright: #d02a38;

  --ink: #1a1633;
  --ink-muted: #5d5977;
  --line: #e3e2ec;
  --surface: #ffffff;
  --canvas: #f4f4f8;

  --ok: #16794a;       --ok-bg: #e3f5ec;
  --warn: #8a5a00;     --warn-bg: #fdf1d8;
  --bad: #b3202d;      --bad-bg: #fbe5e7;
  --off: #5d5977;      --off-bg: #ecebf2;
  --info: #1c4f9c;     --info-bg: #e4eefa;

  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  --radius: 10px;
  --sidebar: 248px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body { margin: 0; font-family: var(--font); font-size: 1rem; line-height: 1.55; color: var(--ink); -webkit-font-smoothing: antialiased; }
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3, p, dl, dd, ul { margin: 0; }
a { color: var(--blue-dark); }
code { font-family: var(--mono); font-size: .9em; background: rgba(127, 127, 160, .15); padding: .1em .35em; border-radius: 4px; }
:focus-visible { outline: 2px solid var(--blue-light); outline-offset: 2px; }
[hidden] { display: none !important; }

.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 1rem; top: -3rem; z-index: 100; background: #fff; color: var(--navy); padding: .6rem 1rem; border-radius: 8px; font-weight: 600; }
.skip-link:focus { top: 1rem; }
.mono { font-family: var(--mono); font-size: .92em; }
.muted { color: var(--ink-muted); }
.nowrap { white-space: nowrap; }
.break { overflow-wrap: anywhere; }
.strong { font-weight: 600; }

/* Buttons ------------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 44px; padding: .6rem 1.15rem; border-radius: 8px; border: 1px solid transparent;
  font: inherit; font-weight: 600; font-size: .95rem; line-height: 1.2; text-decoration: none; cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--crimson); color: #fff; }
.btn-primary:hover { background: #b3202d; }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: #cfcddd; }
.btn-secondary:hover { border-color: var(--blue); color: var(--blue-dark); }
.btn-danger { background: var(--bad); color: #fff; }
.btn-danger:hover { background: #8f1823; }
.btn-ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .25); }
.btn-ghost:hover { border-color: var(--blue-light); background: rgba(255, 255, 255, .06); }
.btn-link { background: none; color: var(--ink-muted); }
.btn-link:hover { color: var(--ink); }
.btn-small { min-height: 36px; padding: .4rem .8rem; font-size: .88rem; }
.btn-block { width: 100%; }
.link-button { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; cursor: pointer; }
.button-row { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.75rem; }
.button-row form { display: contents; }

.chip {
  display: inline-flex; align-items: center; min-height: 32px; padding: .25rem .7rem; margin-top: .5rem;
  border: 1px solid #cfcddd; border-radius: 999px; background: var(--surface); color: var(--ink-muted);
  font: inherit; font-size: .82rem; cursor: pointer;
}
.chip:hover { border-color: var(--blue); color: var(--blue-dark); }
.quick-dates { display: flex; flex-wrap: wrap; gap: .4rem; }
.quick-dates .chip { margin-top: .5rem; }

/* Forms ------------------------------------------------------------------- */
.form { display: grid; gap: 1.1rem; }
.form-narrow { max-width: 760px; }
.form-section { font-size: .8rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-muted); padding-top: .75rem; border-top: 1px solid var(--line); }
.form-section:first-of-type { border-top: 0; padding-top: 0; }
.optional { font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--ink-muted); }
.field { display: grid; gap: .35rem; min-width: 0; align-content: start; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem; }
label { font-size: .9rem; font-weight: 600; }
input, select, textarea {
  width: 100%; min-height: 44px; padding: .6rem .8rem; border-radius: 8px;
  border: 1px solid #cfcddd; background: var(--surface); color: var(--ink);
  font: inherit; font-size: 1rem; /* >= 16px: no iOS zoom on focus */
}
textarea { min-height: 88px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(41, 122, 188, .2); }
input[readonly] { background: var(--canvas); color: var(--ink-muted); }
[aria-invalid="true"] { border-color: var(--bad); }
.hint { font-size: .85rem; color: var(--ink-muted); }
.hint-inline { font-weight: 400; font-size: .85rem; color: var(--ink-muted); }
.field-error { font-size: .88rem; color: var(--bad); font-weight: 500; }
.input-group { display: flex; gap: .5rem; }
.input-group input { flex: 1; min-width: 0; }
.check-row { display: flex; gap: .6rem; align-items: flex-start; font-weight: 500; }
.check-row input[type="checkbox"] { width: 1.1rem; height: 1.1rem; min-height: 0; margin: .15rem 0 0; padding: 0; flex: none; accent-color: var(--blue); }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; padding-top: .25rem; }
.username-preview { font-size: .92rem; color: var(--ink-muted); margin-top: -.4rem; }
.username-preview strong { font-family: var(--mono); color: var(--ink); }

/* Alerts & badges ---------------------------------------------------------- */
.alert { padding: .8rem 1rem; border-radius: 8px; font-size: .95rem; border-left: 4px solid; margin-bottom: 1.25rem; }
.alert-success { background: var(--ok-bg); color: var(--ok); border-color: var(--ok); }
.alert-info { background: var(--info-bg); color: var(--info); border-color: var(--info); }
.alert-error { background: var(--bad-bg); color: var(--bad); border-color: var(--bad); }
.form > .alert { margin-bottom: 0; }

.badge { display: inline-block; padding: .15rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; vertical-align: middle; }
.badge-active { background: var(--ok-bg); color: var(--ok); }
.badge-expiring { background: var(--warn-bg); color: var(--warn); }
.badge-expired { background: var(--bad-bg); color: var(--bad); }
.badge-disabled { background: var(--off-bg); color: var(--off); }

/* ==========================================================================
   Sign-in / account pages (dark, on-brand)
   ========================================================================== */
.auth-page {
  min-height: 100vh; min-height: 100dvh; color: #e9e7f3;
  background:
    radial-gradient(50rem 30rem at 85% 0%, rgba(41, 122, 188, .22), transparent 60%),
    radial-gradient(40rem 30rem at 0% 100%, rgba(156, 28, 39, .18), transparent 60%),
    linear-gradient(180deg, var(--navy), var(--navy-deep));
}
.auth-shell { width: min(100% - 2rem, 440px); margin-inline: auto; padding: clamp(2rem, 8vh, 5rem) 0 2rem; }
.auth-shell:has(.auth-card-wide) { width: min(100% - 2rem, 600px); }
.auth-logo { display: block; width: 210px; margin: 0 auto 2rem; }
.auth-card {
  background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .1); border-radius: 16px;
  padding: clamp(1.5rem, 5vw, 2.25rem); box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .6);
  backdrop-filter: blur(6px);
}
.auth-card h1 { font-size: 1.6rem; line-height: 1.2; color: #fff; margin-bottom: 1.25rem; letter-spacing: -.01em; }
.auth-card .eyebrow { font-size: .75rem; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--blue-light); margin-bottom: .5rem; }
.auth-lead { color: #bdb8d6; margin: -.5rem 0 1.25rem; }
.auth-note { font-size: .88rem; color: #a9a4c4; margin-top: 1.25rem; }
.auth-back { text-align: center; margin-top: 1.25rem; font-size: .92rem; }
.auth-back a, .auth-back .link-button { color: #a9a4c4; }
.auth-foot { text-align: center; margin-top: 2.5rem; font-size: .8rem; color: #6e6990; }
.auth-page label { color: #e9e7f3; }
.auth-page input { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .18); color: #fff; }
.auth-page input:focus { border-color: var(--blue-light); box-shadow: 0 0 0 3px rgba(56, 170, 223, .25); }
.auth-page .hint, .auth-page .hint-inline { color: #a9a4c4; }
.auth-page .field-error { color: #ff8a94; }
.auth-page [aria-invalid="true"] { border-color: #ff8a94; }
.auth-page .alert-error { background: rgba(208, 42, 56, .15); color: #ffb3b9; border-color: var(--crimson-bright); }
.auth-page .alert-success { background: rgba(22, 121, 74, .2); color: #9be3bf; border-color: #2fb574; }
.auth-page .alert-info { background: rgba(41, 122, 188, .18); color: #a9d8f3; border-color: var(--blue-light); }
.auth-page .username-preview { color: #a9a4c4; }
.auth-page .username-preview strong { color: #fff; }
.auth-page .btn-primary { box-shadow: 0 10px 30px -12px rgba(208, 42, 56, .7); }
.auth-page .muted { color: #a9a4c4; }
.auth-page code { color: #fff; }

.details { display: grid; gap: .75rem; }
.details > div { display: grid; grid-template-columns: 8.5rem 1fr; gap: 1rem; padding-bottom: .75rem; border-bottom: 1px solid rgba(127, 127, 160, .2); }
.details dt { color: #a9a4c4; font-size: .9rem; }
.details dd { overflow-wrap: anywhere; }
.details-compact { font-size: .9rem; }
.details-compact dt { color: var(--ink-muted); }
.details-compact > div { grid-template-columns: 7rem 1fr; border-color: var(--line); }
.details-compact > div:last-child { border-bottom: 0; padding-bottom: 0; }

/* ==========================================================================
   Back office
   ========================================================================== */
.admin { background: var(--canvas); }

.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 40; width: var(--sidebar);
  display: flex; flex-direction: column; gap: 1.5rem; padding: 1.5rem 1rem;
  background: linear-gradient(180deg, var(--navy), var(--navy-deep)); color: #d9d6ea;
  overflow-y: auto;
}
.sidebar-logo { display: grid; gap: .4rem; padding: 0 .5rem .5rem; text-decoration: none; }
.sidebar-logo img { width: 180px; }
.sidebar-logo span { font-size: .72rem; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--blue-light); }
.sidebar-nav { display: grid; gap: .2rem; }
.sidebar-nav a {
  display: flex; align-items: center; min-height: 44px; padding: 0 .85rem; border-radius: 8px;
  color: #d9d6ea; text-decoration: none; font-weight: 500;
}
.sidebar-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sidebar-nav a[aria-current="page"] { background: rgba(56, 170, 223, .14); color: #fff; box-shadow: inset 3px 0 0 var(--crimson-bright); }
.sidebar-foot { margin-top: auto; display: grid; gap: .6rem; padding: 1rem .85rem 0; border-top: 1px solid rgba(255, 255, 255, .1); font-size: .9rem; }
.sidebar-foot a, .sidebar-foot .link-button { color: #a9a4c4; text-decoration: none; text-align: left; min-height: 32px; display: flex; align-items: center; }
.sidebar-foot a:hover, .sidebar-foot .link-button:hover { color: #fff; }
.sidebar-user { color: #a9a4c4; font-size: .82rem; }
.sidebar-user strong { color: #fff; font-size: .92rem; font-family: var(--mono); overflow-wrap: anywhere; }

.topbar { display: none; }
.admin-main { margin-left: var(--sidebar); padding: 2rem clamp(1.25rem, 3vw, 2.5rem) 4rem; max-width: calc(var(--sidebar) + 1320px); }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.page-head h1 { font-size: 1.75rem; line-height: 1.2; letter-spacing: -.02em; }
.page-sub { color: var(--ink-muted); margin-top: .25rem; max-width: 60rem; }
.crumbs { font-size: .9rem; color: var(--ink-muted); margin-bottom: .2rem; }
.crumbs a { color: var(--ink-muted); }
.user-title { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; overflow-wrap: anywhere; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; min-width: 0; }
.panel + .panel { margin-top: 1.25rem; }
.panel-flush { padding: 0; overflow: hidden; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.panel-head h2, .panel-title { font-size: 1.1rem; }
.panel:not(.form) > .panel-title { margin-bottom: 1rem; }
.panel-head a { font-size: .9rem; }
.panel-danger { border-color: #f1c4c8; }
.panel-danger .panel-title { color: var(--bad); }
.empty { color: var(--ink-muted); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat {
  display: grid; gap: .1rem; padding: 1.1rem 1.25rem; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--blue);
  color: var(--ink); text-decoration: none; transition: transform .15s var(--ease), box-shadow .15s;
}
.stat:hover { transform: translateY(-2px); box-shadow: 0 8px 20px -12px rgba(23, 16, 52, .35); }
.stat-value { font-size: 1.9rem; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; }
.stat-label { font-size: .88rem; color: var(--ink-muted); }
.stat-active { border-top-color: var(--ok); }
.stat-expiring { border-top-color: #d99a00; }
.stat-expired { border-top-color: var(--bad); }
.stat-disabled { border-top-color: #9c98b5; }

.panel-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 1.25rem; align-items: start; }
.panel-grid .panel + .panel { margin-top: 0; }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: .7rem 1rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.table th { font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); background: #fafafc; white-space: nowrap; }
.table th a { color: inherit; text-decoration: none; }
.table th a:hover { color: var(--blue-dark); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafafe; }
.panel:not(.panel-flush) .table th:first-child, .panel:not(.panel-flush) .table td:first-child { padding-left: 0; }
.panel:not(.panel-flush) .table th { background: none; }
.table .ua { max-width: 22rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-muted); font-size: .85rem; }

/* Filters */
.filters {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .9rem; align-items: end;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1.25rem;
}
.filters .field:first-of-type { grid-column: span 2; }
.filters label { font-size: .8rem; color: var(--ink-muted); }
.filters-actions { display: flex; gap: .5rem; }

.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-top: 1rem; color: var(--ink-muted); font-size: .9rem; }
.pagination-links { display: flex; align-items: center; gap: .6rem; }

/* User page */
.user-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.user-side .panel + .panel, .user-main .panel + .panel { margin-top: 1.25rem; }
.timeline { list-style: none; padding: 0; display: grid; gap: .9rem; font-size: .92rem; }
.timeline li { padding-left: 1rem; border-left: 2px solid var(--line); }
.timeline-time { display: block; font-size: .8rem; color: var(--ink-muted); }

/* Content ------------------------------------------------------------------ */
.head-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1.25rem; }
.tabs a {
  display: inline-flex; align-items: center; min-height: 38px; padding: 0 .95rem; border-radius: 999px;
  border: 1px solid #cfcddd; background: var(--surface); color: var(--ink-muted); text-decoration: none; font-size: .9rem; font-weight: 500;
}
.tabs a:hover { border-color: var(--blue); color: var(--blue-dark); }
.tabs a[aria-current="page"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.item-label { font-size: .8rem; }

.badge-published { background: var(--ok-bg); color: var(--ok); }
.badge-upcoming { background: var(--info-bg); color: var(--info); }
.badge-draft { background: var(--off-bg); color: var(--off); }
.badge-v-adopt { background: var(--ok-bg); color: var(--ok); }
.badge-v-monitor { background: var(--warn-bg); color: var(--warn); }
.badge-v-reject { background: var(--bad-bg); color: var(--bad); }
.badge-v-progress { background: var(--info-bg); color: var(--info); }

.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 360px); gap: 1.25rem; align-items: start; }
.editor-main { gap: 1.25rem; }
.editor-main > .panel + .panel { margin-top: 0; }
.editor-side { position: sticky; top: 1.5rem; display: grid; gap: 1.25rem; max-height: calc(100vh - 3rem); overflow-y: auto; }
.editor-side .panel + .panel { margin-top: 0; }
.panel.form { display: grid; gap: 1.1rem; }
.panel.form > .panel-title { margin-bottom: 0; }
.field-row-wide { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.field-row-ref { grid-template-columns: minmax(9rem, 1fr) minmax(0, 4fr); }
textarea.md { font-family: var(--mono); font-size: .9rem; line-height: 1.6; min-height: 120px; }
.stage-editor textarea.md { min-height: 260px; }
.stage-badge {
  display: inline-grid; place-items: center; width: 30px; height: 30px; margin-right: .6rem; border-radius: 50%;
  background: var(--navy); color: #fff; font-size: .95rem; vertical-align: middle;
}
#stage-execute .stage-badge { background: var(--crimson); }

.kpi-row { display: grid; grid-template-columns: 1.3fr .8fr 1.5fr 1fr; gap: .75rem; border: 0; padding: 0 0 1rem; margin: 0; border-bottom: 1px solid var(--line); }
.kpi-row:last-of-type { border-bottom: 0; padding-bottom: 0; }
.kpi-row .field-error { grid-column: 1 / -1; }
.tracker-fields { display: grid; gap: 1rem; border: 1px dashed #cfcddd; border-radius: 8px; padding: 1rem 1.1rem 1.1rem; margin: 0; }
.tracker-fields legend { font-size: .9rem; font-weight: 600; padding: 0 .4rem; }

.save-bar {
  position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 1rem;
  padding: .9rem 1.25rem; border-radius: var(--radius); background: rgba(255, 255, 255, .96);
  border: 1px solid var(--line); box-shadow: 0 -8px 24px -16px rgba(23, 16, 52, .35);
}

.upload-form { gap: .75rem; }
.image-list { list-style: none; padding: 0; margin: 1.25rem 0 0; display: grid; gap: 1rem; }
.image-list li { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: .8rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.image-list img { width: 72px; height: 54px; object-fit: contain; border-radius: 6px; background: var(--navy); border: 1px solid var(--line); }
.image-meta { display: grid; gap: .2rem; font-size: .85rem; min-width: 0; }
.snippet { display: block; margin-top: .25rem; padding: .35rem .5rem; overflow-wrap: anywhere; font-size: .8rem; }
.image-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.image-actions form { display: contents; }
.chip-danger { color: var(--bad); }
.chip-danger:hover { border-color: var(--bad); color: var(--bad); }

.md-help details { border-top: 1px solid var(--line); padding: .6rem 0; }
.md-help details:first-of-type { border-top: 0; padding-top: 0; }
.md-help summary { cursor: pointer; font-weight: 600; font-size: .9rem; min-height: 32px; display: flex; align-items: center; }
.md-help pre { margin: .5rem 0 0; padding: .7rem .8rem; border-radius: 8px; background: var(--canvas); font-family: var(--mono); font-size: .78rem; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.md-help .hint { margin-top: .4rem; }

/* Responsive -------------------------------------------------------------- */
@media (max-width: 1100px) {
  .user-grid, .panel-grid, .editor-grid { grid-template-columns: minmax(0, 1fr); }
  .editor-side { position: static; max-height: none; overflow: visible; }
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .topbar {
    position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: .5rem;
    height: 60px; padding: 0 .75rem; background: var(--navy);
  }
  .topbar-logo img { width: 160px; }
  .menu-toggle { position: relative; width: 44px; height: 44px; border: 0; background: none; color: #fff; cursor: pointer; }
  .menu-bar, .menu-bar::before, .menu-bar::after { position: absolute; left: 11px; width: 22px; height: 2px; border-radius: 2px; background: currentColor; }
  .menu-bar { top: 21px; }
  .menu-bar::before, .menu-bar::after { content: ""; left: 0; }
  .menu-bar::before { top: -7px; }
  .menu-bar::after { top: 7px; }

  .sidebar { transform: translateX(-100%); visibility: hidden; transition: transform .25s var(--ease), visibility .25s; }
  .sidebar.is-open { transform: none; visibility: visible; box-shadow: 0 0 40px rgba(0, 0, 0, .4); }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 35; background: rgba(13, 9, 34, .5); }
  .menu-open { overflow: hidden; }

  .admin-main { margin-left: 0; padding-top: 1.5rem; }
}

@media (max-width: 700px) {
  .admin-main { padding: 1.25rem 1rem 3rem; }
  .page-head h1 { font-size: 1.45rem; }
  .page-head > .btn { width: 100%; }
  .panel { padding: 1.15rem; }
  .field-row { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr 1fr; padding: 1rem; }
  .filters .field:first-of-type { grid-column: 1 / -1; }
  .filters-actions { grid-column: 1 / -1; }
  .filters-actions .btn-secondary { flex: 1; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
  .stat { padding: .9rem 1rem; }
  .stat-value { font-size: 1.6rem; }
  .details > div { grid-template-columns: 1fr; gap: .15rem; }
  .input-group { flex-direction: column; }
  .form-actions .btn-primary, .form-actions .btn-secondary, .form-actions .btn-danger { flex: 1; }

  /* Wide tables become stacked cards; each cell shows its column label. */
  .table-users, .table-logs, .table-audit, .table-content { font-size: .92rem; }
  .table-users thead, .table-logs thead, .table-audit thead, .table-content thead { display: none; }
  .table-content tr, .table-users tr, .table-logs tr, .table-audit tr { display: grid; grid-template-columns: 1fr 1fr; gap: .35rem 1rem; padding: 1rem 1.15rem; border-bottom: 1px solid var(--line); }
  .table-users td, .table-logs td, .table-audit td, .table-content td { display: grid; gap: .05rem; padding: 0; border: 0; min-width: 0; }
  .table-users td::before, .table-logs td::before, .table-audit td::before, .table-content td::before {
    content: attr(data-label); font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted);
  }
  .table-users td:first-child, .table-users td[data-label="Email"], .table-logs td[data-label="Device"],
  .table-audit td[data-label="Details"], .table-content td:first-child { grid-column: 1 / -1; }
  .table-content td:first-child::before, .table-content td[data-label="Links"]::before { display: none; }
  .field-row-wide, .field-row-ref { grid-template-columns: minmax(0, 1fr); }
  .kpi-row { grid-template-columns: minmax(0, 1fr); }
  .head-actions { width: 100%; }
  .head-actions .btn { flex: 1; }
  .table-users td:first-child::before { display: none; }
  .table td > .badge, .table td > a { justify-self: start; }
  .table-users td:first-child a { font-size: 1.05rem; }
  .table .ua { max-width: none; white-space: normal; }
  .table th, .table td { padding: .6rem .5rem; }
  .table .nowrap { white-space: normal; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; }
}

/* Markets snapshot page */
.subhead { font-size: .95rem; margin: 1.5rem 0 .5rem; }
.steps { padding-left: 1.2rem; display: grid; gap: .3rem; }
.alert ul { margin: .4rem 0 0; padding-left: 1.2rem; }
