/*
 * edesy-ui.css: the shadcn new-york "neutral" look for the Blog platform's own UI
 * (landing, dashboard, tenant admin, login, error pages).
 *
 * Tokens are copied verbatim from /root/edesy-tables/frontend/src/index.css so every
 * Edesy app matches. Components mirror the shadcn cva classes (button, input, card,
 * table, badge, tabs, dropdown, dialog, alert, toast, skeleton, separator).
 *
 * NEVER load this file into the blog themes (themes/families/**, themes/_base/**):
 * its base rules would leak into bloggers' designs.
 *
 * Everything below the tokens sits in cascade layers, declared in the same order the
 * Tailwind v4 browser build uses, so Tailwind utilities on a page always win over
 * these component classes (same as shadcn: className overrides the cva base).
 */
@layer theme, base, components, utilities;

/* ---------------------------------------------------------------- tokens */
:root {
  --radius: 0.625rem;
  --font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --background: oklch(1 0 0);
  --foreground: oklch(0.145 0 0);
  --card: oklch(1 0 0);
  --card-foreground: oklch(0.145 0 0);
  --popover: oklch(1 0 0);
  --popover-foreground: oklch(0.145 0 0);
  --primary: oklch(0.205 0 0);
  --primary-foreground: oklch(0.985 0 0);
  --secondary: oklch(0.97 0 0);
  --secondary-foreground: oklch(0.205 0 0);
  --muted: oklch(0.97 0 0);
  --muted-foreground: oklch(0.556 0 0);
  --accent: oklch(0.97 0 0);
  --accent-foreground: oklch(0.205 0 0);
  --destructive: oklch(0.577 0.245 27.325);
  --border: oklch(0.922 0 0);
  --input: oklch(0.922 0 0);
  --ring: oklch(0.708 0 0);
  --chart-1: oklch(0.205 0 0);
  --chart-2: oklch(0.439 0 0);
  --chart-3: oklch(0.556 0 0);
  --chart-4: oklch(0.708 0 0);
  --chart-5: oklch(0.87 0 0);
  --sidebar: oklch(0.985 0 0);
  --sidebar-foreground: oklch(0.145 0 0);
  --sidebar-primary: oklch(0.205 0 0);
  --sidebar-primary-foreground: oklch(0.985 0 0);
  --sidebar-accent: oklch(0.97 0 0);
  --sidebar-accent-foreground: oklch(0.205 0 0);
  --sidebar-border: oklch(0.922 0 0);
  --sidebar-ring: oklch(0.708 0 0);
}

.dark {
  --background: oklch(0.145 0 0);
  --foreground: oklch(0.985 0 0);
  --card: oklch(0.205 0 0);
  --card-foreground: oklch(0.985 0 0);
  --popover: oklch(0.205 0 0);
  --popover-foreground: oklch(0.985 0 0);
  --primary: oklch(0.922 0 0);
  --primary-foreground: oklch(0.205 0 0);
  --secondary: oklch(0.269 0 0);
  --secondary-foreground: oklch(0.985 0 0);
  --muted: oklch(0.269 0 0);
  --muted-foreground: oklch(0.708 0 0);
  --accent: oklch(0.269 0 0);
  --accent-foreground: oklch(0.985 0 0);
  --destructive: oklch(0.704 0.191 22.216);
  --border: oklch(1 0 0 / 10%);
  --input: oklch(1 0 0 / 15%);
  --ring: oklch(0.556 0 0);
  --chart-1: oklch(0.985 0 0);
  --chart-2: oklch(0.85 0 0);
  --chart-3: oklch(0.708 0 0);
  --chart-4: oklch(0.556 0 0);
  --chart-5: oklch(0.439 0 0);
  --sidebar: oklch(0.205 0 0);
  --sidebar-foreground: oklch(0.985 0 0);
  --sidebar-primary: oklch(0.985 0 0);
  --sidebar-primary-foreground: oklch(0.205 0 0);
  --sidebar-accent: oklch(0.269 0 0);
  --sidebar-accent-foreground: oklch(0.985 0 0);
  --sidebar-border: oklch(1 0 0 / 10%);
  --sidebar-ring: oklch(0.556 0 0);
}

/* Derived values (same maths as the Tailwind @theme block in Tables/taskflow). */
:root {
  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --ok: oklch(0.527 0.154 150.069);
  --warn: oklch(0.666 0.179 58.318);
  /* Aliases for variables from the retired design-system.css. */
  --space-1: .25rem; --space-2: .5rem; --space-3: .75rem; --space-4: 1rem; --space-6: 1.5rem; --space-8: 2rem;
  --transition-fast: 150ms ease; --transition-base: 200ms ease;
  --font-medium: 500; --font-semibold: 600;
  color-scheme: light;
}
.dark {
  --ok: oklch(0.792 0.209 151.711);
  --warn: oklch(0.828 0.189 84.429);
  color-scheme: dark;
}

/* ------------------------------------------------------------------ base */
@layer base {
  *, ::before, ::after { box-sizing: border-box; border-color: var(--border); }
  html { -webkit-text-size-adjust: 100%; }
  body {
    margin: 0;
    background: var(--background);
    color: var(--foreground);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
  :focus-visible { outline: 2px solid color-mix(in oklab, var(--ring) 50%, transparent); outline-offset: 2px; }
  a { color: inherit; }
  button, [role="button"] { cursor: pointer; }
  button:disabled { cursor: not-allowed; }
  ::selection { background: var(--primary); color: var(--primary-foreground); }
  code, kbd, pre, samp { font-family: var(--font-mono); }
  hr { border: 0; border-top: 1px solid var(--border); }
  input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); }
}

/* ------------------------------------------------------------ components */
@layer components {
  /* Button: shadcn buttonVariants. .btn = default (black). The variant classes also
     work on their own (older markup uses class="btn-primary" without .btn). */
  .btn, .btn-primary, .btn-secondary, .btn-outline, .btn-ghost, .btn-destructive, .btn-danger, .btn-success, .btn-default {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    height: 2.25rem; padding: 0.5rem 1rem; flex-shrink: 0;
    border: 1px solid transparent; border-radius: var(--radius-md);
    background: var(--primary); color: var(--primary-foreground);
    font: inherit; font-size: 0.875rem; font-weight: 500; line-height: 1.25rem;
    white-space: nowrap; text-decoration: none; cursor: pointer;
    transition: background-color .15s, color .15s, box-shadow .15s, border-color .15s;
    outline: none;
  }
  :is(.btn, .btn-primary, .btn-secondary, .btn-outline, .btn-ghost, .btn-destructive, .btn-danger, .btn-success) svg:not([class*="size-"]) { width: 1rem; height: 1rem; }
  :is(.btn, .btn-primary, .btn-secondary, .btn-outline, .btn-ghost, .btn-destructive, .btn-danger, .btn-success) svg { flex-shrink: 0; pointer-events: none; }
  .btn:hover, .btn-primary:hover, .btn-success:hover, .btn-default:hover { background: color-mix(in oklab, var(--primary) 90%, transparent); }
  :is(.btn, .btn-primary, .btn-secondary, .btn-outline, .btn-ghost, .btn-destructive, .btn-danger, .btn-success):focus-visible { border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent); }
  :is(.btn, .btn-primary, .btn-secondary, .btn-outline, .btn-ghost, .btn-destructive, .btn-danger, .btn-success):is(:disabled, [aria-disabled="true"]) { pointer-events: none; opacity: .5; }
  .btn-primary, .btn-default, .btn-success { background: var(--primary); color: var(--primary-foreground); }
  .btn-secondary { background: var(--secondary); color: var(--secondary-foreground); }
  .btn-secondary:hover { background: color-mix(in oklab, var(--secondary) 80%, transparent); }
  .btn-outline {
    background: var(--background); color: var(--foreground);
    border-color: var(--border); box-shadow: var(--shadow-xs);
  }
  .btn-outline:hover { background: var(--accent); color: var(--accent-foreground); }
  .dark .btn-outline { background: color-mix(in oklab, var(--input) 30%, transparent); border-color: var(--input); }
  .dark .btn-outline:hover { background: color-mix(in oklab, var(--input) 50%, transparent); }
  .btn-ghost { background: transparent; color: var(--foreground); }
  .btn-ghost:hover { background: var(--accent); color: var(--accent-foreground); }
  .dark .btn-ghost:hover { background: color-mix(in oklab, var(--accent) 50%, transparent); }
  .btn-destructive, .btn-danger { background: var(--destructive); color: #fff; }
  .btn-destructive:hover, .btn-danger:hover { background: color-mix(in oklab, var(--destructive) 90%, transparent); }
  .dark .btn-destructive, .dark .btn-danger { background: color-mix(in oklab, var(--destructive) 60%, transparent); }
  .btn-link { background: transparent; color: var(--primary); text-underline-offset: 4px; }
  .btn-link:hover { background: transparent; text-decoration: underline; }
  .btn-sm { height: 2rem; padding: 0 0.75rem; gap: 0.375rem; }
  .btn-lg { height: 2.5rem; padding: 0 1.5rem; }
  .btn-icon {
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    width: 2.25rem; height: 2.25rem; padding: 0; border: 1px solid transparent; border-radius: var(--radius-md);
    background: transparent; color: var(--foreground);
  }
  .btn-icon:hover { background: var(--accent); color: var(--accent-foreground); }
  .btn-icon svg:not([class*="size-"]) { width: 1rem; height: 1rem; }
  .btn-icon.btn-sm { width: 2rem; height: 2rem; }
  .btn-block { width: 100%; }

  /* Input, select, textarea: shadcn Input. */
  .input, .form-input, .form-select, .form-textarea, .textarea, .select {
    display: flex; width: 100%; min-width: 0; height: 2.25rem;
    padding: 0.25rem 0.75rem;
    border: 1px solid var(--input); border-radius: var(--radius-md);
    background: transparent; color: var(--foreground);
    font: inherit; font-size: 0.875rem; line-height: 1.25rem;
    box-shadow: var(--shadow-xs);
    transition: color .15s, box-shadow .15s, border-color .15s;
    outline: none;
  }
  .dark .input, .dark .form-input, .dark .form-select, .dark .form-textarea, .dark .textarea, .dark .select {
    background: color-mix(in oklab, var(--input) 30%, transparent);
  }
  .form-textarea, .textarea { height: auto; min-height: 4rem; padding: 0.5rem 0.75rem; }
  .input::placeholder, .form-input::placeholder, .form-textarea::placeholder, .textarea::placeholder { color: var(--muted-foreground); }
  .input:focus-visible, .form-input:focus-visible, .form-select:focus-visible,
  .form-textarea:focus-visible, .textarea:focus-visible, .select:focus-visible,
  .input:focus, .form-input:focus, .form-select:focus, .form-textarea:focus, .textarea:focus, .select:focus {
    border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent);
  }
  .input:disabled, .form-input:disabled { cursor: not-allowed; opacity: .5; }
  .input[aria-invalid="true"], .form-input.error { border-color: var(--destructive); }
  .label, .form-label { display: flex; align-items: center; gap: .5rem; font-size: .875rem; font-weight: 500; line-height: 1; margin-bottom: .5rem; }
  .form-label-required::after { content: " *"; color: var(--destructive); }
  .form-group { display: grid; gap: .5rem; margin-bottom: 1rem; }
  .form-group .form-label { margin-bottom: 0; }
  .form-hint, .description { color: var(--muted-foreground); font-size: .8125rem; }
  .form-error { color: var(--destructive); font-size: .8125rem; }
  .form-checkbox, .form-radio { width: 1rem; height: 1rem; accent-color: var(--primary); }

  /* Card: shadcn Card + parts. */
  .card {
    display: flex; flex-direction: column;
    background: var(--card); color: var(--card-foreground);
    border: 1px solid var(--border); border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
  }
  .card-header { display: grid; gap: .375rem; padding: 1.5rem 1.5rem 0; }
  .card-header.border-b, .card-header.bordered { padding-bottom: 1.5rem; border-bottom: 1px solid var(--border); }
  .card-title { margin: 0; font-size: 1rem; font-weight: 600; line-height: 1; }
  .card-description { margin: 0; color: var(--muted-foreground); font-size: .875rem; }
  .card-content, .card-body { padding: 1.5rem; }
  .card-header + .card-content, .card-header + .card-body { padding-top: 1.5rem; }
  .card-footer { display: flex; align-items: center; gap: .5rem; padding: 0 1.5rem 1.5rem; }
  .card-hover { transition: box-shadow .15s, border-color .15s; }
  .card-hover:hover { box-shadow: var(--shadow-md); border-color: color-mix(in oklab, var(--foreground) 20%, transparent); }

  /* Table: shadcn Table. */
  .table-wrap { position: relative; width: 100%; overflow-x: auto; }
  .table { width: 100%; caption-side: bottom; border-collapse: collapse; font-size: .875rem; }
  .table thead tr { border-bottom: 1px solid var(--border); }
  .table th {
    height: 2.5rem; padding: 0 .5rem; text-align: left; vertical-align: middle;
    font-weight: 500; color: var(--foreground); white-space: nowrap;
  }
  .table thead { background: color-mix(in oklab, var(--muted) 50%, transparent); }
  .table td { padding: .5rem; vertical-align: middle; }
  .table tbody tr { border-bottom: 1px solid var(--border); transition: background-color .15s; }
  .table tbody tr:last-child { border-bottom: 0; }
  .table tbody tr:hover { background: color-mix(in oklab, var(--muted) 50%, transparent); }

  /* Badge: shadcn badgeVariants + ok/warn status. */
  .badge {
    display: inline-flex; align-items: center; justify-content: center; gap: .25rem;
    width: fit-content; flex-shrink: 0; overflow: hidden; white-space: nowrap;
    padding: .125rem .5rem; border: 1px solid transparent; border-radius: 9999px;
    background: var(--primary); color: var(--primary-foreground);
    font-size: .75rem; font-weight: 500; line-height: 1rem;
  }
  .badge svg { width: .75rem; height: .75rem; }
  .badge-default, .badge-primary { background: var(--primary); color: var(--primary-foreground); }
  .badge-secondary, .badge-info { background: var(--secondary); color: var(--secondary-foreground); }
  .badge-outline { background: transparent; color: var(--foreground); border-color: var(--border); }
  .badge-destructive, .badge-error { background: var(--destructive); color: #fff; }
  .dark .badge-destructive, .dark .badge-error { background: color-mix(in oklab, var(--destructive) 60%, transparent); }
  .badge-ok, .badge-success {
    background: color-mix(in oklab, var(--ok) 12%, transparent); color: var(--ok);
    border-color: color-mix(in oklab, var(--ok) 25%, transparent);
  }
  .badge-warn, .badge-warning {
    background: color-mix(in oklab, var(--warn) 14%, transparent); color: var(--warn);
    border-color: color-mix(in oklab, var(--warn) 30%, transparent);
  }

  /* Tabs: shadcn Tabs. Active tab: [aria-selected=true], .active or [data-state=active]. */
  .tabs-list {
    display: inline-flex; align-items: center; justify-content: center; width: fit-content;
    height: 2.25rem; padding: 3px; border-radius: var(--radius-lg);
    background: var(--muted); color: var(--muted-foreground);
  }
  .tabs-trigger {
    display: inline-flex; flex: 1; align-items: center; justify-content: center; gap: .375rem;
    height: calc(100% - 1px); padding: .25rem .5rem;
    border: 1px solid transparent; border-radius: var(--radius-md);
    background: transparent; color: var(--foreground);
    font: inherit; font-size: .875rem; font-weight: 500; white-space: nowrap; text-decoration: none;
    transition: color .15s, box-shadow .15s;
  }
  .dark .tabs-trigger { color: var(--muted-foreground); }
  .tabs-trigger[aria-selected="true"], .tabs-trigger.active, .tabs-trigger[data-state="active"] {
    background: var(--background); color: var(--foreground); box-shadow: var(--shadow-sm);
  }
  .dark .tabs-trigger[aria-selected="true"], .dark .tabs-trigger.active, .dark .tabs-trigger[data-state="active"] {
    background: color-mix(in oklab, var(--input) 30%, transparent); border-color: var(--input); color: var(--foreground);
  }

  /* Dropdown menu: shadcn DropdownMenu. Opens with .show (ui-components.js). */
  .dropdown { position: relative; display: inline-block; }
  .dropdown-trigger { cursor: pointer; }
  .dropdown-menu {
    position: absolute; right: 0; top: calc(100% + .25rem); z-index: 50;
    min-width: 12rem; padding: .25rem; display: none;
    background: var(--popover); color: var(--popover-foreground);
    border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-md);
  }
  .dropdown-menu.show { display: block; animation: eui-in .12s ease-out; }
  .dropdown-item {
    display: flex; align-items: center; gap: .5rem; width: 100%;
    padding: .375rem .5rem; border: 0; border-radius: var(--radius-sm);
    background: transparent; color: inherit; font: inherit; font-size: .875rem;
    text-align: left; text-decoration: none; cursor: default; user-select: none;
  }
  .dropdown-item svg { width: 1rem; height: 1rem; color: var(--muted-foreground); }
  .dropdown-item:hover, .dropdown-item:focus-visible { background: var(--accent); color: var(--accent-foreground); outline: none; }
  .dropdown-item.destructive { color: var(--destructive); }
  .dropdown-label { padding: .375rem .5rem; font-size: .875rem; font-weight: 500; }
  .dropdown-divider, .dropdown-separator { height: 1px; margin: .25rem -.25rem; background: var(--border); }

  /* Dialog: shadcn Dialog. Overlay opens with .show (ui-components.js). */
  .modal-overlay, .dialog-overlay {
    position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
    padding: 1rem; background: rgb(0 0 0 / .5);
    opacity: 0; visibility: hidden; transition: opacity .2s, visibility .2s;
  }
  .modal-overlay.show, .dialog-overlay.show { opacity: 1; visibility: visible; }
  .modal, .dialog {
    position: relative; display: grid; gap: 1rem; width: 100%; max-width: 32rem;
    max-height: calc(100vh - 2rem); overflow: auto; padding: 1.5rem;
    background: var(--background); color: var(--foreground);
    border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
    transform: scale(.95); transition: transform .2s;
  }
  .modal-overlay.show .modal, .dialog-overlay.show .dialog { transform: scale(1); }
  .modal-sm { max-width: 24rem; } .modal-lg { max-width: 42rem; } .modal-xl { max-width: 56rem; }
  .modal-header, .dialog-header { display: flex; flex-direction: column; gap: .5rem; padding-right: 2rem; }
  .modal-title, .dialog-title { margin: 0; font-size: 1.125rem; font-weight: 600; line-height: 1; }
  .dialog-description { margin: 0; color: var(--muted-foreground); font-size: .875rem; }
  .modal-close, .dialog-close {
    position: absolute; top: 1rem; right: 1rem; display: inline-flex; padding: 0;
    border: 0; border-radius: var(--radius-sm); background: transparent; color: inherit; opacity: .7;
  }
  .modal-close:hover, .dialog-close:hover { opacity: 1; }
  .modal-close svg, .dialog-close svg { width: 1rem; height: 1rem; }
  .modal-footer, .dialog-footer { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; }
  .text-secondary { color: var(--muted-foreground); }

  /* Alert: shadcn Alert. */
  .alert {
    position: relative; display: grid; gap: .125rem; width: 100%;
    padding: .75rem 1rem; border: 1px solid var(--border); border-radius: var(--radius-lg);
    background: var(--card); color: var(--card-foreground); font-size: .875rem;
  }
  .alert-title { font-weight: 500; letter-spacing: -.01em; }
  .alert-description { color: var(--muted-foreground); }
  .alert-destructive, .alert-error { color: var(--destructive); }
  .alert-destructive .alert-description, .alert-error .alert-description { color: color-mix(in oklab, var(--destructive) 90%, transparent); }
  .alert-ok, .alert-success { color: var(--ok); }
  .alert-warn, .alert-warning { color: var(--warn); }

  /* Separator, skeleton, spinner, avatar, kbd. */
  .separator { height: 1px; width: 100%; background: var(--border); border: 0; }
  .separator-vertical { width: 1px; height: 100%; }
  .skeleton { border-radius: var(--radius-md); background: var(--accent); animation: eui-pulse 2s cubic-bezier(.4,0,.6,1) infinite; }
  .skeleton-text { height: .875rem; margin-bottom: .5rem; }
  .skeleton-title { height: 1.25rem; width: 40%; margin-bottom: .75rem; }
  .skeleton-avatar { width: 2.5rem; height: 2.5rem; border-radius: 9999px; }
  .spinner {
    display: inline-block; width: 1rem; height: 1rem; border-radius: 9999px;
    border: 2px solid color-mix(in oklab, currentColor 25%, transparent); border-top-color: currentColor;
    animation: eui-spin .7s linear infinite;
  }
  .spinner-sm { width: .75rem; height: .75rem; } .spinner-lg { width: 2rem; height: 2rem; border-width: 3px; }
  .avatar {
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden;
    width: 2rem; height: 2rem; border-radius: 9999px;
    background: var(--muted); color: var(--foreground); font-size: .8125rem; font-weight: 500;
  }
  .avatar-sm { width: 2rem; height: 2rem; } .avatar-md { width: 2.5rem; height: 2.5rem; } .avatar-lg { width: 3rem; height: 3rem; font-size: 1rem; }
  .kbd {
    display: inline-flex; align-items: center; height: 1.25rem; padding: 0 .25rem;
    border-radius: var(--radius-sm); background: var(--muted); color: var(--muted-foreground);
    font-family: var(--font-mono); font-size: .75rem;
  }

  /* Toast: sonner look (popover surface, border, radius, shadow). */
  .toast-container {
    position: fixed; z-index: 100; display: flex; flex-direction: column; gap: .5rem;
    width: min(22rem, calc(100vw - 2rem)); pointer-events: none;
  }
  .toast-top-right { top: 1rem; right: 1rem; }
  .toast-top-left { top: 1rem; left: 1rem; }
  .toast-bottom-right { bottom: 1rem; right: 1rem; flex-direction: column-reverse; }
  .toast-bottom-left { bottom: 1rem; left: 1rem; flex-direction: column-reverse; }
  .toast-top-center { top: 1rem; left: 50%; transform: translateX(-50%); }
  .toast-bottom-center { bottom: 1rem; left: 50%; transform: translateX(-50%); flex-direction: column-reverse; }
  .toast {
    pointer-events: auto; display: flex; align-items: flex-start; gap: .625rem;
    padding: .875rem 1rem; border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--popover); color: var(--popover-foreground);
    box-shadow: 0 4px 12px rgb(0 0 0 / .1); font-size: .8125rem;
    opacity: 0; transform: translateY(-.5rem); transition: opacity .2s, transform .2s;
  }
  .toast.show { opacity: 1; transform: none; }
  .toast-icon { display: inline-flex; flex-shrink: 0; margin-top: .0625rem; }
  .toast-icon svg { width: 1rem; height: 1rem; }
  .toast-content { flex: 1; min-width: 0; }
  .toast-title { font-weight: 500; }
  .toast-message { color: inherit; }
  .toast-title + .toast-message { color: var(--muted-foreground); }
  .toast-close { display: inline-flex; padding: 0; border: 0; background: transparent; color: var(--muted-foreground); }
  .toast-close:hover { color: var(--foreground); }
  .toast-close svg { width: .875rem; height: .875rem; }
  .toast-error .toast-icon { color: var(--destructive); }
  .toast-success .toast-icon { color: var(--ok); }
  .toast-warning .toast-icon { color: var(--warn); }

  /* App chrome: top bar + sidebar (dashboard and tenant admin). */
  .app-topbar {
    position: sticky; top: 0; z-index: 40; height: 3.5rem;
    display: flex; align-items: center; gap: 1rem; padding: 0 1.5rem;
    background: color-mix(in oklab, var(--background) 92%, transparent);
    backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
  }
  .app-brand { display: inline-flex; align-items: center; gap: .5rem; font-weight: 600; font-size: .9375rem; text-decoration: none; color: var(--foreground); }
  .app-brand-mark {
    display: inline-flex; align-items: center; justify-content: center; width: 1.75rem; height: 1.75rem;
    border-radius: var(--radius-md); background: var(--primary); color: var(--primary-foreground);
    font-size: .8125rem; font-weight: 700;
  }
  .app-sidebar { background: var(--sidebar); color: var(--sidebar-foreground); border-right: 1px solid var(--sidebar-border); }
  .sidebar-link, .nav-link {
    display: flex; align-items: center; gap: .625rem; padding: .5rem .75rem;
    border-radius: var(--radius-md); color: var(--sidebar-foreground);
    font-size: .875rem; font-weight: 500; text-decoration: none; transition: background-color .15s, color .15s;
  }
  .sidebar-link svg, .nav-link svg { width: 1rem; height: 1rem; flex-shrink: 0; }
  .sidebar-link:hover, .nav-link:hover { background: var(--sidebar-accent); color: var(--sidebar-accent-foreground); }
  .sidebar-link.active, .sidebar-active, .nav-link.active {
    background: var(--sidebar-accent); color: var(--sidebar-accent-foreground); font-weight: 600;
  }
  .sidebar-heading { padding: .5rem .75rem .25rem; color: var(--muted-foreground); font-size: .75rem; font-weight: 500; }

  /* Theme toggle: shows the moon in light mode, the sun in dark mode. */
  .theme-toggle .icon-sun { display: none; }
  .dark .theme-toggle .icon-sun { display: inline; }
  .dark .theme-toggle .icon-moon { display: none; }

  /* Small helpers. */
  .muted { color: var(--muted-foreground); }
  .eyebrow { color: var(--muted-foreground); font-size: .75rem; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; }
  .num { font-variant-numeric: tabular-nums; }
  .page-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem 1rem; }
  .stack { display: grid; gap: 1rem; }
}

@keyframes eui-spin { to { transform: rotate(360deg); } }
@keyframes eui-pulse { 50% { opacity: .5; } }
@keyframes eui-in { from { opacity: 0; transform: translateY(-2px) scale(.98); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
