/*
 * Scale brand on top of Metronic 9.5. Metronic styles everything through
 * shadcn-style variables (--primary, --foreground, ...), so the brand is
 * applied by redefining them here; no Metronic file is edited.
 *
 * Palette (Scale Design System): Scale Green #3EB881, deep green #2A7F58 for
 * text and filled buttons (white text clears 4.5:1), Confident Blue #273855
 * for ink and the sidebar, Trusting Blue #42CFDF for data and info states.
 */
:root {
  --font-sans: 'Lexend', ui-sans-serif, system-ui, sans-serif;
  --font-display: 'Rubik', ui-sans-serif, system-ui, sans-serif;

  --scale-green: #3EB881;
  --scale-green-deep: #2A7F58;
  --scale-green-press: #23694A;
  --scale-green-soft: #D9F1E6;
  --confident-blue: #273855;
  --confident-blue-raised: #35496B;
  --trusting-blue: #42CFDF;
  --kept-amber: #F2A93B;

  --background: #ffffff;
  --foreground: #273855;
  --mono: #273855;
  --card: #ffffff;
  --card-foreground: #273855;
  --primary: var(--scale-green-deep);
  --primary-foreground: #ffffff;
  --secondary: #F5F8F8;
  --secondary-foreground: #273855;
  --muted: #F5F8F8;
  --muted-foreground: #5E6C85;
  --accent: #EEF3F3;
  --accent-foreground: #273855;
  --border: #E3E8EE;
  --input: #C3CBD8;
  --ring: var(--scale-green);
}

.dark {
  --background: #141B27;
  --foreground: #E6EAF0;
  --mono: #E6EAF0;
  --card: #1A2333;
  --card-foreground: #E6EAF0;
  --primary: var(--scale-green);
  --primary-foreground: #273855;
  --secondary: #222D40;
  --muted: #222D40;
  --muted-foreground: #9AA6BA;
  --accent: #222D40;
  --border: #2C3A52;
  --input: #3E5478;
}

/* The sidebar is a soft charcoal in light and dark page themes, so it stands apart from the page (2026-11-25). */
.kt-sidebar.dark {
  --background: #16191F;
  --foreground: #ffffff;
  --mono: #ffffff;
  --muted-foreground: rgba(255, 255, 255, .62);
  --accent: #242932;
  --border: #2C323D;
  --primary: #6FCB9F;
}

/* Which environment this is (DRESDEN_ENV_LABEL): a strip across the top of the sidebar and a pill by the logo.
   Text on each pill clears 4.5:1; each pill clears 3:1 against the sidebar. */
.env-production { --env: #2CC5B0; --env-text: #0E1116; }
.env-staging { --env: #F2A93B; --env-text: #0E1116; }
.env-local { --env: #A99CF0; --env-text: #0E1116; }
.env-strip { position: absolute; top: 0; inset-inline: 0; height: 4px; background: var(--env); z-index: 1; }
.env-pill { background: var(--env); color: var(--env-text); font-weight: 600; letter-spacing: .04em; }

body {
  font-family: var(--font-sans);
}

/* Rubik is for display headings only, bold with tight tracking. */
.scale-display {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.tnum {
  font-feature-settings: "tnum" 1;
}

/*
 * Utilities Dresden's views use that Metronic's prebuilt styles.css does not
 * include (it ships only the classes its own demos use). Once screens grow,
 * replace this block by compiling Tailwind 4 over resources/views (Vite, built
 * in CI, never on the server) - see DEPLOYMENT.md.
 */
.self-start { align-self: flex-start; }
.max-w-\[400px\] { max-width: 400px; }
.max-w-\[520px\] { max-width: 520px; }
.tracking-wide { letter-spacing: .025em; }
.w-\[320px\] { width: 320px; max-width: 100%; }
.opacity-60 { opacity: .6; }
.max-w-\[720px\] { max-width: 720px; }
.max-w-\[240px\] { max-width: 240px; }
.gap-x-5 { column-gap: 1.25rem; }
.gap-y-2 { row-gap: 0.5rem; }
.select-all { user-select: all; }
.w-\[300px\] { width: 300px; max-width: 100%; }
.align-top { vertical-align: top; }
.break-all { word-break: break-all; }
.whitespace-pre-wrap { white-space: pre-wrap; }
.font-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border-width: 0; }
@media (min-width: 1024px) {
  .lg\:text-5xl { font-size: 3rem; line-height: 1.05; }
}

/* Tenant logos: the image sits over initials, so a missing or broken logo shows the initials. */
.tenant-logo { position: relative; flex: 0 0 auto; width: 36px; height: 36px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); background: var(--muted); display: inline-grid; place-items: center; }
.tenant-logo.tenant-logo-lg { width: 48px; height: 48px; border-radius: 10px; }
.tenant-logo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #fff; }
.tenant-logo-initials { font-size: 12px; font-weight: 600; color: var(--muted-foreground); }

/* Sign-in page: form on the left, brand panel with a Scale-mark pattern on the right. */
.login-shell { width: 100%; min-width: 0; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1024px) { .login-shell { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.login-pane { padding: 16px; }
@media (min-width: 1024px) { .login-pane { padding: 32px; } }
.login-form { width: 100%; max-width: 380px; }
.login-logo { height: 28px; width: auto; align-self: center; }
.login-brand { position: relative; overflow: hidden; background: var(--confident-blue); }
.login-brand::before {
  content: ""; position: absolute; inset: 0; opacity: .07;
  background-image: url("../brand/scale-mark-tile.svg"), url("../brand/scale-mark-tile.svg");
  background-size: 96px 96px, 96px 96px; background-position: 0 0, 48px 48px; background-repeat: repeat;
}
.login-brand::after {
  content: ""; position: absolute; width: 520px; height: 520px; right: -120px; bottom: -150px;
  background: url("../brand/scale-mark-white.svg") no-repeat center / contain; opacity: .08;
}
.login-brand-glow {
  position: absolute; inset: 0;
  background: radial-gradient(circle at 18% 12%, rgba(62, 184, 129, .30), transparent 55%);
}

/* Dashboard stat tiles: whole tile is the link to the list behind the number. */
.stat-tile { transition: border-color .15s; }
.stat-tile:hover, .stat-tile:focus-visible { border-color: var(--scale-green); }
.stat-value { font-size: 28px; line-height: 1.1; font-weight: 600; }
.stat-up { color: var(--scale-green-deep); }
.stat-down { color: var(--destructive); }
.stat-warn { align-self: flex-start; }

/* Single-series bar chart (AI message volume). Validated: #2A7F58 on light, #35A874 on dark surfaces. */
:root { --chart-bar: #2A7F58; }
.dark { --chart-bar: #35A874; }
.bar-chart rect.bar { fill: var(--chart-bar); }
.bar-chart rect.hit { fill: transparent; }
.bar-chart g:hover rect.bar, .bar-chart g:focus rect.bar { opacity: .75; }
.bar-chart text { fill: var(--muted-foreground); font-size: 11px; }
.bar-chart line.axis { stroke: var(--border); }
/* Dashboard sparklines: same single-series colour; the current, unfinished month is lighter. */
.spark rect.bar { fill: var(--chart-bar); }
.spark rect.bar.partial { opacity: .4; }
.spark rect.hit { fill: transparent; }
.spark g:hover rect.bar, .spark g:focus rect.bar { opacity: .7; }
.spark line.base { stroke: var(--border); }
/* Revenue mix: reference categorical slots 1-4, validated light and dark (adjacent pairs); legend carries the values. */
:root { --mix-1: #2a78d6; --mix-2: #eb6834; --mix-3: #1baf7a; --mix-4: #eda100; }
.dark { --mix-1: #3987e5; --mix-2: #d95926; --mix-3: #199e70; --mix-4: #c98500; }
.mix-bar { display: flex; gap: 2px; height: 14px; }
.mix-bar > span { height: 100%; min-width: 2px; }
.mix-bar > span:first-child { border-radius: 4px 0 0 4px; }
.mix-bar > span:last-child { border-radius: 0 4px 4px 0; }
.mix-bar > span:only-child { border-radius: 4px; }
.mix-1 { background: var(--mix-1); } .mix-2 { background: var(--mix-2); } .mix-3 { background: var(--mix-3); } .mix-4 { background: var(--mix-4); }
/* Horizontal count bars (breakdowns): the same validated single-series colour, on a muted track. */
.hbar-track { height: 8px; border-radius: 4px; background: var(--muted); overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 4px; background: var(--chart-bar); }
.chat-bubble { max-width: 760px; white-space: pre-wrap; word-break: break-word; }

/* Utilities Metronic's prebuilt styles.css doesn't ship (it only has its demos' classes). */
.ms-8 { margin-inline-start: 2rem; }
.max-w-\[360px\] { max-width: 360px; }
.w-\[160px\] { width: 160px; }
.min-w-\[280px\] { min-width: 280px; }
.min-w-\[320px\] { min-width: 320px; }
.min-w-\[340px\] { min-width: 340px; }
@media (width >= 64rem) { .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (width >= 48rem) { .md\:col-span-2 { grid-column: span 2 / span 2; } }
@media (width >= 48rem) { .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.w-\[36px\] { width: 36px; }
.list-disc { list-style-type: disc; }
.not-italic { font-style: normal; }
.w-\[260px\] { width: 260px; }
@media (width >= 64rem) { .lg\:col-span-1 { grid-column: span 1 / span 1; } }

/* Two-series chart (budget vs spend). Validated pair: light #2a78d6/#2A7F58, dark #3987e5/#35A874. */
:root { --series-budget: #2a78d6; --series-spend: #2A7F58; }
.dark { --series-budget: #3987e5; --series-spend: #35A874; }
.bar-chart rect.budget { fill: var(--series-budget); }
.bar-chart rect.spend { fill: var(--series-spend); }
.legend-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }

/* Staff guide: Markdown topics. */
.guide-prose { font-size: 14px; line-height: 1.65; color: var(--foreground); }
.guide-prose h2 { font-size: 16px; font-weight: 600; margin: 1.6em 0 .5em; color: var(--mono, var(--foreground)); }
.guide-prose h2:first-child { margin-top: 0; }
.guide-prose h3 { font-size: 14px; font-weight: 600; margin: 1.2em 0 .4em; }
.guide-prose p { margin: 0 0 .8em; }
.guide-prose ul, .guide-prose ol { margin: 0 0 1em; padding-inline-start: 1.25em; }
.guide-prose ul { list-style: disc; }
.guide-prose ol { list-style: decimal; }
.guide-prose li { margin: .3em 0; }
.guide-prose li.guide-locked { color: var(--muted-foreground); }
.guide-prose .guide-tag { margin-inline-end: .35em; vertical-align: 1px; }
.guide-prose strong { font-weight: 600; }
.guide-prose a { color: var(--scale-green-deep); text-decoration: underline; text-underline-offset: 2px; }
.guide-prose code { font-size: 12.5px; padding: .1em .35em; border-radius: 4px; background: var(--muted); }
.guide-prose pre { margin: 0 0 1em; padding: 12px 14px; border-radius: 6px; background: var(--muted); overflow-x: auto; font-size: 12.5px; line-height: 1.5; }
.guide-prose pre code { padding: 0; background: none; }
.guide-prose table { width: 100%; border-collapse: collapse; margin: 0 0 1em; font-size: 13px; }
.guide-prose th, .guide-prose td { text-align: start; padding: .45em .6em; border-bottom: 1px solid var(--border); vertical-align: top; }
.guide-prose th { font-weight: 600; color: var(--muted-foreground); }
.guide-prose blockquote { margin: 0 0 1em; padding: .6em .9em; border-inline-start: 3px solid var(--scale-green); background: var(--muted); border-radius: 4px; }
.whitespace-pre-line { white-space: pre-line; }

/* Server-rendered tabs: Metronic's prebuilt CSS only marks [data-kt-tab-toggle].active (its JS tabs),
   so our link tabs need their own active state. */
.kt-tabs-line .kt-tab-toggle { color: var(--muted-foreground); }
.kt-tabs-line .kt-tab-toggle:hover { color: var(--foreground); }
.kt-tabs-line .kt-tab-toggle.active, .kt-tabs-line .kt-tab-toggle[aria-selected="true"] {
  color: var(--mono, var(--foreground)); font-weight: 600; border-bottom-color: var(--scale-green);
}

/* Breadcrumbs above page titles. */
.breadcrumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; font-size: 13px; }
.breadcrumbs li { display: inline-flex; align-items: center; gap: .35rem; color: var(--muted-foreground); }
.breadcrumbs li + li::before { content: "›"; color: var(--muted-foreground); opacity: .7; }
.breadcrumbs a { color: var(--scale-green-deep); }
.breadcrumbs a:hover { text-decoration: underline; text-underline-offset: 2px; }
.breadcrumbs [aria-current="page"] { color: var(--foreground); font-weight: 500; }

/* Budget grid: cost centre rows stand out from their sub-accounts; the name column stays put while months scroll. */
.w-\[320px\] { width: 320px; max-width: 100%; }
.budget-grid .budget-parent td { background: var(--muted, #f6f7f9); }
.budget-grid th:first-child, .budget-grid td:first-child { position: sticky; left: 0; z-index: 1; background: var(--background, #fff); }
.budget-grid .budget-parent td:first-child { background: var(--muted, #f6f7f9); }
.budget-grid tfoot th { border-top: 2px solid var(--border); }
