/* Brand tokens and controls shared by every workspace. */
:root {
  color-scheme: light;
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  color: #17191c;
  background: #f7f6f2;
  accent-color: #2457d6;
  --graphite: #17191c;
  --paper: #f7f6f2;
  --surface: #fff;
  --slate: #62676d;
  --cobalt: #2457d6;
  --cobalt-dark: #1b43ad;
  --blue-tint: #eef3ff;
  --line: #dce3ee;
  --line-soft: #e9edf3;
  --input-line: #8492aa;
  --red: #a82939;
  --red-tint: #fff1f2;
  --green: #225f48;
  --green-tint: #e8f5ed;
  --amber: #775011;
  --amber-tint: #fff4de;
  --purple: #604181;
  --purple-tint: #f3edfa;
  --shadow: 0 1px 2px #1b274609;
  --side-w: 218px;
  --bar-h: 66px;
  --mobile-nav: 62px;
  --page-pad: clamp(20px, 2.5vw, 42px);
  --radius: 12px;
  --space-xs: 6px;
  --space-sm: 12px;
  --space-md: 18px;
  --space-lg: 24px;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: 88px; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; font-size: 14px; line-height: 1.5; }
a { color: var(--cobalt-dark); text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
img { display: block; max-width: 100%; }
svg { flex: 0 0 auto; vertical-align: middle; }
p { margin: 0; }
h1, h2, h3 { color: var(--graphite); margin: 0; line-height: 1.19; font-weight: 650; }
h1 { font-size: clamp(29px, 3vw, 39px); letter-spacing: -.045em; }
h2 { font-size: 18px; letter-spacing: -.026em; }
h3 { font-size: 15px; }
article, aside, section, div { min-width: 0; }
:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 3px; }
[hidden] { display: none !important; }
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 99; transform: translateY(-170%); background: white; border: 1px solid var(--cobalt); padding: 12px; border-radius: 8px; }
.skip-link:focus { transform: none; }
.button, .icon-button {
  border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 13px; min-height: 42px; min-width: 42px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 600; line-height: 1.23; background: var(--surface); color: var(--graphite);
  white-space: nowrap;
  transition: background .14s ease, border-color .14s ease, color .14s ease;
}
.button svg, .icon-button svg { width: 17px; height: 17px; }
.button:hover, .icon-button:hover { background: #f5f7fc; border-color: #a2b4dc; }
.button:active, .icon-button:active { background: #e6eeff; }
.primary, .primary:hover { background: var(--cobalt); border-color: var(--cobalt); color: white; }
.primary:hover { background: var(--cobalt-dark); }
.primary:active { background: #17368b; }
.secondary { color: var(--cobalt-dark); border-color: #bbc9e6; }
.danger, .danger:hover { color: var(--red); border-color: #df98a0; background: #fff; }
.danger:hover { background: var(--red-tint); }
.danger-fill, .danger-fill:hover { color: white; background: var(--red); border-color: var(--red); }
.danger-fill:hover { background: #891f2c; }
.text-action { color: var(--cobalt-dark); border-color: transparent; background: transparent; padding-inline: 8px; }
.text-action:hover { background: var(--blue-tint); border-color: transparent; }
.icon-button { padding: 0; width: 42px; }
.button:disabled, .icon-button:disabled { background: #f0f1f3; color: #62676d; border-color: #cbd2dd; }
.muted, small { color: var(--slate); }
small { font-size: .867em; }
.tnum { font-variant-numeric: tabular-nums; }
.strong { font-weight: 650; }
.stack { display: grid; gap: var(--space-md); }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.field { display: grid; align-content: start; gap: 6px; font-weight: 600; min-width: 0; }
.field > span { font-size: 13px; }
.field input, .field select, .field textarea, .search-input input, .filterbar select {
  min-width: 0; width: 100%; max-width: 100%; min-height: 44px;
  border: 1px solid var(--input-line); border-radius: 8px; background: #fff;
  padding: 9px 11px; font-weight: 400; line-height: 1.4;
}
.field textarea { resize: vertical; }
.field :disabled, .field :read-only:is(input,textarea) { background: #f4f5f7; }
.field input:invalid:not(:placeholder-shown):focus { border-color: var(--red); }
.field small { font-weight: 400; }
.grid-form { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px 16px; }
.grid-form .wide { grid-column: 1/-1; }
.check { display: flex; min-height: 44px; align-items: center; gap: 10px; cursor: pointer; }
.check input { flex: 0 0 auto; width: 18px; height: 18px; margin: 0; }
.search-input { display: flex; align-items: center; position: relative; min-width: 0; }
.search-input svg { position: absolute; left: 12px; color: var(--slate); width: 17px; height: 17px; pointer-events: none; }
.search-input input { padding-inline-start: 39px; }
.badge, .chip {
  display: inline-flex; align-items: center; gap: 6px; vertical-align: middle;
  max-width: 100%; padding: 4px 9px; min-height: 24px; width: fit-content; border-radius: 999px;
  background: var(--tone-bg,#eef0f3); color: var(--tone-fg,#4d5663);
  font-size: 12px; font-weight: 650; line-height: 1.35;
}
.badge i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.tone-blue { --tone-bg: #eaf0ff; --tone-fg: #2146a8; }
.tone-red { --tone-bg: var(--red-tint); --tone-fg: var(--red); }
.tone-green { --tone-bg: var(--green-tint); --tone-fg: var(--green); }
.tone-amber { --tone-bg: var(--amber-tint); --tone-fg: var(--amber); }
.tone-purple { --tone-bg: var(--purple-tint); --tone-fg: var(--purple); }
.tile-icon, .entity-icon {
  width: 38px; height: 38px; display: inline-grid; place-items: center; flex: 0 0 auto;
  border-radius: 9px; background: var(--tone-bg,#eef3ff); color: var(--tone-fg,var(--cobalt-dark));
}
.entity-icon { width: 34px; height: 34px; }
.entity { display: flex; align-items: center; gap: 10px; min-width: 0; text-align: left; }
.entity-name { min-width: 0; display: grid; gap: 2px; overflow-wrap: anywhere; }
.entity-name strong { color: var(--graphite); font-weight: 650; }
.entity-name small { line-height: 1.35; }
.entity-name :is(strong,small) { display: block; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.panel.pad { padding: clamp(15px,1.75vw,24px); }
.section-head { display: flex; gap: 12px; align-items: center; justify-content: space-between; margin-block-end: 12px; }
.section-head p { color: var(--slate); font-size: 13px; margin-block-start: 5px; }
.notice {
  display: flex; align-items: flex-start; gap: 9px; color: var(--tone-fg,var(--cobalt-dark));
  background: var(--tone-bg,var(--blue-tint)); padding: 11px 12px;
  border: 1px solid color-mix(in srgb, currentColor 18%, transparent); border-radius: 8px; overflow-wrap: anywhere;
}
.notice svg { margin-top: 1px; width: 18px; height: 18px; }
.empty-state { padding: 28px 16px; display: grid; justify-items: center; gap: 9px; text-align: center; }
.empty-state p { color: var(--slate); max-width: 34ch; }
.details { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px 18px; margin: 0; }
.details div { min-width: 0; }
.details dt { color: var(--slate); font-size: 12px; }
.details dd { margin: 3px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }

.app-shell { min-height: 100vh; min-height: 100dvh; }
.sidebar {
  width: var(--side-w); display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0;
  z-index: 20; background: var(--graphite); color: #e6ebf3; border-right: 1px solid #2c3442;
}
.brand-row { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 18px 13px 14px 17px; border-bottom: 1px solid #30343c; }
.brand { display: flex; align-items: center; justify-content: center; width: 134px; padding: 8px 9px; border-radius: 8px; background: #fff; flex: 0 1 auto; }
.brand img { width: 115px; max-height: 29px; object-fit: contain; }
.sidebar .icon-button { min-width: 34px; width: 34px; min-height: 36px; border-color: #48515f; background: transparent; color: #d7dfe9; }
.sidebar .icon-button:hover { border-color: #8393af; background: #303847; }
.sidebar :focus-visible { outline-color: #a9c2ff; }
.sidebar nav { overflow: auto; padding: 8px 10px; flex: 1; scrollbar-width: thin; scrollbar-color: #566273 var(--graphite); }
.nav-group { padding: 8px 0 3px; }
.nav-group + .nav-group { border-top: 1px solid #30343c; margin-top: 7px; }
.nav-title { padding: 1px 10px 4px; color: #b0bccd; font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.sidebar nav a {
  min-height: 36px; display: flex; align-items: center; gap: 9px; padding: 5px 9px;
  color: #e6ebf3; border: 1px solid transparent; border-radius: 7px; font-size: 13px; font-weight: 550;
}
.sidebar nav a svg { width: 17px; height: 17px; color: #b8c5da; }
.sidebar nav a:hover { background: #252c36; }
.sidebar nav a[aria-current] { background: #25375b; border-color: #4967aa; color: white; }
.sidebar nav a[aria-current] svg { color: #b2c8ff; }
.sidebar nav .rail-more { display: none; }
.account { display: flex; align-items: center; gap: 9px; padding: 12px 14px; border-top: 1px solid #30343c; }
.account .avatar, .profile-avatar { width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; flex-shrink: 0; color: #e7efff; background: #394f7d; font-size: 12px; font-weight: 700; }
.account { color: #e7edf7; }
.account strong, .account small { display: block; }
.account small { color: #b0bccd; font-size: 11px; }
.is-compact { --side-w: 73px; }
.is-compact .brand-row { flex-direction: column; padding: 10px 7px; gap: 8px; }
.is-compact .brand { width: 42px; padding: 4px; }
.is-compact .brand img { width: 34px; max-height: 25px; }
.is-compact .nav-label, .is-compact .nav-title, .is-compact .account-text { display: none; }
.is-compact .sidebar nav a { justify-content: center; min-height: 35px; }
.is-compact .account { justify-content: center; padding-inline: 6px; }
.workspace { margin-inline-start: var(--side-w); min-width: 0; }
.topbar {
  min-height: var(--bar-h); position: sticky; inset-block-start: 0; z-index: 15;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px var(--page-pad); background: #fffffffa; border-bottom: 1px solid var(--line);
}
.crumb { display: flex; gap: 8px; align-items: center; min-width: 0; }
.crumb svg { width: 14px; height: 14px; color: #7c889c; }
.crumb span { color: var(--slate); }
.crumb strong { white-space: nowrap; }
.top-controls { display: flex; align-items: center; gap: 8px; }
.top-controls .search-trigger { min-width: clamp(140px,20vw,300px); justify-content: flex-start; color: var(--slate); font-weight: 500; }
.search-trigger kbd { margin-left: auto; padding: 2px 5px; background: #f0f3f8; border: 1px solid var(--line); border-radius: 4px; font: 11px/1.25 system-ui; }
.notify-dot { position: absolute; width: 9px; height: 9px; border: 2px solid #fff; border-radius: 50%; top: 7px; right: 7px; background: var(--cobalt); }
.notification-button { position: relative; }
.demo-mark {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  border: 1px solid #c5d2ee; background: #f1f5ff; color: #2146a8; border-radius: 6px;
  font-size: 10px; font-weight: 750; letter-spacing: .06em; min-height: 32px; padding-inline: 8px; white-space: nowrap;
}
.demo-mark:hover { background: #e3ecff; }
.mobile-brand, .mobile-nav, .mobile-only { display: none; }
.page-frame { padding: 28px var(--page-pad) 40px; width: 100%; max-width: 1740px; margin: 0 auto; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; }
.page-head p { font-size: 14px; margin-top: 6px; color: var(--slate); max-width: 62ch; }
.page-head .date-line { display: inline-flex; gap: 8px; align-items: center; color: var(--slate); font-weight: 600; margin-bottom: 9px; font-size: 13px; }
.date-line svg { width: 16px; height: 16px; color: var(--cobalt-dark); }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; flex-shrink: 0; }
.tabs { display: flex; gap: 6px; max-width: 100%; overflow-x: auto; scrollbar-width: thin; border-bottom: 1px solid #cad6eb; margin-bottom: 16px; }
.tabs a { font-size: 13px; font-weight: 600; color: #505966; flex: 0 0 auto; padding: 10px 12px 11px; min-height: 44px; border-bottom: 2px solid transparent; line-height: 20px; }
.tabs a:hover { background: #edf2fa; }
.tabs a[aria-current] { color: var(--cobalt-dark); border-color: var(--cobalt); }
.tabs a:focus-visible { outline-offset: -3px; }
.toast {
  position: fixed; right: 22px; bottom: 24px; z-index: 60; display: flex; align-items: flex-start; gap: 10px;
  color: #fff; background: #253249; border: 1px solid #566b8f; border-radius: 9px;
  padding: 12px 14px; max-width: min(470px,calc(100vw - 28px)); box-shadow: 0 8px 24px #14213b22;
}
.toast svg { width: 18px; height: 18px; color: #bed0ff; }
dialog {
  color: var(--graphite); background: #fff; border: 1px solid #b3c4e4; border-radius: 14px;
  width: min(600px,calc(100% - 28px)); max-width: none; max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px);
  padding: 0; overflow: auto; box-shadow: 0 24px 92px #131c3450;
}
dialog::backdrop { background: #161f33a8; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: #fff; border-bottom: 1px solid var(--line); padding: 13px 18px; }
.dialog-head h2 { font-size: 21px; }
.dialog-body { padding: 18px; }
.dialog-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); }
.dialog-body > :not(:last-child) { margin-bottom: 12px; }
.dialog-list { display: grid; gap: 1px; }
.dialog-list > :is(a,button) { min-height: 52px; padding: 8px; background: #fff; border: 0; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; justify-content: space-between; gap: 9px; text-align: left; }
.dialog-list > :is(a,button):hover { background: #f5f7fc; }
.status-line { min-height: 22px; color: var(--slate); font-size: 13px; }
.busy { display: flex; align-items: center; gap: 8px; }
.busy svg { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.route-notice { margin: 0 0 16px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.route-notice .notice { flex: 1 1 12em; }

@media (max-width: 1199px) {
  :root { --side-w: 190px; --page-pad: 22px; }
  .is-compact { --side-w: 68px; }
  .crumb .crumb-parent, .crumb svg { display: none; }
}
@media (max-width: 899px), (max-height: 500px) and (max-width: 1150px) and (pointer: coarse) {
  :root { --bar-h: 57px; --page-pad: 18px; --mobile-nav: 62px; }
  html { scroll-padding-top: calc(73px + env(safe-area-inset-top)); scroll-padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
  body { padding: 0 env(safe-area-inset-right) 0 env(safe-area-inset-left); }
  .sidebar, .crumb, .desktop-only, .search-trigger kbd, .top-controls .search-trigger span, .top-controls .quick-trigger span { display: none !important; }
  .workspace { margin-inline-start: 0; }
  .topbar { min-height: calc(var(--bar-h) + env(safe-area-inset-top)); padding: calc(5px + env(safe-area-inset-top)) 12px 5px; gap: 5px; }
  .mobile-brand { display: flex; align-items: center; gap: 8px; }
  .mobile-brand img { width: 104px; object-fit: contain; }
  .mobile-only { display: initial; }
  .top-controls { gap: 4px; }
  .top-controls .search-trigger, .top-controls .quick-trigger { min-width: 44px; padding: 0; justify-content: center; }
  .top-controls .demo-mark { min-height: 44px; padding-inline: 5px; }
  .button, .icon-button { min-height: 44px; min-width: 44px; }
  .topbar .icon-button { border-color: transparent; }
  .mobile-nav {
    display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); position: fixed; z-index: 18;
    bottom: 0; left: 0; right: 0; padding: 4px env(safe-area-inset-right) calc(4px + env(safe-area-inset-bottom)) env(safe-area-inset-left);
    min-height: calc(var(--mobile-nav) + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid #ccd6e7;
    box-shadow: 0 -2px 12px #263f6610;
  }
  .mobile-nav a { display: grid; justify-items: center; align-content: center; gap: 4px; min-height: 50px; margin-inline: 2px; border-radius: 8px; color: #4a5566; font-size: 10.5px; font-weight: 650; line-height: 1.2; white-space: nowrap; }
  .mobile-nav a svg { width: 20px; height: 20px; }
  .mobile-nav a[aria-current] { color: var(--cobalt-dark); background: var(--blue-tint); }
  .editing-keyboard .mobile-nav { visibility: hidden; }
  .page-frame { padding: 19px var(--page-pad) calc(90px + env(safe-area-inset-bottom)); }
  .page-head { margin-bottom: 17px; align-items: flex-start; flex-wrap: wrap; }
  .page-head h1 { font-size: clamp(27px,7vw,35px); }
  .page-head p { font-size: 13.5px; }
  .page-head .date-line { font-size: 12.5px; }
  .field :is(input,textarea,select), .search-input input, .filterbar select { font-size: 16px; }
  .toast { right: 12px; bottom: calc(70px + env(safe-area-inset-bottom)); }
  dialog { max-height: calc(100dvh - 26px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
  .editing-keyboard dialog { max-height: calc(var(--visual-height, 100dvh) - 18px); }
  .dialog-head, .dialog-body, .dialog-actions { padding-inline: 14px; }
}
@media (max-width: 520px) {
  :root { --page-pad: 14px; }
  .grid-form { grid-template-columns: minmax(0,1fr); gap: 12px; }
  .details { gap: 11px; }
  .section-head { align-items: center; gap: 6px; }
  .section-head .button { font-size: 12px; padding-inline: 7px; }
  .page-actions { width: 100%; }
  .page-actions .button.primary { flex: 1; }
  .page-actions .button.secondary { flex: 0 1 auto; }
  .top-controls .demo-mark { letter-spacing: 0; }
}
@media (max-width: 350px) {
  .mobile-brand img { width: 76px; }
  .top-controls .demo-mark { font-size: 9px; }
  .mobile-nav a { font-size: 9.5px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}



.public-demo-notice {
  color: #274481;
  font-size: .8125rem;
  font-weight: 650;
  line-height: 1.4;
  margin: .5rem 0;
}
.workspace > .public-demo-notice {
  margin: 0;
  padding: .5rem clamp(.875rem, 3vw, 2rem);
  background: #eef4ff;
  border-bottom: 1px solid #c8d8f7;
}
