:root {
  --canvas: #f5f7fa;
  --surface: #ffffff;
  --surface-subtle: #f8fafc;
  --ink: #162033;
  --ink-strong: #0d1524;
  --muted: #657084;
  --muted-light: #8b96a8;
  --line: #dfe5ed;
  --line-soft: #edf1f5;
  --nav: #152238;
  --nav-deep: #0f1a2c;
  --primary: #326de6;
  --primary-hover: #255ac2;
  --primary-soft: #eaf1ff;
  --success: #12805c;
  --success-soft: #e5f6ef;
  --warning: #946200;
  --warning-soft: #fff3d6;
  --danger: #b52f3b;
  --danger-soft: #fdebed;
  --shadow-sm: 0 1px 2px rgba(15, 31, 54, .04);
  --shadow-md: 0 10px 30px rgba(15, 31, 54, .09);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--canvas); }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button:disabled, input:disabled, select:disabled { cursor: not-allowed; opacity: .58; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid rgba(50, 109, 230, .28); outline-offset: 2px; }
[hidden] { display: none !important; }

.skip-link { position: fixed; left: 16px; top: -80px; z-index: 100; padding: 10px 14px; color: white; background: var(--primary); border-radius: 6px; }
.skip-link:focus { top: 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.eyebrow { margin: 0 0 8px; color: var(--primary); font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.muted { color: var(--muted); line-height: 1.55; }
.small { font-size: 13px; }

.brand-lockup { position: relative; z-index: 1; display: flex; align-items: center; gap: 11px; font-size: 15px; font-weight: 800; letter-spacing: .08em; }
.brand-mark { display: grid; flex: 0 0 auto; place-items: center; width: 34px; height: 34px; color: white; background: var(--primary); border: 1px solid rgba(255,255,255,.18); border-radius: 8px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); font-size: 17px; letter-spacing: 0; }

.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(420px, .95fr); }
.login-story { position: relative; overflow: hidden; display: flex; min-height: 100vh; flex-direction: column; justify-content: space-between; padding: 46px 64px; color: white; background: linear-gradient(145deg, #111d31 0%, #172a4b 62%, #18355e 100%); }
.login-story::before { content: ""; position: absolute; inset: 0; opacity: .18; background-image: linear-gradient(rgba(255,255,255,.08) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.08) 1px, transparent 1px); background-size: 56px 56px; mask-image: linear-gradient(to bottom right, transparent 8%, #000 80%); }
.login-story::after { content: ""; position: absolute; width: 420px; height: 420px; right: -180px; bottom: -180px; background: var(--primary); border: 72px solid rgba(255,255,255,.08); border-radius: 50%; }
.story-copy { position: relative; z-index: 1; max-width: 680px; margin: 11vh 0 8vh; }
.story-copy .eyebrow { color: #8fb6ff; }
.story-copy h1 { max-width: 620px; margin: 0 0 22px; font-size: clamp(42px, 4.6vw, 68px); line-height: 1.06; letter-spacing: -.045em; }
.story-copy > p:not(.eyebrow) { max-width: 600px; margin: 0; color: rgba(255,255,255,.72); font-size: 17px; line-height: 1.75; }
.platform-points { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; margin-top: 42px; overflow: hidden; background: rgba(255,255,255,.13); border: 1px solid rgba(255,255,255,.14); border-radius: 10px; }
.platform-points div { display: grid; gap: 7px; padding: 18px; background: rgba(11,28,50,.46); }
.platform-points strong { font-size: 13px; }
.platform-points span { color: rgba(255,255,255,.58); font-size: 11px; line-height: 1.55; }
.trust-strip { position: relative; z-index: 1; display: flex; gap: 26px; color: rgba(255,255,255,.66); font-size: 12px; }
.trust-strip span::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 8px; background: #62d7aa; border-radius: 50%; }
.login-panel { display: grid; place-items: center; padding: 48px; background: var(--canvas); }
.login-card { width: min(430px, 100%); padding: 34px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-md); }
.login-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.product-tag { padding: 5px 8px; color: #46607f; background: #eef3f8; border-radius: 4px; font-size: 11px; font-weight: 750; }
.secure-state { display: inline-flex; align-items: center; gap: 6px; color: var(--success); font-size: 11px; font-weight: 750; }
.secure-state i, .environment-tag i { display: block; width: 7px; height: 7px; background: var(--success); border-radius: 50%; }
.login-card h2, dialog h2 { margin: 0; color: var(--ink-strong); font-size: 28px; letter-spacing: -.025em; }
.login-card > .muted { margin: 10px 0 0; font-size: 14px; }
.login-card form { display: grid; gap: 9px; margin-top: 30px; }
label { margin-top: 8px; color: #39465a; font-size: 13px; font-weight: 700; }
input, select, textarea { width: 100%; min-height: 42px; padding: 9px 12px; color: var(--ink); background: var(--surface); border: 1px solid #cfd7e3; border-radius: 6px; }
input:hover, select:hover, textarea:hover { border-color: #aab5c4; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
textarea { resize: vertical; }
.primary-button, .quiet-button, .icon-button { min-height: 38px; padding: 9px 14px; border: 0; border-radius: 6px; font-weight: 700; transition: background-color .15s ease, color .15s ease, border-color .15s ease; }
.primary-button { color: white; background: var(--primary); box-shadow: 0 1px 2px rgba(25,80,180,.2); }
.primary-button:hover { background: var(--primary-hover); }
.quiet-button { color: #334155; background: var(--surface); border: 1px solid #d5dce6; }
.quiet-button:hover { background: #f4f6f9; border-color: #bdc7d4; }
.icon-button { min-height: 34px; padding: 7px 9px; color: var(--muted); background: transparent; }
.login-card .primary-button { width: 100%; min-height: 44px; margin-top: 14px; }
.login-footnote { display: grid; gap: 5px; margin-top: 26px; padding: 17px; color: var(--muted); background: var(--surface-subtle); border: 1px solid var(--line-soft); border-radius: 7px; font-size: 12px; line-height: 1.55; }
.login-footnote strong { color: #3c495c; }
.form-message { min-height: 20px; margin: 10px 0 0; font-size: 13px; }
.error { color: var(--danger); }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; display: flex; width: 248px; flex-direction: column; padding: 22px 16px; color: white; background: var(--nav); border-right: 1px solid rgba(255,255,255,.04); }
.sidebar-brand { min-height: 42px; padding: 0 8px; }
.sidebar-brand > span:last-child { display: grid; gap: 1px; }
.sidebar-brand strong { font-size: 14px; letter-spacing: .08em; }
.sidebar-brand small { color: rgba(255,255,255,.4); font-size: 8px; font-weight: 800; letter-spacing: .2em; }
.sidebar-divider { height: 1px; margin: 18px 8px 16px; background: rgba(255,255,255,.08); }
#primary-nav { display: grid; gap: 18px; }
.nav-group { display: grid; gap: 4px; }
.nav-group-label { margin: 0 10px 4px; color: rgba(255,255,255,.34); font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.nav-item { position: relative; display: flex; width: 100%; min-height: 40px; align-items: center; gap: 11px; padding: 9px 11px; color: rgba(255,255,255,.67); text-align: left; background: transparent; border: 0; border-radius: 6px; font-size: 13px; }
.nav-item:hover { color: white; background: rgba(255,255,255,.07); }
.nav-item[aria-current="page"] { color: white; background: #284a7e; font-weight: 750; }
.nav-item[aria-current="page"]::before { content: ""; position: absolute; left: -16px; width: 3px; height: 22px; background: #6fa0ff; border-radius: 0 3px 3px 0; }
.nav-icon { display: grid; flex: 0 0 auto; place-items: center; width: 20px; height: 20px; color: rgba(255,255,255,.54); font-size: 13px; font-weight: 800; }
.nav-item[aria-current="page"] .nav-icon { color: #a8c6ff; }
.sidebar-foot { margin-top: auto; padding: 16px 8px 0; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-foot p { margin: 18px 0 0; color: rgba(255,255,255,.26); font-size: 10px; }
.service-state { display: flex; align-items: flex-start; gap: 10px; color: rgba(255,255,255,.68); }
.service-state > span:last-child { display: grid; gap: 3px; }
.service-state strong { color: rgba(255,255,255,.82); font-size: 11px; }
.service-state small { color: rgba(255,255,255,.38); font-size: 10px; }
.live-dot { flex: 0 0 auto; width: 7px; height: 7px; margin-top: 4px; background: #55d3a3; border-radius: 50%; box-shadow: 0 0 0 4px rgba(85,211,163,.1); }

.workspace { min-height: 100vh; margin-left: 248px; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; min-height: 68px; align-items: center; justify-content: space-between; gap: 24px; padding: 10px 30px; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); backdrop-filter: blur(14px); }
.topbar-context { display: flex; min-width: 0; align-items: center; gap: 14px; }
.tenant-control { min-width: 0; }
.tenant-control p { margin: 0 0 1px; color: var(--muted-light); font-size: 10px; font-weight: 700; }
#tenant-select { min-width: 240px; min-height: 28px; padding: 0 26px 0 0; color: var(--ink-strong); background: transparent; border: 0; border-radius: 0; font-size: 14px; font-weight: 750; }
.environment-tag { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; color: #4d6079; background: #f2f5f8; border: 1px solid #e1e7ee; border-radius: 5px; font-size: 10px; font-weight: 700; white-space: nowrap; }
.environment-tag i { width: 6px; height: 6px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.button-with-icon { display: inline-flex; align-items: center; gap: 7px; }
.topbar-separator { width: 1px; height: 28px; margin: 0 3px; background: var(--line); }
.account-button { display: inline-flex; align-items: center; gap: 8px; color: #475569; }
.account-avatar { display: grid; place-items: center; width: 28px; height: 28px; color: #315a9c; background: #e7effc; border-radius: 50%; font-size: 11px; font-weight: 800; }
.nav-toggle { display: none; }

.content { max-width: 1520px; margin: 0 auto; padding: 34px 34px 70px; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.breadcrumb { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; color: var(--muted-light); font-size: 11px; }
.breadcrumb b { color: #c0c8d2; font-weight: 400; }
.breadcrumb span:last-child { color: #536176; }
.page-heading h1 { margin: 0 0 7px; color: var(--ink-strong); font-size: clamp(25px, 3vw, 34px); line-height: 1.12; letter-spacing: -.025em; }
.page-heading p { margin: 0; font-size: 13px; }
.page-heading-side { display: grid; justify-items: end; gap: 8px; padding-top: 8px; }
.permission-label { color: var(--muted-light); font-size: 10px; }
.badge-row { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.badge, .status-pill { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 8px; color: #315a9c; background: var(--primary-soft); border: 1px solid #d5e3ff; border-radius: 999px; font-size: 10px; font-weight: 750; }
.status-pill { color: var(--muted); background: #f0f3f6; border-color: #e2e7ed; }
.status-pill.active, .status-pill.completed, .status-pill.delivered, .status-pill.accepted { color: var(--success); background: var(--success-soft); border-color: #caebdd; }
.status-pill.pending, .status-pill.processing, .status-pill.queued { color: var(--warning); background: var(--warning-soft); border-color: #f0deb4; }
.status-pill.failed, .status-pill.disabled, .status-pill.revoked, .status-pill.expired { color: var(--danger); background: var(--danger-soft); border-color: #f6cdd1; }
.status-banner { margin: -6px 0 20px; padding: 11px 13px; color: #315a7a; background: #edf5ff; border: 1px solid #d8e8fb; border-radius: 6px; font-size: 12px; }
.status-banner.error { color: #8d2933; background: var(--danger-soft); border-color: #f6cdd1; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.metric-card { min-height: 128px; padding: 19px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-sm); }
.metric-card.accent { color: white; background: linear-gradient(135deg, #285fc8, #3e79ee); border-color: transparent; }
.metric-label { color: var(--muted); font-size: 11px; font-weight: 700; }
.accent .metric-label { color: rgba(255,255,255,.7); }
.metric-value { display: block; margin-top: 18px; color: var(--ink-strong); font-size: 30px; font-weight: 800; letter-spacing: -.035em; }
.accent .metric-value { color: white; }
.metric-detail { margin-top: 5px; color: var(--muted-light); font-size: 11px; }
.accent .metric-detail { color: rgba(255,255,255,.66); }
.overview-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .75fr); gap: 18px; }
.overview-stack { display: grid; gap: 18px; }
.progress-track { width: 100%; height: 7px; overflow: hidden; appearance: none; background: #edf1f5; border: 0; border-radius: 999px; }
.progress-track::-webkit-progress-bar { background: #edf1f5; border-radius: 999px; }
.progress-track::-webkit-progress-value { background: var(--primary); border-radius: 999px; }
.progress-track::-moz-progress-bar { background: var(--primary); border-radius: 999px; }
.operation-summary { display: grid; gap: 18px; padding: 22px; }
.operation-row { display: grid; gap: 8px; }
.operation-row-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; font-size: 12px; }
.operation-row-head strong { color: var(--ink-strong); }
.quick-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 16px; }
.quick-link { display: grid; gap: 5px; min-height: 78px; padding: 13px; color: var(--ink); text-align: left; background: var(--surface-subtle); border: 1px solid var(--line-soft); border-radius: 7px; }
.quick-link:hover { background: var(--primary-soft); border-color: #d3e2ff; }
.quick-link strong { font-size: 12px; }
.quick-link span { color: var(--muted); font-size: 10px; }
.attention-list { display: grid; gap: 0; }
.attention-item { display: flex; align-items: flex-start; gap: 11px; padding: 14px 18px; border-top: 1px solid var(--line-soft); }
.attention-item:first-child { border-top: 0; }
.attention-icon { display: grid; flex: 0 0 auto; place-items: center; width: 26px; height: 26px; color: var(--success); background: var(--success-soft); border-radius: 50%; font-size: 11px; font-weight: 800; }
.attention-item.warning .attention-icon { color: var(--warning); background: var(--warning-soft); }
.attention-item strong { display: block; margin-bottom: 3px; font-size: 12px; }
.attention-item span { color: var(--muted); font-size: 11px; line-height: 1.5; }

.panel { overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-sm); }
.panel-heading { display: flex; min-height: 58px; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); }
.panel-title-block { display: grid; gap: 3px; }
.panel-heading h2 { margin: 0; color: var(--ink-strong); font-size: 14px; }
.panel-subtitle { color: var(--muted); font-size: 10px; }
.panel-actions { display: flex; align-items: center; gap: 8px; }
.panel-metrics { margin: 0; padding: 18px; }
.panel-metrics .metric-card { box-shadow: none; }
.section-stack { display: grid; gap: 18px; }
.resource-toolbar { display: flex; align-items: center; gap: 10px; }
.search-field { position: relative; display: flex; align-items: center; }
.search-field span { position: absolute; left: 10px; color: var(--muted-light); font-size: 12px; }
.search-field input { width: 220px; min-height: 34px; padding: 6px 10px 6px 30px; font-size: 12px; }
.record-count { color: var(--muted); font-size: 11px; white-space: nowrap; }
.context-note { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 14px; padding: 12px 14px; color: #47617d; background: #edf5ff; border: 1px solid #d8e8fb; border-radius: 7px; font-size: 11px; line-height: 1.55; }
.context-note strong { color: #315a7a; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
caption { padding: 10px 18px; color: var(--muted); text-align: left; }
th { padding: 10px 16px; color: #748095; background: var(--surface-subtle); border-bottom: 1px solid var(--line-soft); text-align: left; font-size: 10px; font-weight: 750; letter-spacing: .035em; white-space: nowrap; }
td { padding: 13px 16px; border-top: 1px solid var(--line-soft); vertical-align: middle; }
tbody tr:first-child td { border-top: 0; }
tbody tr:hover { background: #fafcff; }
.id-cell { max-width: 250px; color: #66758b; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; overflow-wrap: anywhere; }
.empty-state { padding: 64px 24px; text-align: center; }
.empty-state::before { content: ""; display: block; width: 36px; height: 28px; margin: 0 auto 16px; background: #f0f4f8; border: 1px solid #dfe6ee; border-radius: 5px; box-shadow: 8px -6px 0 -2px #fff, 8px -6px 0 -1px #dfe6ee; }
.empty-state strong { display: block; margin-bottom: 7px; color: var(--ink-strong); font-size: 15px; }
.empty-state p { max-width: 480px; margin: 0 auto; color: var(--muted); font-size: 12px; line-height: 1.6; }
.empty-state .primary-button { margin-top: 18px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.row-actions button { min-height: 30px; padding: 5px 9px; font-size: 11px; }

dialog { width: min(520px, calc(100vw - 32px)); padding: 25px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 28px 80px rgba(6,18,36,.26); }
dialog::backdrop { background: rgba(9,20,37,.6); backdrop-filter: blur(3px); }
dialog form { display: grid; gap: 9px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--line-soft); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 16px; }
.secret-box { display: grid; gap: 12px; padding: 14px; background: var(--surface-subtle); border: 1px solid var(--line); border-radius: 7px; }
.secret-box code { overflow-wrap: anywhere; line-height: 1.55; }
.member-callout { padding: 10px 12px; background: var(--surface-subtle); border: 1px solid var(--line); border-radius: 6px; font-weight: 750; }
.mfa-destination { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px; color: var(--muted); background: var(--surface-subtle); border: 1px solid var(--line-soft); border-radius: 6px; font-size: 12px; }
.mfa-destination strong { color: var(--ink); }
.mfa-code-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-top: 4px; }
.mfa-code-row .quiet-button { white-space: nowrap; }

@media (max-width: 1100px) {
  .overview-layout { grid-template-columns: 1fr; }
  .platform-points { grid-template-columns: 1fr; }
  .platform-points div { padding: 13px 16px; }
}

@media (max-width: 980px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-story { min-height: auto; padding: 34px; }
  .story-copy { margin: 70px 0 38px; }
  .story-copy h1 { font-size: clamp(38px, 8vw, 58px); }
  .trust-strip { flex-wrap: wrap; }
  .login-panel { padding: 48px 24px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-md); }
  .sidebar.open { transform: translateX(0); }
  .workspace { margin-left: 0; }
  .nav-toggle { display: inline-flex; }
  .topbar { align-items: center; gap: 10px; padding: 10px 14px; }
  .topbar-context { flex: 1; }
  .tenant-control { flex: 1; }
  #tenant-select { min-width: 0; width: 100%; }
  .environment-tag, .topbar-actions .quiet-button, .topbar-separator, .account-button span:last-child { display: none; }
  .content { padding: 26px 14px 60px; }
  .page-heading { display: block; }
  .page-heading-side { justify-items: start; margin-top: 18px; }
  .badge-row { justify-content: flex-start; }
  .metric-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 112px; }
  .panel-heading { align-items: flex-start; flex-direction: column; }
  .panel-actions, .resource-toolbar { width: 100%; }
  .search-field { flex: 1; }
  .search-field input { width: 100%; }
  .quick-links { grid-template-columns: 1fr; }
  .platform-points { display: none; }
  .login-card { padding: 26px 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
