:root {
  color-scheme: dark;
  font-family: system-ui, -apple-system, sans-serif;
  color: #eff1fa;
  background: #1a1e2a;
  --panel: #242a3b;
  --border: #3b435b;
  --muted: #b4bed5;
  --accent: #7660eb;
}

* { box-sizing: border-box; }
body { margin: 0; display: grid; grid-template: "sidebar main" / 240px minmax(0, 1fr); min-height: 100vh; }
.sidebar { grid-area: sidebar; background: #222738; padding: 24px 18px; border-right: 1px solid var(--border); display: flex; flex-direction: column; }
.brand { display: flex; gap: 10px; align-items: center; font-weight: 750; line-height: 1.2; }
.brand img { display: block; flex: none; }
.main-nav { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.nav-link { background: transparent; border: 1px solid transparent; border-radius: 6px; padding: 9px 12px; color: inherit; font: inherit; font-weight: 600; cursor: pointer; text-align: left; text-decoration: none; }
.nav-link:hover { background: #2d3348; }
.nav-link.active { background: #373054; border-color: #9e8bf7; }
.sidebar-footer { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border); }
#user-info { font-size: .85rem; color: var(--muted); margin-bottom: 8px; }

main { grid-area: main; min-width: 0; width: 100%; padding: 28px clamp(14px, 1.6vw, 28px) 48px; }
.view { display: block; }
.view[hidden] { display: none; }
.top { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 24px; }
h1 { font-size: clamp(1.75rem, 4vw, 2.45rem); margin: 0 0 16px; }
h2 { font-size: 1.1rem; margin: 0 0 16px; }

.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: clamp(15px, 2.5vw, 23px); margin-bottom: 16px; }
.panel-title { background: #1f2434; padding: 10px 12px; border-radius: 5px; font-size: .85rem; margin: -23px -23px 16px; border-radius: 12px 12px 0 0; }

.metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.metric { text-align: center; }
.metric dt { color: var(--muted); font-size: .85rem; margin-bottom: 8px; }
.metric dd { font-size: 1.8rem; font-weight: 700; margin: 0; }

.dashboard-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
.columns { display: grid; grid-template-columns: 1.25fr 1fr; gap: 18px; align-items: start; }

form { display: grid; gap: 9px; }
label { font-size: .9rem; font-weight: 600; margin-top: 5px; display: block; }
:not(form) > label[for]:not(.check) { margin-bottom: 5px; }
input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  width: 100%; min-height: 42px; padding: 8px 10px;
  background: #1c2130; border: 1px solid var(--border); border-radius: 6px; color: inherit; font: inherit;
}
textarea { min-height: 80px; resize: vertical; }
#description { min-height: 42px; }
fieldset { border: 1px solid var(--border); border-radius: 6px; padding: 12px; margin: 8px 0; }
fieldset.mini { padding: 8px 10px; margin: 8px 0; }
fieldset.mini legend { font-size: .85rem; }
legend { padding: 0 8px; font-weight: 600; }
.check { display: flex; gap: 7px; align-items: center; min-height: 26px; margin: 8px 0; }
.check input { margin: 0; width: 16px; height: 16px; accent-color: var(--accent); }
.check .note { color: var(--muted); font-weight: 500; }

.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; }
.form-actions { display: flex; gap: 12px; margin-top: 16px; }

button { border: 1px solid transparent; border-radius: 6px; padding: 9px 16px; color: inherit; font: inherit; font-weight: 650; cursor: pointer; }
button:hover { filter: brightness(1.13); }
:focus-visible { outline: 2px solid #c0aeff; outline-offset: 2px; }
:is(input:not([type="checkbox"]):not([type="radio"]), select, textarea):focus-visible { outline-offset: -3px; }
.primary { background: #6248d4; }
.secondary { background: #3c3263; border-color: #7466a6; }
.danger { background: #492d42; border-color: #87516b; }
.small { padding: 6px 12px; font-size: .85rem; }

.hint, .status { color: var(--muted); font-size: .85rem; line-height: 1.45; margin: 4px 0; font-weight: 300; }
.field-hint { font-size: .82rem; color: var(--muted); margin: 4px 0; }
.status:empty { display: none; }
.error { color: #ff8080; }
.result { margin-top: 16px; padding: 13px; background: #1c2130; border: 1px solid var(--border); border-radius: 6px; }

details.panel > summary { cursor: pointer; font-weight: 600; padding: 8px 0; }
details.panel[open] > summary { margin-bottom: 12px; }

table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-size: .78rem; font-weight: 650; }

.state { display: inline-block; padding: 3px 8px; border-radius: 12px; font-size: .78rem; font-weight: 600; }
.state.draft { color: #a2adc6; background: #2d3348; }
.state.active { color: #8be5cc; background: #243b3b; }
.state.paused { color: #ffd09c; background: #44333b; }
.state.archived { color: #b4bed5; background: #2a2a2a; }

.integration-modes { margin: 14px 0; padding: 0; border: 0; }
.integration-modes legend { padding: 0 0 7px; font-size: .9rem; }
.integration-modes label { position: relative; margin: 0; border: 1px solid transparent; text-align: center; cursor: pointer; }
.integration-modes input { position: absolute; opacity: 0; }

.action-link { display: inline-block; border: 1px solid #7466a6; border-radius: 6px; padding: 9px 12px; color: inherit; font-weight: 650; text-decoration: none; }
.login-container { max-width: 400px; margin: 80px auto; }

.panel.docs-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px;
  padding: clamp(18px, 3vw, 30px);
  background: linear-gradient(110deg, #242343, var(--panel) 68%);
}
.docs-header h1 { margin: 0 0 4px; }
.docs-search { position: relative; flex: 0 1 21rem; min-width: 0; color: var(--muted); }
.docs-search svg { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); pointer-events: none; }
#docs-search { padding-inline-start: 38px; }
.docs-layout { display: grid; grid-template-columns: minmax(12rem, 15rem) minmax(0, 1fr); gap: 20px; align-items: start; }
.docs-layout:has(.docs-toc[hidden]) { grid-template-columns: minmax(0, 1fr); }
.panel.docs-toc { position: sticky; top: 16px; max-height: calc(100dvh - 32px); overflow-y: auto; padding: 12px; }
.docs-toc summary { padding: 7px 8px; font-weight: 700; cursor: pointer; }
.docs-toc-group { margin: 8px 0 0; padding-top: 10px; border-top: 1px solid var(--border); }
.docs-toc-group h2 { color: var(--muted); font-size: .75rem; margin: 0 8px 4px; }
.docs-toc ul { list-style: none; margin: 0; padding: 0; }
.docs-toc a { display: block; padding: 7px 8px; border-radius: 7px; color: inherit; font-size: .86rem; text-decoration: none; }
.docs-toc a:hover { background: #232d44; }
.docs-toc a[aria-current="location"] { background: #302752; color: #f1ebff; box-shadow: inset 3px 0 #ab97ff; }
.docs { min-width: 0; line-height: 1.65; overflow-wrap: anywhere; }
.docs .panel { padding: clamp(16px, 2.6vw, 30px); }
.docs h2 { font-size: clamp(1.15rem, 2.4vw, 1.45rem); margin: 0 0 14px; scroll-margin-top: 18px; }
.docs p, .docs ol, .docs dl { max-width: 75ch; margin: 0 0 14px; }
.docs ol { padding-inline-start: 1.4em; }
.docs li + li { margin-top: 8px; }
.docs dt { color: #e3d9ff; font-weight: 650; }
.docs dd { margin: 2px 0 10px; color: var(--muted); }
.docs dd + dt { padding-top: 8px; border-top: 1px solid var(--border); }
.docs code { padding: .12em .32em; border-radius: 4px; background: #111929; color: #ddd5ff; font-size: .9em; }
.docs a { color: #cec0ff; text-underline-offset: 3px; }
.docs .panel > :last-child { margin-bottom: 0; }

@media (max-width: 900px) {
  .docs-layout { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .panel.docs-toc { top: 8px; z-index: 2; max-height: 50dvh; margin-bottom: 0; }
  .docs h2 { scroll-margin-top: 78px; }
}

@media (max-width: 1100px) {
  .metrics { grid-template-columns: repeat(3, 1fr); }
  .dashboard-columns { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  body { grid-template: "sidebar" auto "main" 1fr / minmax(0, 1fr); }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--border); padding: 16px; }
  .main-nav { flex-direction: row; flex-wrap: wrap; }
  .nav-link { flex: 1; min-width: 120px; text-align: center; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
}

[hidden] { display: none !important; }
.flow-editor-columns { display: grid; grid-template-columns: minmax(0, 1.16fr) minmax(0, 1fr); align-items: start; gap: 18px; }
.flow-editor-columns fieldset, .editor-side { min-width: 0; }
.editor-header h1 { margin: 3px 0 0; }
.editor-eyebrow { margin: 0; color: #b3a5ff; font-size: .73rem; text-transform: uppercase; letter-spacing: .13em; font-weight: 700; }
.editor-section-title { padding: 9px 12px; margin: 0 0 8px; border-radius: 6px; background: #1f2434; }
.editor-rule { border: 1px solid var(--border); border-radius: 6px; padding: 9px 12px; }
.editor-rule summary { cursor: pointer; font-weight: 650; }
.editor-rule[open] summary { margin-bottom: 8px; }
.flow-editor-columns .form-actions { flex-wrap: wrap; }
#test-result { overflow-wrap: anywhere; }
#test-result p { margin: 5px 0; }
.integration-modes label:has(:focus-visible) { outline: 2px solid #c0aeff; outline-offset: 2px; }
@media (max-width: 980px) { .flow-editor-columns { grid-template-columns: 1fr; } }

/* Shared workspace layout and view states */
:root {
  color: #eef2ff;
  background: #101521;
  --panel: #1a2233;
  --border: #303c54;
  --muted: #aebbd1;
  --accent: #a393ff;
}
body { grid-template-columns: 222px minmax(0, 1fr); }
.skip-link { position: fixed; left: 14px; top: 10px; z-index: 10; transform: translateY(-160%); padding: 8px 12px; border-radius: 8px; background: #262f47; color: inherit; }
.skip-link:focus { transform: none; }
.sidebar { position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; background: #141b2a; padding: 24px 14px; }
.brand { font-size: 1.2rem; letter-spacing: -.025em; }
.sidebar .brand { padding: 0 7px; margin-bottom: 31px; }
.brand small { display: block; color: var(--muted); font-size: .72rem; font-weight: 500; letter-spacing: normal; margin-top: 3px; }
.nav-link { font-size: .88rem; font-weight: 550; border-radius: 8px; color: #c3cee2; }
.nav-link.active { background: #28274a; color: #f2edff; border-color: #4c427e; }
.nav-link, .icon-button { display: inline-flex; align-items: center; gap: 8px; }
.control-icon { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sidebar-footer { padding-inline: 6px; }
main h1:focus { outline: none; }
body:not([data-session="signed-in"]) { grid-template: "main" / minmax(0, 1fr); }
body:not([data-session="signed-in"]) .sidebar { display: none; }
body:is([data-session="checking"], [data-session="signed-out"]) main { display: grid; align-content: center; min-height: 100dvh; }
body[data-session="checking"] #loading-status { text-align: center; }
.login-container { width: min(100%, 410px); margin: 0 auto; padding: 28px; border-radius: 16px; }
.login-brand { flex-wrap: wrap; margin-bottom: 20px; }
.language-select { width: auto; min-height: 36px; font-size: .83rem; letter-spacing: normal; }
.login-brand .language-select { margin-inline-start: auto; }
.sidebar-footer .language-select { display: block; margin-bottom: 8px; }
.login-container h1 { margin: 3px 0 0; }
.login-container .subtitle { margin-bottom: 18px; }
.login-container .primary { width: 100%; }
.password-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
.login-captcha { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.login-captcha img { max-width: 100%; height: auto; border-radius: 6px; }
#toggle-password { display: grid; place-items: center; min-width: 44px; padding: 0; }
#password[type="password"] + #toggle-password .password-eye-open,
#password[type="text"] + #toggle-password .password-eye-closed { display: none; }
.page-heading { align-items: end; gap: 14px; margin-bottom: 20px; padding: 0 0 17px; border-bottom: 1px solid var(--border); }
.page-heading h1 { margin: 1px 0 4px; letter-spacing: -.035em; font-size: clamp(1.55rem, 3vw, 2.15rem); line-height: 1.2; overflow-wrap: anywhere; }
.eyebrow { margin: 0; color: #b9acff; font-size: .7rem; text-transform: uppercase; letter-spacing: .13em; font-weight: 750; }
.subtitle { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.45; }
.header-actions, .section-heading, .table-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.section-heading { justify-content: space-between; margin-bottom: 12px; }
.section-heading h2 { margin: 0; }
.panel { padding: clamp(14px, 2vw, 21px); border-radius: 12px; }
button, .action-link { border-radius: 8px; }
.primary { background: #674ddd; border-color: #8068f3; color: white; }
.secondary, .action-link { background: #222d43; border-color: #40506b; }
button:disabled { opacity: .65; cursor: not-allowed; filter: none; }
input:not([type="checkbox"]):not([type="radio"]), select, textarea { background: #121a2a; border-color: #647697; border-radius: 8px; }
input::placeholder, textarea::placeholder { color: #8b9ab5; }
fieldset { min-width: 0; }
.check { line-height: 1.4; }
.check input { flex: none; margin-top: 2px; }
.check .switch-input {
  appearance: none;
  width: 34px;
  height: 24px;
  margin: 0;
  border: 1px solid #647697;
  border-radius: 20px;
  background: radial-gradient(circle closest-side, #d7def1 98%, transparent) left 4px center / 14px 14px no-repeat #28354d;
  cursor: pointer;
}
.switch-input:checked {
  border-color: #8068f3;
  background-color: #674ddd;
  background-position: right 4px center;
}
.switch-input:indeterminate {
  border-color: #8793b1;
  background-color: #414d65;
  background-position: center;
}
.switch-input:disabled { opacity: .55; cursor: not-allowed; }
#timezone-picker[inert] { opacity: .55; }
@media (forced-colors: active) {
  .check .switch-input { appearance: auto; }
}
.metrics { gap: 10px; margin: 0 0 16px; }
#dashboard-data .metrics { grid-template-columns: repeat(6, minmax(0, 1fr)); margin-bottom: 6px; }
.dashboard-period-caption { margin-bottom: 8px; }
#dashboard-visitor-scope { margin: 0 0 16px; }
.metric { margin: 0; text-align: left; padding: 13px; }
.metric dt { color: var(--muted); font-size: .79rem; line-height: 1.4; margin-bottom: 5px; }
#dashboard-data .metric dt { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px; }
.metric-icon { width: 28px; height: 28px; padding: 5px; border-radius: 7px; background: #332d50; color: #c5baff; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.metric:has(#metric-active) .metric-icon { color: #9ae8d1; background: #243c3e; }
.metric:has(#metric-blocked) .metric-icon { color: #ffb4c1; background: #492d42; }
.metric dd { font-size: clamp(1.45rem, 3vw, 1.95rem); line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: -.035em; }
#dashboard-data .metric { display: flex; flex-direction: column; justify-content: space-between; overflow-wrap: anywhere; }
@media (max-width: 520px) {
  #dashboard-data .metric { min-width: 0; padding: 9px; }
  #dashboard-data .metric dt { font-size: clamp(.6875rem, 2.8vw, .79rem); line-height: 1.2; }
  #dashboard-data .metric dd { font-size: clamp(1rem, 4.1vw, 1.45rem); }
  .metric-icon { width: 23px; height: 23px; padding: 3px; }
}
#metric-active { color: #9ae8d1; }
#metric-redirects { color: #c5baff; }
.dashboard-columns { gap: 14px; margin-bottom: 14px; align-items: start; grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr); }
.dashboard-columns > .panel { margin-bottom: 0; min-width: 0; }
.dashboard-columns h2 { margin-bottom: 6px; }
.dashboard-charts { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); align-items: stretch; gap: 14px; }
.dashboard-charts:has(> #hourly-panel[hidden]) { grid-template-columns: minmax(0, 1fr); }
.daily-traffic td { font-variant-numeric: tabular-nums; }
.daily-traffic :is(th, td):not(:first-child) { text-align: right; }
.daily-traffic th[scope="row"] { white-space: nowrap; }
.partial-day { display: block; margin-top: 2px; font-size: .7rem; font-weight: 500; }
.daily-traffic th:nth-child(2) { width: 50%; }
.daily-traffic tbody tr:last-child th { border-bottom: 0; }
.daily-traffic-volume { display: grid; grid-template-columns: minmax(0, 1fr) minmax(3ch, auto); gap: 8px; align-items: center; }
.traffic-track { display: block; overflow: hidden; height: 8px; background: #11192a; border-radius: 12px; }
.traffic-track > span { display: block; height: 100%; background: linear-gradient(90deg, #745bf0, #b19dff); border-radius: inherit; }
@media (max-width: 970px) {
  .dashboard-charts { grid-template-columns: minmax(0, 1fr); }
}
.table-scroll { overflow-x: auto; }
.table-scroll th, .table-scroll td { padding: 10px 9px; }
.table-scroll tbody tr:hover { background: #232c40; }
.table-scroll tbody tr:last-child td { border-bottom: 0; }
.table-scroll td:first-child { overflow-wrap: anywhere; }
.table-scroll td time, .table-scroll td .state { white-space: nowrap; }
.table-description { display: block; max-width: 65ch; color: var(--muted); font-size: .8rem; margin-top: 4px; }
.table-actions { gap: 6px; }
.flow-action-label { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.flow-action-label svg { flex: none; }
.flow-title-link { color: #d9ceff; font-weight: 650; text-decoration: none; }
.flow-row-state { display: flex; align-items: center; gap: 7px; }
.flow-row-state .state { flex: none; width: 5.2rem; text-align: center; }
.flow-status-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 12px; margin: 10px 0 6px; }
.flow-status-line :is(.hint, .status) { margin: 0; font-size: .85rem; }
.flow-catalog-tools { flex-wrap: nowrap; max-width: 100%; }
#flow-search { flex: 1 1 12rem; width: 12rem; min-width: 0; }
#flow-state-filter, #new-flow-btn { flex: none; width: auto; min-height: 42px; white-space: nowrap; }
.flow-catalog-align-end { text-align: right; }
.flow-catalog-actions { justify-content: flex-end; flex-wrap: nowrap; }
@media (max-width: 660px) {
  #flows-list .flow-catalog-detail { display: none; }
  .flow-catalog-state { flex-wrap: wrap; }
}
@media (max-width: 520px) {
  .flow-catalog-tools { gap: 5px; width: 100%; }
  #flow-search, #flow-state-filter, #new-flow-btn { padding-inline: 7px; font-size: .8rem; }
}
.flow-pause-toggle { display: grid; align-items: center; flex: none; width: 34px; height: 24px; padding: 3px; background: #28354d; border-color: var(--border); border-radius: 20px; }
.flow-pause-toggle::before { content: ""; width: 14px; height: 14px; border-radius: 50%; background: #d7def1; }
.flow-pause-toggle[aria-checked="true"] { background: #674ddd; border-color: #8068f3; }
.flow-pause-toggle[aria-checked="true"]::before { justify-self: end; background: white; }
.flow-trash { display: inline-grid; place-items: center; width: 32px; min-height: 30px; padding: 0; }
.empty-state { padding: 13px; margin: 11px 0 0; color: var(--muted); border: 1px dashed #3c4962; border-radius: 8px; font-size: .86rem; }
.stats-controls { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.stats-groups { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); flex: 5 1 530px; gap: 4px; }
.stats-groups button { background: #252e43; color: var(--muted); border-color: var(--border); padding: 8px 6px; font-size: .85rem; }
.stats-groups button[aria-pressed="true"] { background: #31245e; color: #f2edff; border-color: #8e79df; }
.stats-controls > select, .stats-controls > input { flex: 1 1 140px; width: auto; min-width: 0; font-size: .85rem; }
.stats-table { min-width: 690px; border-top: 1px solid var(--border); }
.stats-table thead button { background: transparent; padding: 4px 0; text-align: left; color: inherit; }
.stats-table thead th, .stats-table tbody th { color: inherit; }
.stats-table tbody th { font-size: inherit; overflow-wrap: anywhere; }
.stats-table tbody tr:last-child th { border-bottom: 0; }
.stats-table td { font-variant-numeric: tabular-nums; }
.stats-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 16px; }
.stats-footer button { margin-inline-start: auto; }
.list-status, .page-status { margin: 10px 0 6px; }
.stats-feedback > .page-status { margin-block: 0; }
.stats-feedback:has(> .page-status:not(:empty)) { margin-block: 0 8px; }
#stats-selection { margin: 0 0 8px; }
#stats-content[aria-busy="true"] { opacity: .66; }

.skeleton { display: grid; gap: 8px; }
.skeleton[hidden] { display: none; }
.skeleton > span {
  border-radius: 6px;
  background: linear-gradient(105deg, #263249 20%, #36445f 45%, #263249 70%);
  background-size: 220% 100%;
  animation: skeleton-shimmer 1.6s ease-in-out infinite;
}
.skeleton[data-kind="dashboard"] { grid-template-columns: repeat(12, minmax(0, 1fr)); margin-bottom: 16px; }
.skeleton:is([data-kind="dashboard"], [data-kind="form"]) > span { border-radius: 12px; }
.skeleton[data-kind="dashboard"] > span { grid-column: span 2; height: 4.75rem; }
.skeleton[data-kind="dashboard"] > span:nth-child(n+7) { height: clamp(8rem, 23vw, 17rem); }
.skeleton[data-kind="dashboard"] > span:nth-child(7) { grid-column: span 7; }
.skeleton[data-kind="dashboard"] > span:nth-child(8) { grid-column: span 5; }
.skeleton[data-kind="captcha"] { width: min(180px, 100%); height: 52px; }
.skeleton[data-kind="stats"] {
  grid-template-columns: minmax(0, 1.5fr) repeat(5, minmax(0, 1fr));
  gap: 20px clamp(6px, 2vw, 22px);
  padding-block: 12px;
}
.skeleton[data-kind="stats"] > span { height: .75rem; width: 66%; }
.skeleton[data-kind="stats"] > span:nth-child(-n+6) { width: 100%; }
.skeleton[data-kind="rows"] > span { height: 2.35rem; }
.skeleton[data-kind="rows"] > span:first-child { width: 38%; height: .8rem; margin-block: 3px; }
.skeleton[data-kind="text"] > span { height: .8rem; width: 80%; }
.skeleton[data-kind="text"] > span:nth-child(2) { width: 63%; }
.skeleton[data-kind="text"] > span:nth-child(3) { width: 45%; }
.skeleton[data-kind="form"] { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; }
.skeleton[data-kind="form"] > span { height: 16rem; }
.skeleton[data-kind="form"] > span + span { height: 10rem; }
@keyframes skeleton-shimmer {
  from { background-position: 100% 0; }
  to { background-position: -120% 0; }
}
@media (max-width: 1240px) {
  #dashboard-data .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .skeleton[data-kind="dashboard"] { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .skeleton[data-kind="dashboard"] > span:nth-child(7) { grid-column: span 4; }
  .skeleton[data-kind="dashboard"] > span:nth-child(8) { grid-column: span 2; }
}
@media (max-width: 560px) {
  #dashboard-data .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .skeleton[data-kind="dashboard"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 970px) {
  .skeleton[data-kind="dashboard"] > span:nth-child(n+7) { grid-column: 1 / -1; }
  .skeleton[data-kind="form"] { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .skeleton > span { animation: none; }
}
.flow-editor-columns { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
#editor { grid-template-columns: minmax(0, 1fr); }
.editor-section-title { color: #e4e8fa; background: #222c42; margin-bottom: 6px; }
.editor-heading-icon { margin-inline-end: 7px; vertical-align: -.2em; color: #aab9d5; }
.integration-panel h3 { margin: 16px 0 8px; padding-top: 13px; border-top: 1px solid var(--border); font-size: .9rem; }
.integration-panel ol { padding-inline-start: 22px; color: var(--muted); font-size: .86rem; }
.integration-panel li + li { margin-top: 5px; }
.integration-panel p + button { margin-top: 5px; }
.integration-steps li + li { margin-top: 13px; }
.integration-steps p { margin: 0; }
.integration-steps label { margin: 0 0 5px; }
.integration-copy-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px; }
.integration-formats { margin-top: 16px; }
.editor-rule, .flow-editor-columns fieldset { border-color: #37455f; border-radius: 8px; }
.editor-rule summary { color: #dde4f9; }
.traffic-preset-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.traffic-preset-buttons button { color: #edf0f7; }
.traffic-preset-logo { width: 16px; height: 16px; flex: none; fill: currentColor; }
.traffic-preset-buttons [data-traffic-preset="meta"] { background: #293b53; border-color: #536a88; }
.traffic-preset-buttons [data-traffic-preset="google"] { background: #2a4039; border-color: #506c60; }
.traffic-preset-buttons [data-traffic-preset="tiktok"] { background: #44313e; border-color: #73556a; }
.editor-actions { position: sticky; bottom: 0; z-index: 1; margin: 5px -4px -4px; padding: 9px 4px 4px; background: var(--panel); border-top: 1px solid var(--border); }
.editor-actions .form-actions { margin: 0; gap: 7px; }
.editor-actions .form-actions button { padding-inline: 11px; }
#delete-flow { margin-inline-start: auto; }
#editor-dirty { color: #ffdaac; background: #3e3040; }
#editor-status { margin: 6px 0 0; }
.error { color: #ff9ba8; }
#editor [aria-invalid="true"] { border-color: #ff9ba8; }
.field-error { margin: 3px 0; font-size: .85rem; line-height: 1.4; }
.variant-row .field-error { grid-column: 1 / -1; }
.form-error-summary { margin: 3px 0 8px; padding: 10px 12px; border: 1px solid currentColor; border-radius: 8px; }

@media (max-width: 1100px) {
  .dashboard-columns { grid-template-columns: minmax(0, 1fr); }
  .metrics { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
}
@media (max-width: 970px) {
  .flow-editor-columns { grid-template-columns: minmax(0, 1fr); }
  .editor-actions { position: static; }
}
@media (max-width: 768px) {
  body { grid-template: "sidebar" auto "main" 1fr / minmax(0, 1fr); }
  .sidebar { position: static; height: auto; padding: 12px; }
  .sidebar .brand { margin-bottom: 9px; }
  .main-nav { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 3px; }
  .nav-link { flex: 0 0 auto; min-width: 0; white-space: nowrap; }
  .sidebar-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; padding-top: 8px; }
  #user-info { margin: 0; }
  main { padding-top: 17px; }
}
@media (max-width: 460px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-groups { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .table-scroll th, .table-scroll td { padding-inline: 6px; }
  .table-actions button { width: 100%; }
}

:is(#discard-flow-dialog, #flow-action-dialog, #visit-dialog) {
  width: min(450px, calc(100% - 28px));
  padding: 20px;
  border: 1px solid #465673;
  border-radius: 12px;
  color: inherit;
  background: var(--panel);
}
:is(#discard-flow-dialog, #flow-action-dialog, #visit-dialog)::backdrop { background: #090d18b8; }
:is(#discard-flow-dialog, #flow-action-dialog, #visit-dialog) h2 { margin: 0; }
.dialog-actions { display: flex; justify-content: end; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

:is(.period-picker, .integration-picker) {
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #141b2a;
}
.period-picker { display: inline-flex; }
.integration-picker { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
:is(.period-picker button, .integration-picker label) { padding: 6px 10px; background: transparent; border-radius: 6px; color: var(--muted); font-size: .83rem; }
:is(.period-picker button[aria-pressed="true"], .integration-picker label:has(:checked)) { background: #332957; color: #f0eaff; }
#dashboard-data[aria-busy="true"] { opacity: .68; }
.visit-toggle { align-items: center; margin: 0; white-space: nowrap; }
.activity-date-label { margin: 0; white-space: nowrap; }
#activity-date { width: auto; max-width: 100%; }
.activity-pagination { justify-content: flex-end; margin-top: 10px; }
#activity-filter { width: auto; }
.visit-column-picker { position: relative; }
#activity-column-options {
  position: absolute; z-index: 4; inset-block-start: calc(100% + 5px); inset-inline-end: 0;
  width: 18rem; padding: 8px 12px; background: var(--panel);
  border: 1px solid var(--border); border-radius: 8px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px 8px;
}
#activity-column-options .check { margin: 0; font-size: .82rem; }
.visit-table, .visit-list { max-width: 100%; max-height: 29rem; overflow: auto; }
.visit-table { --visit-time: 4.5rem; --visit-flow: 9rem; --visit-result: 6.5rem; --visit-details: 5.5rem; }
.visit-table table { width: max-content; min-width: 100%; }
.visit-table th { position: sticky; top: 0; background: var(--panel); white-space: nowrap; }
.visit-table td { overflow-wrap: anywhere; }
.visit-table .visit-pin { position: sticky; background: var(--panel); }
.visit-table td.visit-pin { z-index: 1; }
.visit-table th { z-index: 2; }
.visit-table th.visit-pin { z-index: 3; }
.visit-table tbody tr:hover .visit-pin { background: #232c40; }
.visit-table .visit-time { left: 0; width: var(--visit-time); min-width: var(--visit-time); max-width: var(--visit-time); }
.visit-table .visit-flow { left: var(--visit-time); width: var(--visit-flow); min-width: var(--visit-flow); max-width: var(--visit-flow); }
.visit-table .visit-result { left: calc(var(--visit-time) + var(--visit-flow)); width: var(--visit-result); min-width: var(--visit-result); max-width: var(--visit-result); }
.visit-table .visit-details { right: 0; width: var(--visit-details); min-width: var(--visit-details); max-width: var(--visit-details); }
.visit-details button { padding-inline: 8px; white-space: nowrap; }
.visit-table .visit-result .state { white-space: normal; }
.visit-timestamp { display: block; line-height: 1.2; white-space: nowrap; font-variant-numeric: tabular-nums; }
.visit-clock { display: block; margin-top: 2px; color: var(--muted); font-size: calc(1em - 2px); }
.visit-table .visit-text { min-width: 8rem; }
.visit-table .visit-value { white-space: nowrap; font-variant-numeric: tabular-nums; }
.visit-journal .state.refused { color: #ffb4c1; background: #492d42; }
.visit-reason { display: block; margin-top: 4px; color: var(--muted); font-size: .78rem; }
.visit-list { margin: 0; padding: 0; list-style: none; }
.visit-list li {
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "name details" "time details" "state details";
  align-items: center; gap: 5px 9px; padding: 10px 4px; border-bottom: 1px solid var(--border);
}
.visit-list li:last-child { border-bottom: 0; }
.visit-list strong { grid-area: name; overflow-wrap: anywhere; font-size: .9rem; }
.visit-list .visit-timestamp { grid-area: time; font-size: .8rem; }
.visit-list .state { grid-area: state; justify-self: start; }
.visit-list button { grid-area: details; min-height: 44px; }
.data-status-list { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 0; padding: 0; list-style: none; }
.data-status-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 8px; }
@media (max-width: 768px) {
  .visit-column-picker { display: none; }
}
.visit-facts { margin: 14px 0 0; }
.visit-facts div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.visit-facts dt { color: var(--muted); font-size: .84rem; }
.visit-facts dd { margin: 0; overflow-wrap: anywhere; }
#visit-dialog-reason { margin-top: 7px; }
#visit-dialog .dialog-actions { display: flex; }
.traffic-heading { gap: 12px; align-items: center; }
.traffic-legend { display: flex; flex-wrap: wrap; gap: 12px; list-style: none; margin: 0; padding: 0; color: var(--muted); font-size: .8rem; }
.traffic-legend li { display: flex; gap: 6px; align-items: center; }
.traffic-key { width: 15px; border-top: 3px solid #a791ff; border-radius: 2px; }
.traffic-key.redirects { border-top: 3px dashed #75dec8; }
#hourly-panel { display: flex; flex-direction: column; }
.hourly-traffic { display: flex; flex-direction: column; flex: 1; max-width: 1050px; }
.hourly-plot { position: relative; margin-block: auto; }
#hourly-chart { display: block; width: 100%; height: auto; }
#hourly-tooltip {
  position: absolute;
  top: 4px;
  left: clamp(0px, calc(var(--hour-x) - 6rem), max(0px, calc(100% - 12rem)));
  width: min(12rem, 100%);
  padding: 8px 10px;
  background: #101521;
  border: 1px solid #596483;
  border-radius: 8px;
  color: #eef2ff;
  font-size: .78rem;
  line-height: 1.5;
  pointer-events: none;
}
#hourly-tooltip span, #hourly-tooltip strong { display: block; }
.chart-hit { fill: transparent; cursor: crosshair; }
.chart-hover-line { stroke: #b4bed5; stroke-dasharray: 3 4; }
.chart-hover-redirect { fill: #75dec8; stroke: var(--panel); }
.chart-label { fill: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.chart-grid { stroke: #354159; stroke-width: 1; }
.chart-current { stroke: #75809a; stroke-width: 1; stroke-dasharray: 3 5; }
.chart-fill { fill: #9d81ff; fill-opacity: .13; }
.chart-visits, .chart-redirects { fill: none; stroke-width: 2.6; stroke-linejoin: round; stroke-linecap: round; }
.chart-visits { stroke: #a791ff; }
.chart-redirects { stroke: #75dec8; stroke-dasharray: 5 4; }
.chart-point { fill: #a791ff; stroke: var(--panel); stroke-width: 1; }
.hourly-details { color: var(--muted); padding-top: 5px; font-size: .84rem; }
.hourly-details summary { cursor: pointer; }
.hourly-details table { margin-top: 8px; }
@media (max-width: 520px) {
  .period-picker button { padding-inline: 8px; }
}

.flow-heading-fields { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 3fr); gap: 6px 12px; }
#flow-state-label { display: block; margin: 5px 0; font-size: .9rem; font-weight: 600; }
.flow-state-row { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; min-height: 42px; }
.flow-state-row .check { align-items: center; margin: 0; }
@media (max-width: 480px) {
  .flow-heading-fields { grid-template-columns: minmax(0, 1fr); }
}
.option-toggle { margin-top: 12px; }
.editor-option-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; }
.multi-picker { border: 1px solid #394762; border-radius: 8px; background: #121a2a; }
.multi-picker summary { padding: 10px 11px; color: #e4e8fa; cursor: pointer; font-size: .9rem; overflow-wrap: anywhere; }
.multi-picker[open] summary { border-bottom: 1px solid #303c54; }
.picker-search { padding: 8px; }
.picker-options { max-height: 220px; overflow-y: auto; }
.picker-option { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 9px; min-height: 38px; margin: 0; padding: 6px 11px; cursor: pointer; font-size: .87rem; }
.picker-option > span { overflow-wrap: anywhere; }
.picker-option input { margin: 0; accent-color: #9984ff; }
.picker-option:hover, .picker-option:focus-within { background: #27344d; }
.picker-option:has(input:checked) { background: #4d3a94; color: #fff; }
.picker-option:has(input:focus-visible) { outline: 2px solid #c0aeff; outline-offset: -2px; }
.picker-code { color: #c0cbe2; font-size: .77rem; }
.picker-empty { padding: 4px 11px 10px; }
.country-mode > span { color: var(--muted); }
.country-mode:has(.switch-input:not(:checked)) > span:first-child,
.country-mode:has(.switch-input:checked) > span:last-child { color: inherit; font-weight: 700; }
.device-options { display: flex; gap: clamp(5px, 1.4vw, 14px); overflow-x: auto; padding: 2px; }
.device-options .check { flex: none; align-items: center; gap: 4px; margin: 0; white-space: nowrap; font-size: .82rem; }
.device-options .check input { margin-top: 0; width: 14px; height: 14px; }
#testIps { max-width: 26rem; }
.editor-option-fields .wide-field { grid-column: 1 / -1; }
.editor-option-fields label { margin: 0 0 4px; }
.editor-rule summary .state { float: right; margin-left: 6px; }
.variant-row {
  display: grid;
  grid-template-columns: clamp(2.2rem, 6vw, 3.5rem) minmax(0, 1fr) 5rem 2rem;
  gap: clamp(4px, 1vw, 8px);
  align-items: center;
  margin: 6px 0;
}
.variant-row input { min-width: 0; }
.variant-name, output.variant-weight { text-align: center; font-weight: 650; }
.variant-row label.variant-weight { display: flex; gap: 4px; align-items: center; margin: 0; }
.variant-row input[type="number"] { padding-inline: 5px; }
.variant-row > button { min-height: 42px; padding-inline: 0; }
@media (max-width: 768px) {
  .main-nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); overflow: visible; }
  .main-nav .nav-link { padding-inline: 5px; white-space: normal; font-size: .78rem; }
}
@media (max-width: 460px) {
  .main-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 390px) {
  .editor-option-fields { grid-template-columns: minmax(0, 1fr); }
}
.meter { height: 8px; border-radius: 4px; background: #1c2130; border: 1px solid var(--border); overflow: hidden; margin: 6px 0 12px; }
.meter span { display: block; height: 100%; background: #6f8ff0; transition: width .2s ease; }
.meter.warn span { background: #d9a441; }
.meter.danger span { background: #c25b52; }
