/* ==========================================================================
   isomorphic.css — faithful plain-CSS build of the Isomorphic design system
   (Isomorphic 7.6.2, hydrogen layout + RizzUI components, dark theme,
   default Blue preset). No build step, no external resources. Dark only.
   Loads AFTER katalyst.css / template-fixes.css / mailbox360.css and wins.
   Same PHP markup, same classes as the previous skin — values swapped to
   Isomorphic's real tokens and measurements:
     globals.css dark theme  +  color-presets.ts (Blue)  +
     hydrogen layout.tsx / sidebar.tsx / sidebar-menu.tsx / header.tsx /
     sticky-header.tsx  +  RizzUI component measurements (button/input/
     card/metric-card/table/badge/switch/checkbox/dialog/dropdown).
   ========================================================================== */

/* ---------- Tokens: Isomorphic dark theme (globals.css) + Blue preset ---------- */
:root,
.dark {
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  /* gray scale (dark) */
  --gray-0: #000000;
  --gray-50: #111111;
  --gray-100: #1f1f1f;
  --gray-200: #333333;
  --gray-300: #484848;
  --gray-400: #666666;
  --gray-500: #929292;
  --gray-600: #a2a2a2;
  --gray-700: #dfdfdf;
  --gray-800: #e2e2e2;
  --gray-900: #f1f1f1;
  --gray-1000: #ffffff;
  /* body */
  --background: #08090e;
  --foreground: #dfdfdf;
  --muted: #333333;
  --muted-foreground: #929292;
  /* card / popover (MetricCard: border-muted bg-gray-0; dropdown: bg-gray-100) */
  --card: #000000;
  --card-foreground: #dfdfdf;
  --popover: #1f1f1f;
  --popover-foreground: #f1f1f1;
  /* primary = Blue preset (color-presets.ts DEFAULT_PRESET_COLORS) */
  --primary: #3872fa;
  --primary-foreground: #ffffff;
  --primary-lighter: #d7e3fe;
  --primary-light: #608efb;
  --primary-dark: #1d58d8;
  /* secondary */
  --secondary: #4e36f5;
  --secondary-foreground: #ffffff;
  /* accent = hover surfaces */
  --accent: #1f1f1f;
  --accent-foreground: #f1f1f1;
  /* status (dark variants from globals.css) */
  --destructive: #ee0000;
  --destructive-fg: #ffc1c1;
  --destructive-lighter: #500000;
  --success: #11a849;
  --success-fg: #b9f9cf;
  --warning: #f5a623;
  --warning-fg: #fcea8b;
  --info: #0070f3;
  --info-fg: #b5e9ff;
  /* borders / inputs / focus */
  --border: #333333;
  --input: #484848;
  --ring: #3872fa;
  /* sidebar (hydrogen: bg-gray-100/50 over body, border-e-2 border-gray-100) */
  --sidebar: #141418;
  --sidebar-foreground: #dfdfdf;
  --sidebar-accent: #1f1f1f;
  --sidebar-accent-foreground: #f1f1f1;
  --sidebar-border: #1f1f1f;
  --sidebar-width: 270px;
  --sidebar-width-mobile: 288px;
  --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  /* Isomorphic .card-shadow (globals.css utilities) */
  --iso-shadow-card: 0 1px 0 rgba(0, 0, 0, 0.02), 0 2px 6px rgba(0, 0, 0, 0.05);
  --iso-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
  --iso-shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.45);
}

/* ---------- Base (globals.css @layer base, dark) ---------- */
html { color-scheme: dark; overflow-x: hidden; }
body {
  min-height: 100svh; width: 100%;
  background: var(--background); color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
*, *::before, *::after { border-color: var(--border); }
button:not(:disabled), [role='button']:not(:disabled) { cursor: pointer; }
:focus-visible { outline: none; }
* { scrollbar-width: thin; scrollbar-color: var(--gray-300) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 999px; }
::-webkit-scrollbar-track { background: transparent; }
@media (max-width: 767px) {
  input, select, textarea { font-size: 16px !important; }
}
a { color: inherit; text-decoration: none; }
svg { flex-shrink: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
h1, h2, h3, h4, h5, h6 { font-weight: 700; color: var(--gray-700); letter-spacing: -0.01em; }

/* Focus ring (RizzUI: border-primary + ring) */
.sc-focus, .sc-btn, .sc-input, .sc-textarea, .sc-select,
.mb-btn, .mb-input, .mb-select, .mb-check, .mb-switch,
.kat-btn, .kat-tool-btn, .kat-input, .kat-search, .kat-folder, .kat-row, .kat-compose-btn {
  outline: none;
}
.sc-btn:focus-visible, .sc-input:focus-visible, .sc-textarea:focus-visible,
.sc-select:focus-visible,
.mb-btn:focus-visible, .mb-input:focus-visible, .mb-select:focus-visible,
.kat-btn:focus-visible, .kat-tool-btn:focus-visible, .kat-input:focus-visible, .kat-search:focus-visible {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 35%, transparent);
}

/* ==========================================================================
   APP SHELL — Isomorphic hydrogen layout
   (layout.tsx: flex min-h-screen; sidebar fixed 270px, hidden < xl;
    content xl:ms-[270px]; header sticky blur; main px-4 pt-2 pb-6)
   ========================================================================== */
.sc-wrapper {
  display: flex; min-height: 100svh; width: 100%;
}
.sc-sidebar {
  display: none; color: var(--sidebar-foreground);
}
@media (min-width: 1280px) { .sc-sidebar { display: block; } }
.sc-sidebar-gap {
  position: relative; width: var(--sidebar-width); background: transparent;
}
.sc-sidebar-container {
  position: fixed; inset: 0 auto 0 0; z-index: 10; display: none;
  height: 100svh; width: var(--sidebar-width);
}
@media (min-width: 1280px) { .sc-sidebar-container { display: flex; } }
.sc-sidebar-inner {
  display: flex; flex-direction: column; height: 100%; width: 100%;
  background: var(--sidebar); border-right: 2px solid var(--sidebar-border);
}
/* sidebar.tsx: logo area px-6 pb-5 pt-5 (2xl px-8 pt-6) */
.sc-sidebar-header, .sc-sidebar-footer { display: flex; flex-direction: column; gap: 8px; padding: 20px 24px; }
.sc-sidebar-footer { padding-top: 12px; }
.sc-sidebar-content {
  display: flex; flex: 1; flex-direction: column;
  min-height: 0; overflow-y: auto; overflow-x: hidden;
}
/* sidebar-menu.tsx: nav mt-4 pb-3 */
.sc-sidebar-group { position: relative; display: flex; flex-direction: column; width: 100%; min-width: 0; padding: 0 0 12px; }
/* group title: h6 text-xs uppercase tracking-widest text-gray-500 px-6 mb-2, mt-6 */
.sc-sidebar-group-label {
  display: flex; align-items: center; flex-shrink: 0;
  padding: 0 24px; margin-bottom: 8px;
  font-size: 12px; font-weight: 400; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--gray-500);
  white-space: nowrap;
}
.sc-sidebar-group + .sc-sidebar-group .sc-sidebar-group-label { margin-top: 24px; }
.sc-sidebar-menu { display: flex; flex-direction: column; gap: 2px; width: 100%; min-width: 0; margin: 0; padding: 0; list-style: none; }
.sc-sidebar-menu-item { position: relative; }
/* nav link: mx-3 my-0.5 lg:my-1 2xl:mx-5, rounded-md px-3 py-2, font-medium,
   text-gray-700, hover bg-gray-100; icon size-5 me-2 */
.sc-sidebar-menu-button {
  display: flex; align-items: center; gap: 8px; width: calc(100% - 24px);
  margin: 2px 12px; padding: 8px 12px; border: 0; border-radius: var(--radius-md);
  background: transparent; color: var(--gray-700);
  font-size: 14px; font-weight: 500; text-align: start; white-space: nowrap;
  transition: background-color 200ms, color 200ms;
  cursor: pointer; position: relative;
}
.sc-sidebar-menu-button svg { width: 20px; height: 20px; flex-shrink: 0; color: var(--gray-500); }
.sc-sidebar-menu-button .sc-menu-label { overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.sc-sidebar-menu-button:hover { background: var(--sidebar-accent); color: var(--gray-900); }
.sc-sidebar-menu-button:hover svg { color: var(--gray-700); }
/* active: text-primary + left bar (::before w-1 h-4/5 bg-primary, -start-3) */
.sc-sidebar-menu-button[data-active='true'] { color: var(--primary); font-weight: 500; }
.sc-sidebar-menu-button[data-active='true'] svg { color: var(--primary); }
.sc-sidebar-menu-button[data-active='true']::before {
  content: ''; position: absolute; left: -12px; top: 10%;
  width: 4px; height: 80%; border-radius: 0 4px 4px 0; background: var(--primary);
}
.sc-sidebar-menu-button[data-size='lg'] { padding: 8px 12px; }
.sc-sidebar-menu-button[data-size='lg'] .sc-menu-avatar {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: var(--radius-lg);
  background: var(--primary); color: var(--primary-foreground);
  font-weight: 600; font-size: 13px; flex-shrink: 0;
}
.sc-sidebar-menu-button[data-size='lg'] .sc-menu-meta { display: grid; flex: 1; min-width: 0; text-align: start; line-height: 1.25; }
.sc-sidebar-menu-button[data-size='lg'] .sc-menu-meta b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 14px; }
.sc-sidebar-menu-button[data-size='lg'] .sc-menu-meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; opacity: .75; }
.sc-sidebar-menu-badge {
  margin-left: auto; display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 15%, transparent); color: var(--primary-light);
  font-size: 11px; font-weight: 600;
}
/* hydrogen has no collapse rail */
.sc-sidebar-rail { display: none !important; }
/* SidebarInset: content xl:ms-[270px] */
.sc-inset { position: relative; display: flex; flex-direction: column; flex: 1; width: 100%; min-width: 0; background: var(--background); }
@media (min-width: 1280px) { .sc-inset { margin-left: var(--sidebar-width); } }
/* Header (sticky-header.tsx): sticky, bg-gray-0/80 backdrop-blur-xl, p-4,
   card-shadow once scrolled; no border */
.sc-header {
  z-index: 40; min-height: 64px; flex-shrink: 0; position: sticky; top: 0;
  background: rgba(0, 0, 0, 0.8);
  -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px);
}
.sc-header-inner {
  position: relative; display: flex; align-items: center; gap: 12px;
  height: 100%; min-height: 64px; padding: 16px;
}
@media (min-width: 768px) { .sc-header-inner { padding: 16px 20px; } }
@media (min-width: 1024px) { .sc-header-inner { padding: 16px 24px; } }
/* hamburger: only below xl (hydrogen shows it on mobile to open the drawer) */
.sc-trigger {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border: 0; border-radius: var(--radius-md);
  background: transparent; color: var(--foreground); cursor: pointer;
}
.sc-trigger:hover { background: var(--accent); color: var(--accent-foreground); }
.sc-trigger svg { width: 20px; height: 20px; }
@media (min-width: 1280px) { .sc-trigger { display: none; } }
.sc-separator-v { display: none; }
.sc-header-title { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
/* Main (layout.tsx): px-4 pb-6 pt-2 md:px-5 lg:px-6 lg:pb-8 */
.sc-main { padding: 8px 16px 24px; min-width: 0; }
@media (min-width: 768px) { .sc-main { padding: 8px 20px 24px; } }
@media (min-width: 1024px) { .sc-main { padding: 8px 24px 32px; } }
/* Mobile sidebar = drawer (hydrogen: hamburger opens Sidebar in a drawer) */
.sc-scrim {
  display: none; position: fixed; inset: 0; z-index: 45; background: rgb(0 0 0 / 0.6);
}
.sc-scrim.open { display: block; }
@media (max-width: 1279px) {
  .sc-wrapper.mobile-open .sc-sidebar { display: block; position: fixed; inset: 0 auto 0 0; z-index: 50; }
  .sc-wrapper.mobile-open .sc-sidebar-gap { display: none; }
  .sc-wrapper.mobile-open .sc-sidebar-container { position: static; display: flex; width: var(--sidebar-width-mobile); height: 100svh; }
}

/* ==========================================================================
   COMPONENTS — RizzUI measurements (button / input / textarea / select /
   label / card / table / badge / avatar)
   ========================================================================== */

/* Button (RizzUI): h-10 px-4 md, h-12 px-5 lg, rounded-md, text-sm font-medium */
.sc-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  white-space: nowrap; height: 40px; padding: 0 16px;
  border-radius: var(--radius-md); border: 1px solid transparent;
  font-size: 14px; font-weight: 500; line-height: 1.25; font-family: inherit;
  background: var(--primary); color: var(--primary-foreground);
  cursor: pointer;
  transition: background-color 150ms, color 150ms, opacity 150ms;
}
.sc-btn svg { width: 16px; height: 16px; pointer-events: none; }
.sc-btn:hover { background: var(--primary-dark); }
.sc-btn:disabled { pointer-events: none; opacity: .5; }
.sc-btn[data-variant='secondary'] { background: var(--secondary); color: var(--secondary-foreground); }
.sc-btn[data-variant='secondary']:hover { background: color-mix(in srgb, var(--secondary) 85%, #000); }
.sc-btn[data-variant='outline'] { background: var(--gray-0); border-color: var(--border); color: var(--foreground); }
.sc-btn[data-variant='outline']:hover { background: var(--gray-100); }
.sc-btn[data-variant='ghost'] { background: transparent; color: var(--foreground); }
.sc-btn[data-variant='ghost']:hover { background: var(--accent); color: var(--accent-foreground); }
.sc-btn[data-variant='destructive'] { background: var(--destructive); color: #fff; }
.sc-btn[data-variant='destructive']:hover { background: color-mix(in srgb, var(--destructive) 85%, #000); }
.sc-btn[data-variant='link'] { background: transparent; color: var(--primary); text-underline-offset: 4px; height: auto; padding: 0; }
.sc-btn[data-variant='link']:hover { text-decoration: underline; background: transparent; }
.sc-btn[data-size='sm'] { height: 32px; padding: 0 12px; gap: 6px; }
.sc-btn[data-size='lg'] { height: 48px; padding: 0 20px; }
.sc-btn[data-size='icon'] { width: 40px; height: 40px; padding: 0; }
.sc-btn[data-size='icon-sm'] { width: 32px; height: 32px; padding: 0; }

/* Input (RizzUI): h-10, rounded-md, border-muted, bg-gray-0, px-3, text-sm */
.sc-input {
  display: flex; height: 40px; width: 100%; min-width: 0;
  border-radius: var(--radius-md); border: 1px solid var(--border);
  background: var(--gray-0);
  padding: 4px 12px; font-size: 14px; font-family: inherit; color: var(--foreground);
  transition: border-color 150ms, box-shadow 150ms;
}
.sc-input::placeholder { color: var(--muted-foreground); }
.sc-input:focus-visible { border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 35%, transparent); }
.sc-input:disabled { pointer-events: none; cursor: not-allowed; opacity: .5; }
.sc-input::selection { background: var(--primary); color: var(--primary-foreground); }
.sc-input[data-size='lg'] { height: 48px; }

/* Textarea: rounded-md, px-3 py-2, text-sm */
.sc-textarea {
  display: flex; width: 100%; min-height: 64px;
  border-radius: var(--radius-md); border: 1px solid var(--border);
  background: var(--gray-0);
  padding: 8px 12px; font-size: 14px; font-family: inherit; color: var(--foreground);
  resize: vertical;
  transition: border-color 150ms, box-shadow 150ms;
}
.sc-textarea::placeholder { color: var(--muted-foreground); }
.sc-textarea:focus-visible { border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 35%, transparent); }

/* Select: h-10, rounded-md, border-muted, px-3, text-sm */
.sc-select {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  height: 40px; width: 100%; border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--gray-0);
  padding: 8px 12px; font-size: 14px; font-family: inherit; color: var(--foreground);
  cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23929292' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 36px;
  transition: border-color 150ms, box-shadow 150ms;
}
.sc-select:hover { background: var(--gray-100); }
.sc-select:focus-visible { border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 35%, transparent); }
.sc-select option { background: var(--popover); color: var(--popover-foreground); }

/* Label: text-sm font-medium */
.sc-label { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; line-height: 1; user-select: none; }

/* Card (MetricCard): border border-muted bg-gray-0 p-5 lg:p-6, rounded-lg */
.sc-card {
  display: flex; flex-direction: column; gap: 20px;
  border-radius: var(--radius-lg); border: 1px solid var(--border);
  background: var(--card); color: var(--card-foreground);
  padding-top: 20px; padding-bottom: 20px;
}
.sc-card-header { display: grid; gap: 6px; padding: 0 20px; align-items: start; }
.sc-card-header.row { display: flex; flex-direction: row; align-items: center; justify-content: space-between; padding-bottom: 8px; }
.sc-card-title { font-weight: 600; line-height: 1; letter-spacing: -0.01em; }
.sc-card-title.sm { font-size: 14px; font-weight: 500; }
.sc-card-desc { font-size: 14px; color: var(--muted-foreground); }
.sc-card-content { padding: 0 20px; min-width: 0; }
.sc-card-footer { display: flex; align-items: center; padding: 0 20px; }
.sc-card-footer.bordered { border-top: 1px solid var(--border); padding-top: 20px; }

/* Table (rc-table): th px-4 py-3 text-sm font-medium text-gray-500,
   rows border-b border-gray-100, hover bg-gray-50 */
.sc-table-wrap { position: relative; width: 100%; overflow-x: auto; }
.sc-table { width: 100%; caption-side: bottom; font-size: 14px; border-collapse: collapse; }
.sc-table thead tr { border-bottom: 1px solid var(--border); }
.sc-table tbody tr { border-bottom: 1px solid var(--gray-100); transition: background-color 150ms; }
.sc-table tbody tr:last-child { border-bottom: 0; }
.sc-table tbody tr:hover { background: var(--gray-50); }
.sc-table th {
  padding: 12px 16px; text-align: start; vertical-align: middle;
  font-weight: 500; font-size: 14px; white-space: nowrap; color: var(--muted-foreground);
}
.sc-table td { padding: 12px 16px; vertical-align: middle; white-space: nowrap; }
.sc-table td.wrap, .sc-table th.wrap { white-space: normal; }
.sc-table tfoot { border-top: 1px solid var(--border); background: var(--gray-50); font-weight: 500; }

/* Badge (StatusBadge): rounded-full px-2 py-0.5 text-xs font-medium, tinted */
.sc-badge {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  width: fit-content; white-space: nowrap; flex-shrink: 0;
  border-radius: 999px; border: 1px solid transparent;
  padding: 2px 8px; font-size: 12px; font-weight: 500; line-height: 1.4;
  background: color-mix(in srgb, var(--primary) 15%, transparent); color: var(--primary-light); overflow: hidden;
}
.sc-badge svg { width: 12px; height: 12px; }
.sc-badge[data-variant='secondary'] { background: color-mix(in srgb, var(--secondary) 15%, transparent); color: #c1cbff; }
.sc-badge[data-variant='destructive'] { background: color-mix(in srgb, var(--destructive) 15%, transparent); color: var(--destructive-fg); }
.sc-badge[data-variant='outline'] { background: transparent; border-color: var(--border); color: var(--foreground); }
.sc-badge[data-variant='success'] { background: color-mix(in srgb, var(--success) 15%, transparent); color: var(--success-fg); }
.sc-badge[data-variant='warning'] { background: color-mix(in srgb, var(--warning) 15%, transparent); color: var(--warning-fg); }
.sc-badge.pill { border-radius: 999px; }

/* Avatar: size-8 rounded-full, fallback bg-muted */
.sc-avatar {
  position: relative; display: flex; flex-shrink: 0; align-items: center; justify-content: center;
  width: 32px; height: 32px; overflow: hidden; border-radius: 999px;
  background: var(--muted); color: var(--muted-foreground); font-size: 12px; font-weight: 600;
}
.sc-avatar.lg { width: 40px; height: 40px; font-size: 14px; border-radius: var(--radius-lg); }
.sc-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ==========================================================================
   OVERLAYS — dialog, dropdown-menu, switch, checkbox, separator, tabs,
   alert, skeleton, tooltip, toast (RizzUI measurements)
   ========================================================================== */

/* Dialog: overlay bg-black/60; content rounded-lg, border, bg-gray-50, p-6 */
.sc-dialog-overlay {
  position: fixed; inset: 0; z-index: 50; background: rgb(0 0 0 / 0.6);
  display: none;
}
.sc-dialog-overlay.open { display: block; }
.sc-dialog {
  position: fixed; top: 50%; left: 50%; z-index: 50;
  transform: translate(-50%, -50%);
  display: none; width: 100%; max-width: calc(100% - 2rem);
  gap: 16px; border-radius: var(--radius-lg); border: 1px solid var(--border);
  background: var(--gray-50); padding: 24px; box-shadow: var(--iso-shadow-lg);
}
@media (min-width: 640px) { .sc-dialog { max-width: 32rem; } }
.sc-dialog.open { display: grid; }
.sc-dialog-header { display: flex; flex-direction: column; gap: 8px; text-align: start; }
.sc-dialog-title { font-size: 18px; line-height: 1; font-weight: 600; letter-spacing: -0.01em; }
.sc-dialog-desc { font-size: 14px; color: var(--muted-foreground); }
.sc-dialog-footer { display: flex; flex-direction: column-reverse; gap: 8px; }
@media (min-width: 640px) { .sc-dialog-footer { flex-direction: row; justify-content: flex-end; } }
.sc-dialog-close {
  position: absolute; top: 16px; right: 16px; display: inline-flex;
  align-items: center; justify-content: center; width: 28px; height: 28px;
  border: 0; border-radius: var(--radius-md); background: transparent; color: var(--foreground);
  opacity: .7; cursor: pointer;
}
.sc-dialog-close:hover { opacity: 1; background: var(--accent); }
.sc-dialog-close svg { width: 16px; height: 16px; }

/* Dropdown: content rounded-md border bg-gray-100 p-1 shadow;
   item flex gap-2 rounded-md px-2 py-1.5 text-sm, hover bg-gray-200 */
.sc-dropdown { position: relative; display: inline-block; }
.sc-dropdown-menu {
  position: absolute; z-index: 50; display: none;
  min-width: 8rem; border-radius: var(--radius-md); border: 1px solid var(--border);
  background: var(--popover); color: var(--popover-foreground);
  padding: 4px; box-shadow: var(--iso-shadow-md);
}
.sc-dropdown-menu.open { display: block; }
.sc-dropdown-menu[data-align='end'] { right: 0; }
.sc-dropdown-menu[data-align='start'] { left: 0; }
.sc-dropdown-menu.wide { min-width: 14rem; border-radius: var(--radius-lg); }
.sc-dropdown-item {
  position: relative; display: flex; align-items: center; gap: 8px;
  border-radius: var(--radius-md); padding: 6px 8px; font-size: 14px;
  color: var(--popover-foreground); cursor: pointer; user-select: none;
  text-decoration: none; width: 100%; text-align: start; background: transparent; border: 0; font-family: inherit;
}
.sc-dropdown-item svg { width: 16px; height: 16px; color: var(--muted-foreground); }
.sc-dropdown-item:hover, .sc-dropdown-item:focus-visible { background: var(--gray-200); color: var(--accent-foreground); }
.sc-dropdown-item[data-variant='destructive'] { color: var(--destructive-fg); }
.sc-dropdown-item[data-variant='destructive']:hover { background: color-mix(in srgb, var(--destructive) 15%, transparent); color: var(--destructive-fg); }
.sc-dropdown-label { padding: 6px 8px; font-size: 14px; font-weight: 500; }
.sc-dropdown-sep { height: 1px; background: var(--border); margin: 4px -4px; }

/* Switch (RizzUI): w-11 h-6 rounded-full; thumb 20px */
.sc-switch {
  position: relative; display: inline-flex; align-items: center; flex-shrink: 0;
  width: 44px; height: 24px; border-radius: 999px; border: 1px solid transparent;
  background: var(--gray-300);
  cursor: pointer; transition: background-color 150ms;
  appearance: none; padding: 0; margin: 0;
}
.sc-switch:checked { background: var(--primary); }
.sc-switch::after {
  content: ''; display: block; width: 20px; height: 20px; border-radius: 999px;
  background: var(--gray-1000); transition: transform 150ms; transform: translateX(2px);
}
.sc-switch:checked::after { transform: translateX(20px); background: #fff; }
.sc-switch:focus-visible { border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 35%, transparent); }
.sc-switch:disabled { cursor: not-allowed; opacity: .5; }

/* Checkbox (RizzUI): size-5, rounded-md, border-muted; checked bg-primary */
.sc-checkbox {
  appearance: none; display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; flex-shrink: 0; border-radius: var(--radius-md);
  border: 1px solid var(--input); background: var(--gray-0);
  cursor: pointer; transition: background-color 150ms, border-color 150ms;
  padding: 0; margin: 0; position: relative;
}
.sc-checkbox:checked { border-color: var(--primary); background: var(--primary); }
.sc-checkbox:checked::after {
  content: ''; width: 14px; height: 14px;
  background: var(--primary-foreground);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 14px 14px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 14px 14px no-repeat;
}
.sc-checkbox:focus-visible { border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 35%, transparent); }
.sc-checkbox:disabled { cursor: not-allowed; opacity: .5; }

/* Separator: bg-border, h-px / w-px */
.sc-sep { background: var(--border); flex-shrink: 0; height: 1px; width: 100%; border: 0; }
.sc-sep[data-orientation='vertical'] { width: 1px; height: auto; align-self: stretch; }

/* Tabs: list rounded-lg bg-muted p-1; trigger active bg-gray-0 */
.sc-tabs-list {
  display: inline-flex; align-items: center; justify-content: center;
  height: 40px; width: fit-content; border-radius: var(--radius-lg);
  background: var(--muted); color: var(--muted-foreground); padding: 4px;
}
.sc-tabs-trigger {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 100%; flex: 1; border-radius: var(--radius-md);
  border: 1px solid transparent; padding: 4px 12px;
  font-size: 14px; font-weight: 500; white-space: nowrap;
  background: transparent; color: var(--foreground); cursor: pointer;
  transition: background-color 150ms, color 150ms;
}
.sc-tabs-trigger svg { width: 16px; height: 16px; }
.sc-tabs-trigger[data-active='true'] {
  background: var(--gray-0);
  color: var(--foreground);
}
.sc-tabs-trigger:disabled { pointer-events: none; opacity: .5; }

/* Alert: rounded-lg border px-4 py-3 text-sm, bg-card */
.sc-alert {
  position: relative; width: 100%; border-radius: var(--radius-lg);
  border: 1px solid var(--border); padding: 12px 16px; font-size: 14px;
  background: var(--card); color: var(--card-foreground);
  display: grid; gap: 2px; align-items: start;
}
.sc-alert-title { font-weight: 500; letter-spacing: -0.01em; }
.sc-alert-desc { font-size: 14px; color: var(--muted-foreground); }
.sc-alert[data-variant='destructive'] { color: var(--destructive-fg); border-color: var(--destructive); }
.sc-alert[data-variant='destructive'] .sc-alert-desc { color: var(--destructive-fg); }
.sc-alert svg { width: 16px; height: 16px; }

/* Skeleton: rounded-md bg-muted animate-pulse */
.sc-skeleton { border-radius: var(--radius-md); background: var(--muted); animation: sc-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
@keyframes sc-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }

/* Tooltip: rounded-md, px-3 py-1.5, text-xs */
.sc-tooltip { position: relative; }
.sc-tooltip-bubble {
  display: none; position: absolute; z-index: 60; left: 50%; bottom: calc(100% + 6px);
  transform: translateX(-50%); background: var(--popover); color: var(--popover-foreground);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 6px 12px; font-size: 12px; white-space: nowrap; box-shadow: var(--iso-shadow-md);
}
.sc-tooltip:hover .sc-tooltip-bubble { display: block; }

/* Toast: bottom-right, rounded-lg border bg-popover, p-4 */
.sc-toaster { position: fixed; bottom: 16px; right: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.sc-toast {
  display: flex; align-items: center; gap: 12px; min-width: 280px; max-width: 380px;
  border-radius: var(--radius-lg); border: 1px solid var(--border);
  background: var(--popover); color: var(--popover-foreground);
  padding: 12px 16px; box-shadow: var(--iso-shadow-lg); font-size: 14px;
}
.sc-toast[data-type='error'] { border-color: color-mix(in srgb, var(--destructive) 50%, transparent); }

/* ==========================================================================
   ADMIN PORTAL — .mb-* classes mapped to Isomorphic components
   (admin pages keep their markup; the styles below are the template's)
   ========================================================================== */
.mb-page { min-width: 0; }
.mb-page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.mb-page-title { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; margin: 0; color: var(--gray-700); }
.mb-page-sub { font-size: 14px; color: var(--muted-foreground); margin: 4px 0 0; }
.mb-grid { display: grid; gap: 20px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .mb-grid-2 { grid-template-columns: repeat(2, 1fr); } .mb-grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .mb-grid-4 { grid-template-columns: repeat(4, 1fr); } }
/* MetricCard: border border-muted bg-gray-0 p-5 lg:p-6, rounded-lg */
.mb-card {
  display: flex; flex-direction: column; gap: 20px;
  border-radius: var(--radius-lg); border: 1px solid var(--border);
  background: var(--card); color: var(--card-foreground);
  padding-top: 20px; padding-bottom: 20px; min-width: 0;
}
@media (min-width: 1024px) { .mb-card { padding-top: 24px; padding-bottom: 24px; } }
.mb-card-header { display: grid; gap: 6px; padding: 0 20px; align-items: start; }
@media (min-width: 1024px) { .mb-card-header { padding: 0 24px; } }
.mb-card-title { font-weight: 600; line-height: 1; letter-spacing: -0.01em; font-size: 16px; margin: 0; }
.mb-card-body { padding: 0 20px; min-width: 0; }
@media (min-width: 1024px) { .mb-card-body { padding: 0 24px; } }
/* Stat: label text-gray-500, value bold; icon = MetricCard icon box
   (h-11 w-11 rounded-lg bg-gray-100) */
.mb-stat { display: flex; flex-direction: row; justify-content: space-between; align-items: flex-start; gap: 16px; }
.mb-stat-label { font-size: 14px; font-weight: 400; color: var(--gray-500); margin: 0 0 2px; }
.mb-stat-value { font-size: 24px; font-weight: 700; line-height: 1.2; color: var(--gray-900); }
.mb-stat-icon {
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: var(--radius-lg);
  background: var(--gray-100); color: var(--gray-500); flex-shrink: 0;
}
.mb-stat-icon svg { width: 20px; height: 20px; }
.mb-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  white-space: nowrap; height: 40px; padding: 0 16px;
  border-radius: var(--radius-md); border: 1px solid transparent;
  font-size: 14px; font-weight: 500; line-height: 1.25; font-family: inherit;
  background: var(--primary); color: var(--primary-foreground);
  cursor: pointer; text-decoration: none;
  transition: background-color 150ms, color 150ms, opacity 150ms;
}
.mb-btn svg { width: 16px; height: 16px; pointer-events: none; }
.mb-btn:hover { background: var(--primary-dark); color: var(--primary-foreground); }
.mb-btn:disabled { pointer-events: none; opacity: .5; }
.mb-btn-primary { background: var(--primary); color: var(--primary-foreground); }
.mb-btn-light, .mb-btn-outline-primary { background: var(--gray-0); border-color: var(--border); color: var(--foreground); }
.mb-btn-light:hover, .mb-btn-outline-primary:hover { background: var(--gray-100); color: var(--foreground); }
.mb-btn-danger { background: var(--destructive); color: #fff; }
.mb-btn-danger:hover { background: color-mix(in srgb, var(--destructive) 85%, #000); color: #fff; }
.mb-btn-sm { height: 32px; padding: 0 12px; gap: 6px; }
.mb-btn-block { width: 100%; }
.mb-input {
  display: flex; height: 40px; width: 100%; min-width: 0;
  border-radius: var(--radius-md); border: 1px solid var(--border);
  background: var(--gray-0);
  padding: 4px 12px; font-size: 14px; font-family: inherit; color: var(--foreground);
  transition: border-color 150ms, box-shadow 150ms;
}
.mb-input::placeholder { color: var(--muted-foreground); }
.mb-input:focus-visible { border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 35%, transparent); }
.mb-input:disabled { pointer-events: none; opacity: .5; }
textarea.mb-input { min-height: 64px; padding: 8px 12px; resize: vertical; }
.mb-select {
  display: flex; align-items: center; height: 40px; width: 100%;
  border-radius: var(--radius-md); border: 1px solid var(--border);
  background-color: var(--gray-0);
  padding: 8px 36px 8px 12px; font-size: 14px; font-family: inherit; color: var(--foreground);
  cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23929292' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.mb-select:focus-visible { border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 35%, transparent); }
.mb-select option { background: var(--popover); color: var(--popover-foreground); }
.mb-label { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; line-height: 1; user-select: none; margin-bottom: 0; }
.mb-field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.mb-form-text { font-size: 12px; color: var(--muted-foreground); }
.mb-input-group { display: flex; align-items: stretch; width: 100%; }
.mb-input-group .mb-input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.mb-input-group-text {
  display: flex; align-items: center; padding: 0 12px; font-size: 14px;
  border: 1px solid var(--border); border-left: 0; border-radius: 0 var(--radius-md) var(--radius-md) 0;
  background: var(--muted); color: var(--muted-foreground); white-space: nowrap;
}
.mb-check { appearance: none; display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; flex-shrink: 0; border-radius: var(--radius-md); border: 1px solid var(--input); background: var(--gray-0); cursor: pointer; padding: 0; margin: 0; position: relative; }
.mb-check:checked { border-color: var(--primary); background: var(--primary); }
.mb-check:checked::after { content: ''; width: 14px; height: 14px; background: var(--primary-foreground); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 14px 14px no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 14px 14px no-repeat; }
.mb-check:focus-visible { border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 35%, transparent); }
.mb-switch { position: relative; display: inline-flex; align-items: center; flex-shrink: 0; width: 44px; height: 24px; border-radius: 999px; border: 1px solid transparent; background: var(--gray-300); cursor: pointer; appearance: none; padding: 0; margin: 0; }
.mb-switch:checked { background: var(--primary); }
.mb-switch::after { content: ''; display: block; width: 20px; height: 20px; border-radius: 999px; background: var(--gray-1000); transition: transform 150ms; transform: translateX(2px); }
.mb-switch:checked::after { transform: translateX(20px); background: #fff; }
.mb-switch-label { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; user-select: none; }
.mb-table-wrap { position: relative; width: 100%; overflow-x: auto; }
.mb-table { width: 100%; caption-side: bottom; font-size: 14px; border-collapse: collapse; }
.mb-table thead tr { border-bottom: 1px solid var(--border); }
.mb-table tbody tr { border-bottom: 1px solid var(--gray-100); transition: background-color 150ms; }
.mb-table tbody tr:last-child { border-bottom: 0; }
.mb-table tbody tr:hover { background: var(--gray-50); }
.mb-table th { padding: 12px 16px; text-align: start; vertical-align: middle; font-weight: 500; white-space: nowrap; color: var(--muted-foreground); }
.mb-table td { padding: 12px 16px; vertical-align: middle; white-space: nowrap; }
.mb-badge {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  width: fit-content; white-space: nowrap; flex-shrink: 0;
  border-radius: 999px; border: 1px solid transparent;
  padding: 2px 8px; font-size: 12px; font-weight: 500; line-height: 1.4;
  background: color-mix(in srgb, var(--primary) 15%, transparent); color: var(--primary-light); overflow: hidden;
}
.mb-badge-primary { background: color-mix(in srgb, var(--primary) 15%, transparent); color: var(--primary-light); }
.mb-badge-success { background: color-mix(in srgb, var(--success) 15%, transparent); color: var(--success-fg); }
.mb-badge-warning { background: color-mix(in srgb, var(--warning) 15%, transparent); color: var(--warning-fg); }
.mb-badge-danger { background: color-mix(in srgb, var(--destructive) 15%, transparent); color: var(--destructive-fg); }
.mb-badge-info { background: color-mix(in srgb, var(--info) 15%, transparent); color: var(--info-fg); }
.mb-alert {
  position: relative; width: 100%; border-radius: var(--radius-lg);
  border: 1px solid var(--border); padding: 12px 16px; font-size: 14px;
  background: var(--card); color: var(--card-foreground);
}
.mb-alert-danger { color: var(--destructive-fg); border-color: var(--destructive); }
.mb-alert-success { color: var(--success-fg); border-color: var(--success); }
.mb-alert-warning { color: var(--warning-fg); border-color: var(--warning); }
.mb-alert-info { color: var(--info-fg); border-color: var(--info); }
.mb-avatar-initial {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 32px; height: 32px; border-radius: 999px;
  background: var(--muted); color: var(--muted-foreground); font-size: 12px; font-weight: 600;
}
.mb-avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.mb-avatar-xl { width: 48px; height: 48px; font-size: 16px; }
.mb-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 16px; text-align: center; color: var(--muted-foreground); gap: 8px; font-size: 14px; }
.mb-text-muted { color: var(--muted-foreground); }
.mb-0 { margin: 0 !important; }
/* Admin modal = Dialog */
.mb-modal { position: fixed; inset: 0; z-index: 50; display: none; align-items: center; justify-content: center; background: rgb(0 0 0 / 0.6); padding: 16px; }
.mb-modal.open { display: flex; }
.mb-modal-backdrop { display: none; }
.mb-modal-dialog {
  position: relative; width: 100%; max-width: 32rem;
  border-radius: var(--radius-lg); border: 1px solid var(--border);
  background: var(--gray-50); padding: 24px; box-shadow: var(--iso-shadow-lg);
  display: flex; flex-direction: column; gap: 16px; max-height: calc(100svh - 32px); overflow-y: auto;
}
.mb-modal-header { display: flex; flex-direction: column; gap: 8px; }
.mb-modal-title { font-size: 18px; line-height: 1; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
.mb-modal-body { font-size: 14px; }
.mb-modal-footer { display: flex; flex-direction: column-reverse; gap: 8px; }
@media (min-width: 640px) { .mb-modal-footer { flex-direction: row; justify-content: flex-end; } }
.mb-modal-close {
  position: absolute; top: 16px; right: 16px; display: inline-flex;
  align-items: center; justify-content: center; width: 28px; height: 28px;
  border: 0; border-radius: var(--radius-md); background: transparent; color: var(--foreground);
  opacity: .7; cursor: pointer; font-size: 18px; line-height: 1;
}
.mb-modal-close:hover { opacity: 1; background: var(--accent); }
/* Admin header user chip + logout */
.mb-userchip { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; }
.mb-userchip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
.mb-logout {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: var(--radius-md);
  border: 1px solid var(--border); background: var(--gray-0); color: var(--foreground);
  font-size: 14px; font-weight: 500; cursor: pointer; text-decoration: none;
}
.mb-logout:hover { background: var(--gray-100); }
/* Admin sign-in (legacy .mb-signin kept as centered fallback) */
.mb-signin { display: grid; min-height: 100svh; align-items: center; justify-content: center; padding: 32px 16px; background: var(--background); }
.mb-signin-card {
  display: flex; flex-direction: column; gap: 16px; width: 100%; max-width: 24rem;
  border-radius: var(--radius-lg); border: 1px solid var(--border);
  background: var(--card); color: var(--card-foreground);
  padding: 24px;
}
.mb-signin-foot { padding: 0 32px; text-align: center; font-size: 14px; color: var(--muted-foreground); }

/* ==========================================================================
   MAILBOX PORTAL — .kat-* / .mb360-* classes mapped to Isomorphic components.
   mailbox360.css keeps the app layout; the rules below own the visuals.
   ========================================================================== */

/* Topbar: bg-body, no border (Isomorphic header is blur, borderless) */
.mb360-topbar {
  height: 64px; background: var(--background);
  display: flex; align-items: center; gap: 12px; padding: 0 16px;
}
.mb360-brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }
.mb360-brand-mark {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: var(--radius-lg);
  background: var(--primary); color: var(--primary-foreground); font-weight: 700; font-size: 14px;
}
.mb360-topnav { display: flex; align-items: center; gap: 4px; }
.mb360-topnav a {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px;
  border-radius: var(--radius-md); font-size: 14px; font-weight: 500; color: var(--muted-foreground); text-decoration: none;
}
.mb360-topnav a svg { width: 16px; height: 16px; }
.mb360-topnav a:hover { color: var(--foreground); background: var(--accent); }
.mb360-topnav a.active { color: var(--primary); background: transparent; }
.mb360-userchip { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; }

/* Buttons: .kat-btn = Button, .kat-tool-btn = ghost icon button */
.kat-btn, .kat-compose-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  white-space: nowrap; height: 40px; padding: 0 16px;
  border-radius: var(--radius-md); border: 1px solid transparent;
  font-size: 14px; font-weight: 500; font-family: inherit;
  background: var(--primary); color: var(--primary-foreground);
  cursor: pointer; text-decoration: none;
  transition: background-color 150ms, color 150ms, opacity 150ms;
}
.kat-btn svg, .kat-compose-btn svg { width: 16px; height: 16px; }
.kat-btn:hover, .kat-compose-btn:hover { background: var(--primary-dark); color: var(--primary-foreground); }
.kat-btn:disabled, .kat-compose-btn:disabled { pointer-events: none; opacity: .5; }
.kat-tool-btn, .kat-pager-btns button, .kat-rail-toggle, .kat-menu-btn, .kat-back-btn, .kat-read-back {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 32px; min-width: 32px; padding: 0 8px; border: 0; border-radius: var(--radius-md);
  background: transparent; color: var(--foreground); cursor: pointer; font-family: inherit; font-size: 14px;
  transition: background-color 150ms, color 150ms;
}
.kat-tool-btn svg, .kat-pager-btns button svg, .kat-rail-toggle svg, .kat-menu-btn svg, .kat-back-btn svg, .kat-read-back svg { width: 16px; height: 16px; }
.kat-tool-btn:hover, .kat-pager-btns button:hover, .kat-rail-toggle:hover, .kat-menu-btn:hover, .kat-back-btn:hover, .kat-read-back:hover { background: var(--accent); color: var(--accent-foreground); }
.kat-tool-btn:disabled, .kat-pager-btns button:disabled { opacity: .5; pointer-events: none; }
.kat-tool-btn[data-active='true'], .kat-tool-btn.active { background: var(--accent); color: var(--accent-foreground); }

/* Inputs + search */
.kat-input, .kat-search, .kat-compose-to, .kat-compose-cc, .kat-compose-bcc, .kat-compose-subject, .kat-compose-from {
  display: flex; height: 40px; width: 100%; min-width: 0;
  border-radius: var(--radius-md); border: 1px solid var(--border);
  background: var(--gray-0);
  padding: 4px 12px; font-size: 14px; font-family: inherit; color: var(--foreground);
}
.kat-input::placeholder, .kat-search::placeholder { color: var(--muted-foreground); }
.kat-input:focus-visible, .kat-search:focus-visible { border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 35%, transparent); }
.kat-compose-to, .kat-compose-cc, .kat-compose-bcc, .kat-compose-subject, .kat-compose-from { border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: transparent; }
.kat-compose-to:focus-visible, .kat-compose-cc:focus-visible, .kat-compose-bcc:focus-visible, .kat-compose-subject:focus-visible, .kat-compose-from:focus-visible { border-color: var(--border); box-shadow: none; border-bottom-color: var(--ring); }

/* Folder rail = hydrogen sidebar nav */
.kat-folder-rail, .kat-rail-scroll { background: var(--sidebar); color: var(--sidebar-foreground); }
.kat-rail-top { padding: 8px; }
.kat-folder-title, .kat-list-title-row {
  display: flex; align-items: center; height: 32px; padding: 0 8px;
  font-size: 12px; font-weight: 400; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--gray-500);
}
.kat-folder {
  display: flex; align-items: center; gap: 8px; width: calc(100% - 24px);
  margin: 2px 12px; padding: 8px 12px; border: 0; border-radius: var(--radius-md);
  background: transparent; color: var(--gray-700);
  font-size: 14px; font-weight: 500; text-align: start; cursor: pointer; font-family: inherit;
  transition: background-color 200ms, color 200ms; position: relative;
}
.kat-folder svg { width: 20px; height: 20px; flex-shrink: 0; color: var(--gray-500); }
.kat-folder:hover { background: var(--sidebar-accent); color: var(--gray-900); }
.kat-folder:hover svg { color: var(--gray-700); }
.kat-folder[data-active='true'], .kat-folder.active { color: var(--primary); font-weight: 500; }
.kat-folder[data-active='true'] svg, .kat-folder.active svg { color: var(--primary); }
.kat-folder[data-active='true']::before, .kat-folder.active::before {
  content: ''; position: absolute; left: -12px; top: 10%;
  width: 4px; height: 80%; border-radius: 0 4px 4px 0; background: var(--primary);
}
.kat-folder .kat-count {
  margin-left: auto; display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 15%, transparent); color: var(--primary-light);
  font-size: 11px; font-weight: 600;
}
.kat-label-dot { width: 8px; height: 8px; border-radius: 999px; flex-shrink: 0; }
.kat-label-row { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.kat-label-new-btn { font-size: 12px; color: var(--muted-foreground); background: transparent; border: 0; cursor: pointer; padding: 4px 8px; border-radius: var(--radius-md); }
.kat-label-new-btn:hover { background: var(--accent); color: var(--accent-foreground); }
.kat-label-new-input { height: 32px; font-size: 13px; }

/* Message list rows = Table rows */
.kat-message-list .kat-row {
  border-bottom: 1px solid var(--gray-100); cursor: pointer;
  transition: background-color 150ms; padding: 12px 16px;
}
.kat-message-list .kat-row:hover { background: var(--gray-50); }
.kat-message-list .kat-row[data-selected='true'], .kat-message-list .kat-row.selected { background: var(--gray-100); }
.kat-row .kat-sender { font-size: 14px; }
.kat-row .kat-subject { font-size: 14px; }
.kat-row .kat-snippet { font-size: 13px; color: var(--muted-foreground); }
.kat-row .kat-date { font-size: 12px; color: var(--muted-foreground); }
.kat-row.kat-new .kat-sender, .kat-row.kat-new .kat-subject { font-weight: 600; }
.kat-unread-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--primary); flex-shrink: 0; }
.kat-star { color: var(--muted-foreground); background: transparent; border: 0; cursor: pointer; padding: 4px; border-radius: var(--radius-md); }
.kat-star:hover { background: var(--accent); }
.kat-star[data-starred='true'], .kat-star.starred { color: var(--warning); }
.kat-check { appearance: none; width: 20px; height: 20px; flex-shrink: 0; border-radius: var(--radius-md); border: 1px solid var(--input); background: var(--gray-0); cursor: pointer; padding: 0; margin: 0; }
.kat-check:checked { border-color: var(--primary); background: var(--primary); }

/* Thread / message cards = Card */
.kat-msgcard, .kat-card {
  border-radius: var(--radius-lg); border: 1px solid var(--border);
  background: var(--card); color: var(--card-foreground);
}
.kat-msgcard-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px 0; }
.kat-msgcard-from { font-size: 14px; font-weight: 600; }
.kat-msgcard-date, .kat-msgcard-meta { font-size: 12px; color: var(--muted-foreground); }
.kat-msgcard-body { padding: 12px 20px 16px; }
.kat-msgcard-snippet { font-size: 14px; color: var(--muted-foreground); }
.kat-msgcard-chevron { color: var(--muted-foreground); }
.kat-thread-subject-row { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.kat-thread-count {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; border: 1px solid transparent;
  padding: 2px 8px; font-size: 12px; font-weight: 500;
  background: color-mix(in srgb, var(--secondary) 15%, transparent); color: #c1cbff;
}
.kat-thread-participants, .kat-thread-labels { font-size: 13px; color: var(--muted-foreground); }
.kat-thread-actions { display: flex; gap: 4px; }

/* Reading pane */
.kat-read-subject { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.kat-read-meta, .kat-meta-text { font-size: 13px; color: var(--muted-foreground); }
.kat-read-actions { display: flex; gap: 4px; }
.kat-read-body-frame, .kat-msgcard-frame { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--card); overflow: hidden; }

/* Compose = Dialog */
.kat-compose-modal { position: fixed; inset: 0; z-index: 50; background: rgb(0 0 0 / 0.6); display: none; align-items: center; justify-content: center; padding: 16px; }
.kat-compose-modal.open { display: flex; }
.kat-compose-dialog {
  position: relative; width: 100%; max-width: 48rem;
  border-radius: var(--radius-lg); border: 1px solid var(--border);
  background: var(--gray-50); box-shadow: var(--iso-shadow-lg);
  display: flex; flex-direction: column; gap: 0; max-height: calc(100svh - 32px);
}
.kat-compose-head { display: flex; align-items: center; gap: 12px; padding: 16px 24px; border-bottom: 1px solid var(--border); }
.kat-compose-title { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.kat-compose-close, .kat-compose-discard {
  display: inline-flex; align-items: center; justify-content: center;
  height: 32px; min-width: 32px; padding: 0 8px; border: 0; border-radius: var(--radius-md);
  background: transparent; color: var(--foreground); cursor: pointer; font-size: 14px; font-family: inherit;
}
.kat-compose-close:hover, .kat-compose-discard:hover { background: var(--accent); }
.kat-compose-row { padding: 0 24px; }
.kat-compose-body { min-height: 180px; padding: 16px 24px; font-size: 14px; }
.kat-compose-foot { display: flex; align-items: center; gap: 8px; padding: 16px 24px; border-top: 1px solid var(--border); }
.kat-rte-toolbar { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; padding: 8px 24px; border-bottom: 1px solid var(--border); }
.kat-rte-toolbar button {
  display: inline-flex; align-items: center; justify-content: center;
  height: 28px; min-width: 28px; padding: 0 6px; border: 0; border-radius: var(--radius-md);
  background: transparent; color: var(--foreground); cursor: pointer; font-size: 13px; font-family: inherit;
}
.kat-rte-toolbar button:hover { background: var(--accent); }
.kat-rte-toolbar button[data-active='true'], .kat-rte-toolbar button.active { background: var(--accent); }
.kat-rte-sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
.kat-rte-color { width: 28px; height: 28px; padding: 2px; border: 0; border-radius: var(--radius-md); background: transparent; cursor: pointer; }
.kat-compose-attach-list { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 24px 8px; }
.kat-attach {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 999px; border: 1px solid transparent;
  background: color-mix(in srgb, var(--secondary) 15%, transparent); color: #c1cbff;
  padding: 4px 10px; font-size: 12px; font-weight: 500;
}

/* Pills = Tabs */
.kat-pills { display: inline-flex; align-items: center; height: 40px; border-radius: var(--radius-lg); background: var(--muted); color: var(--muted-foreground); padding: 4px; gap: 0; }
.kat-pill {
  display: inline-flex; align-items: center; justify-content: center; height: 100%;
  border-radius: var(--radius-md); border: 1px solid transparent; padding: 4px 10px;
  font-size: 13px; font-weight: 500; background: transparent; color: var(--foreground); cursor: pointer; font-family: inherit;
}
.kat-pill[data-active='true'], .kat-pill.active { background: var(--gray-0); box-shadow: none; }

/* Toast */
.kat-toast {
  display: flex; align-items: center; gap: 12px; min-width: 280px; max-width: 380px;
  border-radius: var(--radius-lg); border: 1px solid var(--border);
  background: var(--popover); color: var(--popover-foreground);
  padding: 12px 16px; box-shadow: var(--iso-shadow-lg); font-size: 14px;
}
.kat-toast[data-type='error'] { border-color: color-mix(in srgb, var(--destructive) 50%, transparent); }

/* Misc mailbox */
.kat-empty-note, .kat-list-empty, .kat-read-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 16px; text-align: center; color: var(--muted-foreground); gap: 8px; font-size: 14px; }
.kat-skel { border-radius: var(--radius-md); background: var(--muted); animation: sc-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.kat-bulk-bar { display: flex; align-items: center; gap: 8px; padding: 8px 16px; background: var(--muted); border-bottom: 1px solid var(--border); font-size: 14px; }
.kat-bulk-count { font-weight: 600; }
.kat-pager { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted-foreground); }
.kat-page-info { font-size: 13px; color: var(--muted-foreground); }
.kat-account-filter { max-width: 220px; }
.kat-list-head { display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-bottom: 1px solid var(--border); }
.kat-meta-line { font-size: 12px; color: var(--muted-foreground); }
.kat-avatar, .kat-sender-avatar {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 32px; height: 32px; border-radius: 999px;
  background: var(--muted); color: var(--muted-foreground); font-size: 12px; font-weight: 600;
}

/* Fallback: any legacy mb-nav markup still emitted renders as sidebar buttons */
.mb-nav { display: flex; flex-direction: column; gap: 2px; }
.mb-nav-group { display: flex; align-items: center; padding: 0 24px; margin-bottom: 8px; font-size: 12px; font-weight: 400; text-transform: uppercase; letter-spacing: 0.1em; color: var(--gray-500); }
.mb-nav-item {
  display: flex; align-items: center; gap: 8px; width: calc(100% - 24px);
  margin: 2px 12px; padding: 8px 12px;
  border-radius: var(--radius-md); background: transparent; color: var(--gray-700);
  font-size: 14px; font-weight: 500; text-decoration: none; position: relative;
}
.mb-nav-item svg { width: 20px; height: 20px; flex-shrink: 0; color: var(--gray-500); }
.mb-nav-item:hover { background: var(--sidebar-accent); color: var(--gray-900); }
.mb-nav-item.active { color: var(--primary); font-weight: 500; }
.mb-nav-item.active svg { color: var(--primary); }
.mb-nav-item.active::before {
  content: ''; position: absolute; left: -12px; top: 10%;
  width: 4px; height: 80%; border-radius: 0 4px 4px 0; background: var(--primary);
}

/* Mailbox secondary shell (mb360-sidebar / topbar / user menu) */
.mb360-sidebar { background: var(--sidebar); border-right: 2px solid var(--sidebar-border); }
.mb360-sidebar .mb360-brand { padding: 20px 24px; border-bottom: 0; }
.mb360-topbar .mb360-brand { padding: 0; border-bottom: 0; }
.mb360-nav { padding: 0 0 12px; gap: 2px; }
.mb360-nav-label {
  display: flex; align-items: center; padding: 0 24px; margin-bottom: 8px;
  font-size: 12px; font-weight: 400; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--gray-500);
}
.mb360-nav a {
  display: flex; align-items: center; gap: 8px; width: calc(100% - 24px);
  margin: 2px 12px; padding: 8px 12px;
  border-radius: var(--radius-md); color: var(--gray-700);
  font-size: 14px; font-weight: 500; position: relative;
}
.mb360-nav a:hover { background: var(--sidebar-accent); color: var(--gray-900); }
.mb360-nav a:hover svg { color: var(--gray-700); }
.mb360-nav a.active { color: var(--primary); font-weight: 500; }
.mb360-nav a.active svg { color: var(--primary); }
.mb360-nav a.active::before {
  content: ''; position: absolute; left: -12px; top: 10%;
  width: 4px; height: 80%; border-radius: 0 4px 4px 0; background: var(--primary);
}
.mb360-nav a svg { width: 20px; height: 20px; color: var(--gray-500); }
.mb360-side-foot { border-top: 1px solid var(--sidebar-border); color: var(--gray-500); font-size: 12px; }
.mb360-topbar { background: var(--background); }
.mb360-page-title { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.mb360-icon-btn {
  width: 36px; height: 36px; border: 0; border-radius: var(--radius-md);
  background: transparent; color: var(--foreground);
}
.mb360-icon-btn:hover { background: var(--accent); color: var(--accent-foreground); }
.mb360-icon-btn svg { width: 16px; height: 16px; }
.mb360-userchip-btn {
  display: flex; align-items: center; gap: 8px; border: 0; background: transparent;
  border-radius: var(--radius-md); padding: 4px 8px; cursor: pointer; color: var(--foreground);
}
.mb360-userchip-btn:hover { background: var(--accent); }
.mb360-avatar { width: 32px; height: 32px; font-size: 12px; }
.mb360-userchip-name { font-size: 14px; font-weight: 500; }
.mb360-menu {
  border-radius: var(--radius-md); padding: 4px; box-shadow: var(--iso-shadow-md);
  background: var(--popover); min-width: 220px;
}
.mb360-menu a, .mb360-menu button {
  border-radius: var(--radius-md); padding: 6px 8px; font-size: 14px; gap: 8px;
  color: var(--popover-foreground);
}
.mb360-menu a:hover, .mb360-menu button:hover { background: var(--gray-200); color: var(--accent-foreground); }
.mb360-menu .mb360-menu-head { padding: 6px 8px; margin-bottom: 4px; }
.mb360-menu .mb360-menu-head strong { font-size: 14px; font-weight: 500; }
.mb360-menu .mb360-menu-head span { font-size: 13px; }
/* Legacy Bootstrap-style dropdowns / modals used inside secondary pages */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; z-index: 50; display: none; min-width: 8rem;
  border-radius: var(--radius-md); border: 1px solid var(--border);
  background: var(--popover); color: var(--popover-foreground);
  padding: 4px; box-shadow: var(--iso-shadow-md);
}
.dropdown-menu.show { display: block; }
.dropdown-menu a, .dropdown-menu button, .dropdown-item {
  display: flex; align-items: center; gap: 8px; border-radius: var(--radius-md);
  padding: 6px 8px; font-size: 14px; color: var(--popover-foreground);
  text-decoration: none; background: transparent; border: 0; width: 100%; text-align: start; cursor: pointer;
}
.dropdown-menu a:hover, .dropdown-menu button:hover, .dropdown-item:hover { background: var(--gray-200); color: var(--accent-foreground); }
.modal { position: fixed; inset: 0; z-index: 50; display: none; align-items: center; justify-content: center; background: rgb(0 0 0 / 0.6); padding: 16px; }
.modal.show { display: flex; }
.modal-dialog {
  position: relative; width: 100%; max-width: 32rem;
  border-radius: var(--radius-lg); border: 1px solid var(--border);
  background: var(--gray-50); padding: 24px; box-shadow: var(--iso-shadow-lg);
  display: flex; flex-direction: column; gap: 16px; max-height: calc(100svh - 32px); overflow-y: auto;
}
.modal-header { display: flex; flex-direction: column; gap: 8px; }
.modal-title { font-size: 18px; line-height: 1; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
.modal-body { font-size: 14px; }
.modal-footer { display: flex; flex-direction: column-reverse; gap: 8px; }
@media (min-width: 640px) { .modal-footer { flex-direction: row; justify-content: flex-end; } }

/* ==========================================================================
   AUTH — Isomorphic AuthWrapperOne (sign-in-1): split screen.
   Banner left (brand panel, no external image), form right.
   Form = sign-in-form.tsx: labels font-medium, inputs size lg (h-12),
   space-y-5, Button size lg w-full, blue Forget Password link.
   ========================================================================== */
.iso-auth { display: grid; min-height: 100svh; background: var(--background); }
@media (min-width: 1024px) { .iso-auth { grid-template-columns: 1fr 1fr; } }
.iso-auth-banner {
  display: none; position: relative; overflow: hidden;
  background: var(--gray-50);
  padding: 40px;
}
@media (min-width: 1024px) {
  .iso-auth-banner { display: flex; flex-direction: column; justify-content: space-between; }
}
/* soft Blue-preset glow, echoing the template banner art without an image */
.iso-auth-banner::before {
  content: ''; position: absolute; inset: auto -120px -120px auto;
  width: 420px; height: 420px; border-radius: 999px;
  background: radial-gradient(circle, rgba(56, 114, 250, 0.35), transparent 65%);
}
.iso-auth-banner::after {
  content: ''; position: absolute; top: -100px; left: -60px;
  width: 320px; height: 320px; border-radius: 999px;
  background: radial-gradient(circle, rgba(56, 114, 250, 0.18), transparent 65%);
}
.iso-auth-banner-brand { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 600; position: relative; z-index: 1; }
.iso-auth-banner-copy { position: relative; z-index: 1; max-width: 30rem; }
.iso-auth-banner-copy h2 { font-size: 32px; line-height: 1.25; font-weight: 700; color: var(--gray-900); margin: 0 0 12px; }
.iso-auth-banner-copy p { font-size: 15px; line-height: 1.6; color: var(--muted-foreground); margin: 0; }
.iso-auth-banner-foot { position: relative; z-index: 1; font-size: 12px; color: var(--gray-500); }
.iso-auth-form-wrap {
  display: flex; align-items: center; justify-content: center;
  padding: 32px 16px; min-width: 0;
}
.iso-auth-form { width: 100%; max-width: 26rem; }
.iso-auth-form h1 { font-size: 28px; line-height: 1.3; font-weight: 700; color: var(--gray-900); margin: 0 0 8px; }
.iso-auth-form h1 .iso-underline {
  position: relative; display: inline-block; color: var(--primary-light);
}
.iso-auth-form h1 .iso-underline::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -2px;
  height: 3px; border-radius: 2px; background: var(--primary);
}
.iso-auth-desc { font-size: 14px; color: var(--muted-foreground); margin: 0 0 24px; line-height: 1.6; }
.iso-auth-form .iso-field { display: flex; flex-direction: column; gap: 8px; }
.iso-auth-form .iso-row { display: flex; align-items: center; justify-content: space-between; padding-bottom: 8px; }
.iso-auth-forgot { font-size: 14px; font-weight: 600; color: var(--info); text-decoration: underline; }
.iso-auth-forgot:hover { color: var(--gray-900); text-decoration: none; }
.iso-auth-brand-mobile { display: flex; align-items: center; gap: 8px; margin-bottom: 24px; font-size: 18px; font-weight: 600; }
@media (min-width: 1024px) { .iso-auth-brand-mobile { display: none; } }

/* Autofill (globals.css): keep WebKit autofill from painting its own
   background over Isomorphic inputs — the likely cause of a password
   field rendering as a solid black box when the browser autofills it. */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus {
  border: 1px solid transparent;
  -webkit-text-fill-color: currentColor;
  -webkit-box-shadow: 0 0 0px 1000px transparent inset;
  transition: background-color 5000s ease-in-out 0s;
}
