:root {
  color-scheme: dark;
  --black: #060a13;
  --surface: #0e1524;
  --raised: #131c2e;
  --border: #1d2b45;
  --accent: #4f8dff;
  --accent-light: #9cc2ff;
  --text: #f4f7fd;
  --muted: #a4b2c8;
  --quiet: #7b8ba4;
  font-family: "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 85px; }
body { margin: 0; color: var(--text); background: var(--black); font-size: 14px; line-height: 1.55; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
.eyebrow, .field-label { margin: 0; color: var(--accent); font: 10px/1.5 Consolas, monospace; letter-spacing: 1px; }
.button { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; padding: 0 15px; border: 0; border-radius: 4px; font-size: 13px; font-weight: 700; cursor: pointer; }
.button-primary { color: #05070d; background: var(--accent); }
.button-primary:hover { background: var(--accent-light); }
.button-danger { border: 1px solid #7a3946; color: #ffd9de; background: #3a1620; }
.button-danger:hover { border-color: #b0505e; background: #521f2b; }
.button:disabled { opacity: .55; cursor: wait; }
.notice { margin: 0 0 18px; padding: 11px 14px; border: 1px solid var(--border); border-radius: 4px; font-size: 13px; }
.notice-error { border-color: #5a2c3a; color: #f4c3c9; background: #1c0f14; }
.notice-success { border-color: #2b4a7a; color: var(--accent-light); background: #0c172c; }

.auth-page { display: grid; min-height: 100vh; place-items: center; padding: 24px; background: radial-gradient(ellipse at 50% 40%, #0a1526, var(--black) 65%); }
.auth-card { width: min(100%, 390px); padding: 35px; border: 1px solid var(--border); background: var(--surface); }
.auth-brand, .sidebar-brand { display: inline-flex; align-items: center; gap: 11px; font-size: 16px; font-weight: 700; }
.auth-brand img { width: 58px; height: 58px; object-fit: cover; border-radius: 50%; }
.auth-card h1 { margin: 27px 0 4px; font-size: 28px; }
.auth-card > p { margin: 0 0 22px; color: var(--muted); }
.discord-button { display: flex; min-height: 47px; align-items: center; justify-content: center; gap: 10px; border-radius: 4px; color: #fff; background: #5865f2; font-weight: 700; }
.discord-button:hover { background: #4752c4; }
.discord-button svg { width: 20px; height: 20px; }
.back-home { display: block; margin-top: 20px; color: var(--muted); font-size: 12px; text-align: center; }
.back-home:hover { color: var(--accent-light); }

.dashboard-layout { display: grid; min-height: 100vh; grid-template-columns: 250px minmax(0, 1fr); }
.sidebar { position: sticky; z-index: 6; top: 0; display: flex; min-width: 0; height: 100vh; flex-direction: column; padding: 20px 15px; overflow-y: auto; border-right: 1px solid var(--border); background: #0a101d; overscroll-behavior: contain; }
#network-navigation { min-width: 0; }
.sidebar-brand { gap: 9px; margin-bottom: 34px; font-size: 14px; }
.sidebar-brand img { width: 36px; height: 36px; object-fit: cover; border-radius: 50%; }
.sidebar-network-link { margin-bottom: 24px; padding: 9px 10px; border-left: 2px solid transparent; color: var(--muted); font-size: 13px; }
.sidebar-network-link:hover, .sidebar-network-link.active { border-left-color: var(--accent); color: var(--accent-light); background: #0d1830; }
.sidebar-network-label { margin: 0 0 8px 10px; }
.sidebar-network-group { margin-bottom: 5px; }
.sidebar-network-toggle { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 10px; border: 0; border-left: 2px solid transparent; color: #c9d5e6; background: transparent; font-size: 12px; text-align: left; cursor: pointer; }
.sidebar-network-toggle:hover, .sidebar-network-toggle[aria-expanded="true"] { border-left-color: var(--accent); color: var(--accent-light); background: #0d1830; }
.sidebar-network-toggle span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-network-toggle small { flex: 0 0 auto; color: var(--quiet); font-size: 10px; }
.sidebar-network-servers { display: grid; gap: 3px; margin: 2px 0 7px 12px; padding-left: 8px; border-left: 1px solid var(--border); }
.sidebar-network-server { display: flex; align-items: center; justify-content: space-between; gap: 7px; padding: 6px 7px; color: var(--muted); font-size: 11px; }
.sidebar-network-server > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-network-server:hover { color: var(--text); }
.sidebar-server-action { flex: 0 0 auto; padding: 3px 6px; border: 1px solid #2b4a7a; border-radius: 3px; color: var(--accent-light); font-size: 10px; }
.sidebar-server-action:hover { border-color: var(--accent); }
.sidebar-add-server { width: 100%; margin-top: 4px; padding: 8px 9px; border: 1px solid #25406b; border-radius: 3px; color: var(--accent-light); background: #0d1830; font-size: 11px; text-align: left; cursor: pointer; }
.sidebar-add-server:hover { border-color: var(--accent); background: #12213b; }
.network-limit-note { display: block; margin-top: 10px; color: var(--quiet); font-size: 11px; }
.control input, .control select, .control textarea {
  width: 100%;
  min-height: 41px;
  padding: 9px 11px;
  border: 1px solid #263249;
  border-radius: 4px;
  outline: 0;
  color: var(--text);
  background: #0e1524;
}
.control input:focus, .control select:focus, .control textarea:focus { border-color: var(--accent); }
.section-nav { display: grid; gap: 3px; }
.section-nav a { padding: 9px 10px; border-left: 2px solid transparent; color: var(--muted); font-size: 13px; }
.section-nav a:hover, .section-nav a.active { border-left-color: var(--accent); color: var(--accent-light); background: #0d1830; }
.sidebar-home { margin-top: auto; padding: 12px 9px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; }
.sidebar-home:hover { color: var(--accent-light); }

.dashboard-main { min-width: 0; padding: 0 35px 70px; overflow-x: clip; }
.dashboard-header { position: relative; isolation: isolate; display: flex; min-height: 92px; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 21px; overflow: hidden; border-bottom: 1px solid var(--border); }
.dashboard-header > *:not(.header-bg) { position: relative; z-index: 1; }
.header-bg { position: absolute; z-index: 0; inset: 0; pointer-events: none; }
.header-bg > span { position: absolute; inset: 0; display: block; }
.dashboard-header h1 { margin: 3px 0 0; font-size: 22px; }
.account { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.account img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.logout-button { padding: 7px 10px; border: 1px solid #263249; border-radius: 3px; color: var(--muted); background: transparent; cursor: pointer; }
.logout-button:hover { border-color: var(--accent); color: var(--accent-light); }
.empty-state { margin: 40px auto; padding: 34px; border: 1px solid var(--border); background: var(--surface); }
.empty-state h2 { margin: 0 0 6px; font-size: 20px; }
.empty-state p { margin: 0 0 18px; color: var(--muted); }
.config-section { scroll-margin-top: 26px; margin-bottom: 17px; padding: 24px; border: 1px solid var(--border); background: var(--surface); }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 20px; }
.section-title h2 { margin: 4px 0 0; font-size: 19px; }
.server-badge { max-width: 260px; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.control { display: grid; align-content: start; gap: 7px; color: #c9d5e6; font-size: 12px; }
.control input, .control select, .control textarea { font-size: 13px; }
.control textarea { min-height: 80px; resize: vertical; }
.control .panel-code-input { min-height: 300px; font: 12px/1.6 Consolas, monospace; tab-size: 4; white-space: pre; overflow: auto; }
.control small { color: var(--quiet); font-size: 11px; }
.checkbox-control { display: flex; align-items: center; gap: 9px; }
.checkbox-control input { width: 15px; height: 15px; margin: 0; }
.control-hint { margin: 0; max-width: 760px; color: var(--quiet); font-size: 12px; line-height: 1.6; }
.network-integration-form { display: grid; max-width: 760px; gap: 16px; }
.network-integration-actions { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.network-integration-actions > span { color: var(--muted); font-size: 12px; }
.control-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.questions-panel { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.questions-panel summary { display: flex; min-height: 47px; align-items: center; justify-content: space-between; gap: 12px; color: #dbe5f3; font-size: 13px; cursor: pointer; }
.questions-panel summary span { color: var(--quiet); font-size: 11px; }
.question-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; padding: 8px 0 17px; }
.question-grid .control textarea { min-height: 65px; }
.message-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; margin-top: 17px; }
.message-grid .control textarea { min-height: 130px; }
.network-hero { margin-bottom: 34px; padding: 34px; border: 1px solid #2b4a7a; border-radius: 5px; background: radial-gradient(ellipse at 85% 15%, #14243f, #0c172c 55%, #0e1524 100%); }
.network-hero h2 { margin: 5px 0 8px; color: var(--accent-light); font-size: 25px; }
.network-hero p:not(.eyebrow) { max-width: 690px; margin: 0 0 22px; color: var(--muted); }
.network-section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 15px; margin: 26px 0 13px; }
.network-section-heading h2 { margin: 0; font-size: 18px; }
.network-section-heading span { color: var(--quiet); font-size: 11px; }
.networks-list, .department-list { display: grid; gap: 11px; }
.network-card, .department-card { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); }
.network-card:hover, .department-card:hover { border-color: #35618f; }
.network-card h3, .department-card h3 { margin: 0 0 3px; font-size: 15px; }
.network-card p { margin: 0; color: var(--muted); font-size: 12px; }
.department-card small { color: var(--quiet); font-size: 10px; }
.network-card .button, .department-card .button { flex: 0 0 auto; }
.back-link { display: inline-block; margin: 0 0 20px; color: var(--muted); font-size: 12px; }
.back-link:hover { color: var(--accent-light); }
.network-view-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.network-view-heading > div { min-width: 0; }
.network-view-heading h2 { margin: 4px 0 6px; font-size: 23px; }
.network-view-heading p:last-child { max-width: 720px; margin: 0; color: var(--muted); font-size: 12px; }
.network-view-heading .button { flex: 0 0 auto; }
.network-view-actions { display: flex; flex: 0 0 auto; flex-wrap: wrap; gap: 8px; }
.add-department-control { padding: 0 24px 18px; }
.delete-captcha-panel { display: grid; place-items: center; gap: 8px; margin: 0 24px 18px; padding: 20px; border: 1px solid #5a2c3a; border-radius: 4px; background: #1a0f14; text-align: center; }
.delete-captcha-panel > span { color: var(--muted); font-size: 12px; }
.delete-captcha-panel code { color: #ffd9de; font: 700 30px/1.2 Consolas, monospace; letter-spacing: 7px; user-select: all; }
.delete-captcha-panel small { color: var(--quiet); font-size: 10px; }
.delete-captcha-control { margin: 0 24px 18px; }
.delete-captcha-control input { font: 700 18px/1.2 Consolas, monospace; letter-spacing: 5px; text-align: center; text-transform: uppercase; }
.network-dialog { width: min(560px, calc(100% - 32px)); max-height: min(720px, calc(100% - 32px)); padding: 0; overflow: auto; border: 1px solid #2b4a7a; border-radius: 6px; color: var(--text); background: var(--surface); box-shadow: 0 24px 80px rgba(0,0,0,.65); }
.network-dialog::backdrop { background: rgba(0,0,0,.72); }
.network-dialog-header { padding: 24px 24px 16px; }
.network-dialog-header h2 { margin: 4px 0 6px; font-size: 21px; }
.network-dialog-header > p:last-child { margin: 0; color: var(--muted); font-size: 12px; }
.network-server-list { display: grid; gap: 8px; padding: 0 24px 18px; }
.network-server-option { display: flex; align-items: center; gap: 11px; padding: 12px; border: 1px solid var(--border); border-radius: 4px; background: #0a101d; cursor: pointer; }
.network-server-option:hover { border-color: #35618f; }
.network-server-option input { width: 17px; height: 17px; margin: 0; accent-color: var(--accent); }
.network-server-option span { min-width: 0; overflow-wrap: anywhere; font-size: 13px; }
.network-server-option small { display: block; margin-top: 2px; color: var(--quiet); font-size: 10px; }
.network-dialog .notice { margin: 0 24px 16px; }
.network-dialog-actions { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 24px; border-top: 1px solid var(--border); background: #0a101d; }
.network-dialog-actions > span { color: var(--quiet); font-size: 11px; }
.network-dialog-actions > div { display: flex; gap: 8px; }
.network-cancel-button { border: 1px solid var(--border); color: var(--muted); background: transparent; }
.save-bar { position: sticky; z-index: 4; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 15px; margin: 0 -35px; padding: 12px 35px; border-top: 1px solid var(--border); background: rgba(6,10,19,.97); }
.save-bar span { color: var(--muted); font-size: 12px; }

@media (max-width: 850px) {
  .dashboard-layout { grid-template-columns: 210px minmax(0, 1fr); }
  .sidebar { padding-inline: 12px; }
  .dashboard-main { padding-inline: 22px; }
  .network-view-heading { align-items: stretch; flex-direction: column; }
  .network-view-actions { width: 100%; }
  .save-bar { margin-inline: -22px; padding-inline: 22px; }
}
@media (max-width: 650px) {
  .dashboard-layout { display: block; }
  .sidebar { position: static; height: auto; padding: 12px 16px; overflow: visible; border-right: 0; border-bottom: 1px solid var(--border); }
  .sidebar-brand { margin: 0 0 10px; }
  .sidebar-network-link { margin: 0 0 9px; }
  .section-nav { display: flex; overflow-x: auto; gap: 4px; }
  .section-nav a { flex: 0 0 auto; padding: 7px 9px; border-bottom: 2px solid transparent; border-left: 0; font-size: 11px; }
  .section-nav a:hover, .section-nav a.active { border-bottom-color: var(--accent); border-left-color: transparent; }
  .sidebar-home { display: none; }
  .dashboard-main { padding: 0 14px 50px; }
  .dashboard-header { min-height: 75px; margin-bottom: 15px; }
  .dashboard-header h1 { font-size: 18px; }
  .dashboard-header .eyebrow { font-size: 9px; }
  .account { gap: 7px; font-size: 11px; }
  .account img { width: 27px; height: 27px; }
  .logout-button { padding: 6px 7px; font-size: 11px; }
  .config-section { padding: 17px 14px; }
  .control-grid, .question-grid, .message-grid { grid-template-columns: 1fr; }
  .network-hero { padding: 24px 18px; }
  .network-hero h2 { font-size: 21px; }
  .network-card, .department-card { align-items: stretch; flex-direction: column; }
  .network-card .button, .department-card .button { width: 100%; }
  .network-view-heading { align-items: stretch; flex-direction: column; }
  .network-view-heading .button { width: 100%; }
  .network-view-actions { width: 100%; }
  .network-view-actions .button { width: 100%; }
  .network-integration-actions { align-items: stretch; flex-direction: column; }
  .network-dialog-actions { align-items: stretch; flex-direction: column; }
  .network-dialog-actions > div { justify-content: flex-end; }
  .save-bar { margin-inline: -14px; padding-inline: 14px; }
  .save-bar span { max-width: 55%; font-size: 10px; }
  .save-bar .button { min-height: 40px; padding-inline: 11px; font-size: 12px; }
  .command-list > div { grid-template-columns: 120px minmax(0, 1fr); gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0ms !important;
  }
  .reveal { opacity: 1 !important; }
}

/* virja ER:LC dashboard additions */
.muted { color: var(--muted); font-size: 13px; }
.header-actions { display: flex; align-items: center; gap: 14px; }
.save-status { color: var(--quiet); font-size: 12px; }
.button-outline { margin-top: 10px; border: 1px solid #25406b; color: var(--accent-light); background: #0d1830; }
.button-outline:hover { border-color: var(--accent); background: #12213b; }
.button-primary, .button-outline, .button-danger { text-decoration: none; }

.server-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 15px; margin-top: 16px; }
.server-card { display: flex; flex-direction: column; justify-content: space-between; gap: 18px; padding: 18px; border: 1px solid var(--border); background: var(--surface); }
.server-card-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.server-icon { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; }
.server-icon-fallback { display: grid; place-items: center; color: var(--accent-light); background: #14243f; font-size: 18px; font-weight: 700; }
.server-card-name { display: grid; min-width: 0; }
.server-card-name strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.server-card-name small { color: var(--quiet); font-size: 11px; }
.server-card .button { width: 100%; }

.control-wide { grid-column: 1 / -1; }
.list-editor { display: grid; gap: 10px; margin-top: 4px; }
.list-rows { display: grid; gap: 10px; }
.list-row { display: grid; grid-template-columns: 1fr 1fr auto; align-items: end; gap: 10px; padding: 12px; border: 1px solid var(--border); background: var(--raised); }
.list-row select, .list-row input, .list-row textarea { width: 100%; }
.list-row .control span { font-size: 11px; color: var(--quiet); }
.rank-row { grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.4fr) auto; }
.pair-row { grid-template-columns: minmax(200px, 1fr) minmax(120px, .5fr) auto; }
.punishment-row { grid-template-columns: minmax(160px, 1fr) minmax(120px, .7fr) minmax(160px, 1fr) auto; }
.strike-row { grid-template-columns: minmax(200px, 1fr) minmax(140px, .6fr) auto; }
.question-row { grid-template-columns: 1fr auto; }
.question-row textarea { min-height: 60px; }
.question-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.question-actions .button { min-height: 38px; padding: 0 10px; margin-top: 0; }
.group-label { grid-column: 1 / -1; margin: 10px 0 -3px; color: var(--accent-light); font: 11px/1.5 Consolas, monospace; letter-spacing: 1px; text-transform: uppercase; }
.group-label:first-child { margin-top: 0; }
.role-picker { display: grid; gap: 7px; }
.role-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.role-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 5px 4px 9px; border: 1px solid #2b4a7a; border-radius: 3px; color: var(--accent-light); background: #0d1830; font-size: 12px; }
.role-chip-remove { display: grid; place-items: center; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 3px; color: var(--muted); background: transparent; font-size: 14px; line-height: 1; cursor: pointer; }
.role-chip-remove:hover { color: #ffd9de; background: #3a1620; }
.role-empty { color: var(--quiet); font-size: 11px; }
.role-add { width: 100%; min-height: 38px; padding: 7px 10px; border: 1px solid #25406b; border-radius: 4px; color: var(--accent-light); background: #0d1830; cursor: pointer; }
.role-add:focus { border-color: var(--accent); }
.role-add option { color: var(--text); background: #0e1524; }
.role-range { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.ticket-row { display: grid; grid-template-columns: 1fr; gap: 10px; }
.ticket-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ticket-head .button { min-height: 32px; padding: 0 10px; margin-top: 0; font-size: 12px; }
.ticket-key { color: var(--quiet); font: 10px/1 Consolas, monospace; }
.ticket-empty { display: block; margin: 0 0 14px; color: var(--quiet); font-size: 11px; }
.ticket-row { display: block; }
.ticket-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 8px; }
.ticket-grid .control span { color: #c9d5e6; font-size: 12px; }
.questions-panel summary { border-bottom: 1px solid var(--border); }
.questions-panel .list-rows { padding: 10px 0 16px; }

@media (max-width: 820px) {
  .rank-row, .pair-row, .punishment-row, .strike-row { grid-template-columns: 1fr; }
  .ticket-grid, .role-range { grid-template-columns: 1fr; }
  .dashboard-header { flex-direction: column; align-items: stretch; padding-block: 14px; gap: 10px; }
}
.matrix-wrap { overflow-x: auto; }
.permission-matrix { width: 100%; border-collapse: collapse; font-size: 12px; }
.permission-matrix th, .permission-matrix td { padding: 6px 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.permission-matrix thead th { color: var(--accent-light); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
.permission-matrix .matrix-feature { min-width: 210px; font-weight: 600; }
.permission-matrix .matrix-feature small { display: block; color: var(--quiet); font-weight: 400; line-height: 1.4; max-width: 340px; }
.permission-matrix .matrix-cell { min-width: 96px; }
.permission-matrix select.matrix-select { width: 100%; min-height: 32px; padding: 4px 6px; border: 1px solid #25406b; border-radius: 4px; color: var(--accent-light); background: #0d1830; }
.matrix-locked { display: inline-block; padding: 7px 10px; border: 1px dashed #25406b; border-radius: 4px; color: var(--quiet); white-space: nowrap; }
.matrix-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.matrix-tools .button { min-height: 32px; padding: 0 10px; margin-top: 0; font-size: 12px; }

/* Features & guided setup */
.feature-rows { display: grid; gap: 8px; margin-bottom: 14px; }
.feature-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 11px 13px; border: 1px solid var(--border); background: #0a101d; }
.feature-copy { display: grid; min-width: 0; gap: 2px; }
.feature-copy strong { font-size: 13px; }
.feature-copy small { color: var(--quiet); font-size: 11px; line-height: 1.45; }
.feature-row .button { flex: 0 0 auto; min-height: 34px; padding: 0 12px; margin-top: 0; font-size: 12px; }
.feature-tag { display: inline-block; margin-left: 7px; padding: 1px 6px; border: 1px solid #2b4a7a; border-radius: 999px; color: var(--accent-light); font: 9px/1.6 Consolas, monospace; letter-spacing: .5px; text-transform: uppercase; vertical-align: 1px; }
.feature-empty { margin: 0; color: var(--quiet); font-size: 12px; }
.feature-enable { display: flex; gap: 9px; }
.feature-enable select { flex: 1 1 auto; min-height: 40px; padding: 8px 10px; border: 1px solid #25406b; border-radius: 4px; color: var(--accent-light); background: #0d1830; }
.feature-enable .button { flex: 0 0 auto; }
.setup-panel { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--border); }
.setup-copy { margin: 6px 0 12px; color: var(--muted); font-size: 12px; line-height: 1.6; }

.wizard-backdrop { position: fixed; z-index: 40; inset: 0; display: grid; place-items: center; padding: 22px; overflow-y: auto; background: rgba(0, 0, 0, .78); }
.wizard { width: min(680px, 100%); max-height: calc(100vh - 44px); overflow-y: auto; padding: 30px; border: 1px solid #2b4a7a; border-radius: 6px; background: var(--surface); box-shadow: 0 28px 90px rgba(0, 0, 0, .7); }
.wizard h2 { margin: 6px 0 10px; font-size: 24px; }
.wizard-copy { margin: 0 0 14px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.wizard-note { margin: 0 0 14px; padding: 10px 12px; border-left: 2px solid var(--accent); color: var(--accent-light); background: #0c172c; font-size: 12px; line-height: 1.55; }
.wizard-features { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 4px 0 18px; }
.wizard-feature { display: flex; align-items: flex-start; gap: 9px; padding: 10px 11px; border: 1px solid var(--border); border-radius: 4px; background: #0a101d; cursor: pointer; }
.wizard-feature:hover { border-color: #35618f; }
.wizard-feature input { flex: 0 0 auto; width: 15px; height: 15px; margin: 2px 0 0; accent-color: var(--accent); }
.wizard-feature > span { display: grid; min-width: 0; gap: 2px; }
.wizard-feature strong { font-size: 12px; }
.wizard-feature small { color: var(--quiet); font-size: 10px; line-height: 1.45; }
.wizard-actions { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-top: 6px; padding-top: 16px; border-top: 1px solid var(--border); }
.wizard-links, .wizard-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.wizard-link { padding: 4px 2px; border: 0; color: var(--muted); background: transparent; font-size: 12px; text-decoration: underline; cursor: pointer; }
.wizard-link:hover { color: var(--accent-light); }
.wizard .button-outline { margin-top: 0; }
.wizard-progress { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; color: var(--accent-light); font: 11px/1.4 Consolas, monospace; letter-spacing: .04em; }
.wizard-track { flex: 1 1 auto; height: 3px; overflow: hidden; border-radius: 999px; background: #1b2a44; }
.wizard-fill { height: 100%; background: var(--accent); transition: width .2s ease; }
.question-field { margin: 4px 0 18px; padding: 14px; border: 1px solid var(--border); border-radius: 6px; background: #080e1a; }
.question-field .control > .field-label, .question-field .control > small { display: none; }

@media (max-width: 760px) {
  .wizard { padding: 22px 18px; }
  .wizard-features { grid-template-columns: 1fr; }
  .feature-row { align-items: stretch; flex-direction: column; }
  .feature-enable { flex-direction: column; }
  .feature-enable .button { width: 100%; }
  .wizard-actions { align-items: stretch; flex-direction: column; }
  .wizard-buttons { justify-content: flex-end; }
}

/* Motion — same system as virja.xyz: letters out of a blur, 24px/0.8s expo-out reveals,
   cursor-follow shine over 112° pinstripes, springy presses. */
:root {
  --ease-out: cubic-bezier(.22, .61, .36, 1);
  --ease-expo: cubic-bezier(.22, 1, .36, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
}

@keyframes dash-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-in-left { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: none; } }
@keyframes rise-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes letter-in { from { opacity: 0; transform: translateY(.35em); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes backdrop-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes notice-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes save-pulse { 50% { transform: scale(1.035); } }

body.dashboard-page { animation: dash-in .5s var(--ease-expo) both; }
.dashboard-page .sidebar { animation: slide-in-left .5s var(--ease-expo) both; }
.dashboard-page .dashboard-header { animation: rise-in .55s var(--ease-expo) both; }
.auth-card { animation: rise-in .55s var(--ease-expo) both; }
.auth-card > * { animation: rise-in .5s var(--ease-expo) both; }
.auth-card > *:nth-child(2) { animation-delay: .05s; }
.auth-card > *:nth-child(3) { animation-delay: .1s; }
.auth-card > *:nth-child(4) { animation-delay: .15s; }
.auth-card > *:nth-child(5) { animation-delay: .2s; }

.dashboard-header h1 .word { display: inline-block; max-width: 100%; }
.dashboard-header > div:not(.header-bg) { min-width: 0; }
.dashboard-header h1 .ltr { display: inline-block; animation: letter-in .8s var(--ease-expo) both; animation-delay: var(--d, 0ms); }
.dashboard-header h1 .accent-dot { color: var(--accent); }

.header-bands {
  background: repeating-linear-gradient(112deg, rgba(156, 194, 255, .06) 0 1px, transparent 1px 46px);
  -webkit-mask-image: linear-gradient(to bottom, #000 35%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 35%, transparent 100%);
}
.header-shine {
  background: radial-gradient(ellipse 24rem 13rem at var(--mx, 50%) var(--my, 40%), rgba(156, 194, 255, .24), transparent 70%);
  -webkit-mask-image: repeating-linear-gradient(112deg, #000 0 1px, transparent 1px 46px);
  mask-image: repeating-linear-gradient(112deg, #000 0 1px, transparent 1px 46px);
}

.button {
  position: relative;
  overflow: hidden;
  transition: background-color .22s var(--ease-expo), border-color .22s var(--ease-expo), color .22s var(--ease-expo), transform .16s var(--ease-spring), filter .16s ease;
}
.button::after { content: ''; position: absolute; inset: 0; background: linear-gradient(112deg, transparent 30%, rgba(255, 255, 255, .28) 50%, transparent 70%); transform: translateX(-125%); transition: transform .6s var(--ease-expo); pointer-events: none; }
.button:hover::after { transform: translateX(125%); }
.button:active { transform: scale(.96); filter: brightness(.92); transition-duration: 60ms; }
.button.saved { animation: save-pulse .45s var(--ease-expo); }

.notice { animation: notice-in .3s var(--ease-expo) both; }
.control input, .control select, .control textarea, .feature-enable select, .role-add, .matrix-select {
  transition: border-color .2s var(--ease-expo), background-color .2s var(--ease-expo), box-shadow .2s var(--ease-expo);
}
.control input:focus, .control select:focus, .control textarea:focus, .role-add:focus {
  box-shadow: 0 0 0 3px rgba(79, 141, 255, .16);
}
.section-nav a, .sidebar-network-link, .sidebar-network-toggle, .sidebar-home, .guide-nav a {
  transition: background-color .2s var(--ease-expo), border-color .2s var(--ease-expo), color .2s var(--ease-expo), padding-left .2s var(--ease-expo);
}
.section-nav a:hover { padding-left: 13px; }

.reveal { opacity: 0; transform: translateY(24px); transition: opacity .8s var(--ease-expo), transform .8s var(--ease-expo); transition-delay: calc(var(--reveal-delay, 0) * 70ms); }
.reveal.in { opacity: 1; transform: none; }
.server-card { transition: border-color .25s var(--ease-expo), transform .25s var(--ease-expo); }
.server-card:hover { border-color: #2b4a7a; transform: translateY(-2px); }
.server-icon { transition: transform .3s var(--ease-expo); }
.server-card:hover .server-icon { transform: scale(1.05); }
.config-section { transition: border-color .25s var(--ease-expo); }
.config-section:hover { border-color: #22314b; }
.feature-row { transition: border-color .2s var(--ease-expo), background-color .2s var(--ease-expo); }
.feature-row:hover { border-color: #24344f; background: #0f1a2e; }
.list-row { animation: rise-in .25s var(--ease-expo) both; }

.wizard-backdrop { animation: backdrop-in .25s var(--ease-expo) both; }
.wizard { animation: dialog-in .34s var(--ease-expo) both; }
.wizard > * { animation: rise-in .3s var(--ease-expo) both; }
.wizard > *:nth-child(2) { animation-delay: .04s; }
.wizard > *:nth-child(3) { animation-delay: .08s; }
.wizard > *:nth-child(4) { animation-delay: .12s; }
.wizard-track { height: 4px; }
.wizard-fill { transition: width .35s var(--ease-expo); }
.wizard-feature { transition: border-color .2s var(--ease-expo), background-color .2s var(--ease-expo), transform .2s var(--ease-expo); }
.wizard-feature:hover { border-color: #2b4a7a; background: #0f1a2e; transform: translateY(-1px); }
.wizard-feature input { transition: transform .15s var(--ease-spring); }
.wizard-feature input:checked { transform: scale(1.08); }
.role-chip { animation: rise-in .2s var(--ease-expo) both; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1 !important; transform: none !important; }
  .header-shine { display: none; }
  .dashboard-header h1 .ltr, .dashboard-page .sidebar, .dashboard-page .dashboard-header, .auth-card, .auth-card > * { animation: none !important; }
}
