/* CASA API — Sakura Clean v2 (server-side injected, minimal shell) */

:root,
body[data-theme-preset] {
  --radius: 0.625rem;
  --app-header-height: 3.5rem;
  --font-ui-sans: "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-body: var(--font-ui-sans);

  --background: #edf2f7;
  --foreground: #182b46;
  --card: #ffffff;
  --card-foreground: #182b46;
  --popover: #ffffff;
  --popover-foreground: #182b46;
  --primary: #245ccd;
  --primary-foreground: #ffffff;
  --secondary: #eef7fd;
  --secondary-foreground: #1a5d80;
  --muted: #eaf0f7;
  --muted-foreground: #526278;
  --accent: #eaf0ff;
  --accent-foreground: #264fbd;
  --destructive: #b82e47;
  --destructive-foreground: #ffffff;
  --success: #126d48;
  --success-foreground: #ffffff;
  --warning: #895a0c;
  --warning-foreground: #ffffff;
  --info: #176895;
  --info-foreground: #ffffff;
  --neutral: #526278;
  --neutral-foreground: #ffffff;
  --border: #cdd7e4;
  --input: #ffffff;
  --ring: #245ccd;
  --control-border: #7d8fa7;

  --chart-1: #f45f9e;
  --chart-2: #4fb8e6;
  --chart-3: #9b8cf0;
  --chart-4: #ffb3ce;
  --chart-5: #63d8c6;
  --overview-accent-1: #f45f9e;
  --overview-accent-2: #4fb8e6;
  --overview-accent-3: #9b8cf0;

  --sidebar: #111d36;
  --sidebar-foreground: #d4def2;
  --sidebar-primary: #8faaff;
  --sidebar-primary-foreground: #ffffff;
  --sidebar-accent: #293e66;
  --sidebar-accent-foreground: #ffffff;
  --sidebar-border: #233451;
  --sidebar-ring: #7cc9ee;

  --skeleton-base: #f2f1f7;
  --skeleton-highlight: #fafaff;
  --table-row: var(--card);
  --table-header: #e6edf6;
  --table-header-hover: #dae5f3;
}

html.dark,
html.dark body[data-theme-preset] {
  --background: #0c1020;
  --foreground: #ecebff;
  --card: #141a2e;
  --card-foreground: #ecebff;
  --popover: #151b30;
  --popover-foreground: #ecebff;
  --primary: #a3c1ff;
  --primary-foreground: #101b31;
  --secondary: #1b2740;
  --secondary-foreground: #b9e8ff;
  --muted: #171c2f;
  --muted-foreground: #b0bdd2;
  --accent: #26203c;
  --accent-foreground: #ffd9ea;
  --destructive: #ff6b6b;
  --destructive-foreground: #2b0709;
  --success: #37c98e;
  --success-foreground: #041a10;
  --warning: #f4b740;
  --warning-foreground: #241400;
  --info: #6dcbf0;
  --info-foreground: #061922;
  --neutral: #7c83a8;
  --neutral-foreground: #0c1020;
  --border: #262d45;
  --input: #1a2036;
  --ring: #a3c1ff;
  --control-border: #8494b0;

  --chart-1: #ff8fbe;
  --chart-2: #6dcbf0;
  --chart-3: #b1a3ff;
  --chart-4: #ffc1d9;
  --chart-5: #6ee7d8;
  --overview-accent-1: #ff8fbe;
  --overview-accent-2: #6dcbf0;
  --overview-accent-3: #b1a3ff;

  --sidebar: #101527;
  --sidebar-foreground: #e6e5f7;
  --sidebar-primary: #ff8fbe;
  --sidebar-primary-foreground: #2b0a1e;
  --sidebar-accent: #221c38;
  --sidebar-accent-foreground: #ffd9ea;
  --sidebar-border: #222941;
  --sidebar-ring: #7fd8f5;

  --skeleton-base: #171c2f;
  --skeleton-highlight: #232a44;
  --table-row: var(--card);
  --table-header: #202c43;
  --table-header-hover: #1a2036;
}

html {
  color-scheme: light;
}

html.dark {
  color-scheme: dark;
}

body {
  font-family: var(--font-ui-sans);
  color: var(--foreground);
  background-color: var(--background);
  background-image: none;
}

#root {
  position: relative;
  z-index: 1;
}

div.bg-background.relative.min-h-svh,
div.min-h-svh.bg-background {
  background-color: transparent !important;
}

header {
  background-color: var(--card);
  border-bottom: 1px solid var(--border);
  backdrop-filter: none;
  box-shadow: 0 1px 0 rgba(31, 53, 89, 0.04);
}

[data-slot="card"] {
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: none;
  backdrop-filter: none;
}

[data-slot="button"] {
  border-radius: 0.5rem;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

[data-slot="button"].bg-primary {
  background-image: none;
  background-color: var(--primary);
  border-color: var(--primary);
  box-shadow: none;
  color: var(--primary-foreground);
}

[data-slot="button"].bg-primary:hover {
  background-color: color-mix(in oklab, var(--primary) 88%, #000);
  transform: none;
  box-shadow: none;
}

[data-slot="sidebar-inner"],
[data-sidebar="sidebar"] {
  background-image: none;
  background-color: var(--sidebar);
  border-right: 1px solid var(--sidebar-border);
  color: var(--sidebar-foreground);
}

[data-sidebar="sidebar"] [data-sidebar="group-label"] {
  color: #8f9fbd;
  font-size: 11px;
  letter-spacing: 0.04em;
}

[data-sidebar="sidebar"] [data-sidebar="menu-button"]:hover {
  background-color: #233657;
  color: #ffffff;
}

[data-sidebar="menu-button"] {
  border-radius: 0.5rem;
  min-height: 2.4rem;
}

[data-sidebar="menu-button"][data-active="true"] {
  background-image: none !important;
  background-color: var(--sidebar-accent) !important;
  color: var(--sidebar-accent-foreground) !important;
  box-shadow: inset 3px 0 #f18cbf !important;
  font-weight: 600;
}

[data-slot="input"],
input,
textarea,
select {
  border-color: var(--control-border);
  border-radius: 0.5rem;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted-foreground);
  opacity: 1;
}

body[data-sakura-workspace] main :is(input:not([type="checkbox"]):not([type="radio"]), textarea) {
  background-color: var(--card);
}

body[data-sakura-workspace] main :is(button, [role="checkbox"]):not(.border-transparent):not(.bg-primary) {
  border-color: var(--control-border);
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  border-color: var(--ring);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--ring) 24%, transparent);
}

::selection {
  background: color-mix(in srgb, var(--primary) 26%, transparent);
  color: var(--foreground);
}

* {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--muted-foreground) 40%, transparent) transparent;
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--muted-foreground) 38%, transparent);
  border-radius: 999px;
}

[data-slot="badge"] {
  border-radius: 999px;
  font-weight: 500;
}

[data-slot="table-row"]:hover {
  background-color: color-mix(in srgb, var(--primary) 5%, transparent);
}

[data-slot="table-header"] {
  background-color: var(--table-header);
}

[data-slot="table-head"] {
  color: var(--foreground);
  font-weight: 600;
}

body[data-sakura-workspace] [data-slot="table"] {
  background-color: var(--card);
}

body[data-sakura-workspace] [data-slot="table-cell"][data-column-id="actions"] {
  background-color: var(--card);
}

body[data-sakura-workspace] [data-slot="table-row"]:hover [data-slot="table-cell"] {
  background-color: color-mix(in oklab, var(--accent) 48%, var(--card));
}

.casa-home {
  --casa-bg: var(--background) !important;
  --casa-ink: var(--foreground) !important;
  --casa-muted: var(--muted-foreground) !important;
  --casa-link: var(--primary) !important;
}

main[data-slot="sidebar-inset"] {
  background-color: var(--background);
}

main[data-slot="sidebar-inset"] :where(.rounded-xl.border, .rounded-lg.border) {
  border-color: var(--border);
  box-shadow: 0 3px 16px -12px rgba(23, 42, 77, 0.2);
}

[data-slot="dialog-content"],
[data-slot="alert-dialog-content"],
[data-slot="sheet-content"],
[data-slot="popover-content"],
[data-slot="dropdown-menu-content"] {
  backdrop-filter: none;
  box-shadow: 0 12px 32px -18px rgba(20, 20, 50, 0.35);
}

a {
  text-underline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .sakura-control,
  [data-slot="button"] {
    transition: none;
  }
}

@media (forced-colors: active) {
  :root, body[data-theme-preset], html.dark, html.dark body[data-theme-preset] {
    --background: Canvas;
    --foreground: CanvasText;
    --card: Canvas;
    --card-foreground: CanvasText;
    --popover: Canvas;
    --popover-foreground: CanvasText;
    --primary: Highlight;
    --primary-foreground: HighlightText;
    --muted: Canvas;
    --muted-foreground: CanvasText;
    --border: CanvasText;
    --control-border: ButtonText;
    --ring: Highlight;
    --table-header: Canvas;
    --sidebar: Canvas;
    --sidebar-foreground: CanvasText;
    --sidebar-accent: Highlight;
    --sidebar-accent-foreground: HighlightText;
  }

  [data-sidebar="menu-button"][data-active="true"],
  .sakura-key-filter[aria-current="page"] {
    outline: 2px solid Highlight;
    outline-offset: -2px;
  }
}

/* ===== admin-only theme (green) ===== */
body:has([data-sidebar]) {
  --background:#f5f7f4; --foreground:#13231b; --card:#fff; --card-foreground:#13231b;
  --popover:#fff; --popover-foreground:#13231b; --primary:#16a34a; --primary-foreground:#fff;
  --secondary:#edf7f0; --secondary-foreground:#12683a; --muted:#eff4f0; --muted-foreground:#5b6f63;
  --accent:#e9f6ee; --accent-foreground:#157a43; --destructive:#c03546;
  --border:#d9e5dd; --input:#fff; --ring:#16a34a; --control-border:#93a89b;
  --table-header:#eaf2ec; --table-header-hover:#dfeee4;
  --chart-1:#16a34a; --chart-2:#0ea5e9; --chart-3:#f59e0b; --chart-4:#34d399; --chart-5:#6366f1;
  --overview-accent-1:#16a34a; --overview-accent-2:#0ea5e9; --overview-accent-3:#f59e0b;
  --sidebar:#0d2419; --sidebar-foreground:#cde5d5; --sidebar-primary:#6ee7a4;
  --sidebar-primary-foreground:#06200f; --sidebar-accent:#1a422c; --sidebar-accent-foreground:#fff;
  --sidebar-border:#1c3527; --sidebar-ring:#7ee2a8; --skeleton-base:#eef3ef; --skeleton-highlight:#f7faf8;
}
html.dark body:has([data-sidebar]) {
  --background:#0b1512; --foreground:#e6f2ea; --card:#131f1a; --card-foreground:#e6f2ea;
  --popover:#16241e; --popover-foreground:#e6f2ea; --primary:#4ade80; --primary-foreground:#06200f;
  --secondary:#172a21; --secondary-foreground:#a7e8c2; --muted:#152420; --muted-foreground:#a4bcac;
  --accent:#17301f; --accent-foreground:#b7f0cc; --border:#22362c; --input:#16241e;
  --ring:#4ade80; --control-border:#6f8b7a; --table-header:#1a2b23; --table-header-hover:#16241e;
  --sidebar:#08150f; --sidebar-foreground:#d5ebdd; --sidebar-accent:#16351f; --sidebar-border:#17301f;
}
body:has([data-sidebar]) [data-sidebar] [data-sidebar="group-label"] { color:#7fa68d; font-weight:600; }
body:has([data-sidebar]) [data-sidebar] [data-sidebar="menu-button"]:hover { background-color:#17351f; color:#fff; }
body:has([data-sidebar]) [data-sidebar="menu-button"][data-active="true"] { box-shadow: inset 3px 0 #6ee7a4 !important; }
#bai-help-fab { position:fixed; right:20px; bottom:22px; z-index:99998; display:inline-flex;
  align-items:center; justify-content:center; height:40px; padding:0 16px; border-radius:999px;
  border:1px solid #16a34a; background:#16a34a; color:#fff; font-size:13px; font-weight:700;
  cursor:pointer; font-family:inherit; box-shadow:0 8px 22px -10px rgba(22,163,74,.7); }
#bai-help-fab:hover { background:#128a3f; }
#bai-help-panel { position:fixed; right:20px; bottom:74px; z-index:99999; width:400px;
  max-height:66vh; overflow:auto; border-radius:14px; border:1px solid #d9e5dd; background:#fff;
  box-shadow:0 18px 46px -20px rgba(13,36,25,.5); color:#13231b; font-size:13px; line-height:1.6;
  font-family:inherit; }
html.dark #bai-help-panel { background:#131f1a; border-color:#22362c; color:#e6f2ea; }
#bai-help-panel .bh-head { display:flex; align-items:center; justify-content:space-between;
  padding:13px 15px; border-bottom:1px solid #e6efe9; font-weight:800; font-size:14px; }
html.dark #bai-help-panel .bh-head { border-color:#22362c; }
#bai-help-panel .bh-close { cursor:pointer; color:#7d9488; font-size:18px; padding:0 4px; }
#bai-help-panel .bh-body { padding:12px 15px 16px; }
#bai-help-panel .bh-item { padding:8px 0; border-bottom:1px dashed #e6efe9; }
html.dark #bai-help-panel .bh-item { border-color:#22362c; }
#bai-help-panel .bh-k { font-weight:700; color:#0f7a4a; }
html.dark #bai-help-panel .bh-k { color:#6ee7a4; }
#bai-help-panel .bh-v { color:#5b6f63; margin-top:2px; }
html.dark #bai-help-panel .bh-v { color:#a4bcac; }
#bai-help-panel .bh-tip { margin-top:10px; padding:9px 11px; border-radius:9px;
  background:#f0f9f2; border:1px solid #d6ecdc; color:#12683a; font-size:12px; }
html.dark #bai-help-panel .bh-tip { background:#16281d; border-color:#23402c; color:#9fe0b8; }/* bai logo */
body:has([data-sidebar]) a[aria-label='返回主页'] img[alt='徽标']{display:none!important}
body:has([data-sidebar]) a[aria-label='返回主页'] div.flex.size-5{background:#e8f7ec;border:1px solid #b7e2c4;border-radius:7px}
body:has([data-sidebar]) a[aria-label='返回主页'] div.flex.size-5 svg{display:none!important}
body:has([data-sidebar]) a[aria-label='返回主页'] div.flex.size-5::after{content:'🥬';font-size:12px;line-height:1}/* bai simple polish */
body:has([data-sidebar]) main [data-slot='form-item']{row-gap:.45rem}
body:has([data-sidebar]) main [data-slot='form-label']{font-size:13px;font-weight:600;color:#1c3a2a}
body:has([data-sidebar]) main [data-slot='form-item']>p{font-size:11.5px;line-height:1.55;color:#6b8477}
body:has([data-sidebar]) main [data-slot='card']{border:1px solid #dcebe2;border-radius:12px}
body:has([data-sidebar]) main table th{background:#eef7f1;color:#14653a;font-size:12px}
body:has([data-sidebar]) main table td{font-size:13px}body:has([data-sidebar]) #bai-brand-badge{position:relative;z-index:9;pointer-events:none}
body:has([data-sidebar]) main::before{content:'';display:block;height:3px;background:linear-gradient(90deg,#16a34a,#86efac,#16a34a);border-radius:2px}
body:has([data-sidebar]) #bai-brand-badge{margin:32px 8px 2px !important;display:block}
body:has([data-sidebar]) #bai-brand-badge{display:none !important}
.casa-home.casa-home{--casa-bg:#f4faf6;--casa-surface:#fff;--casa-ink:#0f2a1b;--casa-muted:#5c7a68;--casa-line:#d8ebe0;--casa-blue:#16a34a;--casa-link:#15803d;--casa-pink:#f59e0b;--casa-cyan:#34d399}
.dark .casa-home.casa-home{--casa-bg:#08150e;--casa-surface:#112218;--casa-ink:#e8f6ec;--casa-muted:#9db8a8;--casa-line:#1f3a2a;--casa-link:#86efac}
.casa-home .casa-hero-band{background:linear-gradient(120deg,#0b2a18,#123c22 55%,#0d2419)}
.casa-home.casa-home{--casa-bg:#f4faf6 !important;--casa-ink:#0f2a1b !important;--casa-muted:#5c7a68 !important;--casa-line:#d8ebe0 !important}
.casa-home .hl{color:#7ee2a8 !important}
.casa-home .casa-section-kicker{color:#16a34a !important}
.casa-home .casa-section-link{color:#15803d !important}
.casa-home .casa-step-number{color:#16a34a !important}
.casa-home .casa-step-link{color:#15803d !important}
.casa-home .casa-code-panel{background:#0b2419 !important}
.casa-home .casa-code-head{background:#123c22 !important}
.casa-home .casa-feature-index{color:#16a34a !important}
.casa-home .casa-flow-status{color:#16a34a !important}
.casa-home .casa-btn.primary{background:#16a34a !important}
img[alt="logo"],img[alt="徽标"]{content:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Crect width='64' height='64' rx='14' fill='%2316a34a'/%3E%3Ctext x='32' y='46' font-size='34' font-family='sans-serif' font-weight='700' text-anchor='middle' fill='%23ffffff'%3E%E7%99%BD%3C/text%3E%3C/svg%3E")}.casa-home .casa-title b{display:block;color:#7ee2a8 !important}
