/* ProxVN Console — builds on the tokens in site.css */
body.console { background: var(--bg); min-height: 100vh; min-height: 100dvh; }
.console :is(button, a, input, select, textarea) { touch-action: manipulation; scroll-margin-block: 100px 160px; }
.console .btn:active { transform: none; opacity: .8; }
.console .icon-btn { width: 44px; height: 44px; }
.console .btn { min-height: 44px; }
body.console.modal-open, body.console.menu-open { overflow: hidden; }
.boot { min-height: 100vh; display: grid; place-items: center; }
.boot img { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; transform: scale(.94); } }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 40px 20px; }
.auth-card { width: 100%; max-width: 444px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 36px; box-shadow: var(--shadow); }
.auth-card .brand { margin-bottom: 32px; }
.auth-card h1 { font-size: 1.75rem; letter-spacing: -.04em; margin-bottom: 8px; }
.auth-card .sub { color: var(--muted); margin-bottom: 28px; font-size: .95rem; line-height: 1.7; }
.auth-switch { margin-top: 16px; font-size: .9rem; color: var(--muted); text-align: center; }
.auth-tools { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); font-size: .86rem; }
.auth-tools > span { display: flex; gap: 8px; }
.verification-actions { display: grid; gap: 10px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.verification-actions[hidden], .verification-panel[hidden], .panel[hidden] { display: none; }
.verification-actions p { margin: 0; }
.notice { padding: 12px 14px; border-radius: 10px; font-size: .9rem; line-height: 1.65; overflow-wrap: anywhere; }
.notice-warn { background: var(--warn-soft); color: var(--fg); border: 1px solid var(--border); }
.verification-panel { display: grid; gap: 12px; margin-top: 18px; }
.verification-panel .toolbar > .btn { white-space: normal; text-align: left; }
.verification-state { display: inline-block; padding: 3px 9px; border-radius: 6px; font-size: .84rem; background: var(--warn-soft); color: var(--fg); }
.verification-state.verified { background: var(--ok-soft); color: var(--ok); }

/* ---------- Forms ---------- */
.field { display: grid; gap: 8px; margin-bottom: 20px; min-width: 0; }
.field label { font-size: .86rem; font-weight: 600; color: var(--fg); }
.field .hint { font-size: .8rem; color: var(--muted); }
.hint { color: var(--muted); font-size: .82rem; line-height: 1.65; }
input, select, textarea {
  width: 100%; min-height: 46px; padding: 11px 13px; border-radius: 9px; border: 1px solid var(--border-2);
  background: var(--surface); color: var(--fg); font: 500 .95rem var(--font);
}
textarea { min-height: 90px; resize: vertical; font-family: var(--mono); font-size: .85rem; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.check { display: flex; gap: 12px; align-items: center; min-height: 44px; font-weight: 550; font-size: .92rem; cursor: pointer; }
.check input { width: 18px; height: 18px; min-height: 0; accent-color: var(--accent); }
.form-grid { display: grid; gap: 0 16px; }
@media (min-width: 760px) { .form-grid.two { grid-template-columns: 1fr 1fr; } }
.err { color: var(--err); font-size: .88rem; min-height: 1.2em; margin: 4px 0 10px; }
.btn-block { width: 100%; }
button:disabled { cursor: not-allowed; opacity: .55; }
.console :is(a, button):focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.skip-content { position: fixed; top: 8px; left: 8px; padding: 10px 16px; border-radius: 8px; background: var(--surface); color: var(--accent); z-index: 150; transform: translateY(-150%); }
.skip-content:focus { transform: translateY(0); }

/* ---------- Shell ---------- */
.shell { display: grid; min-height: 100vh; min-height: 100dvh; }
.shell > *, .cols > *, .stack, .form-grid > * { min-width: 0; }
@media (min-width: 1000px) { .shell { grid-template-columns: 264px minmax(0, 1fr); } }
.side { background: var(--surface); border-right: 1px solid var(--border); padding: 24px 16px 16px; display: none; flex-direction: column; gap: 8px; position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; }
@media (min-width: 1000px) { .side { display: flex; } }
.side.open { display: flex; position: fixed; inset: 0 auto 0 0; width: min(320px, calc(100vw - 28px)); height: 100vh; height: 100dvh; z-index: 80; box-shadow: var(--shadow); overscroll-behavior: contain; }
.side-brand { display: flex; align-items: center; gap: 8px; padding: 0 8px 24px; }
.side-brand .brand { gap: 9px; padding: 0; min-height: 44px; white-space: nowrap; }
.side-brand .role { font-size: .6rem; }
.side .side-brand .brand:hover { background: none; }
.side-close { display: none; flex-shrink: 0; margin-left: auto; }
.side.open .side-close { display: inline-grid; }
.side-nav { display: grid; gap: 4px; }
.side .nav-group { font-size: .68rem; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 12px 12px 8px; }
.side a, .side-action { display: flex; align-items: center; gap: 12px; padding: 10px 12px; min-height: 44px; border-radius: 9px; color: var(--fg-2); font-weight: 550; font-size: .86rem; line-height: 1.45; text-decoration: none; }
.side a svg, .side-action svg { width: 18px; height: 18px; flex: none; }
.side a:hover, .side-action:hover { background: var(--surface-2); text-decoration: none; color: var(--fg); }
.side a.active { background: var(--accent-soft); color: var(--fg); font-weight: 700; box-shadow: inset 2px 0 0 var(--fg); }
.side-footer { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 20px; }
.side-action { width: 100%; border: 0; background: none; font-family: var(--font); text-align: left; cursor: pointer; }
.side .grow { flex: 1; }
.scrim { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 70; }
.scrim.open { display: block; }

.topbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 10px; min-height: 76px; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface); }
@media (min-width: 720px) { .topbar { padding-inline: 32px; } }
.topbar-location { display: grid; gap: 3px; min-width: 0; }
.workspace-caption { font-size: .66rem; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.topbar-title { font-size: .88rem; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .icon-btn, .topbar .user-chip { flex-shrink: 0; }
.topbar .spacer { flex: 1; }
.topbar .menu-btn { display: inline-grid; }
@media (min-width: 1000px) { .topbar .menu-btn { display: none; } }
.user-chip { display: flex; align-items: center; gap: 8px; font-size: .82rem; color: var(--fg-2); border-left: 1px solid var(--border); margin-left: 4px; padding-left: 14px; }
.topbar a.user-chip { text-decoration: none; }
.topbar a.user-chip:hover { color: var(--fg); text-decoration: none; }
.avatar { width: 34px; height: 34px; border-radius: 10px; background: var(--fg); background-size: cover; background-position: center; background-repeat: no-repeat; color: var(--bg); display: grid; place-items: center; font-weight: 700; font-size: .76rem; text-transform: uppercase; }
.role { font: 700 .68rem var(--mono); text-transform: uppercase; padding: 2px 7px; border-radius: 6px; background: var(--surface-2); color: var(--muted); }
.role.admin { background: var(--accent-soft); color: var(--accent); }
@media (max-width: 560px) { .user-chip .uname, .user-chip .role { display: none; } }

.content { padding: 28px 16px max(80px, env(safe-area-inset-bottom)); max-width: 1536px; width: 100%; margin-inline: auto; }
@media (min-width: 720px) { .content { padding: 36px 32px 88px; } }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 28px; }
.page-head > div:first-child { flex: 1; min-width: min(100%, 240px); }
.page-head h1 { font-size: clamp(1.55rem, 2.4vw, 2rem); letter-spacing: -.045em; margin: 0; text-wrap: balance; }
.page-head p { margin: 8px 0 0; max-width: 74ch; color: var(--muted); font-size: .92rem; line-height: 1.7; }

/* ---------- Panels / KPIs ---------- */
.kpis { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 20px; min-height: 120px; }
@media (min-width: 900px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; min-width: 0; }
.kpi .l { font-size: .8rem; color: var(--muted); font-weight: 600; display: flex; justify-content: space-between; gap: 6px; }
.kpi .v { font-size: clamp(1.35rem, 2vw, 1.8rem); font-weight: 700; letter-spacing: -.045em; font-variant-numeric: tabular-nums; margin-top: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .s { font-size: .8rem; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meter { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 10px; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .4s; }
.meter i.warn { background: var(--warn); } .meter i.err { background: var(--err); }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 20px; min-width: 0; overflow: clip; }
.console section.panel { padding: 0; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.panel-head h2, .panel-head h3 { margin: 0; font-size: .96rem; font-weight: 650; letter-spacing: -.02em; }
.panel-head > svg { width: 18px; height: 18px; color: var(--muted); }
.panel-body { padding: 20px; }
.panel-body.flush { padding: 0; }
.cols { display: grid; gap: 20px; }
@media (min-width: 1100px) { .cols.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .cols.wide { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } }
.cols > .panel { margin-bottom: 0; }
.stack { display: grid; align-content: start; gap: 20px; }
.stack > * { min-width: 0; }
.stack > * + * { margin-top: 0; }
.stack > .panel { margin-bottom: 0; }

.chart { position: relative; height: 200px; }
.chart canvas { width: 100%; height: 100%; display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: .8rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }
.legend .chart-key-primary { width: 18px; background: var(--fg); }
.legend .chart-key-secondary { width: 18px; height: 0; border-top: 2px dashed var(--muted); border-radius: 0; }

.kv { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: 8px 16px; font-size: .9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 550; overflow-wrap: anywhere; }

/* ---------- Tables ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tbl th { text-align: left; font-weight: 650; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover td { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.tbl .mono { font-family: var(--mono); font-size: .82rem; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .actions { text-align: right; white-space: nowrap; }
.tbl a.pub { font-family: var(--mono); font-size: .82rem; white-space: nowrap; }
.scroll-x { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }
.tag { display: inline-block; font: 700 .7rem var(--mono); text-transform: uppercase; padding: 2px 7px; border-radius: 6px; }
.tag.http { background: var(--accent-soft); color: var(--accent); }
.tag.tcp { background: var(--ok-soft); color: var(--ok); }
.tag.udp { background: var(--warn-soft); color: var(--warn); }
.tag.tls { background: var(--surface-2); color: var(--accent); border: 1px solid var(--border); }
.tag.ssh { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.empty { padding: 36px 16px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--fg); margin-bottom: 4px; font-size: 1rem; }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toolbar input, .toolbar select { min-height: 44px; padding: 9px 12px; width: auto; max-width: 100%; font-size: .88rem; }
.toolbar input[type="search"] { min-width: 200px; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: transparent; color: var(--muted); font: 600 .82rem var(--font); padding: 8px 12px; min-height: 40px; border-radius: 7px; cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--fg); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.pagination { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--border); color: var(--muted); font-size: .83rem; }
.pagination:empty { display: none; }

/* ---------- Operational settings ---------- */
.readiness-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.readiness-item { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px; border: 1px solid var(--border); border-radius: 10px; min-width: 0; }
.readiness-item > span { font-size: .8rem; font-weight: 600; color: var(--muted); }
.state { font-size: .76rem; font-weight: 600; border-radius: 99px; padding: 3px 9px; background: var(--surface-2); }
.state.good { color: var(--ok); background: var(--ok-soft); }
.state.pending { color: var(--warn); background: var(--warn-soft); }
.public-checks { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 14px; font-size: .82rem; }
.public-checks > span { color: var(--muted); }
.public-checks a { white-space: nowrap; }
.server-readiness:empty { display: none; }
.server-readiness { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
#sf #inow, #sf #mail-test { max-width: 100%; height: auto; white-space: normal; line-height: 1.4; padding-block: 8px; }
.readiness-list { padding: 0; margin: 10px 0 0; list-style: none; display: grid; gap: 8px; font-size: .83rem; line-height: 1.6; }
.readiness-list li { color: var(--fg-2); }
.readiness-list li > span { display: inline-block; text-align: center; width: 18px; font-weight: 800; margin-right: 4px; }
.readiness-list .good > span { color: var(--ok); }
.readiness-list .pending > span { color: var(--warn); }
.readiness-list .bad > span { color: var(--err); }
.savebar { position: sticky; bottom: max(16px, env(safe-area-inset-bottom)); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; margin-top: 24px; background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--radius); box-shadow: var(--shadow); z-index: 20; }
.save-status { color: var(--muted); font-size: .85rem; }
@media (min-width: 1200px) { .readiness-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ---------- Connection administration ---------- */
.connection-layout { align-items: start; }
@media (min-width: 1200px) { .connection-layout { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); } }
.endpoint-grid { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 680px) { .endpoint-grid { grid-template-columns: minmax(0, 1fr) 180px; } }
.connection-layout .panel { margin-bottom: 0; }
.connection-layout .field:last-child { margin-bottom: 0; }
.connection-layout input, .connection-layout textarea { font-family: var(--mono); letter-spacing: .01em; }
.connection-layout .pin-input { min-height: 74px; resize: vertical; overflow-wrap: anywhere; }
.field-error { color: var(--err); font-size: .8rem; min-height: 0; line-height: 1.45; }
[aria-invalid="true"] { border-color: var(--err); }
.form-errors { border: 2px solid var(--err); background: var(--err-soft); color: var(--fg); border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 20px; }
.form-errors h2 { font-size: .95rem; margin: 0 0 6px; }
.form-errors p { margin: 0 0 6px; }
.form-errors ul { margin: 6px 0 0 18px; padding: 0; }
.form-errors a { color: inherit; text-decoration: underline; }
.installed-pin { display: grid; gap: 7px; padding: 14px 0 0; margin-top: 2px; border-top: 1px solid var(--border); }
.installed-pin code { font: .78rem var(--mono); overflow-wrap: anywhere; color: var(--fg); }
.connection-description { line-height: 1.65; margin: 16px 0 0; }
.connection-discovery-url { margin-top: 16px; }
.connection-discovery-url .code-row { font-size: .74rem; }
.migration-panel .panel-body { padding-bottom: 22px; }
.migration-steps { margin: 0; padding-left: 22px; display: grid; gap: 15px; color: var(--fg-2); font-size: .87rem; line-height: 1.6; }
.migration-steps li::marker { color: var(--fg); font-family: var(--mono); font-weight: 700; }
.migration-note { border-top: 1px solid var(--border); margin: 20px 0 0; padding-top: 16px; line-height: 1.65; }
.connection-savebar .hint { margin: 4px 0 0; }
.connection-savebar .btn { flex-shrink: 0; }

/* ---------- Personal profile ---------- */
.profile-layout { align-items: start; }
@media (min-width: 1100px) { .profile-layout { grid-template-columns: minmax(0, 1.45fr) minmax(300px, .8fr); } }
.profile-layout .panel { margin-bottom: 0; }
.profile-layout .panel-body { min-width: 0; }
.profile-summary { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 18px; margin-bottom: 24px; }
.avatar-profile { width: 76px; height: 76px; border-radius: 18px; font-size: 1.3rem; box-shadow: inset 0 0 0 1px var(--border); background-size: cover; background-position: center; background-repeat: no-repeat; }
.avatar-image { color: transparent; }
.profile-form { border-top: 1px solid var(--border); padding-top: 20px; }
.profile-avatar-controls { border-top: 1px solid var(--border); margin-top: 20px; padding-top: 20px; }
.profile-avatar-controls .field { margin-bottom: 14px; }
.profile-status { min-height: 1.5em; margin: 16px 0 0; }
.profile-status.err { color: var(--err); }
.email-state { margin-bottom: 22px; }
.email-state dd[hidden] { display: none; }
.privacy-panel .toolbar { align-items: flex-start; }
.privacy-panel .toolbar .hint { flex: 1 1 220px; margin: 8px 0 0; }
@media (max-width: 719px) {
  .profile-summary { grid-template-columns: 1fr; justify-items: start; }
  .profile-layout .panel-head, .profile-layout .panel-body { padding-inline: 16px; }
  .avatar-profile { width: 68px; height: 68px; }
  .privacy-panel .toolbar { align-items: stretch; }
  .privacy-panel .toolbar .hint { margin-top: 0; }
}

/* ---------- Blog administration ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.posts-list { padding: 0; margin: 0; list-style: none; }
.post-list-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 22px 20px; border-bottom: 1px solid var(--border); }
.post-list-item:last-child { border-bottom: 0; }
.post-list-main { min-width: 0; }
.post-list-meta { display: flex; gap: 8px; align-items: center; }
.post-list-main h3 { font-size: 1rem; line-height: 1.5; margin: 10px 0 6px; overflow-wrap: anywhere; }
.post-list-main h3 a { color: var(--fg); text-decoration: underline; text-underline-offset: 3px; }
.post-list-main p { margin: 4px 0 0; }
.post-list-summary { max-width: 76ch; }
.post-list-url, .post-editor-url { font-family: var(--mono); overflow-wrap: anywhere; }
.post-list-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; flex-shrink: 0; max-width: 360px; }
.post-delete { color: var(--err); }
.posts-public h2 { margin: 0 0 8px; font-size: .96rem; }
.posts-public .hint { margin: 0; }
.posts-public .public-checks a { display: inline-flex; align-items: center; min-height: 44px; }
.posts-filters > div { min-width: 0; }
.posts-filters input, .posts-filters select { width: 100%; }
.post-back { display: inline-flex; gap: 8px; align-items: center; min-height: 44px; margin-bottom: 8px; font-size: .86rem; }
.post-back svg { width: 16px; height: 16px; }
.post-editor-layout { align-items: start; }
.post-editor-layout .panel { margin-bottom: 0; }
.post-editor-layout .field:last-child { margin-bottom: 0; }
.post-content-input { min-height: 420px; line-height: 1.65; tab-size: 2; }
.post-savebar > .toolbar { justify-content: flex-end; }
.post-savebar .btn { white-space: normal; }
.post-preview-panel { margin-top: 24px; }
.post-preview-frame { display: block; width: 100%; height: 640px; border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-sm); }
.post-preview-panel .panel-body { padding: 12px; }
@media (min-width: 1100px) { .post-editor-layout { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); } }
@media (max-width: 899px) {
  .posts-list-head { align-items: stretch; }
  .posts-filters { width: 100%; }
  .posts-filters > div:first-child { flex: 1 1 100%; }
  .posts-filters > div:not(:first-child) { flex: 1 1 140px; }
  .post-list-item { flex-direction: column; gap: 14px; }
  .post-list-actions { max-width: none; justify-content: flex-start; }
}
@media (max-width: 719px) {
  .post-savebar > .toolbar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .post-savebar .btn { width: 100%; }
  .post-list-item { padding: 18px 16px; }
  .post-editor-layout .panel-head, .post-editor-layout .panel-body { padding-inline: 16px; }
  .post-preview-frame { height: 540px; }
}

.code-row { display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; background: var(--code-bg); color: var(--code-fg); border-radius: 10px; padding: 10px 12px; font: .84rem var(--mono); }
.code-row code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; background: none; border: 0; padding: 0; color: inherit; }
.code-row .copy { background: transparent; border-color: currentColor; color: var(--code-fg); min-height: 36px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font: 600 .78rem var(--mono); padding: 3px 9px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--fg-2); }

/* ---------- Modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); z-index: 120; display: grid; place-items: center; padding: 16px; }
.modal { width: 100%; max-width: 460px; max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; overflow-wrap: anywhere; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); padding: 22px; }
.modal h3 { margin-bottom: 6px; }
.modal p { color: var(--muted); font-size: .93rem; }
.modal .row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }

.live { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--muted); }
.live .dot { width: 7px; height: 7px; box-shadow: none; }
.banner { border: 1px solid color-mix(in srgb, var(--warn) 40%, var(--border)); background: var(--warn-soft); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 18px; font-size: .92rem; }
.tbl td .copy { min-width: 36px; height: 36px; padding: 0 8px; vertical-align: middle; margin-left: 4px; }
.tbl td:nth-child(2) { min-width: 220px; }
@media (max-width: 719px) {
  input, select, textarea, .toolbar input, .toolbar select { font-size: 16px; }
  .auth { padding: 24px 14px; }
  .auth-card { padding: 28px 20px; }
  .toolbar input[type="search"] { min-width: 0; width: 100%; }
  .panel-head .toolbar { width: 100%; min-width: 0; }
  .kv { grid-template-columns: minmax(80px, auto) minmax(0, 1fr); gap: 8px 12px; }
  .savebar { bottom: 8px; padding: 12px; }
  .savebar { align-items: stretch; }
  .savebar > div { flex: 1 1 100%; }
  .savebar .btn { flex: 1; width: 100%; }
  .connection-layout { gap: 16px; }
  .connection-layout .panel-head, .connection-layout .panel-body { padding-inline: 16px; }
}
@media (min-width: 1000px) { .side-close { display: none !important; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; } .boot img { animation: none; } .meter i { transition: none; } }

/* ---------- 9.1: overview, activity, motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes flash { from { background: color-mix(in srgb, var(--accent) 16%, transparent); } }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
.content > * { animation: rise .34s cubic-bezier(.2, .7, .2, 1) both; }
.content > *:nth-child(2) { animation-delay: .04s; } .content > *:nth-child(3) { animation-delay: .08s; }
.content > *:nth-child(4) { animation-delay: .12s; } .content > *:nth-child(n+5) { animation-delay: .16s; }
.kpi { transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-2); }
.kpi .v small { font-size: .55em; font-weight: 600; color: var(--muted); letter-spacing: 0; margin-left: 2px; }
.panel { transition: box-shadow .2s ease, border-color .2s ease; }
.panel:hover { border-color: var(--border-2); }
.side-nav a { transition: background .15s ease, color .15s ease; }
.tbl tbody tr { transition: background .15s ease; }
tr.new td { animation: flash 1.8s ease-out; }
.skel-wrap { padding: 16px 20px; }
.skel { display: block; height: 12px; border-radius: 6px; margin: 10px 0; background: linear-gradient(90deg, var(--surface-2) 25%, color-mix(in srgb, var(--surface-2) 40%, var(--surface)) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; }
.skel.skel-lg { height: 26px; margin: 14px 0; }
.offline-bar { position: fixed; top: 0; left: 50%; transform: translate(-50%, -120%); z-index: 300; max-width: calc(100vw - 24px); padding: 10px 16px; border-radius: 0 0 12px 12px; background: var(--warn-soft); color: var(--fg); border: 1px solid var(--border); border-top: 0; font-size: .88rem; font-weight: 600; box-shadow: var(--shadow); transition: transform .25s ease; }
.offline-bar.ok { background: var(--ok-soft); color: var(--ok); }
.offline-bar.show { transform: translate(-50%, 0); }
@media (min-width: 1100px) { .cols.home-cols { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); } }
.qstep { display: flex; align-items: center; gap: 10px; margin: 18px 0 8px; font-size: .88rem; font-weight: 600; }
.qstep:first-child { margin-top: 0; }
.qstep b { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-size: .74rem; }
.qstep b svg { width: 13px; height: 13px; }
#hstart .code-row + .code-row { margin-top: 8px; }
.fp { font-size: .78rem; overflow-wrap: anywhere; }
.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li { padding: 12px 20px; border-bottom: 1px solid var(--border); display: grid; gap: 4px; transition: background .15s ease; }
.mini-list li:last-child { border-bottom: 0; }
.mini-list li:hover { background: var(--surface-2); }
.mini-main { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-width: 0; overflow-wrap: anywhere; }
.mini-main .muted { width: 100%; }
.mini-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface-2); color: var(--fg); font-weight: 600; font-size: .86rem; transition: border-color .15s ease, transform .15s ease; }
.chip:hover { border-color: var(--accent); transform: translateY(-1px); text-decoration: none; }
.chip svg { width: 14px; height: 14px; color: var(--accent); }
.link-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.link-list a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--fg); font-weight: 600; font-size: .9rem; transition: background .15s ease; }
.link-list a:hover { background: var(--surface-2); text-decoration: none; }
.link-list a span { flex: 1; }
.link-list svg { width: 16px; height: 16px; color: var(--muted); }
.toolbar select.compact, select.compact { width: auto; min-width: 150px; }
.btn.btn-xs { min-height: 30px; padding: 3px 8px; }
.btn.btn-xs svg { width: 14px; height: 14px; }
.ev { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: .76rem; font-weight: 700; white-space: nowrap; background: var(--surface-2); color: var(--muted); }
.ev-tunnel_open { background: var(--ok-soft); color: var(--ok); }
.ev-tunnel_refused, .ev-ip_block { background: var(--warn-soft); color: var(--warn); }
.ev-tunnel_kick { background: color-mix(in srgb, var(--err) 14%, transparent); color: var(--err); }
.ev-tbl td { vertical-align: middle; }
.ev-msg { overflow-wrap: anywhere; min-width: 220px; }
.count { font-size: .76rem; color: var(--muted); font-weight: 700; }
.nowrap { white-space: nowrap; font-variant-numeric: tabular-nums; }
.kpis.mini { grid-template-columns: repeat(2, minmax(0, 1fr)); min-height: 0; margin-bottom: 14px; }
.live.off .dot { background: var(--muted); animation: none; }
@media (prefers-reduced-motion: reduce) {
  .content > *, tr.new td, .skel { animation: none; }
  .kpi:hover, .chip:hover { transform: none; }
  .offline-bar { transition: none; }
}

/* ---------- 9.1: account sub-pages ---------- */
.subnav { display: flex; gap: 6px; overflow-x: auto; margin: -8px 0 22px; padding: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; scrollbar-width: none; }
.subnav::-webkit-scrollbar { display: none; }
.subnav a { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; min-height: 42px; border-radius: 9px; color: var(--muted); font-weight: 600; font-size: .88rem; white-space: nowrap; transition: background .15s ease, color .15s ease, box-shadow .15s ease; }
.subnav a:hover { color: var(--fg); text-decoration: none; }
.subnav a.on { background: var(--surface); color: var(--fg); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.subnav a svg { width: 16px; height: 16px; }
.profile-status { min-height: 1.4em; margin: -10px 0 14px; }
.profile-status.ok { color: var(--ok); }
.avatar-drop { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; padding: 16px; margin-bottom: 16px; border: 1.5px dashed var(--border-2); border-radius: 14px; transition: border-color .15s ease, background .15s ease; }
.avatar-drop.over { border-color: var(--accent); background: var(--accent-soft); }
.avatar-drop .field { margin-bottom: 0; }
.avatar-copy { flex: 1; min-width: 200px; }
.avatar.avatar-xl { width: 96px; height: 96px; font-size: 1.9rem; border-radius: 50%; flex: none; background-size: cover; background-position: center; transition: box-shadow .2s ease, transform .2s ease; }
.avatar.avatar-preview { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--accent); }
@media (prefers-reduced-motion: reduce) { .avatar.avatar-xl, .subnav a { transition: none; } }

/* Button-like links and navigation are never underlined. */
.content a.btn, .subnav a, .link-list a, .chip, .mini-list a.pub { text-decoration: none; }
.content a.btn:hover, .subnav a:hover, .link-list a:hover, .chip:hover { text-decoration: none; }
.sys-extra { margin-top: 20px; }
#sx-ev .ev-msg { min-width: 0; }
#sx-ev .ev-tbl td:first-child { width: 1%; }

/* ---------- Captcha ---------- */
.captcha-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.captcha-img { height: 52px; width: 180px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface-2); display: block; flex: none; }
.captcha-refresh { min-height: 44px; padding: 0 12px; }
