/* =========================================================================
   PUSSO 7 — Peter University identity service
   One stylesheet for the portal, the sign-in page and the admin area.
   Tokens: navy ink + crest gold from the university mark, cool paper greys.
   ========================================================================= */

:root {
  --ink: #14213d;
  --ink-deep: #0c1529;
  --ink-soft: #2a3a5e;
  --gold: #b98a2c;
  --gold-soft: #f4ead3;
  --paper: #f3f4f7;
  --surface: #ffffff;
  --line: #dde2ea;
  --line-strong: #c6cdd9;
  --text: #19212f;
  --muted: #5b6578;
  --faint: #8a93a3;

  --ok: #1e7b4f;      --ok-bg: #e5f3ec;
  --warn: #9a5b07;    --warn-bg: #fdf1dc;
  --danger: #b42318;  --danger-bg: #fdeceb;
  --info: #24508f;    --info-bg: #e8eef8;

  --sans: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;

  --r-lg: 12px;
  --r: 8px;
  --r-sm: 6px;
  --rail: 248px;
  --focus: 0 0 0 3px rgba(185, 138, 44, .35);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 400 15px/1.55 var(--sans);
  color: var(--text);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--ink-soft); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--ink); }
h1, h2, h3 { margin: 0; line-height: 1.2; color: var(--ink); }
h2 { font-size: 1.05rem; font-weight: 600; }
h3 { font-size: .95rem; font-weight: 600; }
p { margin: 0; }
code, .mono { font-family: var(--mono); font-size: .86em; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }
.icon { width: 18px; height: 18px; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.grow { flex: 1; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

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

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px;
  font: 600 .9rem/1 var(--sans);
  border: 1px solid transparent; border-radius: var(--r-sm);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn .icon { width: 16px; height: 16px; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--ink-deep); color: #fff; }
.btn-quiet { background: var(--surface); color: var(--text); border-color: var(--line-strong); }
.btn-quiet:hover { border-color: var(--ink-soft); color: var(--ink); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #8f1c13; color: #fff; }
.btn-danger-quiet { background: var(--surface); color: var(--danger); border-color: #efc4c0; }
.btn-danger-quiet:hover { background: var(--danger-bg); color: var(--danger); }
.btn-link { background: none; border: 0; color: var(--ink-soft); padding: 0; height: auto; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.btn-sm { height: 30px; padding: 0 10px; font-size: .82rem; gap: 6px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 32px; height: 32px; border-radius: var(--r-sm);
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: rgba(20, 33, 61, .07); color: var(--ink); }
.icon-btn.is-disabled { opacity: .35; pointer-events: none; }
.inline-form { display: inline; margin: 0; }

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

.shell { display: flex; min-height: 100vh; }

.rail {
  position: fixed; inset: 0 auto 0 0; z-index: 30;
  width: var(--rail);
  display: flex; flex-direction: column;
  background: var(--ink);
  color: #d5dbe7;
}
.rail-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 22px 20px 20px;
  color: #fff; text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.rail-brand:hover { color: #fff; }
.rail-brand img { width: 36px; height: 36px; border-radius: 50%; background: #fff; padding: 2px; }
.rail-brand strong { display: block; font-size: 1rem; letter-spacing: .02em; }
.rail-brand small { display: block; font-size: .78rem; color: #9fabc2; }

.rail-nav { padding: 14px 10px; display: grid; gap: 2px; }
.rail-nav a, .rail-portal {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: var(--r-sm);
  color: #c4ccdb; text-decoration: none; font-weight: 500; font-size: .92rem;
}
.rail-nav a:hover, .rail-portal:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.rail-nav a.is-active { background: rgba(255, 255, 255, .09); color: #fff; }
.rail-nav a.is-active::before {
  content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--gold);
}
.rail-nav a.is-active .icon { color: var(--gold); }

.rail-foot { margin-top: auto; padding: 10px; border-top: 1px solid rgba(255, 255, 255, .08); }
.rail-me { display: flex; align-items: center; gap: 10px; padding: 10px 6px 4px 8px; }
.rail-me-name { flex: 1; min-width: 0; font-size: .85rem; color: #fff; line-height: 1.3; }
.rail-me-name small { display: block; color: #9fabc2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-me .icon-btn { color: #9fabc2; }
.rail-me .icon-btn:hover { background: rgba(255, 255, 255, .08); color: #fff; }

.main { flex: 1; min-width: 0; margin-left: var(--rail); }
.topbar { display: none; }
.content { max-width: 1240px; padding: 34px 40px 64px; }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  margin-bottom: 26px;
}
.page-head h1 { font: 600 1.9rem/1.15 var(--serif); letter-spacing: -.005em; }
.page-sub { margin-top: 6px; color: var(--muted); max-width: 64ch; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumb { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 10px; font-size: .85rem; color: var(--muted); text-decoration: none; }
.crumb:hover { color: var(--ink); }
.crumb .icon { width: 15px; height: 15px; }

@media (max-width: 960px) {
  .rail { transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 0 40px rgba(0, 0, 0, .3); }
  body.rail-open .rail { transform: none; }
  .main { margin-left: 0; }
  .topbar {
    display: flex; align-items: center; gap: 10px;
    position: sticky; top: 0; z-index: 20;
    height: 54px; padding: 0 14px;
    background: var(--surface); border-bottom: 1px solid var(--line);
  }
  .topbar-title { font-weight: 600; color: var(--ink); }
  .content { padding: 22px 16px 48px; }
  .page-head h1 { font-size: 1.55rem; }
}

/* ---------- Notices ---------- */

.notice {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; margin-bottom: 18px;
  border-radius: var(--r); border: 1px solid; font-size: .92rem;
}
.notice > span { flex: 1; padding-top: 1px; }
.notice .icon { margin-top: 1px; }
.notice-ok     { background: var(--ok-bg); border-color: #bfe0cf; color: #145536; }
.notice-warn   { background: var(--warn-bg); border-color: #f0d3a2; color: #6e4105; }
.notice-danger { background: var(--danger-bg); border-color: #f2c3be; color: #8a1a12; }
.notice-info   { background: var(--info-bg); border-color: #c9d6ec; color: #1d3f72; }
.notice-close { border: 0; background: none; color: inherit; opacity: .6; cursor: pointer; padding: 0; }
.notice-close:hover { opacity: 1; }
.notice-close .icon { width: 16px; height: 16px; margin: 0; }

/* ---------- Ledger (stats band) ---------- */

.ledger {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  margin-bottom: 24px; overflow: hidden;
}
.ledger > * {
  padding: 16px 20px; border-left: 1px solid var(--line);
  text-decoration: none; color: inherit;
}
.ledger > *:first-child { border-left: 0; }
a.ledger-item:hover { background: #fafbfc; }
.ledger-value { display: block; font: 600 1.65rem/1.1 var(--serif); color: var(--ink); font-variant-numeric: tabular-nums; }
.ledger-label { display: block; margin-top: 4px; font-size: .84rem; color: var(--muted); }
.ledger-note { display: block; margin-top: 2px; font-size: .78rem; color: var(--faint); }

@media (max-width: 640px) {
  .ledger { grid-template-columns: 1fr 1fr; }
  .ledger > * { border-left: 0; border-top: 1px solid var(--line); }
  .ledger > *:nth-child(even) { border-left: 1px solid var(--line); }
  .ledger > *:nth-child(-n+2) { border-top: 0; }
}

/* ---------- Panels ---------- */

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.panel + .panel { margin-top: 20px; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.panel-head p { color: var(--muted); font-size: .86rem; margin-top: 2px; }
.panel-body { padding: 20px; }
.panel-foot { padding: 14px 20px; border-top: 1px solid var(--line); }
.panel-danger { border-color: #efc4c0; }
.panel-danger .panel-head h2 { color: var(--danger); }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.grid-even { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 1080px) { .grid-2, .grid-even { grid-template-columns: 1fr; } }

/* Definition list for read-only facts */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 10px 20px; margin: 0; font-size: .92rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th {
  text-align: left; font-weight: 600; font-size: .8rem; color: var(--muted);
  padding: 10px 16px; background: #f8f9fb; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 12px 16px; border-bottom: 1px solid #edf0f4; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fafbfc; }
.table .col-check { width: 36px; padding-right: 0; }
.table .col-actions { text-align: right; white-space: nowrap; }
.table .col-actions > * + * { margin-left: 4px; }
.cell-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cell-main strong { display: block; font-weight: 600; color: var(--text); }
.cell-main a { text-decoration: none; color: inherit; }
.cell-main a:hover strong { color: var(--ink); text-decoration: underline; }
.cell-main small { display: block; color: var(--muted); font-size: .82rem; }

/* ---------- Pills, avatars, app marks ---------- */

.pill {
  display: inline-flex; align-items: center; height: 22px; padding: 0 9px;
  border-radius: 999px; font-size: .76rem; font-weight: 600; white-space: nowrap;
  background: #eef0f4; color: var(--muted);
}
.pill-ok     { background: var(--ok-bg); color: var(--ok); }
.pill-muted  { background: #eef0f4; color: var(--faint); }
.pill-warn   { background: var(--warn-bg); color: var(--warn); }
.pill-danger { background: var(--danger-bg); color: var(--danger); }
.pill-gold   { background: var(--gold-soft); color: #7c5a14; }
.pill-ink    { background: #e3e7f0; color: var(--ink); }
.pill-blue   { background: #e6eefb; color: #2d5ba6; }
.pill-violet { background: #efe9fa; color: #5b3d99; }

.avatar {
  display: inline-grid; place-items: center; flex: none; overflow: hidden;
  width: 40px; height: 40px; border-radius: 50%;
  background: #e3e7f0; color: var(--ink); font-weight: 600; font-size: .85rem;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 32px; height: 32px; font-size: .75rem; }
.avatar-lg { width: 64px; height: 64px; font-size: 1.2rem; }
.rail .avatar { background: rgba(255, 255, 255, .12); color: #fff; }

.app-mark {
  display: inline-grid; place-items: center; flex: none; overflow: hidden;
  width: 40px; height: 40px; border-radius: 10px;
  font-weight: 700; font-size: .85rem; letter-spacing: .02em; color: #fff; background: var(--ink-soft);
}
.app-mark img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.app-mark.lg { width: 56px; height: 56px; border-radius: 14px; font-size: 1.05rem; }
.tint-0 { background: #1f3a68; } .tint-1 { background: #23614f; } .tint-2 { background: #7a3e2b; }
.tint-3 { background: #4c3d79; } .tint-4 { background: #8a6420; } .tint-5 { background: #2f5d7c; }

/* ---------- Copy fields ---------- */

.copy-field {
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%;
  padding: 2px 2px 2px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: #f8f9fb;
}
.copy-field code { overflow-x: auto; white-space: nowrap; color: var(--ink); }
.copy-field .icon-btn { width: 28px; height: 28px; }
.copy-field.is-secret { background: var(--gold-soft); border-color: #e3cf9f; }
.copy-field.is-copied .icon-btn { color: var(--ok); }

/* ---------- Forms ---------- */

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 18px; }
.form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 720px) { .form-grid { grid-template-columns: 1fr; } }

.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .field > .label { font-weight: 600; font-size: .86rem; color: var(--text); }
.field .hint { font-size: .8rem; color: var(--muted); }
.input, .field input[type=text], .field input[type=email], .field input[type=url], .field input[type=password],
.field input[type=search], .field input[type=tel], .field input[type=date], .field select, .field textarea, select.input {
  width: 100%; height: 40px; padding: 0 12px;
  font: inherit; font-size: .92rem; color: var(--text);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-sm);
}
.field textarea { height: auto; min-height: 92px; padding: 10px 12px; line-height: 1.5; resize: vertical; }
.field textarea.mono { font-family: var(--mono); font-size: .84rem; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--gold); box-shadow: var(--focus); }
.field input[readonly] { background: #f6f7f9; color: var(--muted); }
.field input[type=file] { font-size: .86rem; }

.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 7px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); font-size: .88rem; background: var(--surface);
}
.choice:has(input:checked) { border-color: var(--ink); background: #eef1f7; }
.choice input { accent-color: var(--ink); margin: 0; }
.choice-card { align-items: flex-start; padding: 12px 14px; flex: 1 1 220px; }
.choice-card strong { display: block; font-size: .9rem; }
.choice-card small { display: block; color: var(--muted); font-size: .8rem; margin-top: 2px; }
.choice-card input { margin-top: 3px; }

.check { display: inline-flex; align-items: center; gap: 8px; font-size: .9rem; cursor: pointer; }
.check input { accent-color: var(--ink); width: 16px; height: 16px; margin: 0; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 20px; }

.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 44px; }
.pw-wrap .icon-btn { position: absolute; right: 4px; top: 4px; }

/* Filter bar above tables */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.filters .search { position: relative; flex: 1 1 260px; }
.filters .search .icon { position: absolute; left: 11px; top: 11px; width: 17px; height: 17px; color: var(--faint); }
.filters .search input { padding-left: 36px; }
.filters select.input { width: auto; min-width: 140px; }

.bulkbar { display: none; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 16px; background: #eef1f7; border-bottom: 1px solid var(--line); font-size: .88rem; }
.bulkbar.is-on { display: flex; }

/* ---------- Tabs ---------- */

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 22px; overflow-x: auto; }
.tabs a {
  padding: 10px 14px; margin-bottom: -1px;
  font-weight: 600; font-size: .9rem; color: var(--muted); text-decoration: none; white-space: nowrap;
  border-bottom: 2px solid transparent;
}
.tabs a:hover { color: var(--ink); }
.tabs a.is-active { color: var(--ink); border-bottom-color: var(--gold); }
.tabs .count { margin-left: 6px; font-weight: 500; color: var(--faint); }

/* ---------- Detail header (app / user pages) ---------- */

.subject { display: flex; align-items: center; gap: 16px; }
.subject h1 { font: 600 1.9rem/1.15 var(--serif); }
.subject .row { margin-top: 6px; }

/* ---------- Misc ---------- */

.empty { padding: 44px 20px; text-align: center; }
.empty strong { display: block; color: var(--ink); font-size: 1rem; }
.empty p { color: var(--muted); margin: 6px auto 16px; max-width: 46ch; font-size: .92rem; }

.pager { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--line); font-size: .86rem; color: var(--muted); }
.pager-count { flex: 1; }
.pager-links { display: inline-flex; align-items: center; gap: 4px; }
.pager-page { padding: 0 6px; }
.pager-per select { height: 30px; margin-left: 6px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); font: inherit; padding: 0 6px; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 12px; padding: 11px 20px; border-bottom: 1px solid #edf0f4; font-size: .88rem; }
.timeline li:last-child { border-bottom: 0; }
.timeline time { flex: none; width: 92px; color: var(--faint); font-size: .8rem; padding-top: 1px; }
.timeline .what { min-width: 0; }
.timeline .what small { display: block; color: var(--muted); overflow-wrap: anywhere; }

.action-code { font-family: var(--mono); font-size: .78rem; color: var(--ink-soft); background: #eef1f6; padding: 1px 6px; border-radius: 4px; }

.bars { display: flex; align-items: flex-end; gap: 4px; height: 72px; padding-top: 8px; }
.bars span { flex: 1; min-height: 2px; background: #cdd5e3; border-radius: 3px 3px 0 0; position: relative; }
.bars span.has { background: var(--ink-soft); }
.bars-axis { display: flex; justify-content: space-between; font-size: .74rem; color: var(--faint); margin-top: 6px; }

.secret-callout {
  border: 1px solid #e3cf9f; background: #fffaf0; border-radius: var(--r-lg); padding: 18px 20px; margin-bottom: 22px;
}
.secret-callout h2 { color: #6d4f10; }
.secret-callout p { color: #6d5a33; font-size: .9rem; margin: 4px 0 12px; }
.secret-callout .copy-field { width: 100%; }
.secret-callout .copy-field code { flex: 1; }

pre.snippet {
  margin: 0; padding: 14px 16px; overflow-x: auto;
  background: var(--ink-deep); color: #dfe6f3; border-radius: var(--r);
  font: 400 .8rem/1.6 var(--mono);
}

/* ---------- Dialogs ---------- */

dialog {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0;
  border: 0; border-radius: var(--r-lg); color: var(--text);
  box-shadow: 0 24px 60px rgba(12, 21, 41, .35);
}
dialog.wide { width: min(760px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(12, 21, 41, .5); }
dialog[open] { animation: dlg .16s ease-out; }
@keyframes dlg { from { opacity: 0; transform: translateY(8px); } }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 0; }
.dlg-head h2 { font: 600 1.25rem/1.2 var(--serif); }
.dlg-body { padding: 18px 22px; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 0 22px 20px; }

/* =========================================================================
   Sign-in page
   ========================================================================= */

.page-login { background: var(--ink-deep); }
.login {
  min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(420px, 1fr);
}
.login-visual {
  position: relative; display: flex; flex-direction: column; justify-content: flex-end;
  padding: 48px; color: #fff; overflow: hidden;
  background: var(--ink) url("../img/graduation.jpg") center / cover no-repeat;
}
.login-visual::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(12, 21, 41, .55) 0%, rgba(12, 21, 41, .25) 40%, rgba(12, 21, 41, .92) 100%);
}
.login-visual > * { position: relative; }
.login-visual .crest { position: absolute; top: 44px; left: 48px; display: flex; align-items: center; gap: 12px; font-weight: 600; }
.login-visual .crest img { width: 48px; height: 48px; border-radius: 50%; background: #fff; padding: 3px; }
.login-visual blockquote { margin: 0; max-width: 30ch; font: 500 2.1rem/1.2 var(--serif); }
.login-visual p { margin-top: 14px; color: #c9d1e0; max-width: 46ch; }

.login-form-side { display: grid; place-items: center; padding: 40px 24px; background: var(--paper); }
.login-card { width: 100%; max-width: 380px; }
.login-card .crest-sm { display: none; }
.login-card h1 { font: 600 2rem/1.15 var(--serif); }
.login-card .lede { color: var(--muted); margin: 8px 0 26px; }
.login-card .field + .field { margin-top: 16px; }
.login-card .btn-primary { height: 44px; margin-top: 22px; }
.login-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; font-size: .86rem; }
.login-foot { margin-top: 34px; padding-top: 18px; border-top: 1px solid var(--line); font-size: .82rem; color: var(--muted); }

@media (max-width: 900px) {
  .login { grid-template-columns: 1fr; }
  .login-visual { display: none; }
  .login-card .crest-sm { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; font-weight: 600; color: var(--ink); }
  .login-card .crest-sm img { width: 40px; height: 40px; }
}

/* =========================================================================
   Portal (signed-in user home)
   ========================================================================= */

.portal-top {
  background: var(--ink); color: #fff;
}
.portal-bar { max-width: 1120px; margin: 0 auto; padding: 14px 24px; display: flex; align-items: center; gap: 14px; }
.portal-bar .brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 600; }
.portal-bar .brand:hover { color: #fff; }
.portal-bar .brand img { width: 34px; height: 34px; border-radius: 50%; background: #fff; padding: 2px; }
.portal-bar .brand small { display: block; font-weight: 400; color: #9fabc2; font-size: .78rem; }
.portal-bar .spacer { flex: 1; }
.portal-bar .btn-quiet { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .25); }
.portal-bar .btn-quiet:hover { border-color: #fff; color: #fff; }
.portal-hero { max-width: 1120px; margin: 0 auto; padding: 26px 24px 34px; display: flex; align-items: center; gap: 18px; }
.portal-hero h1 { color: #fff; font: 600 2.1rem/1.15 var(--serif); }
.portal-hero p { color: #b7c1d4; margin-top: 4px; }
.portal-hero .avatar { background: rgba(255, 255, 255, .12); color: #fff; border: 2px solid rgba(185, 138, 44, .7); }

.portal { max-width: 1120px; margin: 0 auto; padding: 28px 24px 64px; }
.portal-section + .portal-section { margin-top: 36px; }
.portal-section > h2 { font: 600 1.3rem/1.2 var(--serif); margin-bottom: 4px; }
.portal-section > p.muted { margin-bottom: 16px; font-size: .92rem; }

.launchers { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.launcher {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  text-decoration: none; color: inherit; transition: border-color .15s;
}
.launcher:hover { border-color: var(--ink-soft); color: inherit; }
.launcher strong { display: block; color: var(--ink); font-size: 1rem; }
.launcher p { color: var(--muted); font-size: .86rem; margin-top: 3px; }
.launcher .go { margin-left: auto; color: var(--faint); }
.launcher:hover .go { color: var(--ink); }
.launcher .pill { margin-top: 8px; }

.must-change { border: 1px solid #f0d3a2; background: var(--warn-bg); border-radius: var(--r-lg); padding: 18px 20px; margin-bottom: 28px; }
.must-change h2 { color: #6e4105; }
.must-change p { color: #7a4f12; font-size: .9rem; margin-top: 4px; }

/* =========================================================================
   Message page
   ========================================================================= */

.message-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.message { max-width: 460px; text-align: center; }
.message-crest { margin: 0 auto 20px; }
.message h1 { font: 600 1.8rem/1.2 var(--serif); }
.message p { color: var(--muted); margin-top: 10px; }
.message-actions { display: flex; gap: 10px; justify-content: center; margin-top: 24px; flex-wrap: wrap; }

/* Inline forms built with .row: let the main field take a full line on narrow screens */
.row > .field.grow { flex: 1 1 260px; }
.row > .input.grow { flex: 1 1 200px; min-width: 0; }
