/* ============================================================================
   Eurowings Challenge — design system
   Same language as Eurowings Staff: Eurowings brand palette (magenta, dark
   magenta, blue, grey), flat structured surfaces, a magenta brand band at the
   top of the sidebar, filled magenta active nav, icon-badge stat cards.
   Only interaction-driven animation (no page-load entrance effects).
   ============================================================================ */

:root {
  --ew-magenta: #B4175E;
  --ew-magenta-dark: #8F174F;
  --ew-blue: #089BC9;
  --ew-blue-light: #7BCBE2;
  --ew-grey: #C8C4C3;

  --ew-accent: var(--ew-magenta);
  --ew-accent-strong: var(--ew-magenta-dark);
  --ew-accent-soft: rgba(180, 23, 94, 0.12);
  --ew-blue-soft: rgba(8, 155, 201, 0.12);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --shadow-card: 0 1px 2px rgba(0,0,0,.35), 0 6px 18px -10px rgba(0,0,0,.4);
  --shadow-pop: 0 14px 38px -10px rgba(0,0,0,.5);
  --ease: cubic-bezier(.4,0,.2,1);
}

:root,
:root[data-theme="dark"] {
  --bg: #15121a;
  --bg-elevated: #1c1821;
  --surface: #201c27;
  --surface-alt: #2a2432;
  --border: #37303f;
  --text: #f3f0f6;
  --text-muted: #aba1b6;
  --text-faint: #7d7389;
  --success: #38c796;
  --warning: #e2a93b;
  --danger: #e2573f;
  --info: #3fb6dd;
}

:root[data-theme="light"] {
  --bg: #f6f4f6;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-alt: #f3eef1;
  --border: #e4dde2;
  --text: #241f26;
  --text-muted: #685f6c;
  --text-faint: #978d9c;
  --success: #1f9d72;
  --warning: #b9790f;
  --danger: #c43e2b;
  --info: #0a86ad;
  --shadow-card: 0 1px 2px rgba(40,20,40,.06), 0 6px 18px -12px rgba(40,20,40,.18);
  --shadow-pop: 0 14px 38px -12px rgba(40,20,40,.28);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #f6f4f6; --bg-elevated: #ffffff; --surface: #ffffff; --surface-alt: #f3eef1;
    --border: #e4dde2; --text: #241f26; --text-muted: #685f6c; --text-faint: #978d9c;
    --success: #1f9d72; --warning: #b9790f; --danger: #c43e2b; --info: #0a86ad;
    --shadow-card: 0 1px 2px rgba(40,20,40,.06), 0 6px 18px -12px rgba(40,20,40,.18);
    --shadow-pop: 0 14px 38px -12px rgba(40,20,40,.28);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
h1, h2, h3 { margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: 22px; font-weight: 800; }
h2 { font-size: 16px; font-weight: 800; }
h3 { font-size: 14px; font-weight: 700; }
p { margin: 0 0 .8em; }
.icon { width: 16px; height: 16px; flex-shrink: 0; }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
:focus-visible { outline: 2px solid var(--ew-accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition-duration: .01ms !important; animation-duration: .01ms !important; } }

/* ---- Shell ----------------------------------------------------------------*/
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 252px; flex-shrink: 0;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand-lockup {
  display: flex; align-items: center; gap: 10px;
  padding: 18px; text-decoration: none;
  background: linear-gradient(135deg, var(--ew-magenta-dark), var(--ew-magenta) 65%, var(--ew-blue) 140%);
  margin-bottom: 8px;
}
.brand-badge { width: 32px; height: 32px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,.18); color: #fff; flex-shrink: 0; }
.brand-badge .icon { width: 18px; height: 18px; }
.brand-name { display: block; font-weight: 800; font-size: 14.5px; letter-spacing: .2px; color: #fff; line-height: 1.2; }
.brand-sub { display: block; font-size: 10.5px; color: rgba(255,255,255,.78); text-transform: uppercase; letter-spacing: .6px; }

nav { padding: 0 12px; }
.nav-group-label { font-size: 10.5px; text-transform: uppercase; font-weight: 700; letter-spacing: .6px; color: var(--text-faint); padding: 14px 10px 6px; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm); margin-bottom: 2px;
  color: var(--text-muted); text-decoration: none; font-size: 13px; font-weight: 600;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.nav-link:hover { background: var(--surface-alt); color: var(--text); }
.nav-link.active { background: var(--ew-accent); color: #fff; }
.nav-icon { width: 20px; display: flex; align-items: center; justify-content: center; }
.nav-badge { margin-left: auto; background: var(--ew-accent); color: #fff; font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; }
.nav-link.active .nav-badge { background: #fff; color: var(--ew-accent); }

.sidebar-footer { margin-top: auto; padding: 14px 12px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 8px; }
.user-chip { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--radius-sm); text-decoration: none; transition: background .15s var(--ease); }
.user-chip:hover, .user-chip.active { background: var(--surface-alt); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--ew-accent-soft); color: var(--ew-accent); font-weight: 800; font-size: 12.5px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.user-chip-text { min-width: 0; }
.user-chip-name { display: block; font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip-role { display: block; font-size: 11px; color: var(--text-faint); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.user-chip-role.role-root { color: var(--ew-accent); }
.user-chip-role.role-admin { color: var(--info); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 28px; border-bottom: 1px solid var(--border); background: var(--bg-elevated);
  position: sticky; top: 0; z-index: 20;
}
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-title { font-size: 16px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.content { padding: 26px 28px 48px; width: 100%; max-width: 1280px; }

.icon-btn {
  width: 34px; height: 34px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text-muted); display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background .15s var(--ease), color .15s var(--ease); flex-shrink: 0; text-decoration: none;
}
.icon-btn:hover { background: var(--surface-alt); color: var(--text); }
.mobile-only { display: none; }
.theme-icon-light { display: none; }
:root[data-theme="light"] .theme-icon-light { display: inline-flex; }
:root[data-theme="light"] .theme-icon-dark { display: none; }
.sidebar-scrim { display: none; }

/* ---- Page heading -----------------------------------------------------------*/
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 0; color: var(--text-muted); }
.page-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); text-decoration: none; font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.back-link:hover { color: var(--text); }

/* ---- Surfaces ---------------------------------------------------------------*/
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 20px; box-shadow: var(--shadow-card); }
.card + .card { margin-top: 18px; }
.grid > .card + .card, .template-grid > .card + .card { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.card-flush { padding: 0; overflow: hidden; }
.card-flush .card-head { padding: 16px 20px 0; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-side { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.stack > * + * { margin-top: 18px; }

.welcome {
  position: relative; overflow: hidden;
  border-radius: var(--radius-md); padding: 26px 28px; margin-bottom: 20px; color: #fff;
  background: linear-gradient(120deg, var(--ew-magenta-dark), var(--ew-magenta) 60%, #c43a7c);
  display: flex; align-items: center; gap: 18px;
}
.welcome::after {
  content: ''; position: absolute; top: 0; right: 0; bottom: 0; width: 45%;
  background: repeating-linear-gradient(-55deg, rgba(255,255,255,.10) 0 18px, transparent 18px 40px);
  -webkit-mask-image: linear-gradient(to right, transparent, #000 70%);
  mask-image: linear-gradient(to right, transparent, #000 70%);
  pointer-events: none;
}
.welcome > * { position: relative; z-index: 1; }
.welcome .avatar { width: 54px; height: 54px; font-size: 18px; background: rgba(255,255,255,.2); color: #fff; }
.welcome h1 { margin: 0 0 2px; color: #fff; }
.welcome p { margin: 0; color: rgba(255,255,255,.85); }

.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px 18px; display: flex; align-items: center; gap: 14px; box-shadow: var(--shadow-card); text-decoration: none; transition: border-color .15s var(--ease); }
a.stat-card:hover { border-color: var(--ew-accent); }
.stat-icon { width: 42px; height: 42px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; background: var(--ew-accent-soft); color: var(--ew-accent); flex-shrink: 0; }
.stat-icon .icon { width: 20px; height: 20px; }
.stat-icon.blue { background: var(--ew-blue-soft); color: var(--ew-blue); }
.stat-icon.amber { background: rgba(226,169,59,.15); color: var(--warning); }
.stat-icon.green { background: rgba(56,199,150,.15); color: var(--success); }
.stat-value { display: block; font-size: 24px; font-weight: 800; line-height: 1.1; }
.stat-label { display: block; font-size: 12px; color: var(--text-muted); font-weight: 600; }

.project-card { display: flex; flex-direction: column; gap: 10px; }
.project-card h3 { margin: 0; font-size: 15px; }
.project-meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-muted); }
.project-meta span { display: inline-flex; align-items: center; gap: 5px; }
.project-counts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.project-counts div { background: var(--surface-alt); border-radius: var(--radius-sm); padding: 8px 10px; }
.project-counts strong { display: block; font-size: 17px; }
.project-counts span { font-size: 11px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .3px; }
.project-card .card-actions { margin-top: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- Buttons ----------------------------------------------------------------*/
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 15px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-weight: 700; font-size: 13px; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease), transform .1s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--ew-accent); color: #fff; }
.btn-primary:hover { background: var(--ew-accent-strong); }
.btn-secondary { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-secondary:hover { background: var(--surface-alt); }
.btn-blue { background: var(--ew-blue); color: #fff; }
.btn-blue:hover { filter: brightness(.92); }
.btn-danger { background: transparent; border-color: rgba(226,87,63,.45); color: var(--danger); }
.btn-danger:hover { background: rgba(226,87,63,.12); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(.94); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-alt); color: var(--text); }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-block { width: 100%; }
.btn .icon { width: 15px; height: 15px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
form.inline { display: inline; }

/* ---- Forms ------------------------------------------------------------------*/
.form-stack > * + * { margin-top: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .span-2 { grid-column: span 2; }
.field { display: block; }
.field > span, .field-label { display: block; font-size: 12px; font-weight: 700; color: var(--text-muted); margin-bottom: 6px; }
.field small, .hint { display: block; font-size: 12px; color: var(--text-faint); margin-top: 5px; }
input[type=text], input[type=password], input[type=number], input[type=email], input[type=search], select, textarea {
  width: 100%; padding: 9px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ew-accent); box-shadow: 0 0 0 3px var(--ew-accent-soft); }
.check { display: flex; align-items: flex-start; gap: 9px; cursor: pointer; font-size: 13.5px; }
.check input { margin-top: 3px; accent-color: var(--ew-accent); width: 16px; height: 16px; flex-shrink: 0; }
.check-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.check-list .check { background: var(--surface-alt); border-radius: var(--radius-sm); padding: 9px 11px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 18px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filters .field { min-width: 170px; }

/* ---- Tables -----------------------------------------------------------------*/
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; }
.data-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-faint); font-weight: 700; padding: 11px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface); }
.data-table td { padding: 11px 14px; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--surface-alt); }
.data-table .actions { text-align: right; white-space: nowrap; }
.data-table .actions > * { margin-left: 4px; }
.cell-main { font-weight: 700; }
.cell-sub { font-size: 12px; color: var(--text-faint); }
.code-chip { display: inline-flex; align-items: center; gap: 6px; font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-weight: 700; font-size: 13px; letter-spacing: .5px; background: var(--surface-alt); border: 1px solid var(--border); padding: 4px 8px; border-radius: var(--radius-sm); }
.copy-btn { border: none; background: transparent; color: var(--text-faint); cursor: pointer; padding: 0; display: inline-flex; }
.copy-btn:hover { color: var(--ew-accent); }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: var(--radius-sm); font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.badge-neutral { background: var(--surface-alt); color: var(--text-muted); }
.badge-info { background: var(--ew-blue-soft); color: var(--info); }
.badge-warning { background: rgba(226,169,59,.16); color: var(--warning); }
.badge-success { background: rgba(56,199,150,.16); color: var(--success); }
.badge-danger { background: rgba(226,87,63,.16); color: var(--danger); }
.badge-accent { background: var(--ew-accent-soft); color: var(--ew-accent); }

.score-inline { display: flex; align-items: center; gap: 10px; min-width: 150px; }
.score-bar { flex: 1; height: 7px; background: var(--surface-alt); border-radius: 4px; overflow: hidden; min-width: 60px; }
.score-bar > span { display: block; height: 100%; background: var(--ew-accent); border-radius: 4px; }
.score-bar.good > span { background: var(--success); }
.score-bar.mid > span { background: var(--warning); }
.score-bar.low > span { background: var(--danger); }
.score-num { font-weight: 800; font-size: 13px; white-space: nowrap; }

/* ---- Alerts, tabs, empty states --------------------------------------------*/
.alert { padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 13.5px; font-weight: 500; border: 1px solid transparent; }
.alert-success { background: rgba(56,199,150,.12); border-color: rgba(56,199,150,.35); color: var(--success); }
.alert-error { background: rgba(226,87,63,.12); border-color: rgba(226,87,63,.35); color: var(--danger); }
.alert-info { background: var(--ew-blue-soft); border-color: rgba(8,155,201,.35); color: var(--info); }
.alert-warning { background: rgba(226,169,59,.12); border-color: rgba(226,169,59,.35); color: var(--warning); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tab-btn { display: inline-flex; align-items: center; gap: 7px; padding: 10px 14px; color: var(--text-muted); text-decoration: none; font-weight: 700; font-size: 13px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--ew-accent); border-bottom-color: var(--ew-accent); }
.tab-count { background: var(--surface-alt); color: var(--text-muted); font-size: 11px; padding: 1px 7px; border-radius: 9px; }

.empty-state { text-align: center; padding: 44px 20px; }
.empty-icon { width: 54px; height: 54px; margin: 0 auto 14px; border-radius: 50%; background: var(--ew-accent-soft); color: var(--ew-accent); display: flex; align-items: center; justify-content: center; }
.empty-icon .icon { width: 24px; height: 24px; }
.empty-state p { max-width: 420px; margin: 0 auto 16px; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; font-size: 13.5px; margin: 0; }
.kv dt { color: var(--text-muted); font-weight: 600; }
.kv dd { margin: 0; font-weight: 600; }

.pagination { display: flex; gap: 6px; justify-content: center; padding: 16px; }

/* ---- Mailbox editor (staff) ------------------------------------------------*/
.mail-row { display: flex; align-items: center; gap: 14px; padding: 13px 18px; border-bottom: 1px solid var(--border); }
.mail-row:last-child { border-bottom: none; }
.mail-order { display: flex; flex-direction: column; gap: 2px; }
.mail-order .icon-btn { width: 26px; height: 22px; }
.mail-num { width: 26px; text-align: center; font-weight: 800; color: var(--text-faint); font-size: 13px; }
.mail-info { flex: 1; min-width: 0; }
.mail-info .cell-main { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.option-editor { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px; background: var(--surface-alt); }
.option-editor + .option-editor { margin-top: 10px; }
.option-editor-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.option-grid { display: grid; grid-template-columns: minmax(0, 1fr) 110px; gap: 10px; }
.option-grid .span-2 { grid-column: span 2; }
.points-pos { color: var(--success); font-weight: 800; }
.points-neg { color: var(--danger); font-weight: 800; }
.points-zero { color: var(--text-faint); font-weight: 800; }

/* ---- Result page ------------------------------------------------------------*/
.score-hero { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.score-ring { --p: 0; width: 120px; height: 120px; border-radius: 50%; flex-shrink: 0;
  background: conic-gradient(var(--ring, var(--ew-accent)) calc(var(--p) * 1%), var(--surface-alt) 0);
  display: flex; align-items: center; justify-content: center; }
.score-ring > div { width: 94px; height: 94px; border-radius: 50%; background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.score-ring strong { font-size: 24px; font-weight: 800; line-height: 1; }
.score-ring span { font-size: 11.5px; color: var(--text-muted); font-weight: 600; margin-top: 3px; }
.answer-item { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px 16px; }
.answer-item + .answer-item { margin-top: 10px; }
.answer-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.answer-head h3 { margin: 0; }
.answer-options { list-style: none; padding: 0; margin: 12px 0 0; }
.answer-options li { display: flex; gap: 10px; align-items: flex-start; padding: 7px 10px; border-radius: var(--radius-sm); font-size: 13px; }
.answer-options li + li { margin-top: 3px; }
.answer-options li.chosen { background: var(--ew-accent-soft); font-weight: 600; }
.answer-options .pts { margin-left: auto; white-space: nowrap; font-size: 12px; }
.answer-options .mark { width: 16px; flex-shrink: 0; margin-top: 1px; color: var(--ew-accent); }
.feedback { margin-top: 8px; font-size: 12.5px; color: var(--text-muted); border-left: 2px solid var(--border); padding-left: 10px; }

/* ---- Modal & toasts ---------------------------------------------------------*/
.modal-backdrop { position: fixed; inset: 0; background: rgba(10,6,14,.6); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 100; opacity: 0; pointer-events: none; transition: opacity .18s var(--ease); }
.modal-backdrop.open { opacity: 1; pointer-events: auto; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); width: 100%; max-width: 460px; padding: 24px; transform: translateY(8px) scale(.98); transition: transform .18s var(--ease); max-height: 90vh; overflow-y: auto; }
.modal-backdrop.open .modal { transform: none; }
.modal h2 { margin-bottom: 8px; }
.modal-icon { width: 46px; height: 46px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--ew-accent-soft); color: var(--ew-accent); margin-bottom: 14px; }
.modal-icon .icon { width: 22px; height: 22px; }
.modal-icon.danger { background: rgba(226,87,63,.14); color: var(--danger); }

.toast-stack { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 11px 15px; box-shadow: var(--shadow-pop); font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 9px; opacity: 0; transform: translateY(8px); transition: opacity .2s var(--ease), transform .2s var(--ease); }
.toast.show { opacity: 1; transform: none; }
.toast .icon { color: var(--success); }
.toast.error .icon { color: var(--danger); }

/* ---- Auth (split screen) ----------------------------------------------------*/
.auth-body { background: var(--bg); }
.auth-split { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; }
.auth-hero { position: relative; overflow: hidden; color: #fff; display: flex; align-items: flex-end; padding: 48px;
  background: linear-gradient(150deg, var(--ew-magenta-dark) 0%, var(--ew-magenta) 55%, #9d1a6a 100%); }
.auth-stripes { position: absolute; inset: 0; pointer-events: none; }
.auth-stripes span { position: absolute; right: -20%; width: 140%; height: 70px; transform: rotate(-28deg); }
.auth-stripes span:nth-child(1) { top: 16%; background: rgba(255,255,255,.08); }
.auth-stripes span:nth-child(2) { top: 26%; height: 38px; background: var(--ew-blue); opacity: .85; }
.auth-stripes span:nth-child(3) { top: 33%; height: 14px; background: var(--ew-blue-light); opacity: .7; }
.auth-hero-inner { position: relative; max-width: 460px; }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 64px; }
.auth-kicker { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: rgba(255,255,255,.75); margin-bottom: 8px; }
.auth-headline { font-size: 38px; line-height: 1.1; font-weight: 800; color: #fff; margin: 0 0 14px; letter-spacing: -.02em; }
.auth-sub { color: rgba(255,255,255,.85); font-size: 15px; margin: 0; }
.auth-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 24px; gap: 18px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-title { font-size: 22px; margin-bottom: 4px; }
.auth-lead { margin-bottom: 20px; }
.auth-footer { font-size: 13px; }
.auth-footer a { color: var(--text-muted); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.auth-footer a:hover { color: var(--ew-accent); }
.code-input { text-align: center; font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 22px !important; font-weight: 800; letter-spacing: 3px; text-transform: uppercase; padding: 14px !important; }

.brief { max-width: 760px; margin: 0 auto; padding: 40px 20px 60px; }
.brief-head { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.brief-text { white-space: pre-line; line-height: 1.65; }
.brief-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 22px 0; }
.brief-facts .stat-card { box-shadow: none; }

/* ---- Candidate mailbox ------------------------------------------------------*/
.mailbox-body { height: 100vh; overflow: hidden; }
.mailbox { display: grid; grid-template-rows: auto 1fr; height: 100vh; }
.mb-top { display: flex; align-items: center; gap: 16px; padding: 0 18px 0 0; background: var(--bg-elevated); border-bottom: 1px solid var(--border); min-height: 58px; }
.mb-top .brand-lockup { margin: 0; align-self: stretch; padding: 0 18px; width: 252px; }
.mb-search { flex: 1; max-width: 460px; position: relative; }
.mb-search input { padding-left: 34px; background: var(--surface); }
.mb-search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-faint); }
.mb-top-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.mb-progress { display: flex; flex-direction: column; gap: 4px; min-width: 130px; }
.mb-progress-label { font-size: 11.5px; color: var(--text-muted); font-weight: 700; }
.mb-progress .score-bar { height: 5px; }
.mb-timer { display: inline-flex; align-items: center; gap: 7px; font-weight: 800; font-variant-numeric: tabular-nums; padding: 7px 11px; border-radius: var(--radius-sm); background: var(--surface-alt); font-size: 14px; }
.mb-timer.warn { background: rgba(226,169,59,.16); color: var(--warning); }
.mb-timer.danger { background: rgba(226,87,63,.16); color: var(--danger); }
.mb-user { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; }
.mb-user .avatar { width: 30px; height: 30px; font-size: 11px; }

.mb-main { display: grid; grid-template-columns: 220px 380px minmax(0, 1fr); min-height: 0; }
.mb-folders { border-right: 1px solid var(--border); background: var(--bg-elevated); padding: 14px 10px; overflow-y: auto; }
.mb-folder { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; color: var(--text-muted); cursor: pointer; border: none; background: none; width: 100%; text-align: left; }
.mb-folder:hover { background: var(--surface-alt); color: var(--text); }
.mb-folder.active { background: var(--ew-accent); color: #fff; }
.mb-folder .count { margin-left: auto; font-size: 11.5px; font-weight: 800; }
.mb-folder-sep { font-size: 10.5px; text-transform: uppercase; font-weight: 700; letter-spacing: .6px; color: var(--text-faint); padding: 16px 10px 6px; }
.mb-account { margin: 12px 4px 0; padding: 12px; border-radius: var(--radius-sm); background: var(--surface-alt); font-size: 12px; color: var(--text-muted); }
.mb-account strong { display: block; color: var(--text); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.mb-list { border-right: 1px solid var(--border); overflow-y: auto; background: var(--surface); }
.mb-list-head { position: sticky; top: 0; z-index: 2; background: var(--surface); padding: 14px 16px 10px; border-bottom: 1px solid var(--border); display: flex; align-items: baseline; justify-content: space-between; }
.mb-list-head h2 { margin: 0; font-size: 15px; }
.mb-item { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 11px; padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer; position: relative; border-left: 3px solid transparent; background: none; width: 100%; text-align: left; border-top: none; border-right: none; }
.mb-item:hover { background: var(--surface-alt); }
.mb-item.active { background: var(--ew-accent-soft); border-left-color: var(--ew-accent); }
.mb-item .avatar { width: 36px; height: 36px; font-size: 12px; }
.mb-item-top { display: flex; align-items: center; gap: 6px; }
.mb-item-from { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.mb-item-time { font-size: 11.5px; color: var(--text-faint); white-space: nowrap; }
.mb-item-subject { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.mb-item-preview { font-size: 12.5px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mb-item.unread .mb-item-from, .mb-item.unread .mb-item-subject { font-weight: 800; }
.mb-item.unread::before { content: ''; position: absolute; left: 6px; top: 18px; width: 7px; height: 7px; border-radius: 50%; background: var(--ew-blue); }
.mb-flags { display: flex; gap: 6px; align-items: center; margin-top: 3px; }
.mb-flag { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 700; }
.mb-flag .icon { width: 12px; height: 12px; }
.mb-flag.important { color: var(--danger); }
.mb-flag.answered { color: var(--success); }
.mb-flag.todo { color: var(--text-faint); }
.mb-flag.attach { color: var(--text-faint); }
.mb-empty-list { padding: 40px 20px; text-align: center; color: var(--text-faint); font-size: 13px; }

.mb-reader { overflow-y: auto; background: var(--bg); min-width: 0; }
.mb-reader-empty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-faint); text-align: center; padding: 30px; }
.mb-reader-empty .empty-icon { margin-bottom: 12px; }
.mb-message { max-width: 860px; margin: 0 auto; padding: 26px 32px 60px; }
.mb-back { display: none; margin-bottom: 14px; }
.mb-subject { font-size: 21px; font-weight: 800; margin: 0 0 16px; line-height: 1.3; }
.mb-sender { display: flex; align-items: center; gap: 12px; padding-bottom: 16px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.mb-sender .avatar { width: 42px; height: 42px; font-size: 14px; }
.mb-sender-name { font-weight: 800; font-size: 14px; }
.mb-sender-addr { font-size: 12.5px; color: var(--text-muted); }
.mb-sender-to { font-size: 12px; color: var(--text-faint); }
.mb-sender-time { margin-left: auto; font-size: 12.5px; color: var(--text-muted); white-space: nowrap; align-self: flex-start; }
.mb-body { font-size: 14.5px; line-height: 1.7; white-space: pre-wrap; word-wrap: break-word; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 22px 24px; }
.mb-attachment { display: inline-flex; align-items: center; gap: 10px; margin-top: 12px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); font-size: 13px; font-weight: 600; }
.mb-attachment .icon { color: var(--ew-accent); }
.mb-attachment small { color: var(--text-faint); font-weight: 500; }

.mb-respond { margin-top: 22px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.mb-respond-head { display: flex; align-items: center; gap: 10px; padding: 13px 18px; border-bottom: 1px solid var(--border); background: var(--surface-alt); }
.mb-respond-head h3 { margin: 0; font-size: 14px; }
.mb-respond-head .icon { color: var(--ew-accent); }
.mb-save-state { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--text-faint); display: inline-flex; align-items: center; gap: 5px; }
.mb-save-state.ok { color: var(--success); }
.mb-save-state.err { color: var(--danger); }
.mb-options { padding: 10px; }
.mb-option { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid transparent; cursor: pointer; transition: background .12s var(--ease), border-color .12s var(--ease); }
.mb-option + .mb-option { margin-top: 4px; }
.mb-option:hover { background: var(--surface-alt); }
.mb-option input { position: absolute; opacity: 0; pointer-events: none; }
.mb-radio { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border); flex-shrink: 0; margin-top: 1px; display: flex; align-items: center; justify-content: center; transition: border-color .12s var(--ease); }
.mb-option.selected { background: var(--ew-accent-soft); border-color: var(--ew-accent-ring, rgba(180,23,94,.4)); }
.mb-options.locked .mb-option { cursor: default; }
.mb-options.locked .mb-option:not(.selected) { opacity: .55; }
.mb-options.locked .mb-option:hover:not(.selected) { background: none; }
.mb-option.selected .mb-radio { border-color: var(--ew-accent); }
.mb-option.selected .mb-radio::after { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--ew-accent); }
.mb-option input:focus-visible + .mb-radio { outline: 2px solid var(--ew-accent); outline-offset: 2px; }
.mb-option-letter { font-weight: 800; color: var(--text-faint); width: 16px; flex-shrink: 0; }
.mb-option-text { font-size: 14px; line-height: 1.5; }
.mb-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; }

.done-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.done-card { max-width: 480px; text-align: center; }
.done-card .empty-icon { width: 64px; height: 64px; }
.done-card .empty-icon .icon { width: 30px; height: 30px; }

/* ---- v2: branding, SSO, settings, templates ---------------------------------*/
.brand-badge-img { background: #fff; overflow: hidden; padding: 0; }
.brand-badge-img img { width: 100%; height: 100%; object-fit: cover; }
.btn-sso { gap: 10px; padding: 11px 15px; }
.btn-sso .brand-badge { width: 22px; height: 22px; border-radius: 4px; }
.btn-sso .brand-badge .icon { width: 14px; height: 14px; }
.or-sep { display: flex; align-items: center; gap: 10px; color: var(--text-faint); font-size: 12px; font-weight: 600; margin: 18px 0; }
.or-sep::before, .or-sep::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.settings-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 22px; align-items: start; }
.settings-layout > * { min-width: 0; }
.settings-nav { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 2px; }
.settings-nav a { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--text-muted); text-decoration: none; font-weight: 600; font-size: 13px; }
.settings-nav a:hover { background: var(--surface-alt); color: var(--text); }
.settings-nav a.active { background: var(--ew-accent-soft); color: var(--ew-accent); }
.setting-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 18px; padding: 16px 0; border-top: 1px solid var(--border); align-items: start; }
.setting-row > div { min-width: 0; }
input[type=file] { max-width: 100%; min-width: 0; }
.setting-row:first-of-type { border-top: none; padding-top: 4px; }
.setting-row h3 { margin: 0 0 3px; font-size: 13.5px; }
.setting-row p { margin: 0; font-size: 12.5px; color: var(--text-muted); }
.color-field { display: flex; gap: 8px; align-items: center; }
.color-field input[type=color] { width: 44px; height: 38px; padding: 2px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); cursor: pointer; flex-shrink: 0; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13.5px; font-weight: 600; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 38px; height: 22px; border-radius: 11px; background: var(--surface-alt); border: 1px solid var(--border); position: relative; flex-shrink: 0; transition: background .15s var(--ease); }
.switch .track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--text-faint); transition: transform .15s var(--ease), background .15s var(--ease); }
.switch input:checked + .track { background: var(--ew-accent); border-color: var(--ew-accent); }
.switch input:checked + .track::after { transform: translateX(16px); background: #fff; }
.switch input:focus-visible + .track { outline: 2px solid var(--ew-accent); outline-offset: 2px; }
.logo-preview { width: 64px; height: 64px; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--surface-alt); display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0; }
.logo-preview img { width: 100%; height: 100%; object-fit: cover; }
.brand-preview { border-radius: var(--radius-md); overflow: hidden; border: 1px solid var(--border); }
.brand-preview .brand-lockup { margin: 0; }
.sticky-save { position: sticky; bottom: 0; background: linear-gradient(to top, var(--bg) 70%, transparent); padding: 16px 0 4px; display: flex; justify-content: flex-end; gap: 8px; z-index: 5; }
.status-line { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-faint); }
.status-dot.ok { background: var(--success); }
.status-dot.bad { background: var(--danger); }
pre.code-box { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 12.5px; overflow-x: auto; margin: 8px 0 0; white-space: pre-wrap; word-break: break-all; }

.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.template-card { display: flex; flex-direction: column; gap: 10px; }
.template-card h3 { margin: 0; font-size: 15px; }
.template-card p { margin: 0; font-size: 13px; color: var(--text-muted); }
.template-card .card-actions { margin-top: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.template-icon { width: 40px; height: 40px; border-radius: var(--radius-sm); background: var(--ew-accent-soft); color: var(--ew-accent); display: flex; align-items: center; justify-content: center; }
.template-icon.custom { background: var(--ew-blue-soft); color: var(--ew-blue); }
.lib-email { display: grid; grid-template-columns: 22px 36px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 13px 18px; border-bottom: 1px solid var(--border); cursor: pointer; }
.lib-email:last-child { border-bottom: none; }
.lib-email:hover { background: var(--surface-alt); }
.lib-email input { margin-top: 10px; accent-color: var(--ew-accent); width: 16px; height: 16px; }
.lib-email details { margin-top: 6px; }
.lib-email summary { font-size: 12.5px; color: var(--ew-accent); cursor: pointer; font-weight: 600; }
.lib-email .lib-body { white-space: pre-line; font-size: 13px; color: var(--text-muted); margin-top: 8px; line-height: 1.55; }
.lib-email ul { margin: 8px 0 0; padding-left: 18px; font-size: 12.5px; }
.lib-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; background: var(--surface-alt); }

/* ---- v3: integrity ----------------------------------------------------------*/
.noselect .mb-message, .noselect .mb-list { -webkit-user-select: none; user-select: none; }
.mb-integrity { display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px; border-radius: var(--radius-sm); background: rgba(226,87,63,.16); color: var(--danger); font-weight: 800; font-size: 13px; }
.mb-integrity .icon { width: 15px; height: 15px; }
.mb-integrity.bump { animation: integ-bump .45s var(--ease); }
@keyframes integ-bump { 0% { transform: scale(1); } 40% { transform: scale(1.18); } 100% { transform: scale(1); } }
.integrity-banner { position: fixed; top: 70px; left: 50%; transform: translate(-50%, -12px); z-index: 150; max-width: min(560px, calc(100vw - 32px)); background: var(--danger); color: #fff; border-radius: var(--radius-md); padding: 12px 16px; box-shadow: var(--shadow-pop); display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; opacity: 0; transition: opacity .2s var(--ease), transform .2s var(--ease); }
.integrity-banner.show { opacity: 1; transform: translate(-50%, 0); }
.integrity-banner { pointer-events: none; }
.integrity-banner[hidden], .fs-gate[hidden] { display: none; }
.integrity-banner strong { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; opacity: .9; }
.fs-gate { position: fixed; inset: 0; z-index: 140; background: rgba(10,6,14,.85); display: flex; align-items: center; justify-content: center; padding: 16px; }
.fs-gate .card { max-width: 420px; text-align: center; }
.integrity-notice { margin-top: 18px; border: 1px solid rgba(226,87,63,.35); background: rgba(226,87,63,.07); border-radius: var(--radius-md); padding: 16px 18px; font-size: 13.5px; }
.integrity-notice-head { display: flex; align-items: center; gap: 8px; color: var(--danger); margin-bottom: 8px; }
.integrity-notice-head .icon { width: 18px; height: 18px; }
.integrity-notice ul { margin: 6px 0 10px; padding-left: 20px; line-height: 1.7; color: var(--text-muted); }
.integrity-notice p { margin: 0; }
.integ-summary { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.integ-level { font-size: 22px; font-weight: 800; }
.integ-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.integ-timeline { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--border); }
.integ-timeline li { position: relative; padding: 8px 0 8px 16px; font-size: 13px; }
.integ-timeline li::before { content: ''; position: absolute; left: -6px; top: 13px; width: 10px; height: 10px; border-radius: 50%; background: var(--text-faint); }
.integ-timeline li.sev-2::before { background: var(--warning); }
.integ-timeline li.sev-3::before, .integ-timeline li.sev-4::before, .integ-timeline li.sev-5::before { background: var(--danger); }
.integ-timeline .t { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; color: var(--text-faint); margin-right: 8px; }
.integ-timeline .d { display: block; color: var(--text-muted); font-size: 12.5px; margin-top: 2px; word-break: break-word; }

/* ---- Responsive -------------------------------------------------------------*/
@media (max-width: 1180px) {
  .mb-main { grid-template-columns: 64px 320px minmax(0, 1fr); }
  .mb-folder span.lbl, .mb-folder .count, .mb-folder-sep, .mb-account { display: none; }
  .mb-folder { justify-content: center; }
  .mb-top .brand-lockup { width: auto; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .grid-side, .grid-3 { grid-template-columns: 1fr; }
  .auth-split { grid-template-columns: 1fr; }
  .auth-hero { padding: 32px 24px; min-height: 260px; }
  .auth-brand { margin-bottom: 28px; }
  .auth-headline { font-size: 28px; }
}
@media (max-width: 860px) {
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { position: static; flex-direction: row; overflow-x: auto; }
  .settings-nav a { white-space: nowrap; }
  .setting-row { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .lib-email { grid-template-columns: 22px minmax(0, 1fr); }
  .lib-email .avatar, .lib-email .lib-pts { display: none; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 60; transform: translateX(-100%); transition: transform .2s var(--ease); }
  .sidebar.open { transform: none; box-shadow: var(--shadow-pop); }
  .sidebar-scrim.open { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 55; }
  .mobile-only { display: inline-flex; }
  .topbar { padding: 12px 16px; }
  .content { padding: 18px 16px 40px; }
  .grid-2, .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .brief-facts { grid-template-columns: 1fr; }

  .mb-main { grid-template-columns: minmax(0, 1fr); }
  .mb-top { gap: 10px; padding-right: 12px; }
  .mb-top .brand-lockup { padding: 0 12px; }
  .mb-user { display: none; }
  .mb-folders { display: none; }
  .mb-reader { display: none; }
  .mailbox.reading .mb-list { display: none; }
  .mailbox.reading .mb-reader { display: block; }
  .mb-back { display: inline-flex; }
  .mb-search, .mb-user span { display: none; }
  .mb-message { padding: 18px 16px 40px; }
  .mb-progress { min-width: 90px; }
}
@media (max-width: 560px) {
  .grid-4 { grid-template-columns: 1fr; }
  .mb-top .brand-lockup > span:last-child { display: none; }
  .mb-top-right { gap: 8px; }
  .mb-top [data-theme-toggle] { display: none; }
  .integrity-banner { top: 64px; }
  #mb-submit { padding: 8px 12px; }
  .mb-progress { display: none; }
  .welcome { padding: 20px; }
}
