:root {
  color-scheme: dark;
  font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei UI', 'Noto Sans CJK SC', system-ui, sans-serif;
  color: #E4E9F6;
  background: #0B1020;
  font-synthesis: none;
  --ink: #E4E9F6;
  --muted: #A4AFC8;
  --brand: #B49CFF;
  --brand-hover: #4930b7;
  --violet: #7258eb;
  --line: #29354E;
  --surface: #151D30;
  --chrome: #080D19;
  --sidebar: 234px;
  --radius: 15px;
}

*, *::before, *::after { box-sizing: border-box; }
html { min-width: 0; scroll-behavior: smooth; }
body { min-width: 0; min-height: 100vh; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; }
button, select { cursor: pointer; }
button { border: 0; }
button:disabled { cursor: default; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
img { max-width: 100%; }
main:focus { outline: none; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid #BAA4FF; outline-offset: 3px; }
[hidden] { display: none !important; }
.icon { flex: 0 0 auto; vertical-align: middle; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip { position: fixed; top: 12px; left: 12px; z-index: 50; padding: 10px 16px; transform: translateY(-150%); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.skip:focus { transform: none; }
.splash { display: grid; min-height: 100vh; place-items: center; color: var(--muted); }
.muted { color: var(--muted); font-size: .9rem; }

.button { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 15px; border: 1px solid transparent; border-radius: 9px; white-space: nowrap; font-size: .875rem; font-weight: 650; transition: background .16s, color .16s, box-shadow .16s, border-color .16s; }
.button .icon { width: 17px; height: 17px; }
.button.primary { color: #F0EDFA; background: linear-gradient(115deg,#6245DF,#5635C4); box-shadow: 0 2px 5px #4e27b831; }
.button.primary:hover { background: var(--brand-hover); }
.button.secondary { border-color: #37435E; background: var(--surface); color: #DDE5F7; }
.button.secondary:hover, .button.subtle:hover { border-color: #6354A2; background: #242544; color: #E3DAFF; }
.button.subtle { color: #ACB8D2; background: transparent; }
.button.danger { color: #F0EDFA; background: #a93242; }
.button.danger:hover { background: #8d2332; }
.button:disabled { opacity: .44; }
.button.compact { min-height: 36px; padding-inline: 12px; font-size: .81rem; }
.icon-button { width: 42px; height: 42px; display: inline-grid; flex: 0 0 auto; place-items: center; border-radius: 9px; background: transparent; color: #ABB8D1; }
.icon-button:hover { background: #242342; color: var(--brand); }
.brand { display: inline-flex; align-items: center; gap: 11px; min-width: max-content; color: #F0EDFA; }
.brand-mark { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 12px; color: #F0EDFA; background: linear-gradient(144deg, #947aff, #6445e1); box-shadow: 0 5px 18px #11092566; }
.brand-mark .icon { width: 25px; height: 25px; }
.brand strong, .brand small { display: block; line-height: 1.15; }
.brand strong { font-size: 1.23rem; letter-spacing: .09em; }
.brand small { margin-top: 4px; font-size: .58rem; font-weight: 700; letter-spacing: .14em; color: #c1bad7; }

/* Product site and role selection */
.site { min-height: 100vh; background: #0D1426; }
.site-width { width: min(100% - 72px, 1230px); margin-inline: auto; }
.site-head { position: relative; z-index: 1; border-bottom: 1px solid #ffffff12; background: #080D19; color: #F0EDFA; }
.site-head-inner { display: flex; min-height: 73px; align-items: center; justify-content: space-between; gap: 22px; }
.site-head nav, .site-actions, .hero-actions { display: flex; align-items: center; gap: 20px; }
.site-head nav a { color: #dedced; font-size: .9rem; }
.site-head nav a:hover { color: #F0EDFA; text-decoration: underline; text-underline-offset: 6px; }
.site .subtle, .site-head .subtle { color: #e1dafa; }
.site .subtle:hover, .site-head .subtle:hover { color: #F0EDFA; border-color: #a894e655; background: #ae96ff20; }
.button.light { background: #30284F; color: #E7DEFF; }
.button.light:hover { background: var(--surface); }
.site-hero { position: relative; overflow: hidden; isolation: isolate; min-height: 590px; background: #17162f; color: #F0EDFA; }
.hero-image { position: absolute; inset: 0 0 0 25%; z-index: -1; background: linear-gradient(90deg, #17162f, #17162f00 32%), url('../assets/hero.png') center right / cover no-repeat; }
.hero-content { padding-block: 85px 80px; }
.hero-tag { display: inline-flex; align-items: center; gap: 9px; padding: 6px 12px; border: 1px solid #bba9ff4d; border-radius: 8px; background: #9381e21b; color: #e3dafd; font-size: .84rem; font-weight: 650; }
.hero-tag span, .overview-banner i, .side-note span { width: 7px; height: 7px; border-radius: 50%; background: #a990ff; box-shadow: 0 0 9px #9b7cf099; }
.hero-content h1 { max-width: 620px; margin-top: 24px; font-size: clamp(2.75rem, 5.2vw, 5.2rem); letter-spacing: -.055em; line-height: 1.12; font-weight: 780; text-wrap: balance; }
.hero-content > p { max-width: 475px; margin-top: 23px; color: #e1deef; font-size: 1.08rem; line-height: 1.8; }
.hero-actions { margin-top: 28px; gap: 12px; }
.hero-actions .button { min-height: 50px; padding-inline: 20px; }
.hero-actions .primary { background: #7455ee; }
.hero-actions .primary:hover { background: #8b6dff; }
.button.glass { color: #F0EDFA; border-color: #bba9ff65; background: #ffffff12; }
.button.glass:hover { background: #ffffff26; }
.hero-content .hero-caption { margin-top: 19px; color: #c1bdd8; font-size: .85rem; }
.site-section { padding-block: 72px; }
.site-process { padding-block: 67px; background: #10192C; }
.site-process .button { margin-top: 26px; }
.section-title h2 { font-size: clamp(1.62rem, 3.5vw, 2.4rem); letter-spacing: -.045em; }
.section-title p { margin-top: 12px; color: var(--muted); line-height: 1.6; }
.feature-grid { margin-top: 28px; display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; }
.feature { min-width: 0; padding: 25px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.feature-icon { display: inline-grid; width: 47px; height: 47px; place-items: center; border-radius: 12px; background: #302757; color: #C5B4FF; }
.feature-icon .icon { width: 23px; height: 23px; }
.feature h3 { margin: 14px 0 8px; font-size: 1.08rem; }
.feature p { color: var(--muted); line-height: 1.65; font-size: .94rem; }
.step-list { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; list-style: none; padding: 0; margin: 25px 0 0; }
.step-list li { display: grid; gap: 8px; border-top: 2px solid #8a70eb; padding: 15px 2px 0; }
.step-list li span { color: #AFBBD3; font-size: .9rem; line-height: 1.55; }
.site-footer { padding-block: 25px; color: #F0EDFA; background: #080D19; }
.site-footer .site-width { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.site-footer p { color: #d5d1e7; font-size: .86rem; }
.migration-note { padding-top: 17px; }
.migration-note .callout { margin-bottom: 0; }
.audience { margin-top: 24px; padding: 18px 0 0; border-top: 1px solid var(--line); }
.audience h3 { margin-bottom: 8px; font-size: 1.03rem; }
.audience p { color: var(--muted); line-height: 1.65; }
.auth { background: radial-gradient(ellipse at 55% 0, #221C3A, #0B1020 58%); }
.auth-main { display: grid; min-height: calc(100vh - 74px); align-items: start; justify-items: center; padding: clamp(26px, 8vh, 86px) 18px 40px; }
.auth-card { width: min(100%, 555px); padding: 35px; border: 1px solid #303955; border-radius: 20px; background: var(--surface); box-shadow: 0 18px 55px #271b5a11; }
.auth-card h1 { margin-top: 17px; font-size: 2rem; letter-spacing: -.03em; }
.auth-card > p { margin: 9px 0 22px; color: var(--muted); line-height: 1.65; }
.persona-list { display: grid; gap: 10px; }
.persona { display: grid; width: 100%; min-height: 78px; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 11px 13px; text-align: left; background: #121B2F; border: 1px solid var(--line); border-radius: 12px; }
.persona:hover { border-color: #7967CA; background: #21213E; }
.persona strong, .persona small, .profile-name strong, .profile-name small { display: block; }
.persona strong { margin-bottom: 4px; }
.persona small, .auth-footer { color: var(--muted); line-height: 1.55; }
.persona .icon { color: #B5A4ED; }
.auth-footer { display: flex; gap: 7px; align-items: center; margin-top: 19px; font-size: .85rem; }
.auth-footer .icon { width: 17px; height: 17px; }
.auth .button.subtle { color: #BAC3DE; }
.auth .site-head .button.subtle { color: #e1dafa; }

/* Workspace shell */
.workspace { min-height: 100vh; }
.sidebar { position: fixed; z-index: 4; inset: 0 auto 0 0; width: var(--sidebar); min-height: 0; display: flex; flex-direction: column; overflow: hidden auto; padding: 24px 14px 14px; background: linear-gradient(163deg, #111A2B, #080D19 59%); color: #d6d8ed; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 0 7px; }
.workspace-label { margin: 22px 2px 7px; padding: 10px; display: flex; align-items: center; gap: 8px; min-height: 54px; border: 1px solid #ffffff14; border-radius: 9px; background: #ffffff09; color: #e5e2f8; font-size: .86rem; font-weight: 650; }
.workspace-label > .icon { color: #a892ff; width: 18px; height: 18px; }
.workspace-label small { display: block; color: #b3aacd; font-size: .72rem; font-weight: 500; margin-top: 2px; }
.nav-group { margin-top: 14px; }
.nav-group h2 { margin: 0 0 5px 10px; color: #aca8c8; font-size: .72rem; font-weight: 650; letter-spacing: .065em; }
.nav-item { position: relative; display: flex; min-height: 41px; width: 100%; align-items: center; gap: 10px; padding: 8px 10px; margin: 2px 0; color: #d7d6e9; border-radius: 8px; background: transparent; font-size: .87rem; text-align: left; }
.nav-item > .icon { width: 18px; height: 18px; color: #b0aacd; }
.nav-item:hover { background: #ffffff13; color: #F0EDFA; }
.nav-item.active { background: linear-gradient(115deg,#6550D7,#5040A9); color: #F0EDFA; font-weight: 700; box-shadow: 0 3px 12px #100b2860; }
.nav-item.active > .icon { color: #F0EDFA; }
.nav-count { margin-left: auto; min-width: 22px; padding: 2px 5px; text-align: center; border-radius: 6px; background: #352B61; color: #E5DCFF; }
.side-bottom { margin-top: auto; padding-top: 16px; }
.side-note { display: flex; align-items: center; gap: 9px; margin: 7px 10px 2px; min-height: 28px; font-size: .75rem; color: #c6bce6; }
.mobile-close, .menu-toggle, .nav-scrim, .mobile-tabs, .mobile-sort { display: none; }
.work-body { margin-left: var(--sidebar); min-width: 0; }
.topbar { position: sticky; z-index: 3; top: 0; display: flex; align-items: center; justify-content: space-between; min-height: 67px; gap: 12px; padding: 0 28px; background: #101728; border-bottom: 1px solid var(--line); }
.crumb, .top-actions, .profile-button { display: flex; min-width: 0; align-items: center; gap: 9px; }
.crumb { color: #A9B5CF; font-size: .9rem; white-space: nowrap; }
.crumb strong { color: var(--ink); overflow: hidden; text-overflow: ellipsis; }
.crumb .icon { width: 14px; height: 14px; }
.top-actions { gap: 14px; }
.global-search { display: inline-flex; min-height: 40px; align-items: center; gap: 8px; padding: 0 10px; color: #AEBAD5; border: 1px solid #2B374F; background: #11192D; border-radius: 8px; white-space: nowrap; font-size: .84rem; }
.global-search:hover { border-color: #6255A7; }
.global-search .icon { width: 17px; height: 17px; }
kbd { padding: 2px 5px; margin-left: 13px; border: 1px solid #313D56; border-radius: 5px; background: var(--surface); font: .66rem/1.2 'Segoe UI', sans-serif; color: #A7B4D0; }
.top-profile { position: relative; }
.profile-button { padding: 3px 2px; color: var(--ink); background: transparent; border-radius: 9px; text-align: left; }
.profile-button > .icon { width: 14px; height: 14px; color: #ABB7D0; }
.profile-name { min-width: 62px; }
.profile-name strong { font-size: .84rem; }
.profile-name small { margin-top: 2px; font-size: .72rem; color: var(--muted); }
.avatar { display: grid; flex: 0 0 auto; width: 35px; height: 35px; place-items: center; border-radius: 10px; background: #332959; color: #CFBCFF; font-weight: 760; font-size: .92rem; }
.avatar.viewer { background: #1D4139; color: #9CE4C9; }
.avatar.admin { background: #332959; color: #CDBBFF; }
.persona .avatar { width: 43px; height: 43px; }
.profile-menu { position: absolute; top: calc(100% + 9px); right: 0; z-index: 6; display: grid; min-width: 212px; padding: 6px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); box-shadow: 0 11px 25px #20274922; }
.profile-menu a, .profile-menu button { display: flex; align-items: center; min-height: 39px; gap: 8px; padding: 5px 8px; background: var(--surface); text-align: left; border-radius: 6px; font-size: .86rem; white-space: nowrap; }
.profile-menu .icon { width: 17px; height: 17px; color: var(--brand); }
.profile-menu a:hover, .profile-menu button:hover { background: #232843; }
.work-main { width: min(100%, 1510px); margin-inline: auto; padding: 27px 28px max(35px, env(safe-area-inset-bottom)); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 19px; }
.overline { margin-bottom: 6px; color: #B7A8F0; font-size: .78rem; font-weight: 650; }
.page-head h1 { font-size: clamp(1.65rem, 2.8vw, 2.26rem); line-height: 1.25; letter-spacing: -.045em; }
.page-head p { margin-top: 7px; color: var(--muted); line-height: 1.55; font-size: .94rem; }
.page-actions { display: flex; justify-content: flex-end; flex: 0 0 auto; }

/* Overview, reporting and tables */
.overview-banner { position: relative; isolation: isolate; display: flex; justify-content: space-between; gap: 18px; align-items: center; min-height: 137px; overflow: hidden; margin-bottom: 17px; padding: 20px 25px; border-radius: var(--radius); background: linear-gradient(101deg, #25284b, #302660 63%, #4b3492); color: #F0EDFA; }
.overview-banner::before { position: absolute; z-index: -1; inset: 0; background-image: repeating-radial-gradient(ellipse at 92% 12%, transparent 0 22px, #d2baff12 23px 24px, transparent 25px 44px); content: ''; }
.overview-banner span { display: flex; gap: 7px; align-items: center; color: #e1d7fa; font-size: .78rem; }
.overview-banner h2 { margin: 6px 0 5px; font-size: clamp(1.26rem, 2.6vw, 1.74rem); letter-spacing: -.033em; }
.overview-banner p { color: #e5e1f2; font-size: .87rem; line-height: 1.5; }
.banner-button { background: #ffffff16; border-color: #e8daff58; color: #F0EDFA; }
.banner-button:hover { background: #ffffff28; }
.metric-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; margin-bottom: 16px; }
.metric, .panel { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 2px 6px #1b265005; }
.metric { display: grid; min-height: 128px; padding: 13px 15px; align-content: start; }
.metric:hover { border-color: #6656AB; box-shadow: 0 5px 16px #42379212; }
.metric-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 7px; }
.metric-top > .icon { width: 15px; height: 15px; color: #9AA7C4; }
.metric-icon { display: inline-grid; width: 36px; height: 36px; place-items: center; border-radius: 9px; }
.metric-icon .icon { width: 19px; height: 19px; }
.metric-icon.violet, .badge.violet { color: #CBBBFF; background: #312852; }
.metric-icon.blue, .badge.blue { color: #A8CAFF; background: #203456; }
.metric-icon.amber, .badge.amber { color: #F5CE8A; background: #41301B; }
.metric-icon.green, .badge.green { color: #A0E5CB; background: #1B392F; }
.badge.red { color: #FFB3C5; background: #472935; }
.badge.neutral { color: #BDCAE3; background: #29344D; }
.metric-label { color: #BECAE2; font-size: .81rem; font-weight: 650; }
.metric strong { margin-top: 2px; font-size: 1.79rem; line-height: 1.09; font-variant-numeric: tabular-nums; letter-spacing: -.045em; }
.metric small { margin-top: 4px; color: var(--muted); font-size: .75rem; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0,1.75fr) minmax(226px,1fr); gap: 15px; margin-bottom: 16px; }
.panel { overflow: hidden; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 17px 17px 12px; }
.panel-head h2 { font-size: 1.03rem; letter-spacing: -.025em; }
.panel-head p { margin-top: 4px; color: var(--muted); font-size: .8rem; line-height: 1.45; }
.customer-tabs { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 14px; padding: 5px; border: 1px solid var(--line); border-radius: 11px; background: #10182A; }
.customer-tabs a { display: grid; place-items: center; min-height: 40px; padding: 0 13px; border-radius: 7px; color: var(--muted); font-weight: 650; font-size: .88rem; }
.customer-tabs a:hover, .customer-tabs a[aria-current] { background: #29234B; color: #E6DDFF; }
.client-hero { background: linear-gradient(115deg,#20284B,#282657 62%,#3A2875); }
.panel-empty { padding: 15px 17px 22px; color: var(--muted); line-height: 1.65; }
.client-task-list, .notification-list { list-style: none; margin: 0; padding: 0 17px 8px; }
.client-task-list li { display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: center; gap: 10px; padding: 11px 0; border-top: 1px solid var(--line); }
.client-task-list li > span:not(.badge) { color: var(--muted); white-space: nowrap; font-size: .78rem; }
.notification-list li { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 11px; padding: 12px 0; border-top: 1px solid var(--line); }
.notification-list p { margin-top: 4px; color: var(--muted); font-size: .83rem; line-height: 1.5; }
.notification-list .feature-icon { width: 36px; height: 36px; }
.notification-list .feature-icon .icon { width: 18px; height: 18px; }
.notification-actions { display: flex; align-items: center; gap: 6px; }
.segments { display: flex; flex: 0 0 auto; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: #10182A; }
.segments button { min-height: 34px; padding: 0 9px; border-radius: 6px; background: transparent; color: var(--muted); font-size: .83rem; }
.segments button:hover, .segments button[aria-pressed="true"] { background: #332955; color: #E5D9FF; }
.personal-grid { display: grid; grid-template-columns: minmax(0,1.25fr) minmax(0,1fr); align-items: start; gap: 14px; }
.settings-panel { max-width: 840px; }
.settings-form { display: grid; gap: 13px; padding: 4px 17px 18px; }
.settings-form .button { justify-self: start; }
.settings-form fieldset { display: grid; gap: 7px; margin: 0; padding: 8px 11px; border: 1px solid var(--line); border-radius: 8px; }
.settings-form legend { padding: 0 6px; color: var(--muted); font-size: .83rem; }
.settings-form fieldset label { display: flex; align-items: center; min-height: 36px; gap: 8px; color: var(--ink); }
.settings-form input[type="checkbox"] { width: 17px; height: 17px; accent-color: #947AFF; }
.account-header { display: flex; align-items: center; gap: 10px; }
.account-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 11px; padding: 4px 17px 13px; margin: 0; }
.account-fields div { padding: 9px 0; border-top: 1px solid var(--line); }
.account-fields dt { color: var(--muted); font-size: .8rem; }
.account-fields dd { margin: 4px 0 0; overflow-wrap: anywhere; }
.account-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 17px 16px; }
.record-history ul { list-style: none; margin: 0; padding: 0; }
.record-history li { display: flex; justify-content: space-between; gap: 8px; padding: 5px 0; border-top: 1px solid var(--line); font-size: .84rem; }
.record-history time { color: var(--muted); white-space: nowrap; }
.lab-summary { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-bottom: 14px; color: var(--muted); }
.lab-summary > span { margin-right: .35rem; padding: .25rem .5rem; border: 1px solid #4c427a; border-radius: 6px; color: #ded2ff; }
.lab-summary strong { color: var(--ink); }
.lab-page-actions { display: flex; justify-content: flex-end; margin-bottom: 12px; }
.standalone-lab { margin-top: 18px; }
.lab-panel + .lab-panel { margin-top: 12px; }
.lab-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .38rem; }
.lab-panel th, .lab-panel td { vertical-align: middle; }
.lab-table td:last-child { min-width: 9rem; }
.lab-form { display: grid; gap: .8rem; }
.inline-lab-form { max-width: 33rem; padding: 0 18px 18px; }
.inline-lab-form .button { justify-self: start; }
.lab-form textarea { min-height: 5rem; }
.lab-check { color: var(--muted); min-height: 36px; display: flex; align-items: center; gap: .5rem; }
.lab-preview { width: 100%; min-height: min(40vh, 27rem); background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.lab-filters .button { min-height: 42px; }
.dialog-body .lab-actions { margin-bottom: .75rem; }
.chart-panel, .flow-panel { height: 100%; }
.range-label select { min-width: 96px; }
select, input, textarea { min-width: 0; border: 1px solid #35415D; border-radius: 8px; background: var(--surface); }
select { min-height: 39px; padding: 5px 28px 5px 9px; appearance: none; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%23aab5d0' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") right 9px center / 12px 8px no-repeat; font-size: .83rem; }
.bar-chart { display: grid; min-width: 0; grid-template-columns: 22px 1fr; gap: 7px; margin: 5px 17px 0 14px; height: 146px; }
.bar-guides { display: flex; flex-direction: column; justify-content: space-between; align-items: end; padding: 0 1px 22px 0; color: #AAB6D0; font-size: .73rem; line-height: 1; }
.bar-area { display: grid; gap: 2px; align-items: end; background: repeating-linear-gradient(to bottom, #2D3950 0 1px, transparent 1px 25%); background-size: 100% calc(100% - 22px); background-repeat: no-repeat; }
.bar-area.grid-6 { grid-template-columns: repeat(6,minmax(0,1fr)); }
.bar-area.grid-7 { grid-template-columns: repeat(7,minmax(0,1fr)); }
.bar-day { min-width: 0; height: 100%; display: grid; grid-template-rows: 1fr 22px; }
.bar-pair { display: flex; gap: clamp(2px, 1vw, 7px); align-items: end; justify-content: center; border-bottom: 1px solid #34415C; }
.bar { width: min(27%,20px); border-radius: 4px 4px 0 0; background: #7658ee; }
.bar.second { background: #c4b5fd; }
.bar.h-0 { height: 0; }.bar.h-1 { height: 10%; }.bar.h-2 { height: 20%; }.bar.h-3 { height: 30%; }.bar.h-4 { height: 40%; }.bar.h-5 { height: 50%; }.bar.h-6 { height: 60%; }.bar.h-7 { height: 70%; }.bar.h-8 { height: 80%; }.bar.h-9 { height: 90%; }.bar.h-10 { height: 100%; }
.bar-label { align-self: end; text-align: center; white-space: nowrap; color: #AAB6D0; font-size: .73rem; }
.chart-legend { display: flex; justify-content: center; gap: 18px; padding: 12px 10px 15px; color: #AAB7D4; }
.chart-legend span { display: flex; align-items: center; gap: 6px; font-size: .76rem; }
.chart-legend i { width: 9px; height: 9px; border-radius: 2px; background: #7658ee; }
.chart-legend span:nth-child(2) i { background: #c4b5fd; }
.stages { display: grid; padding: 0 14px 10px; }
.stage { display: grid; grid-template-columns: 12px 1fr auto; align-items: center; gap: 9px; padding: 9px 5px; border-top: 1px solid #2A3650; }
.stage:hover { background: #222342; }
.stage-dot { width: 9px; height: 9px; border-radius: 50%; background: #a1a8ba; }
.stage-dot.violet { background: #7a5bf0; }.stage-dot.amber { background: #df9c25; }.stage-dot.green { background: #379d76; }
.stage strong, .stage small { display: block; }
.stage strong { font-size: .85rem; }
.stage small { margin-top: 3px; font-size: .73rem; color: var(--muted); }
.stage b { font-size: 1.08rem; min-width: 20px; text-align: right; }
.callout { display: flex; align-items: center; gap: 10px; min-height: 49px; margin-bottom: 16px; padding: 10px 14px; border: 1px solid #51437F; border-radius: 10px; background: #21213D; color: #D4CAF7; font-size: .88rem; line-height: 1.45; }
.callout .icon { width: 18px; height: 18px; }
.sample-total { flex: 0 0 auto; display: flex; align-items: center; gap: 7px; margin-left: auto; }
.sample-total small { font-size: .75rem; }
.sample-total strong { font-size: 1.13rem; }
.filters { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; padding: 2px 17px 12px; }
.vis-label { display: grid; gap: 4px; }
.vis-label > span { font-size: .75rem; color: #A4B0CA; }
.vis-label select { min-width: 120px; }
.search-field { display: flex; min-height: 40px; align-items: center; gap: 8px; padding: 0 10px; border: 1px solid #35415D; border-radius: 8px; background: var(--surface); color: #A6B5D0; }
.filters .search-field { flex: 0 1 300px; }
.search-field:focus-within { outline: 2px solid #b3a0fc; outline-offset: 1px; }
.search-field .icon { width: 17px; height: 17px; }
.search-field input { width: 100%; min-height: 36px; padding: 3px 0; border: 0; outline: none; color: var(--ink); background: transparent; font-size: .89rem; }
.search-field input:focus-visible { outline: none; }
.search-field input::placeholder { color: #9BA9C6; }
.filters .subtle { min-height: 40px; }
.results-meta { padding: 0 17px 8px; color: var(--muted); min-height: 27px; font-size: .82rem; }
.table-wrap { overflow-x: auto; border-top: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; color: #D2DAED; font-size: .84rem; }
th { background: #11192D; color: #BCC7DF; text-align: left; font-weight: 650; white-space: nowrap; }
th, td { padding: 10px 13px; border-bottom: 1px solid #29344D; }
th:first-child, td:first-child { padding-left: 17px; }
td:last-child { padding-right: 15px; }
.data-table td { min-width: 82px; }
.data-table td:first-child { min-width: 158px; }
.data-table tr:hover td { background: #19243A; }
.sort { display: inline-flex; align-items: center; gap: 4px; padding: 0; color: inherit; background: transparent; font-weight: 650; }
.sort .icon { color: #9AA8C4; width: 13px; height: 13px; }
[aria-sort] .sort { color: #C4B4FF; }
.row-link { padding: 0; color: #C8B8FF; background: transparent; font-size: .88rem; text-align: left; }
.row-link:hover, .text-button:hover { text-decoration: underline; text-underline-offset: 3px; }
.row-link strong, .row-link small { display: block; }
.row-link small { margin-top: 3px; color: #A9B6D0; font-size: .73rem; }
.row-action { text-align: right; white-space: nowrap; }
.row-action button { display: inline-flex; align-items: center; gap: 2px; padding: 5px 0 5px 5px; background: transparent; color: #C8BAFF; font-size: .8rem; font-weight: 650; }
.row-action .icon { width: 14px; height: 14px; }
.row-action button:hover { text-decoration: underline; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 7px; border-radius: 6px; white-space: nowrap; font-size: .75rem; font-weight: 650; }
.badge > span { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.table-footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 17px; }
.page-size, .pagination { display: flex; align-items: center; gap: 8px; color: #AAB7D1; font-size: .81rem; white-space: nowrap; }
.page-size select { min-height: 36px; }
.empty-state { display: grid; justify-items: center; gap: 9px; padding: 30px 15px; border-top: 1px solid var(--line); text-align: center; }
.empty-state h3 { font-size: 1rem; }
.empty-state p { color: var(--muted); font-size: .89rem; }

/* Dialogs and feedback */
dialog { width: min(100% - 28px, 620px); max-height: min(87vh, 850px); max-height: min(87dvh, 850px); padding: 0; overflow: auto; border: 1px solid #35415F; border-radius: 17px; color: var(--ink); background: var(--surface); box-shadow: 0 18px 80px #11082c55; }
dialog::backdrop { background: #14152fc0; }
.dialog-head { display: flex; justify-content: space-between; gap: 10px; padding: 18px 17px 13px 20px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { overflow-wrap: anywhere; font-size: 1.23rem; }
.dialog-head p { margin-top: 5px; font-size: .87rem; color: var(--muted); }
.dialog-head .icon-button { width: 36px; height: 36px; }
.dialog-body { padding: 17px 20px; }
.dialog-footer, .form-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.dialog-footer { padding: 12px 20px max(13px,env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: #11192D; }
.detail-grid, .editor-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 15px; margin: 0; }
.detail-grid dt { font-size: .78rem; color: var(--muted); }
.detail-grid dd { margin: 4px 0 0; overflow-wrap: anywhere; font-size: .94rem; }
.text-button { padding: 0; color: #C1ACFF; background: transparent; text-align: left; }
.record-note { display: grid; gap: 5px; margin-top: 15px; padding: 11px 13px; border-radius: 9px; background: #19223B; }
.record-note h3 { font-size: .86rem; }
.record-note p { color: #BBC6E0; font-size: .88rem; line-height: 1.55; overflow-wrap: anywhere; white-space: pre-wrap; }
.editor-field { display: grid; gap: 5px; color: #CED7EA; font-size: .87rem; font-weight: 650; }
.editor-field.wide { grid-column: 1 / -1; }
.editor-field input, .editor-field select, .editor-field textarea { width: 100%; min-height: 42px; padding: 7px 9px; font-weight: 500; font-size: .93rem; }
.editor-field select { padding-right: 25px; }
.editor-field textarea { resize: vertical; }
.editor-field small { color: var(--muted); font-weight: 500; }
.form-error { margin-top: 12px; color: #FFACBD; font-size: .89rem; }
.search-results { display: grid; gap: 3px; margin-top: 10px; }
.search-result { min-height: 41px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 8px; }
.search-result:hover { background: #222743; }
.search-result .icon { color: #BAA9FF; width: 17px; height: 17px; }
.install-list { display: grid; gap: 15px; margin: 0; }
.install-list dt { font-weight: 700; }
.install-list dd { margin: 5px 0 0; color: var(--muted); line-height: 1.65; }
.toast { position: fixed; z-index: 20; right: 20px; bottom: max(18px,env(safe-area-inset-bottom)); max-width: min(calc(100% - 40px),440px); padding: 11px 16px; border-radius: 9px; background: #302749; color: #F0EDFA; box-shadow: 0 4px 20px #35266848; font-size: .85rem; }
dialog[open] + .toast { z-index: 20; }

@media (max-width: 1050px) {
  :root { --sidebar: 200px; }
  .work-main, .topbar { padding-inline: 20px; }
  .sidebar { padding-inline: 11px; }
  .metric-grid, .dashboard-grid { gap: 11px; }
}

@media (max-width: 790px) {
  :root { --sidebar: min(284px, 84vw); }
  .work-body { margin-left: 0; }
  .sidebar { visibility: hidden; transform: translateX(-100%); transition: transform .18s, visibility .18s; padding: max(18px, env(safe-area-inset-top)) 13px 12px; }
  .drawer-open .sidebar { visibility: visible; transform: none; }
  .drawer-open .nav-scrim { display: block; position: fixed; inset: 0; z-index: 4; width: 100%; height: 100%; background: #12132a8c; }
  .drawer-open .sidebar { z-index: 5; }
  .mobile-close, .menu-toggle { display: inline-grid; }
  .mobile-close { color: #e3def6; }
  .topbar { min-height: 59px; justify-content: start; padding-inline: 12px; }
  .top-actions { margin-left: auto; }
  .metric-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .site-width { width: calc(100% - 40px); }
  .site-head nav { gap: 12px; }
  .site-hero { min-height: 520px; }
  .hero-content { padding-block: 62px; }
  .hero-image { inset-inline-start: 16%; background-image: linear-gradient(90deg,#17162f,#17162f12 75%),url('../assets/hero.png'); }
  .feature { padding: 17px; }
}

@media (max-width: 580px) {
  .work-main { padding: 17px 12px calc(77px + env(safe-area-inset-bottom)); }
  .mobile-tabs { position: fixed; z-index: 3; inset: auto 0 0; display: grid; grid-template-columns: repeat(4, 1fr); padding: 4px 8px max(4px, env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); }
  .mobile-tabs a { display: grid; min-height: 48px; gap: 1px; place-content: center; justify-items: center; color: #A0AECB; font-size: .72rem; }
  .mobile-tabs a[aria-current] { color: #C4B4FF; font-weight: 700; }
  .mobile-tabs .icon { width: 18px; height: 18px; }
  .mobile-sort { display: grid; }
  .topbar { gap: 4px; }
  .crumb > span, .crumb > .icon, .profile-name, .global-search span, .global-search kbd { display: none; }
  .crumb { font-size: .9rem; }
  .top-actions { gap: 8px; }
  .global-search { min-width: 40px; justify-content: center; }
  .top-profile .avatar { width: 32px; height: 32px; }
  .top-profile .profile-button { gap: 4px; }
  .page-head { align-items: flex-start; flex-wrap: wrap; gap: 8px; margin-bottom: 13px; }
  .page-head p { font-size: .88rem; }
  .page-actions .button { min-height: 41px; }
  .overview-banner { flex-wrap: wrap; gap: 12px; margin-bottom: 11px; padding: 14px; }
  .overview-banner p { font-size: .82rem; }
  .overview-banner .button { min-height: 38px; }
  .metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; margin-bottom: 11px; }
  .metric { min-height: 115px; padding: 10px 12px; }
  .metric strong { font-size: 1.55rem; }
  .dashboard-grid { grid-template-columns: minmax(0,1fr); margin-bottom: 12px; }
  .personal-grid { grid-template-columns: minmax(0,1fr); }
  .notification-list li { grid-template-columns: auto minmax(0,1fr); }
  .notification-actions { grid-column: 2; flex-wrap: wrap; }
  .client-task-list { padding-inline: 12px; }
  .client-task-list li { grid-template-columns: minmax(0,1fr) auto; }
  .client-task-list li .badge { grid-column: 1; justify-self: start; }
  .panel-head { padding-inline: 12px; }
  .filters { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); padding-inline: 12px; gap: 8px; }
  .filters .search-field { grid-column: 1 / -1; }
  .vis-label select { width: 100%; min-width: 0; min-height: 43px; }
  .filters .button { justify-self: start; padding-inline: 8px; }
  .results-meta { padding-inline: 12px; }
  .table-footer { flex-wrap: wrap; padding-inline: 12px; }
  .callout { flex-wrap: wrap; }
  .callout > span { flex: 1 1 200px; }
  .sample-total { margin-left: 26px; }
  .data-table { overflow: visible; }
  .data-table table, .data-table tbody { display: block; }
  .data-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
  .data-table thead:focus-within { position: static; width: auto; height: auto; overflow: auto; clip: auto; display: block; }
  .data-table tr { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px 9px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .data-table th { padding: 6px; }
  .data-table td { padding: 2px 0; min-width: 0; min-height: 35px; overflow-wrap: anywhere; border: 0; }
  .data-table td:first-child { grid-column: 1 / -1; min-width: 0; padding-left: 0; }
  .data-table td:not(:first-child):not(.row-action)::before { display: block; margin-bottom: 3px; color: #A9B7D2; font-size: .73rem; content: attr(data-label); }
  .data-table .row-action { grid-column: 1 / -1; min-height: 0; text-align: left; padding-right: 0; }
  .row-action button { min-height: 40px; padding: 2px 2px 2px 0; }
  .recent-panel th, .recent-panel td { padding: 8px 7px; }
  .recent-panel th:first-child, .recent-panel td:first-child { padding-left: 11px; }
  .recent-panel table { min-width: 405px; }
  .site-width { width: calc(100% - 28px); }
  .site-head-inner { min-height: 62px; gap: 8px; }
  .site-head nav { display: none; }
  .site-actions { gap: 2px; }
  .site-actions .button { padding-inline: 8px; font-size: .8rem; }
  .site-actions .button .icon { width: 14px; }
  .site-hero { min-height: 0; }
  .hero-content { padding: 43px 0 49px; }
  .hero-content h1 { font-size: clamp(2.35rem, 9.3vw, 3.75rem); margin-top: 16px; }
  .hero-content > p { margin-top: 15px; color: #F0EDFA; font-size: .99rem; }
  .hero-content .hero-caption { font-size: .8rem; color: #e5dff2; }
  .hero-image { inset-inline: 0; background-image: linear-gradient(85deg,#17162fef,#17162f89),url('../assets/hero.png'); background-position: center; }
  .hero-actions { gap: 8px; flex-wrap: wrap; margin-top: 17px; }
  .hero-actions .button { min-height: 47px; padding-inline: 13px; }
  .site-section, .site-process { padding-block: 44px; }
  .feature-grid, .step-list { grid-template-columns: minmax(0,1fr); gap: 9px; }
  .site-footer .site-width { flex-wrap: wrap; gap: 11px; }
  .site-footer p { order: 3; flex-basis: 100%; }
  .auth-card { padding: 20px; }
  .auth-card h1 { font-size: 1.62rem; }
  .detail-grid, .editor-grid { gap: 11px; }
  .dialog-body { padding-inline: 14px; }
  .toast { bottom: calc(68px + env(safe-area-inset-bottom)); }
  .editor-field input, .editor-field select, .editor-field textarea, .search-field input, .vis-label select { font-size: 1rem; }
}

@media (max-width: 340px) {
  .site-actions .subtle { display: none; }
  .editor-grid { grid-template-columns: minmax(0,1fr); }
  .table-footer { padding-inline: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}
