:root {
    color-scheme: light;
    font-family: system-ui, sans-serif;
    color: #101827;
    background: #ecf1f8;
    --primary: #0754ec;
    --line: #d7dfea;
    --muted: #526078;
    --sidebar: #0c162d;
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #3476ff; outline-offset: 3px; }
h1, h2, h3, li, dd { overflow-wrap: anywhere; }
h1 { margin: 0 0 1.5rem; font-size: clamp(1.75rem, 3.2vw, 2.75rem); line-height: 1.15; }
h2 { margin-top: 0; line-height: 1.2; }
a { color: #174ca6; }
main { min-width: 0; padding: clamp(1rem, 2vw, 2rem); }
.columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; align-items: start; }
.panel { min-width: 0; background: #fff; border: 1px solid var(--line); border-radius: .85rem; padding: 1.25rem; margin-bottom: 1rem; }
label { display: block; font-weight: 600; margin-bottom: .35rem; }
input, select, textarea {
    display: block; font: inherit; color: inherit; width: 100%; min-width: 0;
    padding: .58rem .8rem; border: 1px solid #acb8ca; border-radius: .5rem;
    margin: 0 0 1rem; background: #fff;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input[type=checkbox], input[type=radio] { display: inline-block; width: auto; margin: 0 .4rem 0 0; accent-color: var(--primary); }
input[type=file] { max-width: 100%; }
textarea { resize: vertical; }
button, a.button {
    display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
    font: inherit; font-weight: 600; color: #fff; background: var(--primary);
    border: 1px solid transparent; border-radius: .55rem; padding: .6rem .95rem;
    min-height: 2.65rem; cursor: pointer; text-decoration: none;
}
button:hover, a.button:hover { background: #0644c3; }
button.button-secondary, a.button-secondary { background: #fff; border-color: #b6c1d3; color: #17243b; }
button.button-secondary:hover, a.button-secondary:hover { background: #edf3ff; }
button:disabled { opacity: .55; cursor: default; }
.error { color: #a42130; }
[aria-invalid=true] { border-color: #b62d3d; }
[aria-invalid=true] + .error { margin-top: -.65rem; }
.tasks { list-style: none; padding: 0; margin: 0; }
.tasks li { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5rem; padding: .7rem 0; }
.tasks li + li { border-top: 1px solid var(--line); }
.status { display: inline-block; background: #e8eefb; color: #253e75; border-radius: 2rem; padding: .28rem .7rem; font-size: .9rem; font-weight: 600; }
.status--draft { background: #eef0f4; color: #394457; }
.status--queued { background: #e4edff; color: #174785; }
.status--running { background: #fff0cf; color: #805000; }
.status--clarification { background: #f0e7ff; color: #654097; }
.status--review { background: #e2f5e8; color: #17613c; }
.status--failed { background: #fce6e6; color: #941b26; }
.status--timed_out { background: #ffe8d9; color: #8d3616; }
nav { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: .9rem; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { padding: .85rem 1rem; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
th { background: #ebf0f7; }
th:first-child { border-top-left-radius: .5rem; }
th:last-child { border-top-right-radius: .5rem; }
.specification { white-space: pre-wrap; overflow-wrap: anywhere; }
.specification + form { margin-top: 1rem; }
dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .35rem 1rem; }
dt { font-weight: 600; }
dd { margin: 0; }
pre { background: #182336; color: #edf2fb; padding: .9rem; border-radius: .4rem; overflow: auto; max-height: 34rem; }
.login-layout { max-width: 38rem; margin-inline: auto; }
.login-logo { display: block; width: 100%; height: auto; border-radius: .4rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.portal-icon { display: block; width: 1.2em; height: 1.2em; flex: none; }

.portal-shell {
    display: grid; grid-template-columns: clamp(14rem, 18.5vw, 19.5rem) minmax(0, 1fr);
    grid-template-areas: "sidebar top" "sidebar main";
    grid-template-rows: auto 1fr; min-height: 100vh;
}
.portal-shell > main { grid-area: main; }
.portal-top {
    grid-area: top; min-width: 0; min-height: 3.9rem; display: flex; align-items: center;
    gap: .7rem; padding: .5rem clamp(1rem, 2vw, 2rem); background: #fff;
    border-bottom: 1px solid var(--line);
}
.portal-location { min-width: 0; overflow-wrap: anywhere; }
.portal-location span { margin-right: .4rem; color: var(--muted); }
.portal-account { position: relative; margin-left: auto; min-width: 0; max-width: 48%; }
.portal-account summary { display: flex; align-items: center; gap: .5rem; cursor: pointer; list-style: none; padding: .45rem .15rem; }
.portal-account-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.portal-account form {
    position: absolute; right: 0; top: calc(100% + .35rem); z-index: 2;
    padding: .4rem; background: #fff; border: 1px solid var(--line);
    border-radius: .55rem; box-shadow: 0 .45rem 1.2rem #17243b20;
}
.portal-sidebar { grid-area: sidebar; padding: 1.65rem .6rem; color: #fff; background: linear-gradient(#122136 6rem, var(--sidebar) 11rem); }
.portal-brand { display: block; width: min(calc(100% - .8rem), 14.5rem); margin-inline: .8rem 0; }
.portal-brand img { display: block; width: 100%; height: auto; }
.portal-slogan { margin: .55rem .8rem 2rem; color: #dce5f4; font-size: .9rem; }
.portal-sidebar nav { display: grid; gap: .25rem; margin: 0; }
.portal-sidebar nav a { display: flex; align-items: center; gap: 1rem; min-height: 3.5rem; padding: .65rem 1.25rem; color: #f4f7ff; border-radius: .6rem; text-decoration: none; }
.portal-sidebar nav a:hover { background: #1b2e50; }
.portal-sidebar nav a[aria-current] { background: #174392; font-weight: 650; }
.portal-sidebar nav .portal-icon { width: 1.4rem; height: 1.4rem; }
.portal-menu-toggle { display: none; }

.page-heading { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.8rem; }
.page-heading h1 { margin: 0; }
.page-actions { display: flex; flex-wrap: wrap; gap: .7rem; }
.task-workspace { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: "list"; gap: 1.4rem; }
.task-workspace.has-draft { grid-template-columns: minmax(0, 1.36fr) minmax(19rem, 1fr); grid-template-areas: "list draft"; }
.task-workspace .panel { margin-bottom: 0; }
.task-list { grid-area: list; padding: .8rem; }
.task-list table { table-layout: fixed; }
.task-list th:first-child { width: 60%; }
.task-list a { color: inherit; text-decoration-color: #a2aec1; text-underline-offset: .2em; }
.task-list a:hover { color: #174ca6; }
.draft-panel { grid-area: draft; align-self: start; }
.draft-heading { display: flex; justify-content: space-between; align-items: start; gap: .75rem; margin-bottom: .9rem; }
.draft-heading h2 { margin: 0; }
.icon-button { padding: .3rem; min-width: 2rem; min-height: 2rem; }
.draft-submit { width: 100%; }
.chat-layout { display: grid; grid-template-columns: minmax(12rem, 1fr) minmax(0, 3fr); gap: 1rem; align-items: start; }
.chat-turn { padding: 1rem 0; border-bottom: 1px solid var(--line); }
.chat-text { white-space: pre-wrap; overflow-wrap: anywhere; }

@media (min-width: 64.01rem) {
    .page-heading { margin: .25rem 0 2.15rem; }
    .page-actions button, .page-actions a, .draft-submit { min-height: 3.25rem; }
    .task-list td { padding-block: 1.1rem; }
    .draft-heading { margin-bottom: 1.3rem; }
    .draft-panel input, .draft-panel select, .draft-panel textarea { margin-bottom: 1.2rem; }
    .draft-panel textarea { min-height: 7rem; }
    .draft-submit { margin-top: .6rem; }
}
@media (max-width: 64rem) {
    .task-workspace.has-draft { grid-template-columns: minmax(0, 1fr); grid-template-areas: "draft" "list"; }
}
@media (max-width: 49rem) {
    .portal-shell { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "sidebar" "main"; grid-template-rows: auto auto 1fr; }
    .portal-menu-toggle { display: inline-flex; padding-inline: .65rem; }
    .portal-shell:not(.menu-open) .portal-sidebar { display: none; }
    .portal-sidebar { padding: 1rem .7rem; }
    .portal-slogan { margin-bottom: 1rem; }
    .portal-location span { display: none; }
    .chat-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 43rem) {
    .columns, dl { grid-template-columns: 1fr; }
    .task-list th:first-child { width: 55%; }
    th, td { padding: .75rem .45rem; }
    .status { padding-inline: .5rem; }
    .page-heading { margin-bottom: 1.1rem; }
}

.vpn-profile h3 { margin: 0 0 .85rem; overflow-wrap: anywhere; }
.vpn-actions, .vpn-actions form { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; }
.vpn-actions button { min-height: 2.75rem; border: 1px solid transparent; line-height: 1.25; }
.vpn-actions .vpn-secondary { background: white; border-color: #bac8de; color: #20458f; }
.vpn-actions .vpn-secondary:hover { background: #e8eefb; }
.vpn-actions .vpn-danger, .vpn-disclosure .vpn-danger { background: #fff5f5; border: 1px solid #e8b6b6; color: #982631; }
.vpn-actions .vpn-danger:hover, .vpn-disclosure .vpn-danger:hover { background: #fce4e4; }
.vpn-hint, .vpn-actions small { color: #485970; font-size: .9rem; }
.vpn-hint { margin: .75rem 0 0; }
.vpn-disclosure { border-top: 1px solid #d6deec; margin-top: 1rem; padding-top: 1rem; }
.vpn-disclosure p { margin: 0 0 .85rem; }
.vpn-disclosure input[name="vless"] { margin-bottom: .35rem; }
