/* Shared appearance: match the CGC-Max Web palette without its fixed viewport. */
:root {
  color-scheme: dark;
  --bg: #070912;
  --bg-raised: #0c1020;
  --surface: rgba(24, 28, 44, .64);
  --surface-raised: rgba(30, 35, 54, .68);
  --line: rgba(255, 255, 255, .09);
  --line-soft: rgba(255, 255, 255, .065);
  --text: #eef1f8;
  --muted: #a7aec4;
  --dim: #969fb9;
  --accent: #6ea8ff;
  --accent-purple: #a06bff;
  --accent-cyan: #4be3d8;
  --success: #4be3a0;
  --warning: #ffc866;
  --danger: #ff8798;
  --gradient: linear-gradient(120deg, #4be3d8, #6ea8ff 45%, #a06bff);
  --gradient-soft: linear-gradient(120deg, rgba(75, 227, 216, .12), rgba(160, 107, 255, .13));
  --radius: 14px;
  --shadow: 0 8px 24px rgba(0, 0, 0, .14), inset 0 1px 0 rgba(255, 255, 255, .035);
  --sans: "Segoe UI Variable Display", "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
  --mono: "Cascadia Code", Consolas, monospace;
}

* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; }
body {
  display: flow-root;
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 5% 3%, rgba(75, 227, 216, .07), transparent 42%),
    radial-gradient(ellipse at 94% 3%, rgba(160, 107, 255, .1), transparent 45%),
    linear-gradient(180deg, var(--bg-raised), var(--bg));
  background-attachment: fixed;
  color: var(--text);
  font: 13px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, .table-scroll:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
p { margin: 0 0 12px; }
p:last-child { margin-bottom: 0; }
h1, h2, h3 { line-height: 1.4; margin: 0; font-weight: 650; }
h1 { font-size: 25px; letter-spacing: -.4px; }
h2 { font-size: 15px; }
h3 { font-size: 14px; }
small, .small { font-size: 12px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset:disabled { opacity: .6; }
.muted { color: var(--muted); }
.eyebrow { font-size: 11px; color: var(--dim); margin: 0 0 7px; }
.nowrap { white-space: nowrap; }
.preserve-lines { white-space: pre-wrap; overflow-wrap: anywhere; }
.icon { display: block; width: 18px; height: 18px; flex: 0 0 18px; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}
.skip-link {
  position: fixed;
  left: 20px;
  top: -80px;
  z-index: 30;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--bg);
}
.skip-link:focus { top: 14px; }

/* The page stays naturally scrollable, including browser zoom and small windows. */
.center-shell {
  display: grid;
  grid-template-columns: 202px minmax(0, 1fr);
  max-width: 1440px;
  min-height: calc(100vh - 48px);
  margin: 24px auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(13, 17, 32, .82);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .055);
}
.workspace { padding: 0 24px; }
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-name { display: block; font-size: 14px; font-weight: 650; letter-spacing: .2px; white-space: nowrap; }
.brand-mark {
  display: block;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border-radius: 8px;
  background: var(--gradient);
  box-shadow: 0 0 20px rgba(110, 168, 255, .22), inset 0 1px 0 rgba(255, 255, 255, .35);
}
.sidebar {
  position: sticky;
  top: 24px;
  display: flex;
  flex-direction: column;
  align-self: start;
  height: calc(100vh - 48px);
  min-height: 520px;
  padding: 23px 13px 16px;
  border-right: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(255, 255, 255, .022), transparent);
  border-radius: 18px 0 0 18px;
}
.sidebar > .brand { padding: 0 11px 30px; }
.main-nav { display: grid; gap: 5px; }
.main-nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 43px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 11px;
  color: var(--muted);
  font-size: 12px;
  transition: background .15s, color .15s, border-color .15s;
}
.main-nav .icon { width: 16px; height: 16px; flex-basis: 16px; opacity: .85; }
.main-nav a:hover { color: var(--text); background: rgba(255, 255, 255, .04); }
.main-nav a[aria-current="page"] {
  color: var(--text);
  background: var(--gradient-soft);
  border-color: var(--line);
  box-shadow: 0 4px 18px rgba(80, 120, 255, .09), inset 0 1px 0 rgba(255, 255, 255, .04);
}
.main-nav a[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 3px;
  background: var(--gradient);
}
.workspace-body { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  min-height: 55px;
  padding: 10px 28px;
  border-bottom: 1px solid var(--line-soft);
}
.account-menu { display: flex; align-items: center; gap: 11px; min-width: 0; }
.account-name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.role-label { padding: 2px 7px; border: 1px solid rgba(110, 168, 255, .19); border-radius: 6px; color: var(--accent); font-size: 10px; white-space: nowrap; }
.inline-form { display: inline; margin: 0; }
.text-button { display: inline-flex; align-items: center; gap: 6px; padding: 5px 7px; border: 0; border-radius: 6px; background: none; color: var(--muted); font-size: 11px; }
.text-button .icon { width: 14px; height: 14px; flex-basis: 14px; }
.text-button:hover { color: var(--text); background: rgba(255, 255, 255, .04); }
.main-content { width: 100%; max-width: 1280px; margin: 0 auto; padding: 28px; flex: 1; min-width: 0; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 22px; margin-bottom: 24px; }
.page-heading p:not(.eyebrow) { margin: 7px 0 0; max-width: 740px; color: var(--muted); font-size: 12px; }
.page-heading h1 { overflow-wrap: anywhere; }
.page-heading .eyebrow a:hover { color: var(--accent); }

/* Shared cards and actions. Status is always expressed with readable text too. */
.card { min-width: 0; padding: 22px; margin-bottom: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.card:last-child { margin-bottom: 0; }
.card-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 19px; }
.heading-label { display: flex; align-items: center; gap: 9px; min-width: 0; }
.heading-label > .icon { color: var(--accent); width: 16px; height: 16px; flex-basis: 16px; }
.content-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; gap: 20px; margin-bottom: 20px; }
.content-grid > .card { height: 100%; margin: 0; }
.stack { display: grid; gap: 20px; min-width: 0; }
.stack > .card { margin: 0; }
.form-card { max-width: 760px; }
.button-row, .form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.form-actions { margin-top: 24px; }
.button-row { flex-shrink: 0; }
.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, .025);
  color: var(--text);
  font-size: 12px;
  font-weight: 550;
  line-height: 1.5;
  text-align: center;
  white-space: normal;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.button .icon { width: 15px; height: 15px; flex-basis: 15px; }
.button:hover { background: rgba(110, 168, 255, .08); border-color: rgba(110, 168, 255, .33); }
.button-primary { background: var(--gradient); border-color: transparent; color: #091523; box-shadow: 0 3px 12px rgba(110, 168, 255, .12); font-weight: 650; }
.button-primary:hover { background: var(--gradient); border-color: rgba(255, 255, 255, .3); box-shadow: 0 4px 18px rgba(110, 168, 255, .22); }
.button-secondary { background: var(--surface-raised); }
.button-danger { color: var(--danger); border-color: rgba(255, 107, 129, .25); background: rgba(255, 107, 129, .045); }
.button-danger:hover { background: rgba(255, 107, 129, .1); border-color: rgba(255, 107, 129, .42); }
.button-small { min-height: 32px; padding: 6px 10px; font-size: 11px; }
.button-full { width: 100%; }
.text-link { font-size: 11px; color: var(--accent); line-height: 1.5; }
.text-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.messages { display: grid; gap: 10px; margin-bottom: 20px; }
.notice { padding: 13px 16px; margin-bottom: 20px; border: 1px solid rgba(110, 168, 255, .17); border-radius: 10px; background: rgba(110, 168, 255, .045); color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.notice strong { display: block; color: var(--text); margin-bottom: 3px; font-size: 12px; font-weight: 550; }
.notice p { margin: 0; }
.messages .notice { margin: 0; }
.notice-warning { border-color: rgba(255, 200, 102, .22); background: rgba(255, 200, 102, .045); }
.notice-warning strong { color: var(--warning); }
.notice-success { border-color: rgba(75, 227, 160, .2); background: rgba(75, 227, 160, .045); }
.notice-success strong { color: var(--success); }
.notice-danger, .notice-error { border-color: rgba(255, 107, 129, .25); background: rgba(255, 107, 129, .045); }
.notice-danger strong, .notice-error strong { color: var(--danger); }

/* Forms keep native controls, labels and browser validation. */
.field { min-width: 0; margin-bottom: 18px; }
.field label { display: block; color: #c4cbdf; font-size: 12px; font-weight: 500; margin-bottom: 7px; }
.field input:not([type="checkbox"]):not([type="radio"]), .field select, .field textarea {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 41px;
  padding: 10px 12px;
  border: 1px solid rgba(161, 178, 218, .18);
  border-radius: 9px;
  background: rgba(5, 10, 23, .56);
  color: var(--text);
  line-height: 1.5;
  transition: border-color .15s, box-shadow .15s;
}
.field input::placeholder, .field textarea::placeholder { color: #8a94b0; opacity: 1; }
.field textarea { min-height: 84px; max-height: 320px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: rgba(110, 168, 255, .6); box-shadow: 0 0 0 3px rgba(110, 168, 255, .06); }
.field select option, .field select optgroup { background: #151a2b; color: var(--text); }
.field input[type="checkbox"] { width: 16px; height: 16px; flex: 0 0 16px; margin: 0; accent-color: var(--accent); }
.field-checkbox { padding: 12px; margin-bottom: 10px; border: 1px solid var(--line-soft); border-radius: 9px; background: rgba(255, 255, 255, .018); }
.checkbox-row { display: flex; align-items: center; gap: 10px; }
.checkbox-row label { margin: 0; }
.field-checkbox .help-text { margin-left: 26px; }
.field-invalid input, .field-invalid textarea, .field-invalid select { border-color: var(--danger) !important; }
.help-text { margin-top: 7px; color: var(--dim); font-size: 11px; overflow-wrap: anywhere; }
.help-text ul { margin: 4px 0; padding-left: 17px; }
.help-text li { margin: 2px 0; }
.field-errors { margin: 7px 0 0; color: var(--danger); font-size: 12px; }
.field-errors p { margin: 3px 0; }
.form-errors { padding: 11px 13px; margin-bottom: 18px; border: 1px solid rgba(255, 107, 129, .25); border-radius: 8px; background: rgba(255, 107, 129, .055); color: var(--danger); font-size: 12px; }
.form-errors p { margin: 3px 0; }
.filter-bar { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px; margin-bottom: 22px; }
.filter-bar .field { margin: 0; min-width: 145px; }
.filter-bar .search-field { flex: 1; min-width: 210px; }
.filter-bar .text-link { padding-bottom: 11px; }
.filter-bar .button { min-height: 41px; }
form[data-submitting="true"] .button { pointer-events: none; opacity: .65; }
form[data-submitting="true"] { cursor: progress; }

/* Account details, badges and dashboard summaries. */
.badge { display: inline-flex; align-items: center; justify-content: center; padding: 3px 8px; border: 1px solid rgba(163, 176, 209, .16); border-radius: 6px; background: rgba(163, 176, 209, .035); color: var(--muted); font-size: 11px; line-height: 1.5; white-space: nowrap; }
.badge-success { color: var(--success); border-color: rgba(75, 227, 160, .22); background: rgba(75, 227, 160, .055); }
.badge-warning { color: var(--warning); border-color: rgba(255, 200, 102, .23); background: rgba(255, 200, 102, .055); }
.badge-danger { color: var(--danger); border-color: rgba(255, 107, 129, .25); background: rgba(255, 107, 129, .055); }
.tag-row { display: flex; flex-wrap: wrap; gap: 5px; }
.tag { padding: 2px 6px; border: 1px solid var(--line); border-radius: 5px; color: var(--dim); font-size: 10px; }
.tag-active { color: var(--accent); border-color: rgba(110, 168, 255, .22); background: rgba(110, 168, 255, .06); }
.detail-list { display: grid; gap: 0; margin: 0; }
.detail-list > div { display: grid; grid-template-columns: 105px minmax(0, 1fr); gap: 18px; padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.detail-list > div:first-child { padding-top: 0; }
.detail-list > div:last-child { border: 0; padding-bottom: 0; }
.detail-list dt { color: var(--muted); font-size: 12px; }
.detail-list dd { margin: 0; overflow-wrap: anywhere; }
.note-block { padding: 14px; margin-top: 18px; border: 1px solid var(--line-soft); border-radius: 9px; background: rgba(7, 9, 18, .24); color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.note-block p { margin: 7px 0 0; }
.section-note { margin: 16px 0 0; color: var(--dim); font-size: 11px; }
.section-note-top { margin: 0 0 17px; }
.capability-list > div { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 15px 0; border-bottom: 1px solid var(--line-soft); }
.capability-list > div:first-child { padding-top: 0; }
.capability-list > div:last-child { border-bottom: 0; }
.capability-list strong { display: block; font-size: 12px; font-weight: 550; }
.capability-list small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card { position: relative; display: flex; flex-direction: column; min-width: 0; padding: 18px 19px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); transition: border-color .15s, background .15s; }
.stat-card:hover { border-color: rgba(110, 168, 255, .3); background: var(--surface-raised); }
.stat-label { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 11px; }
.stat-label .icon { width: 15px; height: 15px; flex-basis: 15px; color: var(--accent); opacity: .85; }
.stat-card > strong { margin: 12px 0 5px; font: 500 32px/1.35 var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.8px; }
.stat-card > small { color: var(--dim); font-size: 10px; }
.stat-highlight { border-color: rgba(110, 168, 255, .26); background: linear-gradient(120deg, rgba(110, 168, 255, .095), rgba(160, 107, 255, .045)); }
.stat-highlight > strong { color: var(--accent); }
.dashboard-grid { grid-template-columns: minmax(0, 1.65fr) minmax(260px, 1fr); }
.activity { padding: 15px 0; border-bottom: 1px solid var(--line-soft); overflow-wrap: anywhere; }
.activity:first-child { padding-top: 0; }
.activity:last-child { border-bottom: 0; padding-bottom: 0; }
.activity > div { display: flex; justify-content: space-between; align-items: center; gap: 13px; }
.activity strong { font-size: 12px; font-weight: 550; }
.activity p { margin: 6px 0; color: var(--muted); font-size: 12px; }
.activity small { color: var(--dim); font-size: 10px; }
.summary-list > a { display: flex; align-items: center; justify-content: space-between; padding: 13px 0; border-bottom: 1px solid var(--line-soft); color: var(--muted); font-size: 12px; }
.summary-list > a:first-child { padding-top: 0; }
.summary-list > a:last-child { border: 0; }
.summary-list > a:hover { color: var(--accent); }
.summary-list strong { color: var(--text); font: 500 19px/1.5 var(--mono); }

/* Tables scroll locally instead of widening the document. */
.table-scroll { position: relative; width: 100%; overflow-x: auto; scrollbar-width: thin; scrollbar-color: #3a4467 transparent; border: 1px solid var(--line-soft); border-radius: 10px; }
.data-table { width: 100%; min-width: 690px; border-collapse: collapse; text-align: left; font-size: 12px; }
.data-table th { padding: 11px 13px; border-bottom: 1px solid var(--line); background: rgba(7, 9, 18, .34); color: var(--muted); font-size: 11px; font-weight: 500; white-space: nowrap; }
.data-table td { padding: 15px 13px; border-bottom: 1px solid var(--line-soft); vertical-align: top; overflow-wrap: anywhere; max-width: 270px; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: rgba(110, 168, 255, .025); }
.cell-title { display: block; color: var(--text); font-size: 12px; font-weight: 550; }
.cell-title:hover { color: var(--accent); }
.cell-subtitle { display: block; margin-top: 5px; color: var(--dim); font-size: 10px; }
.code-prefix { font-family: var(--mono); letter-spacing: .6px; }
.invite-table { min-width: 820px; }
.invite-disable-form { width: 210px; }
.invite-disable-form .field { margin-bottom: 8px; }
.invite-disable-form .field label { font-size: 10px; margin-bottom: 4px; }
.invite-disable-form .field textarea { min-height: 48px; height: 48px; padding: 7px; font-size: 11px; }
.audit-table .reason-cell { min-width: 230px; max-width: 400px; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding-top: 18px; margin-top: 17px; border-top: 1px solid var(--line-soft); font-size: 11px; }
.pagination > div { display: flex; gap: 8px; }
.empty-state { text-align: center; padding: 36px 22px; }
.empty-state > .icon { width: 28px; height: 28px; margin: 0 auto 13px; color: var(--dim); opacity: .7; }
.empty-state h3 { margin-bottom: 8px; font-size: 13px; font-weight: 550; }
.empty-state p { max-width: 420px; margin: 0 auto; color: var(--muted); font-size: 12px; }
.action-groups { display: grid; gap: 13px; }
.action-groups > .button-row + .button-row { border-top: 1px solid var(--line-soft); padding-top: 13px; }
.author-edit-grid > .card { height: auto; }
.password-reset-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; gap: 32px; }
.password-reset-card h2 { margin-bottom: 12px; }
.password-reset-card > div { max-width: 460px; }
.secret-panel { padding: 20px; margin: 20px 0; border: 1px dashed rgba(110, 168, 255, .42); border-radius: 11px; background: rgba(110, 168, 255, .045); }
.secret-code { display: block; margin: 15px 0 20px; color: var(--accent); font: 550 21px/1.6 var(--mono); letter-spacing: .6px; overflow-wrap: anywhere; user-select: all; }
.secret-panel [role="status"] { margin-top: 12px; }
.error-card { max-width: 650px; margin: 30px auto; padding: 32px; }
.error-card h1 { margin: 8px 0 17px; }

/* Public entry pages: one clear form, with the same workspace visual language. */
.public-page { padding: 0 24px; }
.public-page .center-shell { display: flex; flex-direction: column; max-width: 1120px; }
.public-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 26px; border-bottom: 1px solid var(--line-soft); }
.public-header nav { display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 12px; }
.public-header nav a { padding: 6px 11px; border: 1px solid transparent; border-radius: 8px; }
.public-header nav a:hover { color: var(--text); background: rgba(255, 255, 255, .04); }
.public-header nav a[aria-current="page"] { color: var(--accent); background: rgba(110, 168, 255, .07); border-color: rgba(110, 168, 255, .16); }
.public-page .main-content { display: flex; flex-direction: column; justify-content: center; padding: 46px 24px; }
.public-page .messages { width: 100%; max-width: 560px; align-self: center; }
.auth-layout { width: 100%; max-width: 412px; margin: 0 auto; }
.auth-card { padding: 29px; margin: 0; background: linear-gradient(145deg, rgba(32, 39, 61, .75), rgba(18, 23, 39, .86)); }
.auth-emblem { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 19px; border: 1px solid rgba(110, 168, 255, .2); border-radius: 13px; background: var(--gradient-soft); color: var(--accent); }
.auth-emblem .icon { width: 23px; height: 23px; }
.section-heading { margin-bottom: 26px; }
.section-heading h1 { margin-bottom: 7px; font-size: 23px; }
.section-heading .muted { font-size: 12px; }
.auth-card .button-full { min-height: 42px; }
.login-page .center-shell { border: 0; background: none; box-shadow: none; }
.login-page .auth-card { padding: 32px; box-shadow: 0 22px 60px rgba(0, 0, 0, .2), inset 0 1px 0 rgba(255, 255, 255, .045); }
.login-page .auth-emblem { margin: 0 auto 19px; }
.login-page .section-heading { text-align: center; margin-bottom: 27px; }
.login-page .section-heading h1 { font-size: 23px; letter-spacing: .25px; }
.login-page .auth-feedback { margin: 0 0 16px; line-height: 1.7; }
.login-page .auth-feedback p { margin: 0; }
.login-page .auth-support { margin: 19px 0 0; }
.auth-switch { display: flex; justify-content: center; flex-wrap: wrap; gap: 7px; margin: 23px 0 0; padding-top: 20px; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: 12px; }
.auth-switch a { color: var(--accent); }
.auth-switch a:hover { text-decoration: underline; text-underline-offset: 3px; }
.auth-support { margin: 17px 5px 0; color: var(--dim); font-size: 11px; line-height: 1.8; text-align: center; }
.registration-layout { max-width: 540px; }
.registration-layout .auth-card { padding: 29px 32px; }
.registration-layout .section-heading { margin-bottom: 23px; }
.registration-layout .auth-emblem { width: 38px; height: 38px; margin-bottom: 16px; border-radius: 11px; }

/* Smaller desktop windows keep the same controls and order. */
@media (max-width: 1180px) {
  .workspace { padding: 0 16px; }
  .center-shell { grid-template-columns: 184px minmax(0, 1fr); margin: 16px auto; min-height: calc(100vh - 32px); }
  .sidebar { top: 16px; height: calc(100vh - 32px); padding-left: 10px; padding-right: 10px; }
  .sidebar > .brand { padding-left: 9px; padding-right: 9px; }
  .main-nav a[aria-current="page"]::before { left: -11px; }
  .main-content { padding: 24px; }
  .topbar { padding-left: 24px; padding-right: 24px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: minmax(0, 1fr); }
  .author-edit-grid { grid-template-columns: minmax(0, 1fr); }
  .page-heading { align-items: flex-start; }
  .page-heading > .button-row { justify-content: flex-end; }
  .card { padding: 20px; }
}

@media (max-width: 900px) {
  .content-grid { grid-template-columns: minmax(0, 1fr); }
  .password-reset-card { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .page-heading { flex-wrap: wrap; gap: 16px; }
  .page-heading > .button-row { justify-content: flex-start; }
  .account-menu { width: 100%; }
  .account-name { margin-right: auto; }
}

/* On mobile the navigation becomes a compact horizontal strip. */
@media (max-width: 680px) {
  .workspace, .public-page { padding: 0; }
  .center-shell { display: block; min-height: 100vh; margin: 0; border: 0; border-radius: 0; }
  .sidebar { position: relative; top: auto; width: 100%; height: auto; min-height: 0; padding: 17px 16px 11px; border-right: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
  .sidebar > .brand { padding: 0 3px 17px; }
  .brand-mark { width: 20px; height: 20px; flex-basis: 20px; border-radius: 6px; }
  .brand-name { font-size: 14px; }
  .main-nav { display: flex; gap: 5px; padding: 3px 2px 5px; overflow-x: auto; scrollbar-width: thin; scrollbar-color: #3a4467 transparent; }
  .main-nav a { flex: 0 0 auto; gap: 7px; min-height: 36px; padding: 7px 10px; border-radius: 9px; font-size: 11px; white-space: nowrap; }
  .main-nav .icon { width: 14px; height: 14px; flex-basis: 14px; }
  .main-nav a[aria-current="page"]::before { display: none; }
  .workspace-body { min-height: calc(100vh - 124px); }
  .topbar { min-height: 53px; padding: 10px 19px; }
  .account-menu { gap: 8px; }
  .account-name { max-width: 50vw; font-size: 11px; }
  .role-label { font-size: 9px; }
  .text-button { padding-right: 0; }
  .main-content { padding: 23px 17px 28px; }
  .page-heading { margin-bottom: 20px; }
  .page-heading h1 { font-size: 23px; }
  .page-heading p:not(.eyebrow) { font-size: 11px; }
  .page-heading > .button, .page-heading > .button-row { margin-top: 0; }
  .card { padding: 17px; margin-bottom: 16px; border-radius: 12px; }
  .card-heading { gap: 10px; margin-bottom: 17px; }
  .card-heading h2 { font-size: 14px; }
  .content-grid, .stack { gap: 16px; margin-bottom: 16px; }
  .stack { margin-bottom: 0; }
  .stats-grid { gap: 10px; margin-bottom: 18px; }
  .stat-card { padding: 15px; border-radius: 11px; }
  .stat-card > strong { margin-top: 10px; font-size: 28px; }
  .stat-card > small { font-size: 10px; }
  .stat-label { gap: 4px; font-size: 11px; }
  .stat-label .icon { width: 13px; height: 13px; flex-basis: 13px; }
  .filter-bar { gap: 10px; }
  .filter-bar .search-field { flex-basis: 100%; min-width: 0; }
  .filter-bar > .field:not(.search-field) { flex: 1; min-width: 115px; }
  .filter-bar > .button { flex: 0 0 auto; }
  .data-table { min-width: 660px; }
  .pagination { align-items: flex-start; flex-direction: column; gap: 12px; }
  .detail-list > div { grid-template-columns: 82px minmax(0, 1fr); gap: 10px; }
  .notice { padding: 12px 14px; font-size: 11px; }
  .button { font-size: 11px; padding: 8px 12px; }
  .public-page .center-shell { min-height: 100vh; }
  .public-header { padding: 17px 18px; gap: 12px; }
  .public-header .brand { gap: 9px; }
  .public-header nav { gap: 4px; font-size: 11px; }
  .public-header nav a { padding: 5px 8px; }
  .public-page .main-content { padding: 30px 18px; }
  .auth-card, .registration-layout .auth-card, .login-page .auth-card { padding: 25px 22px; }
  .section-heading h1 { font-size: 22px; }
  .auth-support { font-size: 10px; }
  .secret-code { font-size: 17px; }
  .error-card { margin: 15px 0; padding: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

/* The catalog shares the account shell; model cards show content and state. */
.catalog-quota { display: flex; flex-wrap: wrap; gap: 10px 22px; margin: 0 0 21px; padding: 13px 16px; border: 1px solid var(--line-soft); border-radius: 9px; color: var(--muted); font-size: 11px; }
.catalog-quota strong { margin-left: 5px; color: var(--text); font-weight: 550; }
.catalog-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.model-card { min-width: 0; padding: 18px; border: 1px solid var(--line-soft); border-radius: 10px; background: rgba(7, 9, 18, .18); }
.model-card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.model-card-heading h2 { min-width: 0; margin: 1px 0 0; font-size: 15px; line-height: 1.6; overflow-wrap: anywhere; }
.model-card-heading h2 a:hover { color: var(--accent); }
.model-description { margin: 13px 0; color: var(--muted); font-size: 12px; line-height: 1.8; overflow-wrap: anywhere; }
.model-facts { display: grid; gap: 7px; margin: 16px 0; font-size: 11px; }
.model-facts > div { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 12px; }
.model-facts dt { color: var(--dim); }
.model-facts dd { margin: 0; overflow-wrap: anywhere; }
.catalog-empty { grid-column: 1 / -1; }
.catalog-identities { margin-top: 23px; }
.section-actions { margin-top: 20px; }
.catalog-class-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 30px; max-height: 360px; overflow-y: auto; margin: 0; padding-left: 25px; color: var(--muted); font-size: 12px; }
.catalog-class-list li { padding-left: 3px; overflow-wrap: anywhere; }
.upload-status { display: none; }
form[data-submitting="true"] .upload-status { display: block; }
.catalog-upload-form input[type="file"] { cursor: pointer; overflow: hidden; }
.catalog-upload-form input[type="file"]::file-selector-button { margin: -3px 12px -3px -4px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-raised); color: var(--text); cursor: pointer; }
@media (max-width: 900px) {
  .catalog-grid { grid-template-columns: minmax(0, 1fr); }
  .catalog-class-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .catalog-quota { gap: 7px 15px; padding: 12px; }
  .model-card { padding: 15px; }
  .model-card-heading { flex-wrap: wrap; gap: 8px; }
  .catalog-class-list { grid-template-columns: minmax(0, 1fr); }
}
