/* ==========================================================================
   Boredroom Design System — Modern Apple + Notion Aesthetic (Light & Dark)
   ========================================================================== */

/* Bundled Local Typography (Zero System Font Fallback on Linux Chromium) */
@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/Inter-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/Inter-Italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/Inter-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/Inter-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/Inter-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/Inter-BoldItalic.woff2") format("woff2");
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Source Serif 4";
  src: url("/assets/fonts/SourceSerif4-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Source Serif 4";
  src: url("/assets/fonts/SourceSerif4-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("/assets/fonts/JetBrainsMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("/assets/fonts/JetBrainsMono-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  --font-display: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  --font-serif: "Source Serif 4", "New York", Georgia, Cambria, serif;
  --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --radius-xs: 5px;
  --radius-sm: 7px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-pill: 9999px;

  --header-height: 48px;
  --toolbar-height: 38px;
  --topbar-height: 48px;
  --space-unit: 16px;
  --control-height: 32px;

  --transition-fast: 120ms cubic-bezier(0.2, 0.8, 0.2, 1);
  --transition-med: 200ms cubic-bezier(0.2, 0.8, 0.2, 1);

  /* Light Mode — Calm Apple + Notion Palette */
  --bg-app: #FFFFFF;
  --bg-canvas: #F5F5F7;
  --bg-sidebar: #F7F7F5;
  --bg-surface: #FFFFFF;
  --bg-surface-subtle: #F7F7F5;
  --bg-hover: rgba(55, 53, 47, 0.055);
  --bg-active: rgba(55, 53, 47, 0.09);
  --bg-glass: rgba(255, 255, 255, 0.84);
  --bg-backdrop: rgba(15, 15, 15, 0.24);

  --border-subtle: rgba(55, 53, 47, 0.09);
  --border-strong: rgba(55, 53, 47, 0.16);

  --text-primary: #1D1D1F;
  --text-secondary: #5C5B57;
  --text-muted: #8E8D89;
  --text-faint: #AEADA8;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.035);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.045), 0 0 0 1px var(--border-subtle);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.11), 0 0 0 1px var(--border-subtle);
  --shadow-lg: 0 22px 60px rgba(0, 0, 0, 0.16), 0 0 0 1px var(--border-subtle);

  --accent: #0071E3;
  --accent-hover: #0062C4;
  --accent-soft: rgba(0, 113, 227, 0.10);
  --accent-ring: rgba(0, 113, 227, 0.24);
  --accent-on: #FFFFFF;

  --success: #1D9A6C;
  --success-soft: rgba(29, 154, 108, 0.11);
  --warning: #C97A00;
  --warning-soft: rgba(201, 122, 0, 0.11);
  --danger: #D93025;
  --danger-soft: rgba(217, 48, 37, 0.10);
}

/* Dark Mode — Warm Notion Charcoal + Apple Dark */
[data-theme="dark"] {
  color-scheme: dark;
  --bg-app: #191919;
  --bg-canvas: #141414;
  --bg-sidebar: #1D1D1D;
  --bg-surface: #202020;
  --bg-surface-subtle: #262626;
  --bg-hover: rgba(255, 255, 255, 0.06);
  --bg-active: rgba(255, 255, 255, 0.10);
  --bg-glass: rgba(32, 32, 32, 0.84);
  --bg-backdrop: rgba(0, 0, 0, 0.54);

  --border-subtle: rgba(255, 255, 255, 0.085);
  --border-strong: rgba(255, 255, 255, 0.16);

  --text-primary: #EDEDEC;
  --text-secondary: #A5A5A2;
  --text-muted: #70706D;
  --text-faint: #52524F;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.26);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.30), 0 0 0 1px var(--border-subtle);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.44), 0 0 0 1px var(--border-subtle);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.62), 0 0 0 1px var(--border-subtle);

  --accent: #2F81F7;
  --accent-hover: #4B93FA;
  --accent-soft: rgba(47, 129, 247, 0.15);
  --accent-ring: rgba(47, 129, 247, 0.30);
}

/* Accent Palettes — Restrained & Tasteful */
[data-accent="slate"] {
  --accent: #52525B;
  --accent-hover: #3F3F46;
  --accent-soft: rgba(82, 82, 91, 0.12);
  --accent-ring: rgba(82, 82, 91, 0.24);
}
[data-theme="dark"][data-accent="slate"] {
  --accent: #A1A1AA;
  --accent-hover: #D4D4D8;
  --accent-soft: rgba(161, 161, 170, 0.15);
  --accent-ring: rgba(161, 161, 170, 0.28);
  --accent-on: #141414;
}
[data-accent="ocean"] {
  --accent: #0071E3;
  --accent-hover: #0062C4;
  --accent-soft: rgba(0, 113, 227, 0.10);
  --accent-ring: rgba(0, 113, 227, 0.24);
}
[data-theme="dark"][data-accent="ocean"] {
  --accent: #2F81F7;
  --accent-hover: #4B93FA;
  --accent-soft: rgba(47, 129, 247, 0.15);
  --accent-ring: rgba(47, 129, 247, 0.30);
}
[data-accent="sage"] {
  --accent: #1D9A6C;
  --accent-hover: #17805A;
  --accent-soft: rgba(29, 154, 108, 0.11);
  --accent-ring: rgba(29, 154, 108, 0.24);
}
[data-accent="amber"] {
  --accent: #C97A00;
  --accent-hover: #AD6800;
  --accent-soft: rgba(201, 122, 0, 0.12);
  --accent-ring: rgba(201, 122, 0, 0.25);
}
[data-accent="rose"] {
  --accent: #D93025;
  --accent-hover: #B9261C;
  --accent-soft: rgba(217, 48, 37, 0.11);
  --accent-ring: rgba(217, 48, 37, 0.24);
}

/* Density */
[data-density="compact"] {
  --header-height: 44px;
  --toolbar-height: 34px;
  --topbar-height: 44px;
  --space-unit: 12px;
  --control-height: 28px;
}

/* Reset & Base Typography */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: -0.006em;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  font-feature-settings: inherit;
}

a {
  color: var(--accent);
  text-decoration: none;
}

::selection {
  background: var(--accent-soft);
}

::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ==========================================================================
   Independent Full-Viewport App Shell (Zero Permanent Sidebar)
   ========================================================================== */

.br-shell-root {
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-app);
  overflow: hidden;
  position: relative;
}

.br-independent-app {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-app);
}

.br-workspace {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
  position: relative;
  background: var(--bg-app);
}

.br-app-viewport {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.br-app-viewport > * {
  min-height: 0;
}

/* ==========================================================================
   Shared 48px Translucent Apple + Notion Independent App Titlebar
   ========================================================================== */

.br-app-header {
  height: var(--header-height);
  min-height: var(--header-height);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  background: color-mix(in srgb, var(--bg-surface) 84%, transparent);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  z-index: 30;
  user-select: none;
}

.br-app-header-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.br-app-header-center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
}

.br-app-header-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}

.br-app-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.br-app-header-utils {
  display: flex;
  align-items: center;
  gap: 2px;
}

.br-waffle-btn {
  width: 30px;
  height: 30px;
  color: var(--text-secondary);
}

.br-app-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 7px 0 4px;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition-fast);
}

.br-app-badge:hover {
  background: var(--bg-hover);
}

.br-app-badge-icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.br-app-badge-name {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text-primary);
}

.br-app-badge-name.muted {
  font-weight: 500;
  color: var(--text-secondary);
}

.br-app-header-slash {
  color: var(--text-faint);
  font-size: 13px;
  flex-shrink: 0;
  user-select: none;
}

.br-doc-title-input {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-primary);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.014em;
  height: 28px;
  padding: 0 7px;
  border-radius: 6px;
  min-width: 110px;
  max-width: 280px;
  width: auto;
  outline: none;
  text-overflow: ellipsis;
  transition: background var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.br-doc-title-input:hover {
  background: var(--bg-hover);
}

.br-doc-title-input:focus {
  background: var(--bg-surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.br-doc-title-static {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.014em;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}

.br-doc-status {
  font-size: 11.5px;
  font-weight: 400;
  color: var(--text-muted);
  white-space: nowrap;
  margin-left: 4px;
  flex-shrink: 0;
}

/* ==========================================================================
   38px Razor-Clean Formatting Ribbon (Google Docs / Apple Pages / Notion)
   ========================================================================== */

.br-tool-bar {
  height: var(--toolbar-height);
  min-height: var(--toolbar-height);
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 12px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  user-select: none;
}

.br-tool-bar::-webkit-scrollbar {
  display: none;
}

.br-tool-group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.br-tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.br-tool-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.br-tool-btn:active {
  background: var(--bg-active);
}

.br-tool-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.br-tool-btn:disabled {
  opacity: 0.38;
  pointer-events: none;
}

.br-tool-select {
  height: 28px;
  padding: 0 22px 0 8px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-primary);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: background var(--transition-fast);
}

.br-tool-select:hover {
  background: var(--bg-hover);
}

.br-tool-select:focus {
  background: var(--bg-hover);
  box-shadow: 0 0 0 2px var(--accent-ring);
}

.br-tool-sep {
  display: inline-block;
  width: 1px;
  height: 16px;
  background: var(--border-subtle);
  margin: 0 5px;
  flex-shrink: 0;
}

/* Apple Segmented Control */
.br-segmented {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: 8px;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
}

.br-segmented-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 24px;
  padding: 0 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
}

.br-segmented-btn:hover {
  color: var(--text-primary);
}

.br-segmented-btn.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-xs);
}

/* ==========================================================================
   Apple Frosted-Glass Menus & Popovers
   ========================================================================== */

.br-popover-anchor {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.br-popover-backdrop {
  position: fixed;
  inset: 0;
  z-index: 58;
  background: transparent;
}

.br-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 60;
  background: color-mix(in srgb, var(--bg-surface) 92%, transparent);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  animation: br-pop-in 120ms cubic-bezier(0.2, 0.85, 0.25, 1);
}

.br-menu {
  min-width: 214px;
  padding: 5px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.br-menu-right {
  left: auto;
  right: 0;
}

.br-menu-label {
  padding: 5px 10px 3px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

.br-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text-primary);
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 400;
  text-align: left;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.br-menu-item:hover {
  background: var(--bg-hover);
}

.br-menu-item.danger {
  color: var(--danger);
}

.br-menu-item.danger:hover {
  background: var(--danger-soft);
}

.br-menu-item-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.br-menu-shortcut {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.br-menu-sep {
  height: 1px;
  background: var(--border-subtle);
  margin: 4px 6px;
}

/* ==========================================================================
   3x3 Floating App Switcher Popover
   ========================================================================== */

.br-launcher-popover {
  position: fixed;
  top: calc(var(--header-height) + 6px);
  left: 12px;
  width: 328px;
  max-width: calc(100vw - 24px);
  z-index: 80;
  background: color-mix(in srgb, var(--bg-surface) 92%, transparent);
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: br-pop-in 130ms cubic-bezier(0.2, 0.85, 0.25, 1);
}

.br-launcher-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 4px 4px;
  border-bottom: 1px solid var(--border-subtle);
}

.br-launcher-home-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 8px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.br-launcher-home-btn:hover {
  background: var(--bg-hover);
}

.br-launcher-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
}

.br-launcher-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 6px 9px;
  border: none;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.br-launcher-item:hover {
  background: var(--bg-hover);
}

.br-launcher-item.active {
  background: var(--bg-active);
}

.br-launcher-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.br-launcher-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.2;
}

.br-launcher-ext {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
}

.br-launcher-item:hover .br-launcher-ext {
  opacity: 1;
}

.br-launcher-ext:hover {
  background: var(--bg-active);
  color: var(--text-primary);
}

.br-launcher-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 6px;
  border-top: 1px solid var(--border-subtle);
  gap: 4px;
}

/* ==========================================================================
   Serene Apple iCloud + Notion Launchpad Home Screen (#/)
   ========================================================================== */

.br-home {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg-canvas);
  overflow-y: auto;
}

.br-home-header {
  height: 54px;
  min-height: 54px;
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: color-mix(in srgb, var(--bg-canvas) 82%, transparent);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  border-bottom: 1px solid var(--border-subtle);
}

.br-home-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.br-home-mark {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--text-primary);
  color: var(--bg-surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.br-home-wordmark {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.br-home-header-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.br-home-search-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-muted);
  font-size: 12.5px;
  cursor: pointer;
  transition: border-color var(--transition-fast), color var(--transition-fast);
}

.br-home-search-btn:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.br-home-main {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  padding: 44px 28px 72px;
  display: flex;
  flex-direction: column;
  gap: 36px;
}

.br-home-hero {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.br-home-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.2;
  color: var(--text-primary);
}

.br-home-subtitle {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary);
}

.br-home-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.br-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.br-section-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

/* Quick Start Blank Row */
.br-quick-create-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.br-quick-create-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 13px;
  border-radius: 9px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: border-color var(--transition-fast), background var(--transition-fast), transform var(--transition-fast);
}

.br-quick-create-btn:hover {
  border-color: var(--border-strong);
  background: var(--bg-surface);
  transform: translateY(-1px);
}

.br-quick-create-btn:active {
  transform: translateY(0);
}

.br-quick-create-plus {
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
}

/* 9-App Launchpad Grid */
.br-launchpad-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.br-app-tile {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 16px;
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.br-app-tile:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .br-app-tile:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.34);
}

.br-app-tile-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.br-app-tile-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}

.br-app-tile-name {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text-primary);
}

.br-app-tile-role {
  font-size: 12.5px;
  color: var(--text-muted);
}

.br-tile-ext {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
}

.br-app-tile:hover .br-tile-ext {
  opacity: 1;
}

.br-tile-ext:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Recent Files List (Notion Minimal Table Rows) */
.br-recent-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

.br-recent-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 10px 14px;
  border: none;
  border-bottom: 1px solid var(--border-subtle);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.br-recent-row:last-child {
  border-bottom: none;
}

.br-recent-row:hover {
  background: var(--bg-hover);
}

.br-recent-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.br-recent-icon {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.br-recent-title {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.br-recent-right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
  font-size: 12px;
  color: var(--text-muted);
}

.br-recent-ext {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
}

.br-recent-row:hover .br-recent-ext {
  opacity: 1;
}

.br-recent-ext:hover {
  background: var(--bg-active);
  color: var(--text-primary);
}

.br-home-empty {
  padding: 16px 18px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.br-inline-link {
  border: none;
  background: transparent;
  padding: 0;
  color: var(--accent);
  font-size: inherit;
  font-weight: 500;
  cursor: pointer;
}

.br-inline-link:hover {
  text-decoration: underline;
}

/* ==========================================================================
   Reusable UI Primitives (Shared by Shell & All 9 Apps)
   ========================================================================== */

.br-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--control-height);
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

.br-btn:hover {
  background: var(--bg-surface-subtle);
  border-color: var(--border-strong);
}

.br-btn:active {
  transform: scale(0.985);
}

.br-btn-primary {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-on);
}

.br-btn-primary:hover {
  background: var(--accent-hover);
  border-color: transparent;
}

.br-btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-secondary);
}

.br-btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: transparent;
}

.br-btn-danger {
  background: var(--danger-soft);
  border-color: transparent;
  color: var(--danger);
}

.br-btn-danger:hover {
  background: var(--danger);
  color: #FFFFFF;
}

.br-btn-sm {
  height: 28px;
  padding: 0 10px;
  font-size: 12.5px;
  border-radius: 6px;
}

.br-icon-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.br-icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.br-icon-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.br-kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 5px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--text-muted);
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 5px;
}

.br-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  padding: 16px;
}

.br-input,
.br-textarea,
.br-select {
  width: 100%;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 13.5px;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.br-input:focus,
.br-textarea:focus,
.br-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.br-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 500;
  background: var(--bg-surface-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.br-pill-accent {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
}

.br-muted {
  color: var(--text-muted);
}

.br-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 14px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
}

.br-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
  gap: 8px;
}

/* ==========================================================================
   Automation Studio Slide-Over Drawer
   ========================================================================== */

.br-drawer {
  width: 392px;
  max-width: 94vw;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  height: 100%;
  box-shadow: var(--shadow-md);
  z-index: 25;
  flex-shrink: 0;
}

.br-macro-card {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: border-color var(--transition-fast);
}

.br-macro-card:hover {
  border-color: var(--border-strong);
}

.br-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.br-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.br-code-editor {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
  min-height: 126px;
  resize: vertical;
  background: var(--bg-surface-subtle);
}

/* ==========================================================================
   Modals, Spotlight Command Palette, Shortcuts & Settings
   ========================================================================== */

.br-modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--bg-backdrop);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
  z-index: 100;
  animation: br-fade-in 110ms ease-out;
}

.br-modal {
  width: 540px;
  max-width: calc(100vw - 32px);
  max-height: 76vh;
  background: color-mix(in srgb, var(--bg-surface) 96%, transparent);
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: br-pop-in 130ms cubic-bezier(0.2, 0.85, 0.25, 1);
}

.br-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border-subtle);
}

.br-modal-title {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.015em;
  margin: 0;
}

.br-modal-body {
  padding: 16px 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Spotlight / Notion Command Palette */
.br-palette {
  width: 580px;
  max-width: calc(100vw - 28px);
}

.br-palette-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.br-palette-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 14.5px;
  outline: none;
  color: var(--text-primary);
}

.br-palette-list {
  max-height: 380px;
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.br-palette-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  border: none;
  background: transparent;
  padding: 8px 10px;
  border-radius: 7px;
  cursor: pointer;
  text-align: left;
  transition: background var(--transition-fast);
}

.br-palette-item:hover,
.br-palette-item.selected {
  background: var(--bg-hover);
}

.br-palette-item-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.br-palette-item-title {
  font-weight: 500;
  font-size: 13.5px;
  color: var(--text-primary);
}

.br-palette-item-sub {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Settings Rows */
.br-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.br-setting-row:last-child {
  border-bottom: none;
}

.br-swatches {
  display: flex;
  align-items: center;
  gap: 8px;
}

.br-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.br-swatch:hover {
  transform: scale(1.1);
}

.br-swatch.active {
  border-color: var(--text-primary);
  box-shadow: 0 0 0 2px var(--bg-surface) inset;
}

/* Shortcuts List */
.br-shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.br-shortcut-row:last-child {
  border-bottom: none;
}

/* ==========================================================================
   Quiet Minimal Bottom-Center Toast Pill (Auto-Dismiss 2.6s)
   ========================================================================== */

.br-toast-region {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 200;
  pointer-events: none;
  display: flex;
  justify-content: center;
  max-width: calc(100vw - 32px);
}

.br-toast-pill {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  background: #1D1D1F;
  color: #F5F5F7;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.3;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  border: none;
  cursor: pointer;
  animation: br-pill-in 150ms cubic-bezier(0.2, 0.85, 0.25, 1);
}

[data-theme="dark"] .br-toast-pill {
  background: #2C2C2E;
  color: #EDEDEC;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.10);
}

.br-toast-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.55);
}

.br-toast-pill.level-success .br-toast-dot { background: #34D399; }
.br-toast-pill.level-warning .br-toast-dot { background: #FBBF24; }
.br-toast-pill.level-error .br-toast-dot { background: #F87171; }

.br-toast-pill-detail {
  color: rgba(255, 255, 255, 0.70);
  font-weight: 400;
}

/* ==========================================================================
   Panic Mode Ledger Overlay (Ctrl/Cmd + Shift + B)
   ========================================================================== */

.br-panic-overlay {
  position: fixed;
  inset: 0;
  background: #0D0F12;
  color: #CBD5E1;
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 28px 36px;
  z-index: 9999;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.br-panic-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #1E293B;
  padding-bottom: 12px;
  color: #64748B;
  font-size: 12px;
}

.br-panic-pre {
  margin: 0;
  line-height: 1.7;
  color: #94A3B8;
  white-space: pre-wrap;
}

.br-panic-exit {
  align-self: flex-start;
  background: #1E293B;
  color: #E2E8F0;
  border: 1px solid #334155;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 12px;
}

/* ==========================================================================
   Full-Screen Confetti Canvas Layer
   ========================================================================== */

.br-confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9000;
}

/* ==========================================================================
   Desktop App Download Card & Modal (Windows & Linux)
   ========================================================================== */

.br-desktop-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 20px;
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  box-shadow: var(--shadow-xs);
}

.br-desktop-card-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  max-width: 380px;
}

.br-desktop-card-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.3;
  color: var(--text-primary);
}

.br-desktop-card-sub {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text-secondary);
}

.br-desktop-card-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.br-desktop-btn-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.br-download-btn {
  height: auto;
  min-height: 42px;
  padding: 7px 13px;
  gap: 9px;
  border-radius: 9px;
  text-align: left;
  text-decoration: none;
  box-shadow: var(--shadow-xs);
  transition: background var(--transition-fast), border-color var(--transition-fast),
    transform var(--transition-fast), box-shadow var(--transition-fast);
}

.br-download-btn:hover {
  transform: translateY(-1px);
}

.br-download-btn:active {
  transform: translateY(0) scale(0.99);
}

.br-download-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.br-download-btn.br-download-secondary {
  background: var(--bg-surface-subtle);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}

.br-download-btn.br-download-secondary:hover {
  background: var(--bg-active);
  border-color: var(--border-strong);
}

.br-download-btn.br-btn-primary {
  box-shadow: 0 1px 3px color-mix(in srgb, var(--accent) 26%, transparent);
}

.br-download-btn.br-btn-primary:hover {
  box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 30%, transparent);
}

.br-download-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

.br-download-btn:hover .br-download-icon {
  color: var(--text-primary);
}

.br-download-btn.br-btn-primary .br-download-icon,
.br-download-btn.br-btn-primary:hover .br-download-icon {
  color: var(--accent-on);
  opacity: 0.95;
}

.br-download-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  line-height: 1.2;
}

.br-download-label {
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.br-download-meta {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
}

.br-download-btn.br-btn-primary .br-download-label {
  color: var(--accent-on);
}

.br-download-btn.br-btn-primary .br-download-meta {
  color: color-mix(in srgb, var(--accent-on) 78%, transparent);
}

.br-releases-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.br-releases-link:hover {
  color: var(--text-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.br-download-modal {
  width: 508px;
}

.br-download-modal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.br-download-modal-grid .br-download-btn {
  width: 100%;
  justify-content: flex-start;
  padding: 11px 14px;
  min-height: 52px;
  border-radius: 10px;
}

.br-download-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
}

.br-download-step-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text-secondary);
}

.br-download-step-os {
  flex-shrink: 0;
  width: 62px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.br-download-code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.br-download-modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 2px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Animations */
@keyframes br-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes br-pop-in {
  from { opacity: 0; transform: translateY(-5px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes br-pill-in {
  from { opacity: 0; transform: translateY(8px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 820px) {
  .br-launchpad-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .br-home-main {
    padding: 28px 18px 56px;
  }
  .br-home-header {
    padding: 0 16px;
  }
  .br-doc-status {
    display: none;
  }
  .br-desktop-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }
  .br-desktop-card-copy {
    max-width: none;
  }
  .br-desktop-card-actions {
    align-items: flex-start;
    width: 100%;
  }
}

@media (max-width: 540px) {
  .br-launchpad-grid {
    grid-template-columns: 1fr;
  }
  .br-download-modal-grid {
    grid-template-columns: 1fr;
  }
}
