:root {
  color-scheme: light;
  --background: #fbf8ff;
  --sidebar: #fff;
  --surface: #fff;
  --control: #f4f2fd;
  --hover: #efecf8;
  --text: #1a1b23;
  --muted: #5c403c;
  --border: #e6bdb8;
  --primary: #b70011;
  --brand: #dc2626;
  --on-brand: #fff6f5;
  --success-bg: #7ffc97;
  --success-text: #002109;
  --warning-bg: #ffdcc3;
  --warning-text: #2f1500;
  --danger-bg: #ffdad6;
  --danger-text: #93000a;
  --font-body: "Instrument Sans", system-ui, sans-serif;
  --font-heading: Alatsi, system-ui, sans-serif;
  --font-mono: "Source Code Pro", ui-monospace, monospace;
  --page-padding: 16px;
  font: 14px/20px var(--font-body);
  color: var(--text);
  background: var(--background);
  scroll-padding-top: 80px;
}

:root.dark {
  color-scheme: dark;
  --background: #12131a;
  --sidebar: #0d0e15;
  --surface: #1a1b23;
  --control: #1e1f27;
  --hover: #292931;
  --text: #e3e1ec;
  --muted: #e6bdb8;
  --border: #5c403c;
  --primary: #ffb4ab;
  --success-bg: #005320;
  --success-text: #7ffc97;
  --warning-bg: #6e3900;
  --warning-text: #ffdcc3;
  --danger-bg: #93000a;
  --danger-text: #ffdad6;
}

*, *::before, *::after { box-sizing: border-box; }
body, h1, h2, h3, p { margin: 0; }
h1 { font: 400 28px/34px var(--font-heading); letter-spacing: -.25px; }
h2 { font: 600 18px/24px var(--font-body); }
h3 { font: 600 15px/20px var(--font-body); }
a { color: var(--primary); text-underline-offset: .2em; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
::selection { background: var(--brand); color: var(--on-brand); }

.skip-link {
  position: fixed;
  z-index: 50;
  top: 8px;
  left: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--surface);
  transform: translateY(calc(-100% - 12px));
}
.skip-link:focus { transform: none; }

.app-shell { display: flex; min-height: 100vh; }
.app-frame { flex: 1; min-width: 0; }
.sidebar {
  position: fixed;
  z-index: 40;
  inset: 0 auto 0 0;
  width: min(240px, 100%);
  flex: 0 0 240px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 16px;
  overflow-y: auto;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  transform: translateX(-100%);
  transition: transform 150ms cubic-bezier(.3, 0, 1, 1);
}
.sidebar.is-open {
  transform: none;
  transition: transform 220ms cubic-bezier(.2, 0, 0, 1);
}
.sidebar-backdrop { position: fixed; z-index: 30; inset: 0; background: rgb(0 0 0 / .6); }
.dark .sidebar-backdrop { background: rgb(0 0 0 / .7); }
.has-open-sidebar { overflow: hidden; }
.brand-row, .brand, .sidebar-nav a, .topbar, .topbar-group, .workspace-label {
  display: flex;
  align-items: center;
}
.brand-row { justify-content: space-between; padding: 4px 8px 0; }
.brand {
  gap: 8px;
  color: var(--text);
  font: 400 22px/28px var(--font-heading);
  text-decoration: none;
}
.brand-icon.material-symbols-outlined {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--brand);
  color: var(--on-brand);
  font-size: 18px;
}
.material-symbols-outlined {
  width: 1em;
  height: 1em;
  line-height: 1;
  overflow: hidden;
  white-space: nowrap;
  flex-shrink: 0;
  vertical-align: middle;
}
.sidebar-nav { display: grid; gap: 4px; }
.sidebar-nav a {
  gap: 12px;
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--muted);
  text-decoration: none;
  transition: background-color 120ms ease-out, color 120ms ease-out;
}
.sidebar-nav .material-symbols-outlined { font-size: 15px; }
.sidebar-nav a:hover { background: var(--control); color: var(--text); }
.sidebar-nav a:is([aria-current="page"], .active) {
  background: var(--brand);
  color: var(--on-brand);
  font-size: 13px;
  font-weight: 600;
}
.sidebar-nav a:is([aria-current="page"], .active) .material-symbols-outlined { font-variation-settings: 'FILL' 1; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  justify-content: space-between;
  gap: 12px;
  padding: 12px var(--page-padding);
  background: var(--background);
  background: color-mix(in srgb, var(--background) 95%, transparent);
  border-bottom: 1px solid var(--border);
}
.topbar-group { gap: 12px; min-width: 0; }
.workspace-label { gap: 8px; font-size: 13px; font-weight: 600; }
.workspace-label .material-symbols-outlined, .icon-button .material-symbols-outlined { font-size: 18px; }

#app {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
  padding: var(--page-padding);
}
.app-frame #app > * + * { margin-top: 0; }
.sk-page-title, .sk-card-header, .sk-tabs, .sk-actions, .sk-list li, .sk-metric-value {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.sk-page-title, .sk-card-header, .sk-list li { justify-content: space-between; }
.sk-card-header { align-items: flex-start; }
.sk-page-title p, .sk-card-header p { margin-top: 4px; }
.sk-empty, .sk-card-header p, .sk-page-title p { color: var(--muted); }
.sk-card-header p, small { font-size: 12px; line-height: 16px; }

.sk-card {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
}
.sk-card { display: flex; flex-direction: column; gap: 16px; }
.sk-metric { position: relative; justify-content: space-between; }
.sk-metric:has(.sk-card-link:is(:hover, :focus-visible)) { border-color: var(--primary); }
.sk-metric h2 { font-size: 15px; line-height: 20px; }
.sk-metric p { margin-top: 4px; font-size: 12px; line-height: 16px; color: var(--muted); }
.sk-metric-value { align-items: baseline; gap: 8px; }
.sk-metric-value strong { font: 400 28px/34px var(--font-heading); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

.sk-kpis, .sk-revenue, .sk-widgets, .sk-operational, .sk-kanban, .sk-fields {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr);
}
#app .sk-chart { display: block; width: 100%; height: 224px; color: var(--muted); }
.sk-chart text { font: 11px var(--font-mono); fill: currentColor; }
.sk-list { list-style: none; margin: 0; padding: 0; }
.sk-list li { padding: 12px 0; border-bottom: 1px solid var(--border); }
.sk-list li:last-child { border-bottom: 0; }

.sk-badge {
  align-self: start;
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  padding: 4px 8px;
  background: var(--control);
  color: var(--muted);
  font-size: 11px;
  line-height: 14px;
  font-weight: 500;
}
.sk-badge.success, .sk-notice:not(.is-error) { background: var(--success-bg); color: var(--success-text); }
.sk-badge.warning { background: var(--warning-bg); color: var(--warning-text); }
.sk-badge.danger, .sk-notice.is-error, .sk-form-error { background: var(--danger-bg); color: var(--danger-text); }

.sk-button, .icon-button, #app button, :is(#app, .sk-form) select, .sk-form textarea,
.sk-form input:not([type="checkbox"], [type="radio"]) {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--control);
  padding: 8px 12px;
}
.sk-button, .icon-button, #app button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text);
  font-size: 13px;
  line-height: 18px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 120ms ease-out;
}
.icon-button { width: 36px; height: 36px; padding: 0; }
.sk-button:hover, .icon-button:hover, #app button:hover:enabled { background: var(--hover); }
.sk-button.sk-primary, #app button.sk-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--on-brand);
}
.sk-button.sk-primary:hover, #app button.sk-primary:hover:enabled { background: #b70011; }
:is(#app, .sk-form) :is(input, select, textarea) { max-width: 100%; }
.sk-form :is(input, textarea)::placeholder { color: var(--muted); opacity: 1; }
#app textarea { resize: vertical; }
.sk-fields label { display: grid; gap: 4px; min-width: 0; font-weight: 600; }
.sk-fields label :is(input, select, textarea) { width: 100%; font-weight: 400; }
.sk-notice, .sk-empty { padding: 12px; border-radius: 8px; background: var(--control); }

.sk-column { display: grid; align-content: start; gap: 12px; padding: 16px; border-radius: 12px; background: var(--control); min-width: 0; }
.sk-task { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); overflow-wrap: anywhere; }
.sk-table-wrap { max-width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 12px; text-align: start; border-bottom: 1px solid var(--border); }
th { background: var(--control); }
tbody tr:last-child td { border-bottom: 0; }

@media (min-width: 640px) {
  .sk-kpis, .sk-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  :root { --page-padding: 24px; }
  .sidebar { position: static; transform: none; }
  .mobile-only, .sidebar-backdrop { display: none; }
  .sk-widgets, .sk-kanban { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #app .sk-operational { grid-template-columns: minmax(0, 1fr); }
}
@media (min-width: 1280px) {
  .sk-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  #app .sk-revenue, #app .sk-operational { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .sk-revenue > :first-child { grid-column: span 8; }
  .sk-revenue > :nth-child(2) { grid-column: span 4; }
  .sk-operational > :first-child { grid-column: span 5; }
  .sk-operational > :nth-child(2) { grid-column: span 7; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; }
}

.sk-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.sk-card-link { position: absolute; inset: 0; border-radius: inherit; }
.sk-card-footer, .sk-jump { margin-top: auto; }
.sk-jump { align-self: start; font-weight: 600; }
.sk-list li > div { min-width: 0; overflow-wrap: anywhere; }
.sk-list small { display: block; color: var(--muted); }
.sk-mono { font: 500 13px/18px var(--font-mono); }
.sk-grid-line { stroke: currentColor; stroke-opacity: .16; stroke-dasharray: 3 3; }
.sk-period { display: flex; align-items: center; gap: 4px; }
.sk-period .sk-icon, .sk-button .sk-icon { font-size: 15px; }
.sk-tabs button[aria-pressed="true"] { border-color: var(--primary); color: var(--primary); }
.sk-column > header, .sk-task-footer, .sk-form > header, .sk-form > footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.sk-task p, .sk-field-note { color: var(--muted); font-size: 12px; line-height: 16px; }
.sk-task[draggable="true"] { cursor: grab; }
.sk-task :is(button, select) { cursor: pointer; }
.sk-dialog {
  width: min(520px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
}
.sk-dialog::backdrop { background: rgb(0 0 0 / .6); }
.sk-form { display: grid; gap: 16px; }
.sk-form > footer { justify-content: flex-end; }
.sk-form-error { padding: 8px 12px; border-radius: 8px; }
.sk-field-note { grid-column: 1 / -1; }
.sk-notice {
  position: fixed;
  z-index: 25;
  inset: auto 16px 16px auto;
  max-width: calc(100% - 32px);
  border: 1px solid var(--border);
}
