:root {
  font-family: var(--ui-font);
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button,input,select,textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .64; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
[hidden] { display: none !important; }
h1,h2,h3,p { margin: 0; }
h1 { font-size: clamp(1.8rem,3.2vw,2.4rem); font-weight: 740; line-height: 1.13; letter-spacing: -.045em; }
h2 { font-size: 1.12rem; letter-spacing: -.015em; }
h3 { font-size: 1rem; }
small,.muted { color: var(--muted); }
small { font-size: .81rem; }
.mono { font-variant-numeric: tabular-nums; }
.loading { display: grid; min-height: 36vh; place-items: center; color: var(--muted); }

.shell { display: grid; grid-template-columns: 246px minmax(0,1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; min-width: 0;
  padding: 23px 15px 15px; overflow-y: auto; background: var(--shell); color: var(--shell-text);
  scrollbar-color: #526785 var(--shell);
}
.brand { display: flex; align-items: center; gap: 11px; margin: 0 8px; color: #fff; min-height: 44px; }
.brand:hover { text-decoration: none; }
.brandmark {
  flex: 0 0 37px; border-radius: 12px; box-shadow: 0 6px 17px #0c2242;
}
.brand strong { font-size: 1.19rem; letter-spacing: -.045em; color: #fff; }
.workspace { margin: 25px 5px 12px; border: 1px solid var(--shell-border); background: var(--shell-control); padding: 9px 10px; border-radius: 10px; display: flex; align-items: center; gap: 9px; }
.workspace .avatar { background: #2d4267; color: #d7e5ff; flex: 0 0 29px; height: 29px; }
.workspace b { font-size: .89rem; font-weight: 650; color: #eef4ff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav { display: grid; gap: 3px; }
.nav-section { padding: 16px 13px 4px; color: #9aacc9; font-size: .72rem; letter-spacing: .085em; font-weight: 700; }
.nav a { color: var(--shell-link); border: 1px solid transparent; border-radius: var(--control-radius); padding: 8px 10px; display: flex; align-items: center; gap: 10px; min-height: 36px; font-size: .88rem; font-weight: 560; line-height: 1.15; }
.nav a:hover { color: var(--shell-strong); background: var(--shell-hover); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--shell-selected); color: var(--shell-strong); border-color: var(--shell-selected-border); }
.nav .ico { color: #b3c7f2; }
.ico { width: 19px; height: 18px; display: inline-grid; place-items: center; flex: 0 0 auto; font-size: 1rem; line-height: 1; font-weight: 720; }
.side-foot { margin: auto 2px 0; padding: 16px 5px 1px; }
.side-foot a { display: flex; align-items: center; gap: 9px; color: #b8c9e3; font-size: .83rem; padding: 9px 6px; }
.topbar { min-height: var(--topbar-height); max-width: 1510px; position: sticky; top: 0; z-index: 3; border-bottom: 1px solid var(--border); background: var(--white); display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px clamp(14px,3vw,40px); }
.topbar .location { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .91rem; white-space: nowrap; }
.topbar .location strong { color: var(--ink); }
.top-actions { display: flex; align-items: center; gap: 12px; min-width: 0; }
.user-block { display: flex; gap: 8px; align-items: center; white-space: nowrap; }
.user-block b { font-size: .875rem; max-width: 170px; overflow: hidden; text-overflow: ellipsis; }
.avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: #e8efff; color: #244da8; font-weight: 710; font-size: .82rem; }
.menu-button { display: none !important; }
.content { padding: 28px clamp(14px,3vw,40px) 44px; max-width: 1510px; }
.heading { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 25px; }
.heading p { margin-top: 8px; color: var(--muted); line-height: 1.5; }
.heading .actions { margin-bottom: 1px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 7px; min-height: 40px; padding: 8px 13px; border: 1px solid var(--control-border); border-radius: var(--control-radius); font-weight: 650; font-size: .87rem; white-space: nowrap; color: var(--ink); background: var(--white); text-decoration: none; }
.button:hover { border-color: #9eb4d5; background: var(--hover); text-decoration: none; }
.button.primary { background: var(--blue); border-color: var(--blue); color: var(--primary-ink); }
.button.primary:hover { background: var(--blue-dark); }
.button.danger { background: #fff4f6; border-color: #efc5cd; color: var(--danger); }
.button.compact { min-height: 34px; padding: 6px 9px; font-size: .81rem; }
.button.icon-only { padding: 6px 10px; }
.muted-link { color: var(--muted); }
.card { background: var(--white); border: 1px solid var(--border); border-radius: var(--card-radius); box-shadow: var(--card-shadow); min-width: 0; }
.card + .card.stacked { margin-top: 17px; }
.card-head { display: flex; gap: 9px; align-items: flex-start; justify-content: space-between; padding: 19px 20px 13px; }
.card-head p { margin-top: 4px; }
.card-body { padding: 3px 20px 19px; }
.card-body.text { display: grid; gap: 11px; }
.card-body.text p { line-height: 1.55; }
.summary-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 13px; margin-bottom: 17px; }
.summary { display: grid; gap: 9px; padding: 15px 16px 17px; min-height: 118px; }
.summary .metric-heading { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: .89rem; color: #344862; }
.summary .metric-icon { width: 30px; height: 30px; display: grid; place-items: center; color: #275cc8; background: #eaf1ff; border-radius: 8px; flex: 0 0 auto; }
.summary .metric-value { font-size: clamp(1.38rem,2.5vw,1.94rem); line-height: 1.05; font-weight: 760; letter-spacing: -.04em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.summary:nth-child(2) .metric-icon { color: #0c735f; background: #e3f5ee; }
.summary:nth-child(3) .metric-icon { color: #9b6507; background: #fff1d2; }
.summary:nth-child(4) .metric-icon { color: #6540a6; background: #f0e9fd; }
.split { display: grid; grid-template-columns: minmax(0,1.85fr) minmax(265px,1fr); gap: 17px; margin-bottom: 17px; align-items: start; }
.split.equal { grid-template-columns: repeat(2,minmax(0,1fr)); }
.chart { width: 100%; height: 212px; display: block; }
.legend { display: flex; justify-content: flex-end; align-items: center; gap: 6px; color: var(--muted); font-size: .78rem; margin-bottom: 5px; }
.legend::before { content: ""; width: 9px; height: 9px; border-radius: 3px; background: #3567d4; }
.activity-list, .status-list { list-style: none; margin: 0; padding: 0; display: grid; }
.activity-list li, .status-list li { display: flex; justify-content: space-between; align-items: center; gap: 9px; border-bottom: 1px solid #edf1f7; padding: 11px 0; font-size: .9rem; }
.activity-list li:last-child, .status-list li:last-child { border-bottom: 0; }
.activity-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.activity-title .avatar { width: 28px; height: 28px; flex: 0 0 28px; }
.active-dot::before { content: ""; height: 8px; width: 8px; border-radius: 50%; background: currentColor; }
.badge { display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 4px 9px; background: #edf1f7; color: #465970; border-radius: 999px; font-size: .78rem; font-weight: 670; line-height: 1.2; max-width: 100%; }
.badge.success { color: #096147; background: #e5f6ee; }
.badge.warning { color: var(--warning-ink); background: var(--warning-fill); }
.badge.danger { color: #9b1f3b; background: #fbe8ee; }
.badge.info { color: #2151b4; background: #e8f0ff; }
.badge.tag { background: #f6f8fc; border: 1px solid #dfe6f0; }
.badge.tag::before { content: ""; width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: var(--tag-color,#6b7c93); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.table-scroll { overflow-x: auto; min-width: 0; }
table { border-collapse: collapse; width: 100%; text-align: left; font-size: .88rem; }
th,td { padding: 12px 16px; border-bottom: 1px solid #edf1f7; vertical-align: middle; }
th:first-child,td:first-child { padding-left: 20px; }
th:last-child,td:last-child { padding-right: 20px; }
th { background: #f8faff; color: #495d77; font-size: .82rem; font-weight: 710; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafcff; }
.cell-title { font-weight: 680; }
.cell-title + small { display: block; margin-top: 4px; }
.empty { display: grid; gap: 6px; place-items: center; text-align: center; color: var(--muted); padding: 32px 21px; font-size: .9rem; }
.empty strong { color: var(--ink); font-size: .99rem; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; padding: 13px 15px; align-items: flex-end; margin-bottom: 16px; }
.filters label { flex: 1 1 118px; }
.filters .search { flex: 2 1 250px; }
.filters .button { margin-bottom: 0; }
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 12px 16px; border-top: 1px solid #edf1f7; }
.provider-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,270px),1fr)); gap: 14px; margin-bottom: 17px; }
.provider-icon { display: grid; place-items: center; height: 41px; width: 41px; border-radius: 10px; background: #e9efff; color: #2856b9; font-size: 1.06rem; font-weight: 780; }
.provider-heading { display: flex; align-items: center; gap: 10px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 15px; border-bottom: 1px solid var(--border); }
.tabs button { min-height: 38px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-weight: 650; padding: 6px 11px; }
.tabs button.active { border-bottom-color: var(--blue); color: var(--blue); }

label.field { display: grid; align-content: start; gap: 6px; min-width: 0; font-size: .875rem; color: #3a4d68; font-weight: 640; }
label.field.check { display: flex; align-items: center; gap: 9px; padding: 7px 0; }
label.field small { font-weight: 450; }
input:not([type="checkbox"]),select,textarea {
  width: 100%; min-width: 0; min-height: 40px; border: 1px solid var(--field-border); border-radius: var(--control-radius); background: var(--field); color: var(--field-ink);
  padding: 8px 10px; font-size: .91rem; font-weight: 500;
}
input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--blue); }
textarea { min-height: 85px; resize: vertical; }
select { appearance: none; padding-right: 26px; background-image: linear-gradient(45deg,transparent 50%,#4b6180 50%),linear-gradient(135deg,#4b6180 50%,transparent 50%); background-position: calc(100% - 14px) 17px,calc(100% - 9px) 17px; background-size: 5px 5px; background-repeat: no-repeat; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 13px; }
.wide { grid-column: 1 / -1; }
.field-hint { font-size: .85rem; color: var(--muted); }
.form-error { color: var(--danger); font-size: .89rem; padding-top: 9px; }
.detail { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 11px; margin: 0; }
.detail > div { background: #f5f8fd; padding: 10px 11px; border-radius: 8px; min-width: 0; }
.detail dt { color: var(--muted); font-size: .83rem; margin-bottom: 4px; }
.detail dd { margin: 0; font-size: .94rem; overflow-wrap: anywhere; }
.section-gap { margin-top: 15px; }
.note { padding: 11px 12px; border-radius: 8px; background: #edf4ff; color: #2b4b82; font-size: .9rem; line-height: 1.5; }
.note.warning { background: #fff4d9; color: #754a13; }
.preline { white-space: pre-line; overflow-wrap: anywhere; }
dialog { border: 1px solid var(--border); border-radius: var(--dialog-radius); padding: 0; width: min(680px,calc(100% - 28px)); max-height: min(85vh,850px); color: var(--ink); box-shadow: var(--dialog-shadow); }
dialog::backdrop { background: var(--divider-mask); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 15px 19px; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 1; background: #fff; }
.dialog-body { padding: 17px 19px 19px; display: grid; gap: 13px; }
.dialog-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; padding: 13px 19px; position: sticky; bottom: 0; z-index: 1; background: #fff; border-top: 1px solid var(--border); }
.qr {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  margin-inline: auto;
  padding: 16px;
  background: #fff;
  image-rendering: pixelated;
  filter: grayscale(1) contrast(8);
}
.qr[hidden], [data-qr-retry][hidden] { display: none; }
#notice { position: fixed; z-index: 9; right: 18px; bottom: 18px; max-width: min(530px,calc(100vw - 36px)); background: #142948; color: #fff; border: 1px solid #324b70; padding: 12px 15px; border-radius: 10px; box-shadow: 0 8px 22px #09101d33; font-size: .92rem; }
#notice:empty { display: none; }
.login-page { min-height: 100vh; display: grid; grid-template-columns: minmax(330px,1fr) minmax(360px,1fr); }
.login-brand { display: flex; flex-direction: column; justify-content: space-between; min-height: 440px; padding: clamp(22px,5vw,72px); background: radial-gradient(ellipse at 88% 81%,#1e48a4 0,transparent 50%),#0f1d39; color: white; }
.login-brand .brand { margin: 0; }
.login-brand h1 { max-width: 540px; font-size: clamp(2.05rem,4.4vw,4rem); line-height: 1.08; }
.login-brand p { margin-top: 10px; color: #c4d6f6; max-width: 365px; line-height: 1.55; }
.login-features { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 19px; color: #d5e4ff; font-size: .91rem; }
.login-box { display: grid; place-items: center; padding: 25px; background: #f9fbff; }
.login-box form { width: min(100%,410px); background: #fff; border: 1px solid var(--border); border-radius: 15px; padding: clamp(18px,3vw,33px); box-shadow: 0 8px 25px #182e600b; display: grid; gap: 15px; }
.login-box h2 { font-size: 1.65rem; }
.login-box .primary { width: 100%; }
.sr-only { height: 1px; width: 1px; position: absolute; overflow: hidden; clip: rect(1px,1px,1px,1px); white-space: nowrap; }
[data-theme="dark"] :is(.topbar,.button:not(.primary):not(.danger),.dialog-head,.dialog-foot,.login-box form,dialog) { background: var(--white); border-color: var(--border); }
[data-theme="dark"] :is(.login-box,.detail > div,th) { background-color: var(--field); color: var(--ink); border-color: var(--border); }
[data-theme="dark"] :is(.button:not(.primary):hover,tbody tr:hover) { background: var(--hover); }
[data-theme="dark"] :is(th,td,.activity-list li,.status-list li,.pagination) { border-color: var(--border); }
[data-theme="dark"] :is(.summary .metric-heading,label.field,th) { color: #bfd0e8; }
[data-theme="dark"] .badge { background: #27364d; color: #d0dbed; }
[data-theme="dark"] .badge.tag { border-color: #455979; }
[data-theme="dark"] .badge.success { color: var(--success); background: #14382e; }
[data-theme="dark"] .note.warning { color: var(--warning-ink); background: var(--warning-fill); }
[data-theme="dark"] :is(.badge.danger,.button.danger) { color: var(--danger); background: #4a2733; border-color: #6b3d4c; }
[data-theme="dark"] :is(.badge.info,.note) { color: #b8d1ff; background: #263a59; }
[data-theme="dark"] :is(a:not(.button):not(.brand),.tabs button.active) { color: #adcbff; }
@media (max-width: 1130px) {
  .shell { grid-template-columns: 206px minmax(0,1fr); }
  .sidebar { padding-inline: 11px; }
  .summary-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 870px) {
  .split, .split.equal { grid-template-columns: 1fr; }
  .user-block b { display: none; }
}
@media (max-width: 720px) {
  .shell { display: block; }
  .sidebar { display: none; position: fixed; top: 0; bottom: 0; left: 0; width: min(272px,calc(100vw - 46px)); z-index: 8; box-shadow: 0 0 0 100vmax #08142758; }
  .sidebar.open { display: flex; }
  .menu-button { display: inline-flex !important; }
  .topbar { min-height: var(--topbar-mobile); }
  .top-actions { gap: 6px; }
  .topbar .location .crumb { display: none; }
  .topbar .chat-link { display: none; }
  .content { padding-top: 21px; }
  .login-page { grid-template-columns: 1fr; }
  .login-brand { min-height: auto; gap: 26px; }
  .login-features { display: none; }
}
@media (max-width: 420px) {
  .form-grid,.detail { grid-template-columns: 1fr; }
  .summary { padding: 11px; }
  .summary .metric-heading { gap: 5px; }
  .summary .metric-icon { height: 24px; width: 24px; }
}
