.portal-page { min-height: 100vh; }
.portal-header { border-bottom: 1px solid var(--line); background: var(--white); }
.portal-header-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 22px; min-height: 72px; padding-block: 12px; }
.portal-brand { display: inline-flex; align-items: center; gap: 12px; font-size: 14px; font-weight: 700; }
.portal-brand img { width: 130px; height: auto; }
.portal-nav { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; color: var(--muted); font-size: 14px; font-weight: 650; }
.portal-nav a:hover:not(.button) { color: var(--blue); }
.portal-nav form, .portal-table form { margin: 0; }
.portal-main { padding-block: clamp(32px, 6vw, 72px); }
.portal-intro { margin-bottom: 24px; }
.portal-intro h1 { font-size: clamp(32px, 5vw, 54px); font-weight: 850; line-height: 1.16; letter-spacing: -.055em; overflow-wrap: anywhere; }
.portal-intro p { max-width: 58ch; margin-top: 10px; color: var(--muted); }
.portal-panel { min-width: 0; padding: clamp(18px, 3vw, 32px); border: 1px solid var(--line); border-radius: 17px; background: var(--white); }
.portal-panel + .portal-panel { margin-top: 21px; }
.portal-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; margin-top: 20px; }
.portal-grid > .portal-panel { margin-top: 0; }
.portal-panel h2, .auth-aside h2 { font-size: clamp(22px, 2.6vw, 30px); line-height: 1.24; letter-spacing: -.03em; }
.portal-panel h2 + p, .auth-aside h2 + p { margin-top: 8px; }
.portal-panel p { color: var(--muted); }
.portal-panel p > a:not(.button), .auth-switch a { color: var(--blue-dark); text-decoration: underline; text-underline-offset: 3px; }
.portal-panel > form { margin-top: 20px; }

.auth-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .9fr); align-items: stretch; gap: clamp(16px, 3vw, 26px); max-width: 940px; }
.auth-layout > .portal-panel { margin-top: 0; }
.auth-panel > form:first-child { margin-top: 0; }
.auth-aside {
    min-height: 300px;
    padding: clamp(25px, 4vw, 40px);
    border-radius: 18px;
    overflow: hidden;
    border-color: transparent;
    color: #fff;
    background: linear-gradient(180deg, #122ad8 1%, #1438ec 40%, transparent 75%), #1639ff url('contest-hero.webp') center bottom / min(125%, 540px) auto no-repeat;
}
.auth-aside p { color: #f0f4ff; }
.auth-aside > .button { margin-top: 16px; }
.auth-switch { margin-top: 20px; font-size: 15px; }
.account-details { display: grid; gap: 0; margin-top: 15px; }
.account-details > div { display: grid; grid-template-columns: minmax(88px, .45fr) minmax(0, 1fr); gap: 10px; padding-block: 13px; border-bottom: 1px solid var(--line); }
.account-details dt { color: var(--muted); }
.account-details dd { font-weight: 650; overflow-wrap: anywhere; }

.field { display: grid; gap: 7px; margin-top: 15px; color: var(--ink); font-size: 15px; font-weight: 700; min-width: 0; }
.field:first-child { margin-top: 0; }
.field input, .field select, .field textarea, .portal-table select {
    width: 100%;
    min-height: 44px;
    padding: 9px 12px;
    border: 1px solid #bfc8df;
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    font-family: inherit;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.4;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--blue); outline: 2px solid #6c83ff66; outline-offset: 1px; }
.field textarea { display: block; resize: vertical; }
.field input[aria-invalid="true"] { border-color: #b43648; }
.field small, .field-hint { color: var(--muted); font-size: 13px; font-weight: 500; }
.form-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 19px; }
.portal-page button.button { cursor: pointer; }
.portal-page .button-outline { background: #fff; }
.portal-page .button-outline:hover { background: #edf0ff; }
.portal-notice, .portal-error { margin: 0 0 17px; padding: 11px 14px; border: 1px solid; border-radius: 9px; font-size: 15px; }
.portal-notice, .portal-panel .portal-notice { color: #143d79; border-color: #c2d7ff; background: #eff5ff; }
.portal-error, .portal-panel .portal-error { color: #8c2432; border-color: #ebc4cb; background: #fff0f2; }

.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 19px; }
.stat-card { padding: clamp(13px, 2.5vw, 22px); border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.stat-card dt, .stat-card span { display: block; color: var(--muted); font-size: 14px; font-weight: 650; }
.stat-card dd, .stat-card strong { display: block; margin-top: 5px; color: #1838d7; font-size: clamp(26px, 4vw, 36px); font-weight: 850; line-height: 1.12; }
.table-scroll { max-width: 100%; margin-top: 17px; overflow-x: auto; }
.portal-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 14px; }
.portal-table th { color: var(--muted); background: #f1f4ff; font-size: 13px; white-space: nowrap; }
.portal-table th, .portal-table td { padding: 12px 11px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.portal-table td { overflow-wrap: anywhere; }
.portal-table time, .portal-table button { white-space: nowrap; }
.portal-table input[type="search"] { min-width: 0; }
.status-label { display: inline-block; padding: 3px 8px; border-radius: 999px; color: #164b3b; background: #e4f6ef; font-size: 13px; font-weight: 700; white-space: nowrap; }
.status-label.status-disabled { color: #783444; background: #ffedf0; }
.pagination { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 18px; color: var(--muted); font-size: 14px; }
.admin-filter { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; }
.admin-filter .field { min-width: 140px; flex: 1 1 200px; margin-top: 0; }
.admin-filter .button { min-height: 44px; }
.admin-link-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.admin-link-grid > .field { margin-top: 0; }
.smtp-checkbox { display: flex; align-items: center; gap: 8px; width: fit-content; margin-top: 13px; color: var(--muted); font-size: 15px; cursor: pointer; }
.smtp-checkbox input { width: 17px; height: 17px; margin: 0; accent-color: var(--blue); }
.activity-admin-layout { display: grid; grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr); gap: 18px; align-items: start; }
.activity-admin-layout > .portal-panel { margin-top: 0; }
.activity-admin-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.activity-admin-empty { margin-top: 14px; }
.activity-admin-items { display: grid; gap: 11px; margin: 17px 0 0; padding: 0; list-style: none; }
.activity-admin-item { padding: 13px 14px; border: 1px solid var(--line); border-radius: 11px; overflow-wrap: anywhere; }
.activity-admin-item-current { border-color: #b9c5f6; background: #f6f8ff; }
.activity-admin-item h3 { margin: 0 0 5px; font-size: 17px; }
.activity-admin-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 5px; }
.activity-admin-layout .activity-draft { color: #505970; background: #edeff5; }
.activity-admin-badges .activity-pinned { color: #1732be; background: #dfe6ff; }
.activity-admin-actions { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; margin-top: 10px; }
.activity-admin-actions form { margin: 0; }
.activity-admin-editor h2 { overflow-wrap: anywhere; }
.activity-participation { margin-top: 26px; padding-top: 24px; border-top: 1px solid var(--line); }
.activity-participation > form { margin-top: 17px; }
.event-shell { max-width: 900px; }
.event-date { display: block; margin-bottom: 9px; color: var(--muted); font-size: 14px; }
.portal-intro .event-summary { max-width: 60ch; font-size: 18px; }
.event-copy { overflow-wrap: anywhere; white-space: pre-wrap; line-height: 1.85; }

@media (max-width: 760px) {
    .portal-grid, .auth-layout, .admin-link-grid, .activity-admin-layout { grid-template-columns: minmax(0, 1fr); }
    .auth-aside { min-height: 240px; background-size: auto, min(100%, 490px) auto; }
    .portal-table { min-width: 560px; }
}

@media (max-width: 420px) {
    .portal-header-inner { gap: 8px 15px; }
    .portal-brand img { width: 112px; }
    .portal-nav { gap: 8px 12px; }
    .stat-grid { gap: 7px; }
    .stat-card { padding: 11px 9px; }
    .stat-card dt, .stat-card span { font-size: 13px; }
    .account-details > div { grid-template-columns: minmax(65px, .38fr) minmax(0, 1fr); }
}
