:root {
  color-scheme: light;
  --portal-bg: #f5f6f8;
  --portal-panel: #fff;
  --portal-panel-soft: #eef0f5;
  --portal-text: #262b35;
  --portal-muted: #6c7380;
  --portal-line: #d9dce3;
  --portal-blue: #536aa6;
  --portal-pink: #985a76;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--portal-bg); color: var(--portal-text); font: 14px 'DM Sans', sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--portal-blue); outline-offset: 3px; }
button, input, select, textarea { font: inherit; }
button { min-height: 42px; border: 1px solid var(--portal-blue); padding: 0 14px; background: var(--portal-blue); color: #fff; font-size: 12px; font-weight: 700; text-transform: uppercase; cursor: pointer; }
button:hover { background: #5e74b1; }
button:disabled { cursor: wait; opacity: .55; }
button.secondary { border-color: var(--portal-line); background: #fff; color: var(--portal-text); }
button.secondary:hover { background: #e5e8f2; }
button.danger { border-color: var(--portal-pink); background: #fff; color: #71465a; }
input, select, textarea { width: 100%; min-height: 42px; border: 1px solid var(--portal-line); border-radius: 0; padding: 10px 11px; background: #fff; color: var(--portal-text); }
textarea { min-height: 110px; resize: vertical; }
label { display: grid; gap: 7px; color: var(--portal-text); font-size: 12px; font-weight: 600; }
.portal-header { border-bottom: 1px solid var(--portal-line); background: #e9eef9; }
.portal-header-inner { width: min(1160px, calc(100% - 48px)); min-height: 72px; margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.portal-brand { font: 700 22px 'Newsreader', Georgia, serif; text-decoration: none; text-transform: uppercase; }
.portal-brand span { color: var(--portal-blue); }
.portal-header-actions { display: flex; align-items: center; gap: 18px; }
.portal-header-actions a { color: var(--portal-muted); font-size: 12px; }
.portal-header-actions button { min-height: 36px; }
.portal-main { width: min(1160px, calc(100% - 48px)); margin: 34px auto 80px; }
.portal-title { margin: 0 0 10px; font: 600 48px/.98 'Newsreader', Georgia, serif; }
.portal-intro { max-width: 720px; margin: 0 0 30px; color: var(--portal-muted); font-size: 14px; line-height: 1.7; }
.portal-section { margin-top: 30px; border-top: 1px solid var(--portal-line); padding-top: 24px; }
.portal-section h2 { margin: 0 0 18px; border-bottom: 2px solid #cbd5ed; padding-bottom: 10px; font: 600 28px 'Newsreader', Georgia, serif; }
.portal-section h3 { margin: 0 0 12px; font: 600 22px 'Newsreader', Georgia, serif; }
.portal-grid { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); gap: 28px; }
.portal-form { display: grid; gap: 14px; max-width: 600px; }
.portal-form .form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.portal-message { min-height: 20px; margin: 0; color: var(--portal-muted); font-size: 12px; }
.portal-message.error { color: #9b4568; }
.portal-login { max-width: 460px; border: 1px solid var(--portal-line); border-top: 3px solid var(--portal-blue); padding: 24px; background: var(--portal-panel); }
.selection-field { max-width: 420px; margin-bottom: 22px; }
.spaced-form { margin-top: 16px; }
.portal-login h1 { margin: 0 0 10px; font: 600 32px 'Newsreader', Georgia, serif; }
.table-wrap { overflow-x: auto; border-top: 1px solid var(--portal-line); }
table { width: 100%; border-collapse: collapse; font-size: 12px; text-align: left; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--portal-line); vertical-align: top; }
th { color: var(--portal-muted); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
td button { min-height: 32px; padding: 0 9px; margin: 0 5px 4px 0; font-size: 10px; }
.portal-list { display: grid; gap: 0; border-top: 1px solid var(--portal-line); }
.portal-item { padding: 14px 0; border-bottom: 1px solid var(--portal-line); }
.portal-item-head { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin-bottom: 6px; }
.portal-item-head strong { font-size: 13px; }
.portal-item-head time, .portal-item-meta { color: var(--portal-muted); font-size: 11px; }
.portal-item p { margin: 0; color: var(--portal-muted); line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.portal-item.admin-message { padding-left: 14px; border-left: 2px solid var(--portal-blue); }
.chat-switcher { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 18px; }
.chat-option { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; border: 1px solid var(--portal-line); background: #fff; color: var(--portal-text); text-transform: none; font-weight: 600; }
.chat-option:hover { background: #eef2fd; }
.chat-option.active { border-color: var(--portal-blue); background: #eef2fd; }
.chat-option.pinned { order: -1; }
.chat-badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 7px; background: #edf0f8; color: var(--portal-blue); font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.status-pill { display: inline-block; border: 1px solid var(--portal-line); padding: 4px 7px; color: var(--portal-muted); font-size: 10px; text-transform: uppercase; }
.portal-section { border-color: var(--portal-line); }
.portal-section h2 { text-decoration-color: var(--portal-pink); }
.portal-grid > .portal-section:nth-child(even) h2 { border-bottom-color: #e7cbd7; }
.hidden { display: none !important; }
@media (max-width: 700px) {
  .portal-header-inner, .portal-main { width: min(100% - 32px, 560px); }
  .portal-header-inner { min-height: 64px; }
  .portal-main { margin-top: 26px; }
  .portal-title { font-size: 40px; }
  .portal-grid { grid-template-columns: 1fr; gap: 30px; }
  .portal-form .form-row { grid-template-columns: 1fr; }
  .portal-header-actions { gap: 10px; }
}
@media (max-width: 390px) {
  .portal-header-actions a { font-size: 10px; }
  .portal-brand { font-size: 19px; }
  .portal-login { padding: 18px; }
}