/*
 * Recommengine Application Styles
 * Dark Fabric Design System
 * Dark-mode-first, systems-oriented visual language
 */

/* CSS Variables - Fabric Color System
 * Global background: --bg-primary. Default theme is light (:root); dark when html has data-theme="dark".
 */
:root {
  /* Light theme (default) */
  --fabric-black: #F5F6F8;
  --fabric-slate: #EBEDF1;
  --fabric-graphite: #E0E3E9;
  --fabric-border: #C5CAD4;

  --text-primary: #1A1D24;
  --text-secondary: #3D4452;
  --text-muted: #5C6370;

  --bg-primary: #FAFBFC;
  --bg-secondary: #F0F2F5;
  --bg-tertiary: #E5E8EC;
  --bg-card: #FFFFFF;
  --bg-header: #FFFFFF;
  --bg-sidebar: #F5F6F8;
  --bg-footer: #EBEDF1;
  --bg-input: #FFFFFF;

  --border-color: #D1D5DC;
  --border-color-strong: #B8BEC9;
  --border-color-light: #E0E3E9;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);

  --btn-primary-bg: #4C7DFF;
  --btn-primary-text: #FFFFFF;
  --btn-primary-hover: #8FA8FF;
  --btn-secondary-bg: var(--fabric-graphite);
  --btn-secondary-text: var(--text-primary);
  --btn-secondary-hover: var(--fabric-border);

  --text-link: #4C7DFF;
  --text-link-hover: #8FA8FF;

  /* Barlow — loaded globally in application layout; primary app typography */
  --font-brand-sans: "Barlow", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-brand-display: "Barlow Condensed", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --font-primary: var(--font-brand-sans);
  --font-heading: var(--font-brand-display);
  --font-mono: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  --line-height-base: 1.5;
  --line-height-relaxed: 1.6;

  --command-blue: #327AD1;
  --command-blue-soft: #3F61BE;
  --signal-green: #1FB4DD;
  --signal-amber: #FDB716;
  --signal-red: #F9455C;
  --fabric-violet: #AA0392;
  --brand-magenta: #D00084;
  --brand-coral: #F9455C;
  --brand-lavender: #ADB4CC;
  --command-blue-rgb: 50, 122, 209;
  --signal-green-rgb: 31, 180, 221;
  --fabric-violet-rgb: 170, 3, 146;

  --chart-1: var(--command-blue);
  --chart-2: var(--fabric-violet);
  --chart-3: var(--signal-green);
  --chart-4: var(--signal-amber);
  --chart-5: var(--signal-red);
  --chart-6: var(--text-muted);
  --chart-status-pending: var(--signal-amber);
  --chart-status-needs-attention: var(--signal-red);
  --chart-status-snoozed: var(--text-muted);
  --chart-status-fyi: var(--command-blue);
  --chart-status-accepted: var(--signal-green);
  --chart-status-ignored: var(--text-muted);

  --card-bg: var(--bg-card);
  --bg: var(--bg-primary);
  --primary: var(--command-blue);
  --text: var(--text-primary);
  --overlay-bg: rgba(0, 0, 0, 0.5);
  --terminal-header-bg: rgba(0, 0, 0, 0.06);
  --terminal-line-hover-bg: rgba(0, 0, 0, 0.04);
  --terminal-shadow-outer: 0 0 0 1px rgba(0, 0, 0, 0.08);
  --terminal-shadow-inner: inset 0 1px 0 rgba(255, 255, 255, 0.6);
  --terminal-scanline: rgba(0, 0, 0, 0.02);
  --signal-green-hover: #20b7dc;

  /* Marketing page (light theme) */
  --marketing-bg: #e8ecf7;
  --marketing-header-bg: #e8ecf7;
  --marketing-header-border: rgba(76, 125, 255, 0.2);
  --marketing-grid-line: rgba(76, 125, 255, 0.15);
  --marketing-headline: #1A1D24;
  --marketing-lead: #3D4452;
  --marketing-accent: linear-gradient(90deg, #327AD1 0%, #AA0392 40%, #D00084 70%, #F9455C 100%);
  --marketing-cta-bg: #D00084;
  --marketing-cta-shadow: rgba(208, 0, 132, 0.35);
  --marketing-footer: #5C6370;

  /* Nav header (light theme: light bar, dark text) */
  --header-nav-bg: #e8ecf7;
  --header-nav-text: #1a2744;
  --header-nav-border: rgba(0, 0, 0, 0.08);
  --header-nav-bubble-bg: #327AD1;

  /* Rico onboarding call-to-action card (amber — warm complement to cool blue-gray palette) */
  --rico-onboard-bg: rgba(253, 183, 22, 0.1);
  --rico-onboard-border: #c89000;

  /* Dashboard brand surfaces (light) — pairs with dashboard_marketing.css + Barlow */
  --db-main-wash: linear-gradient(185deg, rgba(232, 236, 247, 0.85) 0%, transparent 40%);
  --db-hero-bg: linear-gradient(165deg, var(--marketing-bg) 0%, #ffffff 72%);
  --db-hero-border: rgba(var(--command-blue-rgb), 0.28);
  --db-hero-shadow: var(--shadow-lg);
  --db-card-bg: var(--bg-card);
  --db-card-border: rgba(var(--command-blue-rgb), 0.22);
  --db-card-shadow: var(--shadow-md);
  --db-chip-bg: rgba(var(--command-blue-rgb), 0.1);
  --db-chip-border: rgba(var(--command-blue-rgb), 0.22);
  --db-chip-label: var(--command-blue);
  --db-clock-bg: radial-gradient(circle at top right, rgba(var(--fabric-violet-rgb), 0.14), transparent 56%), var(--bg-card);
  --db-clock-border: rgba(var(--fabric-violet-rgb), 0.32);
  --db-clock-eyebrow: var(--command-blue);
  --db-btn-ghost-border: rgba(0, 0, 0, 0.14);
  --db-btn-ghost-text: var(--text-primary);
  --db-btn-ghost-hover: rgba(0, 0, 0, 0.06);
  --db-list-divider: var(--border-color-light);
  --db-list-label: var(--text-secondary);
  --db-onboarding-bg: var(--bg-secondary);
  --db-onboarding-border: var(--border-color);
  --db-section-header-bg: var(--bg-secondary);
  --db-section-header-border: var(--border-color-light);
  --db-integration-bg: var(--bg-secondary);
  --db-integration-border: var(--border-color-light);
  --db-group-label: var(--command-blue);
  --db-rico-wash: linear-gradient(145deg, rgba(var(--fabric-violet-rgb), 0.1), rgba(var(--command-blue-rgb), 0.08));
  --db-rico-border: rgba(var(--fabric-violet-rgb), 0.35);

  /* Signed-in product shell (non-marketing pages) — theme-aware panels + main wash */
  --app-surface-wash: linear-gradient(185deg, rgba(232, 236, 247, 0.55) 0%, transparent 38%);
  --surface-panel-border: rgba(var(--command-blue-rgb), 0.22);
  --surface-panel-shadow: var(--shadow-sm);
}

/* Logo: white logo works on dark nav; invert to dark on light theme */
.app-header .app-title-logo {
  filter: none;
}

[data-theme="light"] .app-header .app-title-logo {
  filter: invert(1);
}

/* Dark theme (when html has data-theme="dark") */
[data-theme="dark"] {
  --fabric-black: #0B1030;
  --fabric-slate: #111E53;
  --fabric-graphite: #1B2E77;
  --fabric-border: #3F61BE;

  --text-primary: #EAF1FF;
  --text-secondary: #C0CDEF;
  --text-muted: #97A7D7;

  --bg-primary: var(--fabric-black);
  --bg-secondary: var(--fabric-slate);
  --bg-tertiary: var(--fabric-graphite);
  --bg-card: var(--fabric-slate);
  --bg-header: var(--fabric-slate);
  --bg-sidebar: var(--fabric-slate);
  --bg-footer: var(--fabric-black);
  --bg-input: var(--fabric-graphite);

  --border-color: var(--fabric-border);
  --border-color-strong: #5172C6;
  --border-color-light: #2A3F91;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.6);

  --btn-primary-text: #FFFFFF;
  --btn-secondary-bg: var(--fabric-graphite);
  --btn-secondary-text: var(--text-primary);
  --btn-secondary-hover: var(--fabric-border);

  --overlay-bg: rgba(0, 0, 0, 0.7);
  --terminal-header-bg: rgba(0, 0, 0, 0.25);
  --terminal-line-hover-bg: rgba(255, 255, 255, 0.02);
  --terminal-shadow-outer: 0 0 0 1px rgba(0, 0, 0, 0.5);
  --terminal-shadow-inner: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  --terminal-scanline: rgba(0, 0, 0, 0.03);
  --signal-green-hover: #33c0e3;

  /* Marketing page (dark theme) */
  --marketing-bg: #0a0f2e;
  --marketing-header-bg: #0a0f2e;
  --marketing-header-border: rgba(63, 97, 190, 0.25);
  --marketing-grid-line: rgba(63, 97, 190, 0.12);
  --marketing-headline: #fff;
  --marketing-lead: rgba(234, 241, 255, 0.9);
  --marketing-accent: linear-gradient(90deg, #3f61be 0%, #aa0392 40%, #e91e8c 70%, #ff6b4a 100%);
  --marketing-cta-bg: #e91e8c;
  --marketing-cta-shadow: rgba(233, 30, 140, 0.4);
  --marketing-footer: rgba(234, 241, 255, 0.85);

  /* Nav header (dark theme: deep navy bar, light text) */
  --header-nav-bg: #0a0f2e;
  --header-nav-text: #D0DFFF;
  --header-nav-border: rgba(255, 255, 255, 0.12);
  --header-nav-bubble-bg: #4064E0;

  /* Rico onboarding call-to-action card (richer amber — pops against deep navy background) */
  --rico-onboard-bg: rgba(253, 183, 22, 0.15);
  --rico-onboard-border: rgba(253, 183, 22, 0.55);

  /* Dashboard brand surfaces (dark) */
  --db-main-wash: linear-gradient(185deg, rgba(10, 15, 46, 0.55) 0%, transparent 42%);
  --db-hero-bg: var(--marketing-bg);
  --db-hero-border: rgba(99, 132, 210, 0.28);
  --db-hero-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
  --db-card-bg: var(--marketing-bg);
  --db-card-border: rgba(99, 132, 210, 0.22);
  --db-card-shadow: 0 8px 32px rgba(0, 0, 0, 0.22);
  --db-chip-bg: rgba(255, 255, 255, 0.05);
  --db-chip-border: rgba(99, 132, 210, 0.25);
  --db-chip-label: rgba(123, 178, 232, 0.9);
  --db-clock-bg: radial-gradient(circle at top right, rgba(233, 30, 140, 0.2), transparent 55%), rgba(5, 14, 58, 0.96);
  --db-clock-border: rgba(233, 30, 140, 0.38);
  --db-clock-eyebrow: rgba(123, 178, 232, 0.9);
  --db-btn-ghost-border: rgba(255, 255, 255, 0.28);
  --db-btn-ghost-text: rgba(255, 255, 255, 0.9);
  --db-btn-ghost-hover: rgba(255, 255, 255, 0.08);
  --db-list-divider: rgba(99, 132, 210, 0.2);
  --db-list-label: rgba(192, 205, 239, 0.75);
  --db-onboarding-bg: rgba(10, 15, 46, 0.88);
  --db-onboarding-border: rgba(99, 132, 210, 0.28);
  --db-section-header-bg: rgba(255, 255, 255, 0.05);
  --db-section-header-border: rgba(99, 132, 210, 0.2);
  --db-integration-bg: rgba(255, 255, 255, 0.04);
  --db-integration-border: rgba(99, 132, 210, 0.18);
  --db-group-label: rgba(123, 178, 232, 0.88);
  --db-rico-wash: linear-gradient(145deg, rgba(233, 30, 140, 0.14), rgba(63, 97, 190, 0.1));
  --db-rico-border: rgba(233, 30, 140, 0.42);

  --app-surface-wash: linear-gradient(185deg, rgba(17, 30, 83, 0.5) 0%, transparent 40%);
  --surface-panel-border: rgba(99, 132, 210, 0.24);
  --surface-panel-shadow: 0 4px 20px rgba(0, 0, 0, 0.18);
}

/* Base Styles */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-primary);
  font-size: 16px;
  font-weight: 400;
  line-height: var(--line-height-base);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Typography (Barlow Condensed for headings) */
h1, h2, h3, h4, h5, h6 {
  margin-top: 0;
  color: var(--text-primary);
  font-family: var(--font-heading);
  line-height: 1.25;
  letter-spacing: -0.02em;
}

h1, h2, h3 {
  font-weight: 700;
}

h4, h5, h6 {
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* Signed-in main content — subtle wash; dashboard-brand overrides via dashboard_marketing.css */
body.app-shell .app-main {
  background: var(--app-surface-wash), var(--bg-primary);
}

h1 {
  font-size: 32px;
  font-weight: 600;
  margin-bottom: 24px;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 24px;
  font-weight: 500;
  margin-bottom: 16px;
  margin-top: 32px;
  letter-spacing: -0.01em;
}

h3 {
  font-size: 20px;
  font-weight: 500;
  margin-bottom: 12px;
}

p {
  margin: 0 0 16px 0;
  color: var(--text-primary);
  line-height: var(--line-height-relaxed);
}

/* Links */
a {
  color: var(--text-link);
  text-decoration: none;
  transition: color 0.2s ease;
  font-weight: 500;
}

a:hover {
  color: var(--text-link-hover);
  text-decoration: underline;
}

/* App Container */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: var(--bg-primary);
}

/* Rico Immersive Mode: collapse chrome for focused Rico chat */
.app-header-wrap {
  overflow: hidden;
  /* --header-h is measured and set by JS before the collapse begins */
  max-height: var(--header-h, 120px);
  transition: max-height 0.38s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.32s ease;
}

body.rico-immersive .app-header-wrap {
  max-height: 0 !important;
  opacity: 0;
  pointer-events: none;
}

body.rico-immersive .app-sidebar {
  width: 52px;
}

body.rico-immersive .sidebar-content {
  overflow: hidden;
  width: 0;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: width 0.32s ease, opacity 0.28s ease, padding 0.32s ease, visibility 0s linear 0.32s;
}

body.rico-immersive .app-main {
  min-height: 100vh;
}

body.rico-immersive .app-footer {
  display: none;
}

/* Rico chrome restore — mirrors topnav-restore; visible only in rico-immersive */
.rico-chrome-restore {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 140;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-primary);
  letter-spacing: 0.03em;
  opacity: 0.5;
  transition: opacity 0.2s ease, background 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.rico-chrome-restore:hover {
  opacity: 1;
  background: var(--bg-secondary);
  color: var(--text-primary);
}

body.rico-immersive .rico-chrome-restore {
  display: inline-flex;
}

/* Header */
.app-header {
  background-color: var(--bg-header);
  border-bottom: 1px solid var(--border-color);
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px 24px 16px 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-content--spread {
  width: 100%;
  justify-content: space-between;
}

.header-left {
  flex: 1;
}

.header-content--spread .header-left {
  flex: none;
}

.app-title {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  font-family: var(--font-heading);
  letter-spacing: -0.01em;
}

.app-title a {
  color: var(--fabric-violet);
  text-decoration: none;
  transition: color 0.2s ease;
}

.app-title a:hover {
  color: var(--command-blue);
  text-decoration: none;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-badge {
  padding: 6px 12px;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.logout-form {
  margin: 0;
  display: inline;
}

/* Header actions — same typography scale as .btn (Barlow 600) */
.btn-header {
  padding: 10px 16px;
  background-color: var(--btn-secondary-bg);
  color: var(--btn-secondary-text);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.2;
  transition: all 0.2s ease;
  font-family: var(--font-primary);
}

.btn-header:hover {
  background-color: var(--btn-secondary-hover);
  border-color: var(--border-color-strong);
  color: var(--text-primary);
}

/* Marketing header: speech-bubble CTA */
.btn-header--bubble {
  background: var(--fabric-slate);
  border: 1px solid var(--fabric-border);
  border-radius: 20px;
  padding: 10px 18px;
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.btn-header--bubble:hover {
  background: var(--fabric-graphite);
  border-color: var(--border-color-strong);
  color: var(--text-primary);
  text-decoration: none;
}

/* Nav header: deep blue bar, light text, link-style buttons, speech-bubble CTA */
.app-header--nav {
  background-color: var(--header-nav-bg);
  border-bottom-color: var(--header-nav-border);
}

.app-header--nav .app-title-link--nav {
  color: var(--header-nav-text);
}

.app-header--nav .header-right--nav .btn-header--link,
.app-header--nav .header-right--nav .logout-form .btn-header--link {
  background: transparent;
  border-color: transparent;
  color: var(--header-nav-text);
  text-transform: uppercase;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 8px 4px;
}

.app-header--nav .header-right--nav .btn-header--link:hover,
.app-header--nav .header-right--nav .logout-form .btn-header--link:hover {
  background: transparent;
  border-color: transparent;
  color: #fff;
  opacity: 1;
}

.app-header--nav .btn-header--bubble {
  position: relative;
  background: var(--header-nav-bubble-bg);
  border: none;
  border-radius: 12px;
  padding: 10px 18px;
  color: #fff;
  text-transform: uppercase;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.app-header--nav .btn-header--bubble:hover {
  background: #5070eb;
  color: #fff;
  text-decoration: none;
}

.app-header--nav .btn-header--bubble::after {
  content: "";
  position: absolute;
  left: 20px;
  bottom: -6px;
  border: 6px solid transparent;
  border-top-color: var(--header-nav-bubble-bg);
  border-left-width: 8px;
  border-right-width: 8px;
}

.app-header--nav .btn-header--bubble:hover::after {
  border-top-color: #5070eb;
}

.app-header--nav .layout-toggle--nav,
.app-header--nav .theme-toggle--nav {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.25);
  color: var(--header-nav-text);
}

.app-header--nav .layout-toggle--nav:hover,
.app-header--nav .theme-toggle--nav:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.4);
  color: #fff;
}

.app-header--nav .user-badge--nav {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--header-nav-text);
  text-decoration: none;
}

.app-header--nav a.user-badge--nav:hover {
  opacity: 0.95;
}

.rico-label-mobile {
  display: none;
}

.rico-label-desktop {
  display: inline;
}

.theme-toggle {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 20px;
  transition: all 0.2s ease;
  font-family: var(--font-primary);
}

.theme-toggle:hover {
  background-color: var(--btn-secondary-hover);
  border-color: var(--border-color-strong);
}

.layout-toggle {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  color: var(--text-secondary);
  transition: all 0.2s ease;
  font-family: var(--font-primary);
}

.layout-toggle:hover {
  background-color: var(--btn-secondary-hover);
  border-color: var(--border-color-strong);
  color: var(--text-primary);
}

.topnav-restore {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 140;
  display: none;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-primary);
  box-shadow: var(--shadow-sm);
}

.topnav-restore:hover {
  background-color: var(--btn-secondary-hover);
  border-color: var(--border-color-strong);
}

/* App Body — full width so sidebar can sit on the left edge */
.app-body {
  display: flex;
  flex: 1;
  width: 100%;
}

/* Sidebar: rail (hamburger) + content, flush left */
.sidebar-wrap {
  flex-shrink: 0;
  width: auto;
}

.app-sidebar {
  width: 240px;
  min-height: 100%;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  flex-shrink: 0;
  display: flex;
  flex-direction: row;
  transition: width 0.28s ease;
}

.sidebar-rail {
  width: 52px;
  flex-shrink: 0;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 20px;
}

.sidebar-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 24px 0;
  overflow-y: auto;
  transition: width 0.28s ease, opacity 0.28s ease, padding 0.28s ease, visibility 0s linear 0s;
}

.layout-toggle--sidebar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.layout-toggle--sidebar:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.sidebar-toggle-icon {
  font-size: 20px;
  line-height: 1;
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-list li {
  margin: 0;
}

.nav-list-separator {
  padding: 8px 16px 4px;
  margin-top: 8px;
  border-top: 1px solid var(--border-color);
}
.nav-list-separator-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
  font-weight: 500;
}

.nav-link:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border-left-color: var(--fabric-violet);
}

.nav-link.active {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border-left-color: var(--command-blue);
  font-weight: 600;
}

.nav-icon {
  font-size: 18px;
  width: 24px;
  height: 24px;
  text-align: center;
  flex-shrink: 0;
}

.nav-link img.nav-icon {
  object-fit: contain;
  display: block;
}

/* Page heading: icon + title, vertically aligned; separator matches home hero (border-top there = border-bottom here) */
.page-heading {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
  margin-bottom: 1rem;
}

.page-heading h1 {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0;
}

.page-heading .page-heading-icon {
  display: block;
  object-fit: contain;
  flex-shrink: 0;
}

/* Primary nav: recommendation-focused (Home, Agents, Engines, Workflows) */
.nav-list--primary {
  flex-shrink: 0;
}

/* Secondary nav: operations / more — toggleable, collapsed by default, muted */
.nav-secondary-wrap {
  margin-top: 8px;
  border-top: 1px solid var(--border-color);
  padding-top: 8px;
}

.nav-secondary-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 8px;
  padding: 10px 24px;
  background: none;
  border: none;
  border-left: 3px solid transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease;
  text-align: left;
}

.nav-secondary-toggle:hover {
  color: var(--text-secondary);
  background-color: var(--bg-tertiary);
}

.nav-secondary-toggle__icon {
  font-size: 10px;
  opacity: 0.8;
  transition: transform 0.28s ease;
}

.nav-secondary-wrap--expanded .nav-secondary-toggle__icon {
  transform: rotate(180deg);
}

#nav-secondary-list {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  margin-top: 0;
  transition: max-height 0.28s ease, opacity 0.28s ease, margin-top 0.28s ease, visibility 0s linear 0s;
}

.nav-secondary-wrap--expanded #nav-secondary-list {
  max-height: 80vh;
  opacity: 1;
  margin-top: 4px;
  transition: max-height 0.28s ease, opacity 0.28s ease, margin-top 0.28s ease, visibility 0s linear 0s;
}

.nav-secondary-wrap:not(.nav-secondary-wrap--expanded) #nav-secondary-list {
  visibility: hidden;
  transition: max-height 0.28s ease, opacity 0.28s ease, margin-top 0.28s ease, visibility 0s linear 0.28s;
}

.nav-list--secondary {
  margin-top: 4px;
}

.nav-link--secondary {
  padding: 10px 24px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.nav-link--secondary:hover {
  color: var(--text-secondary);
}

.nav-link--secondary.active {
  color: var(--text-primary);
}

/* Sidebar: pin favorites per section */
.nav-item-pinnable {
  margin: 0;
}

.nav-item-pinnable__row {
  display: flex;
  align-items: stretch;
}

.nav-item-pinnable__row .nav-link {
  flex: 1;
  min-width: 0;
  padding-right: 6px;
}

.nav-pin-form {
  margin: 0;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.nav-pin-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 44px;
  padding: 0 6px;
  margin: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.nav-pin-btn:hover {
  color: var(--accent-primary);
  background-color: var(--bg-tertiary);
}

.nav-pin-btn--pinned {
  color: var(--accent-primary);
}

.nav-pin-lock {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 44px;
  padding: 0 6px;
  margin: 0;
  color: var(--accent-primary);
  font-size: 14px;
  line-height: 1;
  user-select: none;
}

/* Aligns primary rows with pinnable items; Home is not favoritable */
.nav-pin-spacer {
  flex-shrink: 0;
  min-width: 36px;
  min-height: 44px;
  padding: 0 6px;
  margin: 0;
  pointer-events: none;
  visibility: hidden;
}

.nav-list--secondary .nav-pin-btn,
.nav-list--secondary .nav-pin-lock {
  min-height: 40px;
}

/* Sidebar system info (counts) — muted so it doesn't compete with primary nav */
.sidebar-system-info--muted .sidebar-system-info-label,
.sidebar-system-info--muted .sidebar-system-info-link {
  color: var(--text-muted);
}

.sidebar-system-info--muted .sidebar-system-info-link:hover {
  color: var(--text-secondary);
}

.sidebar-system-info--muted .sidebar-system-info-count {
  color: var(--text-muted);
  opacity: 0.9;
}

/* Sidebar system info (counts) */
.sidebar-system-info {
  margin-top: auto;
  padding: 16px 24px 0;
  border-top: 1px solid var(--border-color-light);
}

.sidebar-system-info-label {
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.sidebar-system-info-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-system-info-list li {
  margin: 0;
}

.sidebar-system-info-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.sidebar-system-info-link:hover {
  color: var(--text-primary);
}

.sidebar-system-info-link--text {
  cursor: default;
}

.sidebar-system-info-count {
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  margin-left: 8px;
}

.sidebar-system-info-link:hover .sidebar-system-info-count {
  color: var(--text-secondary);
}

/* Collapsed: sidebar becomes a slim rail with only the hamburger */
body.sidebar-collapsed .app-sidebar {
  width: 52px;
}

body.sidebar-collapsed .sidebar-content {
  overflow: hidden;
  width: 0;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: width 0.28s ease, opacity 0.28s ease, padding 0.28s ease, visibility 0s linear 0.28s;
}

body.topnav-collapsed .app-header {
  display: none !important;
}

body.topnav-collapsed .topnav-restore {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Sidebar open button shown when header is collapsed — mobile only */
.topnav-collapsed-sidebar-open {
  display: none;
}

@media (max-width: 768px) {
  body.topnav-collapsed .topnav-collapsed-sidebar-open {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 140;
    padding: 6px 10px;
    font-size: 1.1rem;
    line-height: 1;
    background-color: var(--btn-secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
  }

  body.topnav-collapsed .topnav-collapsed-sidebar-open:hover {
    background-color: var(--btn-secondary-hover);
    border-color: var(--border-color-strong);
  }
}

/* Main Content */
.app-main {
  flex: 1;
  padding: 32px;
  background-color: var(--bg-primary);
  min-height: calc(100vh - 140px);
}

/* Footer */
.app-footer {
  background-color: var(--bg-footer);
  border-top: 1px solid var(--border-color);
  margin-top: auto;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 32px 32px;
  display: flex;
  gap: 48px;
  align-items: flex-start;
}

.footer-brand {
  flex: 0 0 200px;
}

.footer-brand__logo {
  font-family: var(--font-brand-display, "Barlow Condensed", sans-serif);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 3px;
  color: var(--text-primary);
  text-decoration: none;
  display: inline-block;
  margin-bottom: 10px;
}

.footer-brand__logo:hover { color: var(--accent-primary); }

.footer-brand__tagline {
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 12px;
}

.footer-brand__copy {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
}

.footer-nav {
  flex: 1;
  display: flex;
  gap: 40px;
  flex-wrap: wrap;
}

.footer-nav__col {
  flex: 1;
  min-width: 120px;
}

.footer-nav__heading {
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-secondary);
  margin: 0 0 12px;
}

.footer-nav__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-nav__link {
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color .15s;
}

.footer-nav__link:hover { color: var(--text-primary); }

.footer-bottom {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 32px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 10px;
}

.footer-bottom__legal {
  font-size: 11px;
  color: var(--text-muted);
  margin: 0;
  flex: 1;
  letter-spacing: .5px;
}

.footer-bottom__mark {
  opacity: 0.35;
  transition: opacity .2s;
}

.footer-bottom__mark:hover { opacity: 0.75; }

@media (max-width: 768px) {
  .footer-inner {
    flex-direction: column;
    gap: 32px;
    padding: 36px 24px 24px;
  }
  .footer-brand { flex: none; }
  .footer-nav { gap: 28px; }
  .footer-bottom { padding: 16px 24px 20px; }
}

/* Cards */
.card {
  border: 1px solid var(--surface-panel-border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  background-color: var(--bg-card);
  box-shadow: var(--surface-panel-shadow);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-color-strong);
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.card-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
  font-family: var(--font-heading);
  letter-spacing: -0.02em;
}

.card-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.card-body {
  margin-top: 8px;
  color: var(--text-secondary);
  line-height: var(--line-height-relaxed);
}

.card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.card-priority {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.card-priority .btn-icon {
  padding: 6px 10px;
  min-width: 2.5em;
  font-size: 1em;
}

/* Proposal review row title — explicit class beats global `a` element rule */
.proposal-review__title {
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0;
  text-decoration: none;
}

.proposal-review__title:hover {
  color: var(--text-link);
  text-decoration: none;
}

/* Buttons — shared Barlow 600; variants = intent (see STYLEGUIDE.md) */
.btn,
.btn-secondary,
input[type="submit"].btn,
input[type="submit"].btn-secondary,
button[type="submit"].btn,
button[type="submit"].btn-secondary,
button[type="button"].btn,
button[type="button"].btn-secondary,
a.btn,
a.btn-secondary {
  border-radius: 8px;
  padding: 10px 16px;
  border: 1px solid transparent;
  background-color: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.25;
  text-decoration: none;
  display: inline-block;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, filter 0.2s ease;
  font-family: var(--font-primary);
  text-align: center;
  vertical-align: middle;
}

.btn:hover,
input[type="submit"].btn:hover,
button[type="submit"].btn:hover,
button[type="button"].btn:hover,
a.btn:hover {
  background-color: var(--btn-primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  color: var(--btn-primary-text);
  text-decoration: none;
}

.btn:focus-visible,
.btn-secondary:focus-visible,
a.btn:focus-visible,
a.btn-secondary:focus-visible,
button.btn:focus-visible,
button.btn-secondary:focus-visible {
  outline: 2px solid var(--command-blue);
  outline-offset: 2px;
}

.btn-secondary,
input[type="submit"].btn-secondary,
button[type="submit"].btn-secondary,
button[type="button"].btn-secondary,
a.btn-secondary {
  background-color: var(--btn-secondary-bg);
  color: var(--btn-secondary-text);
  border-color: var(--border-color);
}

.btn-secondary:hover,
input[type="submit"].btn-secondary:hover,
button[type="submit"].btn-secondary:hover,
button[type="button"].btn-secondary:hover,
a.btn-secondary:hover {
  background-color: var(--btn-secondary-hover);
  border-color: var(--border-color-strong);
  color: var(--text-primary);
  text-decoration: none;
  transform: none;
  box-shadow: none;
}

.btn:disabled,
.btn-secondary:disabled,
button.btn:disabled,
button.btn-secondary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  pointer-events: none;
}

/* Emphasis primary — brand gradient + condensed caps */
.btn.btn--cta,
button.btn--cta,
a.btn--cta {
  background: linear-gradient(135deg, var(--brand-magenta), var(--brand-coral));
  border: none;
  color: var(--btn-primary-text);
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 13px;
}

.btn.btn--cta:hover,
button.btn--cta:hover,
a.btn--cta:hover {
  filter: brightness(1.06);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Outline for tinted / dark panels */
.btn.btn--ghost,
button.btn--ghost,
a.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--surface-panel-border);
}

.btn.btn--ghost:hover,
button.btn--ghost:hover,
a.btn--ghost:hover {
  background: var(--btn-secondary-hover);
  color: var(--text-primary);
  border-color: var(--border-color-strong);
  transform: none;
  box-shadow: none;
}

/* Info / low-emphasis (link-colored outline) */
.btn.btn--info,
button.btn--info,
a.btn--info {
  background: transparent;
  color: var(--text-link);
  border: 1px solid rgba(var(--command-blue-rgb), 0.35);
}

.btn.btn--info:hover,
button.btn--info:hover,
a.btn--info:hover {
  background: rgba(var(--command-blue-rgb), 0.1);
  border-color: var(--command-blue);
  color: var(--text-link-hover);
  transform: none;
  box-shadow: none;
}

.btn--sm {
  padding: 7px 12px;
  font-size: 13px;
  border-radius: 7px;
}

.btn.btn--cta.btn--sm,
button.btn--cta.btn--sm,
a.btn--cta.btn--sm {
  font-size: 12px;
  padding: 8px 14px;
  letter-spacing: 0.05em;
}

.btn--xs {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 6px;
  letter-spacing: 0.01em;
}

.btn--block {
  display: block;
  width: 100%;
}

.btn--danger,
button[type="button"].btn--danger,
button[type="submit"].btn--danger {
  background-color: var(--signal-red, #f9455c);
  color: #fff;
  border-color: transparent;
}

.btn--danger:hover,
button[type="button"].btn--danger:hover,
button[type="submit"].btn--danger:hover {
  background-color: color-mix(in srgb, var(--signal-red, #f9455c) 88%, black);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn--with-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn--with-icon .btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Forms */
input[type="text"],
input[type="password"],
input[type="email"],
textarea,
select {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-input);
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-primary);
  font-weight: 400;
  width: 100%;
  transition: all 0.2s ease;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--command-blue);
  box-shadow: 0 0 0 3px rgba(76, 125, 255, 0.15);
  background-color: var(--bg-secondary);
}

input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-variant-numeric: tabular-nums;
}

thead {
  background-color: var(--bg-secondary);
}

th {
  text-align: left;
  padding: 12px;
  font-weight: 600;
  font-family: var(--font-heading);
  color: var(--text-primary);
  border-bottom: 2px solid var(--border-color);
  font-size: 14px;
}

td {
  padding: 12px;
  border-bottom: 1px solid var(--border-color-light);
  color: var(--text-primary);
  font-size: 14px;
}

tbody tr:hover {
  background-color: var(--bg-secondary);
}

/* Daily Review — tabbed layout (accent from fabric system) */
.daily-review-tabs {
  margin-bottom: 1.5rem;
}

.daily-review-tabs__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  padding: 0;
  margin: 0;
  list-style: none;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  box-shadow: var(--shadow-sm);
}

.daily-review-tabs__tab {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 0.75rem 1rem 0.7rem;
  border: none;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-primary);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.3;
  text-align: center;
  cursor: pointer;
  transition:
    color 0.15s ease,
    background-color 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.daily-review-tabs__tab:first-child {
  border-top-left-radius: 9px;
}

.daily-review-tabs__tab:last-child {
  border-top-right-radius: 9px;
}

.daily-review-tabs__tab:not(:last-child) {
  box-shadow: 1px 0 0 var(--border-color-light);
}

.daily-review-tabs__tab:hover {
  color: var(--text-primary);
  background-color: rgba(var(--command-blue-rgb), 0.08);
}

.daily-review-tabs__tab:focus {
  outline: none;
}

.daily-review-tabs__tab:focus-visible {
  z-index: 1;
  color: var(--command-blue);
  box-shadow:
    inset 0 0 0 2px rgba(var(--command-blue-rgb), 0.35),
    0 0 0 2px rgba(var(--fabric-violet-rgb), 0.2);
}

.daily-review-tabs__tab.is-active {
  color: var(--command-blue);
  font-weight: 600;
  background: linear-gradient(
    180deg,
    rgba(var(--command-blue-rgb), 0.14) 0%,
    rgba(var(--command-blue-rgb), 0.04) 100%
  );
  border-bottom-color: var(--command-blue);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 1px 0 rgba(var(--command-blue-rgb), 0.25);
}

html[data-theme="light"] .daily-review-tabs__tab.is-active {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    0 1px 0 rgba(var(--command-blue-rgb), 0.2);
}

.daily-review-tabs__panel {
  padding: 1.25rem 0 0;
  margin: 0;
  border: 1px solid var(--border-color);
  border-top: none;
  border-radius: 0 0 10px 10px;
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
}

.daily-review-tabs__panel.hidden {
  display: none;
}

.daily-review-tabs__panel > .section:first-child {
  margin-top: 0;
}

.daily-review-tabs__panel > .section {
  padding-left: 1rem;
  padding-right: 1rem;
}

.daily-review-tabs__panel > .section:last-child {
  padding-bottom: 1rem;
}

/* Utility Classes */
.chip {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  font-size: 12px;
  font-weight: 500;
  margin-left: 6px;
  text-decoration: none;
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  transition: all 0.2s ease;
}

.chip:hover {
  border-color: var(--border-color-strong);
  color: var(--text-primary);
  background-color: var(--bg-secondary);
}

.chip.chip--active {
  border-color: var(--command-blue);
  color: var(--command-blue);
  background-color: rgba(var(--command-blue-rgb), 0.12);
  font-weight: 600;
}

html[data-theme="light"] .chip.chip--active {
  background-color: rgba(var(--command-blue-rgb), 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

button.chip {
  appearance: none;
  -webkit-appearance: none;
  font-family: inherit;
  cursor: pointer;
}

.empty {
  padding: 24px 16px;
  color: var(--text-muted);
  text-align: center;
  font-size: 14px;
}

/* Flash Messages */
.alert, .notice {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  border: 1px solid;
  font-weight: 500;
}

.alert {
  background-color: rgba(249, 69, 92, 0.1);
  color: var(--signal-red);
  border-color: rgba(249, 69, 92, 0.3);
}

.notice {
  background-color: rgba(var(--signal-green-rgb), 0.1);
  color: var(--signal-green);
  border-color: rgba(var(--signal-green-rgb), 0.3);
}

/* Status Colors - Semantic Usage */
.status-healthy,
.status-complete,
.status-enabled {
  color: var(--signal-green);
}

.status-pending,
.status-snoozed,
.status-review {
  color: var(--signal-amber);
}

.status-error,
.status-blocked,
.status-disabled {
  color: var(--signal-red);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.dashboard-utility-bar {
  position: fixed;
  top: 82px;
  right: 26px;
  z-index: 130;
  pointer-events: none;
}

.dashboard-clock {
  pointer-events: auto;
  min-width: 220px;
  margin: 0;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(var(--signal-green-rgb), 0.42);
  background:
    radial-gradient(circle at top right, rgba(var(--signal-green-rgb), 0.18), transparent 56%),
    var(--bg-card);
  box-shadow: var(--shadow-md);
}

.dashboard-clock__label {
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.dashboard-clock__time {
  display: block;
  margin-top: 3px;
  font-family: var(--font-heading);
  font-size: 24px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

.dashboard-clock__date {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.dashboard-clock__focus-btn {
  margin-top: 8px;
  border: 1px solid rgba(var(--signal-green-rgb), 0.35);
  border-radius: 7px;
  background: rgba(var(--signal-green-rgb), 0.1);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 6px 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dashboard-clock__focus-btn:hover {
  border-color: rgba(var(--signal-green-rgb), 0.65);
  color: var(--signal-green);
  background: rgba(var(--signal-green-rgb), 0.18);
}

.focus-clock-overlay {
  position: fixed;
  inset: 0;
  z-index: 220;
  pointer-events: auto;
  background:
    radial-gradient(circle at 18% 10%, rgba(var(--signal-green-rgb), 0.2), transparent 42%),
    radial-gradient(circle at 85% 82%, rgba(var(--command-blue-rgb), 0.22), transparent 38%),
    rgba(0, 0, 0, 0.9);
  display: grid;
  place-items: center;
  padding: 24px;
}

.focus-clock-overlay__close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  pointer-events: auto;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 8px 14px;
  cursor: pointer;
}

.focus-clock-display {
  position: relative;
  text-align: center;
  background: rgba(16, 20, 30, 0.72);
  border: 1px solid rgba(var(--signal-green-rgb), 0.34);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  padding: 56px 42px 32px;
  min-width: min(860px, 92vw);
}

.focus-clock-display__label {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.focus-clock-display__time {
  display: block;
  margin-top: 12px;
  font-family: var(--font-heading);
  font-size: clamp(56px, 13vw, 160px);
  line-height: 0.95;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.focus-clock-display__date {
  margin: 10px 0 0;
  font-size: clamp(16px, 3vw, 28px);
  color: var(--text-secondary);
}

.focus-clock-display__note-btn {
  margin-top: 22px;
  border: 1px solid rgba(var(--signal-green-rgb), 0.45);
  border-radius: 999px;
  background: rgba(var(--signal-green-rgb), 0.14);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 8px 16px;
  cursor: pointer;
}

.focus-clock-note {
  margin-top: 16px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: rgba(16, 20, 30, 0.88);
  padding: 16px;
  text-align: left;
}

.focus-clock-note__label {
  display: block;
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.focus-clock-note__input {
  width: 100%;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 16px;
  line-height: 1.4;
  padding: 10px 12px;
  resize: vertical;
}

.focus-clock-note__errors {
  min-height: 20px;
  margin: 8px 0 0;
  color: var(--signal-red);
  font-size: 13px;
}

.focus-clock-note__actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.focus-playlist {
  margin: 18px auto 0;
  width: min(760px, 100%);
  border: 1px solid rgba(var(--signal-green-rgb), 0.28);
  border-radius: 14px;
  background: rgba(7, 11, 18, 0.88);
  box-shadow: inset 0 1px 0 rgba(var(--signal-green-rgb), 0.12);
  padding: 14px;
  text-align: left;
}

.focus-playlist__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
}

.focus-playlist__header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-wrap: nowrap;
}

.focus-playlist__kicker {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

.focus-playlist__status {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--signal-green);
  white-space: nowrap;
}

.focus-playlist__hud-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(var(--signal-green-rgb), 0.45);
  border-radius: 999px;
  background: rgba(var(--signal-green-rgb), 0.12);
  color: var(--text-primary);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.focus-playlist__hud-toggle:hover {
  border-color: rgba(var(--signal-green-rgb), 0.7);
  background: rgba(var(--signal-green-rgb), 0.2);
}

.focus-playlist__now {
  margin-top: 8px;
}

.focus-playlist__title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.focus-playlist__subtitle {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.focus-playlist__controls {
  margin-top: 12px;
  display: flex;
  gap: 8px;
}

.focus-playlist__button {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 8px 12px;
  cursor: pointer;
}

.focus-playlist__button:hover {
  border-color: rgba(var(--signal-green-rgb), 0.55);
  color: var(--signal-green);
}

.focus-playlist__button--primary {
  border-color: rgba(var(--signal-green-rgb), 0.45);
  color: var(--text-primary);
  background: rgba(var(--signal-green-rgb), 0.14);
}

.focus-playlist__button--small {
  min-width: 82px;
}

.focus-playlist__button--ghost {
  min-width: 120px;
}

.focus-playlist__timeline {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 46px 1fr 46px;
  gap: 10px;
  align-items: center;
}

.focus-playlist__time {
  font-size: 12px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.focus-playlist__timeline input,
.focus-playlist__volume input {
  width: 100%;
  accent-color: var(--signal-green);
}

.focus-playlist__volume {
  margin-top: 10px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
}

.focus-playlist__tracks {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.focus-playlist__track {
  width: 100%;
  text-align: left;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-secondary);
  padding: 8px 10px;
  cursor: pointer;
  display: grid;
  gap: 2px;
}

.focus-playlist__track:hover {
  border-color: rgba(var(--signal-green-rgb), 0.5);
  color: var(--text-primary);
}

.focus-playlist__track.is-active {
  border-color: rgba(var(--signal-green-rgb), 0.75);
  box-shadow: 0 0 0 1px rgba(var(--signal-green-rgb), 0.5);
  background: rgba(var(--signal-green-rgb), 0.14);
  color: var(--text-primary);
}

.focus-playlist__track-title {
  font-size: 13px;
  font-weight: 600;
}

.focus-playlist__track-subtitle {
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

body.focus-clock-active {
  overflow: hidden;
}

/* Stats panel: hidden by default (per PHILOSOPHY.md) */
.dashboard-stats-panel--hidden {
  display: none !important;
}

.dashboard-chat-placeholder {
  max-width: 56ch;
}

.dashboard-home-hero {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(240px, 1fr);
  gap: 18px;
  align-items: start;
  background:
    radial-gradient(circle at top right, rgba(var(--signal-green-rgb), 0.2), transparent 54%),
    linear-gradient(175deg, rgba(var(--command-blue-rgb), 0.12), transparent 62%),
    var(--bg-card);
}

.dashboard-home-hero__eyebrow {
  margin: 0 0 6px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.dashboard-home-hero__title {
  margin: 0;
  font-family: var(--font-heading);
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  line-height: 1.1;
}

.dashboard-home-hero__lead {
  margin: 10px 0 18px;
  max-width: 54ch;
  color: var(--text-secondary);
}

.dashboard-home-hero__status {
  display: grid;
  gap: 10px;
}

/* Hero graphics: single composed view that animates away/towards */
.dashboard-home-hero__graphics {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
  min-height: 100px;
}

.dashboard-home-hero__graphic {
  display: flex;
  align-items: center;
  justify-content: center;
  animation: hero-graphics-breathe 4s ease-in-out infinite;
}

.dashboard-home-hero__graphic--left {
  animation-direction: normal;
}

.dashboard-home-hero__graphic--stairs {
  animation: none;
  opacity: 0.92;
}

.dashboard-home-hero__graphic--right {
  animation-name: hero-graphics-breathe-right;
}

.dashboard-home-hero__graphic-img {
  display: block;
  height: auto;
  max-height: 100px;
  width: auto;
  object-fit: contain;
}

@keyframes hero-graphics-breathe {
  0%, 100% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(-24px);
  }
}

@keyframes hero-graphics-breathe-right {
  0%, 100% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(24px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .dashboard-home-hero__graphic {
    animation: none;
  }
}

.dashboard-home-chip {
  margin: 0;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: rgba(var(--command-blue-rgb), 0.08);
}

.dashboard-home-chip__label {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.dashboard-home-chip__value {
  margin: 6px 0 0;
  font-size: 15px;
  color: var(--text-primary);
}

.dashboard-home-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.dashboard-home-panel__title {
  margin: 0 0 12px;
  font-size: 17px;
  font-family: var(--font-heading);
}

.dashboard-home-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.dashboard-home-list__item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--border-color-light);
  padding-bottom: 7px;
}

.dashboard-home-list__label {
  color: var(--text-secondary);
}

.dashboard-home-list__value {
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.dashboard-home-actions {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
}

.dashboard-home-actions a {
  color: var(--text-primary);
  text-decoration: underline;
  text-decoration-color: rgba(var(--command-blue-rgb), 0.5);
  text-underline-offset: 3px;
}

.dashboard-home-actions a:hover {
  color: var(--signal-green);
  text-decoration-color: rgba(var(--signal-green-rgb), 0.75);
}

.dashboard-shell {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.dashboard-ops-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(320px, 1fr);
  gap: 24px;
  align-items: start;
}

.dashboard-ops-main,
.dashboard-ops-side {
  min-width: 0;
}

.dashboard-ops-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dashboard-cluster {
  margin-top: 0;
}

.dashboard-card {
  background-color: var(--bg-card);
  border: 1px solid var(--surface-panel-border);
  border-radius: 12px;
  box-shadow: var(--surface-panel-shadow);
}

.rico-onboard-highlight {
  background-color: var(--rico-onboard-bg);
  border: 2px solid var(--rico-onboard-border);
}

.dashboard-summary-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}

.summary-card {
  margin: 0;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--surface-panel-border);
  background: linear-gradient(160deg, rgba(var(--command-blue-rgb), 0.12), transparent 65%), var(--bg-card);
  box-shadow: var(--surface-panel-shadow);
}

.summary-card--incoming {
  border-color: rgba(var(--signal-green-rgb), 0.45);
  box-shadow: 0 0 0 1px rgba(var(--signal-green-rgb), 0.3);
  background: radial-gradient(circle at top left, rgba(var(--signal-green-rgb), 0.24), transparent 58%), var(--bg-card);
}

.summary-card__label {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.summary-card__info {
  position: relative;
  width: 16px;
  height: 16px;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: rgba(var(--command-blue-rgb), 0.16);
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: help;
  padding: 0;
}

.summary-card__tooltip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%);
  width: 220px;
  border: 1px solid var(--border-color-strong);
  border-radius: 8px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 11px;
  line-height: 1.35;
  letter-spacing: normal;
  text-transform: none;
  padding: 8px 9px;
  box-shadow: var(--shadow-md);
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s ease;
  z-index: 20;
}

.summary-card__info:hover .summary-card__tooltip,
.summary-card__info:focus-visible .summary-card__tooltip {
  visibility: visible;
  opacity: 1;
}

.summary-card__value {
  margin: 8px 0 0;
  font-size: 28px;
  line-height: 1;
  font-family: var(--font-heading);
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.summary-card__hint {
  margin: 7px 0 0;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.35;
}

/* Dashboard section wrapper (System status, Incoming, etc.) */
.dashboard-section {
  margin-bottom: 0;
  background: var(--card-bg);
  border: 1px solid var(--surface-panel-border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--surface-panel-shadow);
}

.dashboard-section__title {
  margin: 0;
  padding: 16px 20px 12px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 20px;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  border-bottom: 1px solid var(--border-color-light);
  background: var(--bg-secondary);
}

/* Integration status (dashboard) */
.integration-status-section .dashboard-section__title {
  border-bottom: none;
  padding-bottom: 16px;
}

.integration-status-section .integration-status-list {
  padding: 0 20px 20px;
}

.integration-status-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.integration-status-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 0.9em;
  padding: 10px 12px;
  border: 1px solid var(--surface-panel-border);
  border-radius: 8px;
  background: var(--bg-secondary);
}

.integration-status-label {
  font-weight: 500;
  font-family: var(--font-heading);
  color: var(--text-primary);
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot--ok {
  background-color: var(--signal-green);
}

.status-dot--muted {
  background-color: var(--text-muted);
}

/* Integration Test buttons use .btn .btn-secondary; optional smaller size */
.btn-integration-test {
  margin-left: 4px;
  padding: 6px 12px;
  font-size: 13px;
}
.btn-integration-test:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.integration-test-result {
  font-size: 12px;
  margin-left: 4px;
  min-width: 0;
}
.integration-test-result--pending {
  color: var(--text-muted);
}
.integration-test-result--ok {
  color: var(--signal-green);
}
.integration-test-result--error {
  color: var(--signal-red, #e5534b);
}

/* Status badges (e.g. briefings) */
.status-badge {
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 0.9em;
  color: var(--btn-primary-text);
  background: var(--text-muted);
}
.status-badge--ready { background: var(--signal-green); }
.status-badge--generating { background: var(--signal-amber); }
.status-badge--failed { background: var(--signal-red); }
.status-badge--pending { background: var(--text-muted); }
.status-badge--success { background: var(--signal-green); }
.status-badge--failure { background: var(--signal-red); }

/* Proposal effort/energy chips (visual indicators) */
.proposal-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.8125rem;
  font-weight: 500;
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.15s, box-shadow 0.15s;
}
.proposal-chip:hover { opacity: 0.9; box-shadow: 0 0 0 2px var(--bg-tertiary); }
/* Unselected options: muted so the selected pill stands out */
.proposal-chip--unselected {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  border-color: var(--border-color-light);
}
.proposal-chip--unselected:hover {
  color: var(--text-secondary);
  border-color: var(--border-color);
}
.proposal-chip--effort-low   { background: rgba(61, 220, 151, 0.2);  color: #0d7d4d; border-color: rgba(61, 220, 151, 0.4); }
.proposal-chip--effort-medium { background: rgba(245, 158, 11, 0.2);  color: #b45309; border-color: rgba(245, 158, 11, 0.4); }
.proposal-chip--effort-high  { background: rgba(239, 68, 68, 0.2);   color: #b91c1c; border-color: rgba(239, 68, 68, 0.4); }
.proposal-chip--energy-ambient   { background: rgba(92, 99, 112, 0.2);   color: var(--text-muted); border-color: rgba(92, 99, 112, 0.4); }
.proposal-chip--energy-light    { background: rgba(76, 125, 255, 0.2);   color: var(--text-link); border-color: rgba(76, 125, 255, 0.4); }
.proposal-chip--energy-deep_focus { background: rgba(139, 92, 246, 0.2); color: #6d28d9; border-color: rgba(139, 92, 246, 0.4); }
[data-theme="dark"] .proposal-chip--effort-low   { color: #34d399; }
[data-theme="dark"] .proposal-chip--effort-medium { color: #fbbf24; }
[data-theme="dark"] .proposal-chip--effort-high  { color: #f87171; }
[data-theme="dark"] .proposal-chip--energy-deep_focus { color: #a78bfa; }

/* Proposal show page – tight grid, uniform spacing, scannable hierarchy */
.proposal-show { --proposal-gap: 0.75rem; --proposal-section: 1rem; }
.proposal-show .proposal-show__section { margin-top: var(--proposal-section); }
.proposal-show .proposal-show__section:first-of-type { margin-top: 0; }
.proposal-show .dashboard-card { padding: var(--proposal-gap) 1rem; margin-top: var(--proposal-section); }
.proposal-show .dashboard-card:first-of-type { margin-top: 0; }
.proposal-show .proposal-show__meta { font-size: 0.75rem; color: var(--text-muted); padding-top: var(--proposal-gap); margin-top: var(--proposal-gap); border-top: 1px solid var(--border-color-light); }
.proposal-show .proposal-show__grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--proposal-gap) 1.5rem; align-items: start; }
@media (max-width: 520px) {
  .proposal-show .proposal-show__grid-2 { grid-template-columns: 1fr; }
}
.proposal-show .proposal-show__label { font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 0.25rem; display: block; }
.proposal-show .proposal-show__value { font-size: 0.9375rem; color: var(--text-primary); }
.proposal-show .proposal-show__chips { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.proposal-show .proposal-show__chips .proposal-chip { margin: 0; }
.proposal-show .proposal-show__chips form { display: inline-block; }
.proposal-show .proposal-show__block { margin-bottom: var(--proposal-gap); }
.proposal-show .proposal-show__block:last-child { margin-bottom: 0; }

/* Rico: sidebar-style rail + history panel (mirrors .sidebar-wrap / .app-sidebar) */
.rico-focus-shell {
  align-items: start;
  transition: grid-template-columns 0.28s ease;
}

.rico-history-wrap {
  display: flex;
  flex-shrink: 0;
  min-width: 0;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  overflow: hidden;
}

.rico-history-rail {
  width: 52px;
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 20px;
}

.rico-history-toggle-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.rico-history-wheel-icon {
  display: block;
  width: 24px;
  height: 24px;
  object-fit: contain;
  transition: transform 0.3s ease;
}

.rico-history-toggle--collapsed .rico-history-wheel-icon {
  transform: rotate(-90deg);
}

.rico-history-content {
  flex: 1;
  min-width: 0;
  max-height: calc(100vh - 220px);
  overflow-y: auto;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  transition: width 0.28s ease, opacity 0.28s ease, padding 0.28s ease, visibility 0s linear 0.28s;
}

.rico-history-header {
  flex-shrink: 0;
}

.rico-history-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.rico-history-new-chat {
  font-size: 0.6875rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.rico-history-new-chat:hover {
  color: var(--text-primary);
}

.rico-history-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  font-size: 0.6875rem;
}

.rico-history-filter {
  color: var(--text-muted);
  text-decoration: none;
  padding: 0;
  background: none;
  border: none;
  transition: color 0.15s ease;
}

.rico-history-filter:hover {
  color: var(--text-primary);
}

.rico-history-filter--active {
  color: var(--text-primary);
  font-weight: 600;
}

.rico-history-group-label {
  display: block;
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.rico-history-list {
  font-size: 0.8125rem;
}

.rico-history-empty {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.rico-history-content .rico-thread-link {
  color: var(--text-secondary);
}

.rico-history-content .rico-thread-link:hover {
  color: var(--text-primary);
}

.rico-main .dashboard-card {
  max-width: 980px;
}

.rico-context-row {
  max-width: 560px;
}

.rico-conversation {
  min-height: 52vh;
}

.rico-message {
  border-color: var(--border-color);
}

.rico-message--user {
  background: rgba(var(--command-blue-rgb), 0.14);
  border-color: rgba(var(--command-blue-rgb), 0.45);
  color: var(--text-primary);
}

.rico-message--assistant {
  background: rgba(var(--signal-green-rgb), 0.1);
  border-color: rgba(var(--signal-green-rgb), 0.35);
  color: var(--text-primary);
}

/* Loading indicator — sprite sheet animation (indicator@2x.png, 9 frames horizontal) */
@keyframes loading-indicator-spin {
  to { background-position: -108px 0; }
}

.loading-indicator {
  display: inline-block;
  flex-shrink: 0;
  width: 12px;
  height: 26px;
  background-size: 108px 26px; /* 9 frames × 12px wide */
  background-repeat: no-repeat;
  background-position: 0 0;
  animation: loading-indicator-spin 0.9s steps(9) infinite;
  vertical-align: middle;
}

.rico-execution-trace {
  border-color: var(--border-color-light);
}

.rico-agent-execution-list {
  border-left: 1px solid var(--border-color-light);
}

.rico-agent-execution {
  padding-left: calc((var(--rico-agent-level, 0) * 0.85rem) + 0.6rem);
  margin-left: calc(var(--rico-agent-level, 0) * 0.25rem);
}

@media (min-width: 1024px) {
  .rico-focus-shell.rico-history-collapsed {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .rico-focus-shell.rico-history-collapsed .rico-history-content {
    overflow: hidden;
    width: 0;
    padding: 0;
    border: 0;
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transition: width 0.28s ease, opacity 0.28s ease, padding 0.28s ease, visibility 0s linear 0.28s;
  }

  .rico-focus-shell:not(.rico-history-collapsed) .rico-history-content {
    transition: width 0.28s ease, opacity 0.28s ease, padding 0.28s ease, visibility 0s linear 0s;
  }

  .rico-focus-shell.rico-history-collapsed .rico-main .dashboard-card {
    max-width: 1100px;
  }
}

/* Rico: on mobile, history is a full-width collapsible (rail only when collapsed) */
@media (max-width: 768px) {
  .rico-focus-shell {
    grid-template-columns: 1fr;
  }

  .rico-focus-shell.rico-history-collapsed {
    grid-template-columns: 1fr;
  }

  .rico-history-wrap {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .rico-history-rail {
    width: 100%;
    padding: 12px 16px;
    justify-content: flex-start;
    border-bottom: 1px solid var(--border-color);
  }

  .rico-history-rail .layout-toggle {
    min-width: 44px;
    min-height: 44px;
  }

  .rico-focus-shell.rico-history-collapsed .rico-history-rail {
    border-bottom: none;
  }

  .rico-history-content {
    max-height: min(60vh, 400px);
    width: 100%;
    border-top: 1px solid var(--border-color);
  }

  .rico-focus-shell.rico-history-collapsed .rico-history-content {
    overflow: hidden;
    max-height: 0;
    padding: 0;
    border: none;
    opacity: 0;
    visibility: hidden;
    transition: max-height 0.28s ease, opacity 0.28s ease, visibility 0s linear 0.28s;
  }

  .rico-focus-shell:not(.rico-history-collapsed) .rico-history-content {
    transition: max-height 0.28s ease, opacity 0.28s ease, visibility 0s linear 0s;
  }
}

/* Text Utility Classes */
.text-primary {
  color: var(--text-primary);
}

.text-secondary {
  color: var(--text-secondary);
}

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

.text-description {
  color: var(--text-secondary);
  font-size: 0.9em;
  margin-bottom: 16px;
}

.text-empty {
  color: var(--text-muted);
  padding: 16px;
}

/* Charts section and cards (reusable dashboard components) */
.charts-section {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 20px;
}

.chart-card {
  background: var(--card-bg);
  padding: 18px;
  border-radius: 12px;
  border: 1px solid var(--surface-panel-border);
  box-shadow: var(--surface-panel-shadow);
  grid-column: span 4;
}

.chart-card:first-child {
  margin-top: 0;
}

.chart-card h3 {
  margin-top: 0;
  margin-bottom: 12px;
  color: var(--text-primary);
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 18px;
}

.chart-container {
  width: 100%;
  height: 210px;
  max-height: 210px;
  position: relative;
}

.chart-container--wide {
  height: 200px;
  max-height: 200px;
}

.chart-container canvas {
  max-height: 210px !important;
}

.chart-zero-state {
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 16px;
  text-align: center;
  color: var(--text-muted);
  font-family: var(--font-primary);
}

/* Content Sections (reusable card container) */
.content-section-box {
  margin-bottom: 0;
  padding: 20px;
  background-color: var(--card-bg);
  border: 1px solid var(--surface-panel-border);
  border-radius: 12px;
  box-shadow: var(--surface-panel-shadow);
}

.content-section-box.content-section-box--top-spacing {
  margin-top: 32px;
}

.content-section-box h2 {
  margin-top: 0;
  margin-bottom: 16px;
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.content-section-box p {
  margin: 8px 0;
  font-size: 14px;
  font-family: var(--font-primary);
}

.content-section-box strong {
  font-weight: 600;
  color: var(--text-primary);
}

/* Latest briefing widget layout (dashboard) */
.latest-briefing-widget {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.latest-briefing-widget__row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.latest-briefing-widget__meta {
  flex: 1;
  min-width: 200px;
}

.latest-briefing-widget__meta p {
  margin: 0 0 8px 0;
}

.latest-briefing-widget__meta p:last-child {
  color: var(--text-secondary);
  font-size: 0.9em;
}

.latest-briefing-widget__actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.latest-briefing-widget__select {
  min-width: 220px;
  max-width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-color-strong);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 13px;
}

.latest-briefing-widget__title-link {
  color: inherit;
  text-decoration: none;
}

.latest-briefing-widget__title-link:hover {
  color: var(--text-link);
  text-decoration: underline;
}

.daily-briefings-section .dashboard-section__title {
  border-bottom: none;
  padding-bottom: 12px;
}

.daily-briefings-list {
  list-style: none;
  margin: 0;
  padding: 0 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.daily-briefings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border-color-light);
  border-radius: 8px;
  background: var(--bg-secondary);
}

.daily-briefings-item__meta {
  min-width: 0;
}

.daily-briefings-item__title {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.daily-briefings-item__title a {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 600;
}

.daily-briefings-item__title a:hover {
  text-decoration: underline;
}

.daily-briefings-item__subtext {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.daily-briefings-item__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.daily-briefings-item__not-ready {
  font-size: 12px;
  color: var(--text-muted);
}

.daily-briefings-empty {
  margin: 0;
  padding: 0 20px 16px;
  color: var(--text-muted);
}

.daily-briefings-section__all-link {
  margin: 0 20px 20px;
}

/* Floating action button (e.g. shortcuts) */
.btn-floating {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid var(--surface-panel-border);
  background: var(--card-bg);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.25;
  font-family: var(--font-primary);
  cursor: pointer;
  z-index: 100;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-md);
}

.btn-floating:hover {
  background: var(--btn-secondary-hover);
  border-color: var(--border-color-strong);
  color: var(--text-primary);
}

.btn-floating .kbd {
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  font-size: 12px;
  font-family: var(--font-primary);
}

/* Dashboard: Incoming panel — layout/colors via Tailwind; keep animations + focus mode here */
.incoming-panel {
  position: relative;
  border-color: rgba(var(--signal-green-rgb), 0.38) !important;
  background:
    radial-gradient(circle at 82% -8%, rgba(var(--command-blue-rgb), 0.24), transparent 48%),
    radial-gradient(circle at 12% 0%, rgba(var(--signal-green-rgb), 0.2), transparent 36%),
    var(--fabric-slate);
  box-shadow:
    0 0 0 1px rgba(var(--signal-green-rgb), 0.08),
    0 24px 44px rgba(0, 0, 0, 0.45),
    0 0 40px rgba(var(--signal-green-rgb), 0.14);
}

.incoming-panel__header {
  border-bottom-color: rgba(var(--signal-green-rgb), 0.24) !important;
}

.incoming-panel__icon {
  animation: incoming-blink 1.5s ease-in-out infinite;
}

@keyframes incoming-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.incoming-signal {
  animation: incoming-signal-in 0.3s ease-out;
  border-color: rgba(var(--command-blue-rgb), 0.34) !important;
  border-left-color: rgba(var(--signal-green-rgb), 0.85) !important;
  background:
    linear-gradient(130deg, rgba(var(--command-blue-rgb), 0.12), transparent 45%),
    var(--fabric-graphite) !important;
}

.incoming-signal--green { border-left-color: rgba(var(--signal-green-rgb), 0.85) !important; }
.incoming-signal--yellow { border-left-color: rgba(253, 183, 22, 0.9) !important; }
.incoming-signal--orange { border-left-color: rgba(240, 78, 124, 0.9) !important; }
.incoming-signal--red { border-left-color: rgba(249, 69, 92, 0.9) !important; }

.incoming-attention-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15);
}

.incoming-attention-dot--green { background: rgba(var(--signal-green-rgb), 1); }
.incoming-attention-dot--yellow { background: rgba(253, 183, 22, 1); }
.incoming-attention-dot--orange { background: rgba(208, 0, 132, 1); }
.incoming-attention-dot--red { background: rgba(249, 69, 92, 1); }

.incoming-attention-label {
  font-size: 10px;
  letter-spacing: 0.05em;
  font-weight: 700;
}

.incoming-attention-label--green { color: rgba(var(--signal-green-rgb), 1); }
.incoming-attention-label--yellow { color: rgba(253, 183, 22, 1); }
.incoming-attention-label--orange { color: rgba(208, 0, 132, 1); }
.incoming-attention-label--red { color: rgba(249, 69, 92, 1); }

.incoming-signal:hover {
  border-color: rgba(var(--signal-green-rgb), 0.52) !important;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.38), inset 0 0 0 1px rgba(var(--signal-green-rgb), 0.12);
}

.incoming-signal--success {
  border-left-color: rgba(129, 199, 132, 0.95) !important;
  box-shadow: inset 0 0 0 1px rgba(129, 199, 132, 0.2);
}

.incoming-signal__completed-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(129, 199, 132, 0.2);
  color: var(--text-primary);
}

.incoming-signal__completed-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(129, 199, 132, 0.95);
  color: rgba(15, 23, 42, 0.95);
  font-size: 12px;
  font-weight: 700;
}

.incoming-signal__completed-text {
  font-size: 12px;
  color: var(--text-muted);
}

.incoming-signal--minimized {
  max-height: 0;
  margin: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-width: 0;
  opacity: 0;
  transform: scale(0.98);
  overflow: hidden;
  transition: max-height 0.28s ease, opacity 0.28s ease, margin 0.28s ease, padding 0.28s ease, transform 0.28s ease;
}

@keyframes incoming-signal-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Incoming focus mode: full-viewport overlay for operator attention (backdrop is sibling of section so position:fixed covers viewport) */
.incoming-focus-wrap {
  position: relative;
}

.incoming-focus-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  z-index: 99;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

body.incoming-focus-active {
  overflow: hidden;
}

body.incoming-focus-active .incoming-focus-backdrop {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

.incoming-panel.terminal-feed--focus {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(92vw, 720px);
  max-height: 88vh;
  z-index: 100;
  margin: 0;
  border-radius: 12px;
  border-left-width: 4px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px var(--border-color-strong), 0 0 40px rgba(var(--signal-green-rgb), 0.15);
  display: flex;
  flex-direction: column;
}

.incoming-panel.terminal-feed--focus .incoming-panel__list {
  max-height: 70vh;
  flex: 1;
  min-height: 200px;
}

.incoming-panel.terminal-feed--focus .incoming-panel__header {
  flex-shrink: 0;
}

@media (max-width: 1280px) {
  .dashboard-utility-bar {
    top: 76px;
    right: 20px;
  }

  .dashboard-clock {
    min-width: 200px;
  }

  .dashboard-home-hero {
    grid-template-columns: 1fr;
  }

  .dashboard-home-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-ops-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chart-card {
    grid-column: span 6;
  }
}

@media (max-width: 760px) {
  .dashboard-utility-bar {
    right: 12px;
    left: 12px;
    top: auto;
    bottom: 12px;
  }

  .dashboard-clock {
    min-width: 0;
  }

  .dashboard-clock__time {
    font-size: 20px;
  }

  .dashboard-shell {
    gap: 16px;
  }

  .dashboard-summary-strip {
    grid-template-columns: 1fr;
  }

  .chart-card {
    grid-column: 1 / -1;
  }

  .incoming-panel__header,
  .incoming-panel__list {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
}

/* Recent Events card: flush grid, tight header */
.recent-events-card {
  padding: 0 !important;
  overflow: hidden;
}

.recent-events-card > h2 {
  margin: 0;
  padding: 14px 16px 12px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  border-bottom: 1px solid var(--border-color-light);
  color: var(--text-primary);
}

.recent-events-card > .text-muted {
  padding: 16px;
  margin: 0;
  font-size: 14px;
}

/* Events list (with Create proposal) */
.events-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.events-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color-light);
  flex-wrap: wrap;
}

.events-list-item:last-child {
  border-bottom: none;
}

.events-list-link {
  flex: 1;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}

.events-list-link:hover {
  text-decoration: underline;
}

.events-list-action {
  flex-shrink: 0;
  font-size: 13px;
  padding: 8px 14px;
}

/* Dashboard Recent cards (events + proposals) */
.recent-feed-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

@keyframes recentFeedItemIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.recent-feed-item--just-added {
  animation: recentFeedItemIn 0.3s ease both;
}


.recent-feed-list--compact .recent-feed-item {
  padding: 8px 0;
}

/* Recent Decisions: grouped by proposal */
.decision-groups {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.decision-group {
  border-radius: 8px;
  border: 1px solid var(--surface-panel-border);
  overflow: hidden;
  box-shadow: var(--surface-panel-shadow);
}

.decision-group__header {
  padding: 10px 12px 8px;
}

.decision-group__title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.decision-group__proposal-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-link);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.decision-group__proposal-link:hover {
  text-decoration: underline;
}

.decision-group__toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  background: none;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  white-space: nowrap;
}

.decision-group__toggle:hover {
  border-color: var(--text-link);
  color: var(--text-link);
}

.decision-group__toggle[aria-expanded="true"] .decision-group__toggle-icon {
  display: inline-block;
  transform: rotate(180deg);
}

.decision-group__toggle-icon {
  font-size: 10px;
  line-height: 1;
  transition: transform 0.15s;
}

.decision-group__latest {
  margin: 0;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.decision-group__list {
  list-style: none;
  padding: 0;
  margin: 0;
  border-top: 1px solid var(--border-color);
  background: var(--fabric-graphite, rgba(0,0,0,0.15));
}

.decision-group__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  font-size: 12px;
  border-bottom: 1px solid var(--border-color-light, rgba(255,255,255,0.06));
}

.decision-group__item:last-child {
  border-bottom: none;
}

.decision-group__item-meta {
  font-size: 11px;
}

.decision-group__badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
  background: var(--fabric-graphite, rgba(255,255,255,0.08));
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.decision-group__badge--accept,
.decision-group__badge--complete { background: rgba(129,199,132,0.15); color: #81c784; border-color: rgba(129,199,132,0.3); }
.decision-group__badge--ignore,
.decision-group__badge--fail     { background: rgba(229,115,115,0.12); color: #ef9a9a; border-color: rgba(229,115,115,0.25); }
.decision-group__badge--snooze   { background: rgba(255,183,77,0.12);  color: #ffb74d; border-color: rgba(255,183,77,0.25); }
.decision-group__badge--acknowledge,
.decision-group__badge--undo     { background: rgba(79,195,247,0.12);  color: #4fc3f7; border-color: rgba(79,195,247,0.25); }
.decision-group__badge--unaccept,
.decision-group__badge--set_urgency,
.decision-group__badge--set_effort,
.decision-group__badge--set_energy { background: rgba(206,147,216,0.12); color: #ce93d8; border-color: rgba(206,147,216,0.25); }

/* Recent Events grid: uniform card layout */
.recent-events-grid {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  border: 1px solid var(--border-color-light);
  border-radius: 10px;
  overflow: hidden;
}

.recent-events-grid__item {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto auto auto;
  gap: 0;
  padding: 11px 14px 11px 18px;
  border-bottom: 1px solid var(--border-color-light);
  position: relative;
  transition: opacity 0.25s ease, max-height 0.3s ease, padding 0.25s ease, margin 0.25s ease;
}

.recent-events-grid__item:last-child {
  border-bottom: none;
}

/* Color variability: left accent */
.recent-events-grid__item.recent-feed-item--color-0 { border-left: 3px solid rgba(124, 156, 255, 0.9); }
.recent-events-grid__item.recent-feed-item--color-1 { border-left: 3px solid rgba(129, 199, 132, 0.9); }
.recent-events-grid__item.recent-feed-item--color-2 { border-left: 3px solid rgba(255, 183, 77, 0.9); }
.recent-events-grid__item.recent-feed-item--color-3 { border-left: 3px solid rgba(240, 147, 251, 0.9); }
.recent-events-grid__item.recent-feed-item--color-4 { border-left: 3px solid rgba(79, 195, 247, 0.9); }
.recent-events-grid__item.recent-feed-item--color-5 { border-left: 3px solid rgba(206, 147, 216, 0.9); }

.recent-events-grid__item.recent-feed-item--success {
  background: rgba(129, 199, 132, 0.12);
}

.recent-events-grid__item.recent-feed-item--success.recent-feed-item--color-0 { border-left-color: rgba(124, 156, 255, 0.9); }
.recent-events-grid__item.recent-feed-item--success.recent-feed-item--color-1 { border-left-color: rgba(129, 199, 132, 0.95); }
.recent-events-grid__item.recent-feed-item--success.recent-feed-item--color-2 { border-left-color: rgba(255, 183, 77, 0.95); }
.recent-events-grid__item.recent-feed-item--success.recent-feed-item--color-3 { border-left-color: rgba(240, 147, 251, 0.95); }
.recent-events-grid__item.recent-feed-item--success.recent-feed-item--color-4 { border-left-color: rgba(79, 195, 247, 0.95); }
.recent-events-grid__item.recent-feed-item--success.recent-feed-item--color-5 { border-left-color: rgba(206, 147, 216, 0.95); }

.recent-events-grid__item.recent-feed-item--animating-out {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  margin: 0;
  opacity: 0;
  overflow: hidden;
  border-bottom-width: 0;
}

.recent-feed-item__success {
  grid-column: 1;
  grid-row: 3;
  margin-top: 6px;
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(129, 199, 132, 0.2);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  display: none;
}

.recent-feed-item__success[data-visible="true"] {
  display: block;
  animation: recent-feed-success-in 0.2s ease;
}

@keyframes recent-feed-success-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.recent-feed-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color-light);
  flex-wrap: nowrap;
}

.recent-events-grid__item.recent-feed-item {
  padding: 0;
  border-bottom: none;
  flex-wrap: wrap;
}

.recent-events-grid__item .recent-feed-item__body {
  grid-column: 1;
  grid-row: 1;
  width: 100%;
}

.recent-events-grid__item .recent-feed-item__meta {
  grid-column: 1;
  grid-row: 2;
  width: 100%;
}

.recent-feed-item--stacked {
  flex-direction: column;
  gap: 8px;
}

.recent-events-grid__item.recent-feed-item--stacked {
  flex-direction: column;
  gap: 8px;
}

.recent-feed-item--stacked .recent-feed-item__body {
  width: 100%;
}

.recent-feed-item--stacked .recent-feed-item__meta {
  width: 100%;
  min-width: 0;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  text-align: left;
}

.recent-feed-item:last-child {
  border-bottom: none;
}

.recent-feed-item__body {
  flex: 1;
  min-width: 0;
}

.recent-feed-item__type {
  display: block;
  margin-bottom: 2px;
  font-size: 11px;
  line-height: 1.3;
  color: var(--text-secondary);
}

.recent-feed-item__type-link {
  color: var(--text-secondary);
  text-decoration: none;
}

.recent-feed-item__type-link:hover {
  color: var(--text-link);
  text-decoration: underline;
}

.recent-feed-item__excerpt {
  display: -webkit-box;
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text-primary);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.recent-feed-item__excerpt:hover {
  color: var(--text-link);
}

.recent-feed-item__excerpt--fallback {
  font-weight: 400;
  color: var(--text-secondary);
}

.recent-feed-item__title {
  display: -webkit-box;
  margin: 0;
  color: var(--text-link);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.recent-feed-item__title:hover {
  text-decoration: underline;
}

.recent-feed-item__summary {
  margin: 4px 0 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.4;
  display: -webkit-box;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}

.recent-feed-item__summary strong {
  color: var(--text-primary);
  font-weight: 600;
}

.recent-feed-item__meta {
  min-width: 140px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
  text-align: right;
}

.recent-feed-item__meta--wrap {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  min-width: 0;
}

.recent-feed-item__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  min-width: 0;
}

.recent-feed-item__action-form {
  margin: 0;
  display: inline-flex;
}

.recent-feed-item__time {
  font-size: 12px;
  line-height: 1.35;
  flex-shrink: 0;
}

.recent-events-action-link {
  display: inline-block;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-primary);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-link);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.recent-events-action-link:hover {
  color: var(--text-link-hover);
  text-decoration: underline;
}

/* Create and complete confirmation modal (Stimulus) */
#create-and-complete-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  outline: none;
}

#create-and-complete-modal[hidden] {
  display: none;
}

.cacm-backdrop {
  position: absolute;
  inset: 0;
  background: var(--overlay-bg);
  backdrop-filter: blur(2px);
}

.cacm-dialog {
  position: relative;
  z-index: 1;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  max-width: 400px;
  width: 100%;
  animation: slideUp 0.2s ease;
}

.cacm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border-color-light);
}

.cacm-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  font-family: var(--font-heading);
}

.cacm-body {
  padding: 16px 20px 20px;
}

.cacm-message {
  margin: 0 0 18px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-secondary);
}

.cacm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  justify-content: flex-end;
}

/* Proposal created toast (dashboard) */
.dashboard-proposal-created-toast {
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--bg-tertiary, #2d2d33);
  border: 1px solid var(--border-color-light, rgba(255, 255, 255, 0.08));
}

.proposal-created-toast__text {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.proposal-created-toast__link {
  color: var(--text-link, #7c9cff);
  text-decoration: none;
  font-weight: 500;
}

.proposal-created-toast__link:hover {
  text-decoration: underline;
}

@media (max-width: 768px) {
  .recent-feed-item {
    flex-wrap: wrap;
  }

  .recent-feed-item__meta {
    width: 100%;
    min-width: 0;
    align-items: flex-start;
    text-align: left;
  }

  .recent-feed-item__meta--wrap .recent-feed-item__actions {
    width: 100%;
  }
}

/* Error States */
.error-text {
  color: var(--signal-red);
}

.error-box {
  background-color: rgba(242, 109, 109, 0.1);
  border: 1px solid rgba(242, 109, 109, 0.3);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  color: var(--signal-red);
}

/* Kiosk Styles */
body.kiosk {
  padding: 16px;
  background-color: var(--bg-primary);
}

.kiosk-shell {
  padding: 16px;
  max-width: 1600px;
  margin: 0 auto;
}

.kiosk-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.kiosk-title {
  font-size: 28px;
  font-weight: 600;
  color: var(--text-primary);
  font-family: var(--font-heading);
  letter-spacing: -0.02em;
  margin: 0;
}

.kiosk-subtitle {
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 400;
}

.kiosk-meta {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.kiosk-clock {
  min-width: 250px;
}

.kiosk-meta__chips {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.kiosk-meta__chips .chip {
  margin-left: 0;
}

/* Kiosk note input (large jot area) */
.kiosk-note-section {
  margin-bottom: 32px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px 28px;
}

.kiosk-note-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.kiosk-note-label {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 4px 0;
}

.kiosk-note-input {
  width: 100%;
  min-height: 120px;
  padding: 16px;
  font-size: 18px;
  line-height: 1.5;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  resize: vertical;
  box-sizing: border-box;
}

.kiosk-note-input::placeholder {
  color: var(--text-secondary);
}

.kiosk-note-input:focus {
  outline: none;
  border-color: var(--primary);
}

.kiosk-note-errors {
  margin: 0;
  color: var(--signal-red);
  font-size: 14px;
}

/* Kiosk note submit: primary button + layout */
.kiosk-note-submit {
  align-self: flex-start;
  margin-top: 4px;
}

.kiosk-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

.kiosk-grid section {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
}

.kiosk-grid section h2 {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 600;
  margin-top: 0;
  margin-bottom: 16px;
  color: var(--text-primary);
  text-transform: none;
  letter-spacing: -0.01em;
}

@media (min-width: 900px) {
  .kiosk-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .app-body {
    flex-direction: column;
  }

  /* Mobile sidebar: drawer (off-canvas when closed) */
  .sidebar-wrap {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 500;
    width: min(280px, 85vw);
    transform: translateX(-100%);
    transition: transform 0.28s ease;
    border-right: 1px solid var(--border-color);
    box-shadow: none;
  }

  body.sidebar-open-mobile .sidebar-wrap {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 450;
    background: var(--overlay-bg);
    pointer-events: none;
  }

  body.sidebar-open-mobile .sidebar-overlay {
    display: block;
    pointer-events: auto;
  }

  body.sidebar-open-mobile {
    overflow: hidden;
  }

  .app-sidebar {
    width: 100%;
    height: 100%;
    border-right: none;
    border-bottom: none;
    flex-direction: row;
  }

  .sidebar-rail {
    padding-top: 12px;
  }

  .sidebar-content {
    padding: 12px 0;
    flex: 1;
    overflow-y: auto;
  }

  .sidebar-close-mobile {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
  }

  .sidebar-close-mobile:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
  }

  .nav-list {
    display: block;
    padding: 0 16px;
    overflow-x: visible;
  }

  .nav-list li {
    flex-shrink: unset;
  }

  .nav-link {
    padding: 12px 16px;
    white-space: normal;
  }

  .header-menu-btn.sidebar-open-mobile {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--header-nav-text);
    font-size: 20px;
    cursor: pointer;
  }

  .header-menu-btn.sidebar-open-mobile:hover {
    background: rgba(255, 255, 255, 0.1);
  }

  .app-main {
    padding: 24px 16px;
  }

  .header-content {
    padding: 12px 16px;
    gap: 8px;
    flex-wrap: wrap;
    position: relative;
    z-index: 101;
  }

  .header-left {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
  }

  .header-left .app-title-logo {
    max-width: 140px;
    height: auto;
    object-fit: contain;
  }

  .app-header {
    position: relative;
  }

  .header-right--nav {
    flex: 1 1 auto;
    min-width: 0;
    gap: 6px;
    flex-wrap: nowrap;
    justify-content: flex-end;
  }

  .header-nav-toggle {
    display: flex;
    position: relative;
    z-index: 102;
  }

  .header-nav-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px 0;
    background: var(--header-nav-bg);
    border-bottom: 1px solid var(--header-nav-border);
    box-shadow: var(--shadow-lg);
    z-index: 99;
    max-height: min(70vh, 400px);
    overflow-y: auto;
  }

  .app-header.header-nav-open .header-nav-menu {
    display: flex;
  }

  .header-nav-menu .header-close-mobile-only {
    display: flex;
  }

  .header-nav-menu-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 14px 16px;
    min-height: 48px;
    margin: 0;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    border-bottom: 1px solid var(--header-nav-border);
    color: var(--header-nav-text);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
  }

  .header-nav-menu-close:hover {
    background: rgba(255, 255, 255, 0.12);
  }

  .header-nav-menu .btn-header--link,
  .header-nav-menu .logout-form .btn-header--link {
    justify-content: flex-start;
    padding: 14px 16px;
    min-height: 48px;
    width: 100%;
    border-radius: 0;
    text-align: left;
  }

  .header-nav-menu .btn-header--bubble {
    justify-content: flex-start;
    padding: 14px 16px;
    min-height: 48px;
    width: 100%;
    border-radius: 0;
    margin: 4px 8px 0;
    width: calc(100% - 16px);
  }

  .header-nav-menu .user-badge--nav {
    margin: 8px 16px 0;
    max-width: none;
    padding: 12px 16px;
  }

  .header-item-desktop-only {
    display: none;
  }

  .app-header--nav .user-badge--nav {
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: middle;
  }

  .app-header--nav .btn-header--link,
  .app-header--nav .logout-form .btn-header--link {
    padding: 10px 8px;
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .app-header--nav .btn-header--bubble {
    min-height: 44px;
    padding: 10px 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .rico-label-mobile {
    display: inline;
  }

  .rico-label-desktop {
    display: none;
  }

  .app-header--nav .theme-toggle--nav {
    min-width: 44px;
    min-height: 44px;
    padding: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .app-title {
    font-size: 20px;
  }

  .kiosk-grid {
    grid-template-columns: 1fr;
  }

  .kiosk-header {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  .kiosk-meta {
    flex-direction: column;
  }

  .kiosk-clock {
    min-width: 0;
  }

  .focus-clock-overlay__close {
    top: 10px;
    right: 10px;
  }

  .focus-clock-display {
    min-width: 0;
    width: 100%;
    padding: 52px 20px 24px;
  }

  .focus-playlist {
    padding: 12px;
  }

  .focus-playlist__tracks {
    grid-template-columns: 1fr;
  }

  /* Review bulk action bar: stack controls on small screens */
  .review-bulk-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .review-bulk-bar #bulk_action,
  .review-bulk-bar select,
  .review-bulk-bar input[type="number"],
  .review-bulk-bar .btn,
  .review-bulk-bar .btn-secondary {
    width: 100%;
    min-width: 0;
  }

  /* Modals: full-bleed safe on small viewports */
  .modal-overlay {
    padding: 12px;
    align-items: flex-start;
    overflow-y: auto;
  }

  .stats-modal-overlay .stats-modal {
    max-height: min(90vh, calc(100vh - 24px));
  }

  .modal-body,
  .stats-modal-body {
    padding: 16px;
  }

  /* Prevent horizontal overflow in app main */
  .app-main {
    min-width: 0;
  }
}

/* Header nav: desktop = inline menu, mobile = toggle + dropdown */
.header-nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--header-nav-text);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.header-nav-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
}

.header-nav-menu {
  display: flex;
  align-items: center;
  gap: inherit;
}

/* Hide header menu close button on desktop (show only in mobile dropdown) */
.header-close-mobile-only {
  display: none;
}

/* Hide mobile menu button on desktop */
.sidebar-open-mobile.header-menu-btn {
  display: none;
}

/* Hide sidebar close button on desktop */
.sidebar-close-mobile {
  display: none;
}

/* Utility Classes */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  background-color: var(--bg-card);
  transition: all 0.2s ease;
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-color-strong);
}

.stat-card h3 {
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 18px;
  font-family: var(--font-heading);
  font-weight: 500;
  color: var(--text-primary);
}

.stat-card p {
  margin: 8px 0;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.stat-card strong {
  color: var(--text-primary);
  font-weight: 600;
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  margin-top: 32px;
}

.content-section {
  background-color: var(--bg-card);
  border: 1px solid var(--surface-panel-border);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--surface-panel-shadow);
}

.content-section h2 {
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 20px;
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.content-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.content-section li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color-light);
}

.content-section li:last-child {
  border-bottom: none;
}

.content-section a {
  color: var(--text-link);
}

.quick-note-form {
  margin: 24px 0;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.quick-note-form input[type="text"] {
  flex: 1;
  max-width: 520px;
}

.section {
  margin-bottom: 32px;
}

.section h2 {
  font-size: 20px;
  font-family: var(--font-heading);
  font-weight: 700;
  text-transform: none;
  letter-spacing: -0.02em;
  margin-top: 24px;
  margin-bottom: 16px;
  color: var(--text-primary);
}

/* System States */
.system-state {
  font-family: var(--font-heading);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 12px;
}

/* Modal / Dialog Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--overlay-bg);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
  display: flex;
}

/* Stats modal: stronger blur, wider content */
.stats-modal-overlay {
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

body.stats-modal-open {
  overflow: hidden;
}

.stats-modal-overlay .stats-modal {
  max-width: min(1000px, 92vw);
  max-height: 90vh;
}

.stats-modal-body {
  padding: 24px;
  overflow-y: auto;
  max-height: calc(90vh - 80px);
}

.modal {
  background-color: var(--bg-card);
  border: 1px solid var(--surface-panel-border);
  border-radius: 12px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s ease;
  position: relative;
}

.modal-header {
  padding: 24px;
  border-bottom: 1px solid var(--border-color-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  margin: 0;
  font-size: 24px;
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.2s ease;
  font-family: var(--font-primary);
}

.modal-close:hover {
  background-color: var(--btn-secondary-hover);
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
}

.shortcuts-section {
  margin-bottom: 32px;
}

.shortcuts-section:last-child {
  margin-bottom: 0;
}

.shortcuts-section h3 {
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 18px;
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--text-primary);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color-light);
}

.shortcut-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color-light);
}

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

.shortcut-description {
  color: var(--text-primary);
  font-size: 14px;
  flex: 1;
}

.shortcut-keys {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-left: 16px;
}

.kbd {
  display: inline-block;
  padding: 4px 8px;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  min-width: 24px;
  text-align: center;
}

code,
pre,
samp,
kbd {
  font-family: var(--font-mono);
}

.kbd-plus {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0 2px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ==========================================================================
   Marketing page (root when logged out) — uses --marketing-* (theme-aware)
   ========================================================================== */
.marketing-page .app-container {
  background: var(--marketing-bg);
}

.marketing-page .app-header {
  background: var(--marketing-header-bg);
  border-bottom-color: var(--marketing-header-border);
}

.marketing-page .app-body {
  max-width: none;
}

.app-main--marketing {
  padding: 1.5rem clamp(1rem, 4vw, 2rem) 3rem;
  min-height: calc(100vh - 73px);
  background: transparent;
}

.marketing {
  width: 100%;
  box-sizing: border-box;
}

.marketing__screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 48px 24px;
  box-sizing: border-box;
}

.marketing__screen--hero {
  padding: 48px 24px;
}

.marketing__screen--hero .marketing__bg {
  position: absolute;
  inset: 0;
  background-color: var(--marketing-bg);
  background-image:
    linear-gradient(30deg, var(--marketing-grid-line) 1px, transparent 1px),
    linear-gradient(-30deg, var(--marketing-grid-line) 1px, transparent 1px);
  background-size: 40px 70px;
  pointer-events: none;
}

.marketing__screen--cta {
  background-color: var(--marketing-bg);
}

.marketing__bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.marketing__hero {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
  max-width: 1000px;
  width: 100%;
}

.marketing__copy {
  max-width: 420px;
}

.marketing__headline {
  margin: 0;
  font-family: var(--font-heading);
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--marketing-headline);
}

.marketing__headline-line {
  display: block;
}

.marketing__accent-line {
  display: block;
  width: 200px;
  height: auto;
  margin: 16px 0 20px;
  object-fit: contain;
}

.marketing__lead {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--marketing-lead);
}

.marketing__graphic {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
}

.marketing__graphic-inner {
  position: relative;
  width: 480px;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.marketing__graphic-item {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  bottom: 0;
}

.marketing__graphic-item--left {
  left: 0;
  z-index: 2;
  animation: marketing-graphic-combine-left 5s ease-in-out infinite;
}

.marketing__graphic-item--stairs {
  left: 50%;
  transform: translate(calc(-50% + 32px), 28px);
  z-index: 1;
  animation: marketing-graphic-combine-stairs 5s ease-in-out infinite;
}

.marketing__graphic-item--stairs .marketing__graphic-img {
  max-height: 120px;
}

.marketing__graphic-item--right {
  right: 0;
  z-index: 0;
  animation: marketing-graphic-combine-right 5s ease-in-out infinite;
}

.marketing__graphic-img {
  display: block;
  height: auto;
  max-height: 200px;
  width: auto;
  object-fit: contain;
}

@keyframes marketing-graphic-combine-left {
  0%, 100% { transform: translateX(0); }
  35%, 65% { transform: translateX(130px); }
}

@keyframes marketing-graphic-combine-stairs {
  0%, 100% { transform: translate(calc(-50% + 32px), 28px); }
  35%, 65% { transform: translate(calc(-50% + 32px), 28px) scale(1.08); }
}

@keyframes marketing-graphic-combine-right {
  0%, 100% { transform: translateX(0); }
  35%, 65% { transform: translateX(-130px); }
}

@media (prefers-reduced-motion: reduce) {
  .marketing__graphic-item--left,
  .marketing__graphic-item--stairs,
  .marketing__graphic-item--right {
    animation: none;
  }
}

.marketing__cta-wrap {
  position: relative;
  margin-bottom: 24px;
}

.marketing__cta {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: var(--marketing-cta-bg) center / cover no-repeat;
  color: #fff;
  text-decoration: none;
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-align: center;
  box-shadow: 0 8px 32px var(--marketing-cta-shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.marketing__cta:hover {
  transform: scale(1.04);
  box-shadow: 0 12px 40px var(--marketing-cta-shadow);
  color: #fff;
  text-decoration: none;
}

.marketing__cta-text {
  display: block;
}

.marketing__below {
  width: 100vw;
  margin-left: calc(-50vw + 50%);
  padding: 48px 24px;
  background-color: #f4efe6;
  box-sizing: border-box;
  text-align: left;
}

.marketing__below-inner {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 32px;
}

.marketing__below-headline {
  margin: 0 0 28px;
  font-family: var(--font-heading);
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.02em;
  color: #1a2744;
}

.marketing__tm {
  font-size: 0.55em;
  vertical-align: super;
  font-weight: 600;
}

.marketing__below-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.marketing__below-item {
  margin-bottom: 20px;
  font-size: 1.2rem;
  line-height: 1.55;
  color: #1a2744;
}

.marketing__below-item:last-child {
  margin-bottom: 0;
}

.marketing__below-label {
  color: #1a2744;
  font-weight: 600;
}


@media (max-width: 768px) {
  .marketing__hero {
    grid-template-columns: 1fr;
    gap: 32px;
    text-align: center;
  }

  .marketing__copy {
    max-width: none;
  }

  .marketing__accent-line {
    margin-left: auto;
    margin-right: auto;
  }

  .marketing__graphic {
    order: -1;
  }
}

/* Workflow step run — 3D status cube (six faces; front reserved for avatar/character) */
.workflow-step-run-card .cube-scene {
  perspective: 420px;
  width: 56px;
  height: 56px;
  flex-shrink: 0;
}
.workflow-step-run-card .cube {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.45s ease;
  transform: var(--cube-transform, rotateX(-12deg) rotateY(12deg));
}
.workflow-step-run-card .cube-face {
  position: absolute;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  border: 1px solid rgba(0, 0, 0, 0.15);
  backface-visibility: hidden;
  box-sizing: border-box;
}
.workflow-step-run-card .cube-face--front {
  transform: rotateY(0deg) translateZ(28px);
}
.workflow-step-run-card .cube-face--back {
  transform: rotateY(180deg) translateZ(28px);
}
.workflow-step-run-card .cube-face--right {
  transform: rotateY(90deg) translateZ(28px);
}
.workflow-step-run-card .cube-face--left {
  transform: rotateY(-90deg) translateZ(28px);
}
.workflow-step-run-card .cube-face--top {
  transform: rotateX(90deg) translateZ(28px);
}
.workflow-step-run-card .cube-face--bottom {
  transform: rotateX(-90deg) translateZ(28px);
}
.workflow-step-run-card .cube-face--front {
  background: linear-gradient(145deg, #6366f1 0%, #4f46e5 100%);
  color: #fff;
}
.workflow-step-run-card .cube-face--back {
  background: linear-gradient(145deg, #94a3b8 0%, #64748b 100%);
  color: #fff;
}
.workflow-step-run-card .cube-face--right {
  background: linear-gradient(145deg, #22c55e 0%, #16a34a 100%);
  color: #fff;
}
.workflow-step-run-card .cube-face--left {
  background: linear-gradient(145deg, #ef4444 0%, #dc2626 100%);
  color: #fff;
}
.workflow-step-run-card .cube-face--top {
  background: linear-gradient(145deg, #f59e0b 0%, #d97706 100%);
  color: #fff;
}
.workflow-step-run-card .cube-face--bottom {
  background: linear-gradient(145deg, #8b5cf6 0%, #7c3aed 100%);
  color: #fff;
}
.workflow-step-run-card[data-workflow-status="running"] .cube-face--front,
.workflow-step-run-card[data-workflow-status="queued"] .cube-face--front {
  animation: workflow-cube-pulse 1.2s ease-in-out infinite;
}
@keyframes workflow-cube-pulse {
  0%,
  100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.15);
  }
}
/* Compact step row: 36px cube */
.workflow-step-run-card .cube-scene--compact {
  width: 36px;
  height: 36px;
  perspective: 260px;
}
.workflow-step-run-card .cube-scene--compact .cube-face {
  width: 36px;
  height: 36px;
  font-size: 7px;
}
.workflow-step-run-card .cube-scene--compact .cube-face--front { transform: rotateY(0deg) translateZ(18px); }
.workflow-step-run-card .cube-scene--compact .cube-face--back { transform: rotateY(180deg) translateZ(18px); }
.workflow-step-run-card .cube-scene--compact .cube-face--right { transform: rotateY(90deg) translateZ(18px); }
.workflow-step-run-card .cube-scene--compact .cube-face--left { transform: rotateY(-90deg) translateZ(18px); }
.workflow-step-run-card .cube-scene--compact .cube-face--top { transform: rotateX(90deg) translateZ(18px); }
.workflow-step-run-card .cube-scene--compact .cube-face--bottom { transform: rotateX(-90deg) translateZ(18px); }
.workflow-step-run-card details summary::-webkit-details-marker { display: none; }
.workflow-step-run-card details summary::marker { content: none; }
.workflow-details-panel details summary::-webkit-details-marker { display: none; }
.workflow-details-panel details summary::marker { content: none; }
.compact-form details summary::-webkit-details-marker { display: none; }
.compact-form details summary::marker { content: none; }

/* Index table grids — dense analysis layout */
.workflow-index-grid {
  grid-template-columns: 1fr 1fr auto auto auto auto auto;
}
.agent-index-grid {
  grid-template-columns: auto auto 1fr auto auto 1fr auto auto;
}
.engine-index-grid {
  grid-template-columns: auto 1fr 1fr auto auto auto;
}

/* Compact forms (create/edit agent, engine, workflow) */
.compact-form .compact-input {
  max-width: 100%;
  padding: 0.375rem 0.5rem;
  font-size: 0.8125rem;
  line-height: 1.35;
  border: 1px solid var(--border-color);
  border-radius: 0.25rem;
  background: var(--bg-input);
  color: var(--text-primary);
}
.compact-form .compact-input:focus {
  outline: 2px solid var(--text-link);
  outline-offset: 0;
}
.compact-form textarea.compact-input {
  resize: vertical;
  min-height: 2.5rem;
}

/* Print Styles */
@media print {
  .app-header,
  .sidebar-wrap,
  .app-sidebar,
  .app-footer,
  .theme-toggle {
    display: none;
  }
  
  .app-main {
    padding: 0;
  }
}

/* FullCalendar theme overrides (fc-recommengine) */
.fc-recommengine .fc-theme-standard td,
.fc-recommengine .fc-theme-standard th,
.fc-recommengine .fc-theme-standard .fc-scrollgrid {
  border-color: var(--border-color);
}
.fc-recommengine .fc-col-header-cell {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.fc-recommengine .fc-daygrid-day {
  background: var(--bg-primary);
}
.fc-recommengine .fc-daygrid-day:hover {
  background: var(--bg-secondary);
}
.fc-recommengine .fc-daygrid-day-number,
.fc-recommengine .fc-timegrid-axis-cushion,
.fc-recommengine .fc-timegrid-slot-label-cushion {
  color: var(--text-muted);
  font-size: 0.75rem;
}
.fc-recommengine .fc-day-today {
  background: color-mix(in srgb, var(--bg-primary) 85%, #4f46e5 15%) !important;
}
.fc-recommengine .fc-event {
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
}
.fc-recommengine .fc-list-table {
  border-color: var(--border-color);
}
.fc-recommengine .fc-list-event:hover td {
  background: var(--bg-secondary);
}
.fc-recommengine .fc-list-day-cushion {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ========================================================================
   Toast Notifications
   ======================================================================== */
#flash-toasts {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
  max-width: 380px;
}

.toast {
  display: flex;
  align-items: center;
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 500;
  font-family: var(--font-primary);
  box-shadow: 0 4px 20px rgba(0,0,0,0.2), 0 1px 4px rgba(0,0,0,0.1);
  pointer-events: auto;
  opacity: 0;
  transform: translateY(10px) scale(0.96);
  transition: opacity 0.22s ease, transform 0.22s ease;
  cursor: pointer;
  user-select: none;
  line-height: 1.4;
}

.toast--visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.toast--dismissing {
  opacity: 0;
  transform: translateY(-4px) scale(0.97);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.toast--success {
  background: var(--signal-green);
  color: #fff;
}

.toast--accepted {
  background: var(--command-blue);
  color: #fff;
}

.toast--info {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 20px rgba(0,0,0,0.12), 0 1px 4px rgba(0,0,0,0.07), 0 0 0 1px rgba(0,0,0,0.04);
}

.toast--warning {
  background: var(--signal-amber);
  color: #1a1d24;
}

.toast--danger {
  background: var(--signal-red);
  color: #fff;
}

/* ========================================================================
   Button Loading State (form-submitting Stimulus controller)
   ======================================================================== */
.btn--loading {
  opacity: 0.72;
  pointer-events: none;
}

.btn--loading::after {
  content: "";
  display: inline-block;
  width: 11px;
  height: 11px;
  margin-left: 7px;
  border: 2px solid rgba(255,255,255,0.45);
  border-top-color: rgba(255,255,255,0.95);
  border-radius: 50%;
  animation: btn-spin 0.5s linear infinite;
  vertical-align: -1px;
}

.btn-secondary--loading {
  opacity: 0.65;
  pointer-events: none;
}

.btn-secondary--loading::after {
  content: "";
  display: inline-block;
  width: 11px;
  height: 11px;
  margin-left: 7px;
  border: 2px solid rgba(0,0,0,0.18);
  border-top-color: rgba(0,0,0,0.6);
  border-radius: 50%;
  animation: btn-spin 0.5s linear infinite;
  vertical-align: -1px;
}

@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

/* Favorite / star button */
.fav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 0.875rem;
  cursor: pointer;
  transition: color 0.15s ease, transform 0.15s ease;
  line-height: 1;
}
.fav-btn:hover {
  color: var(--signal-amber, #f59e0b);
  transform: scale(1.15);
}
.fav-btn--active {
  color: var(--signal-amber, #f59e0b);
}

/* Agent select — multi-select action bar */
.agent-select-bar {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%) translateY(calc(100% + 1.5rem));
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 9999px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  font-size: 0.75rem;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.18s ease;
  opacity: 0;
  z-index: 50;
  white-space: nowrap;
  pointer-events: none;
}
.agent-select-bar--visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.agent-select-bar__count {
  color: var(--text-secondary);
}
.agent-select-bar__count strong {
  color: var(--text-primary);
}

/* ── Home page: minimal compose-first layout ────────────────────────── */

.home-page {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 160px);
}

/* Status bar */
.home-status-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 0 16px;
  font-size: 12px;
  color: var(--text-muted);
}

.home-status-bar__link {
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: rgba(var(--command-blue-rgb), 0.4);
}
.home-status-bar__link:hover {
  color: var(--text-secondary);
}

.home-status-bar__shortcut {
  background: none;
  border: none;
  padding: 0;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  letter-spacing: 0.01em;
}
.home-status-bar__shortcut:hover {
  color: var(--text-secondary);
}

.home-status-bar__clear {
  color: var(--text-muted);
  font-size: 12px;
}

/* Keyboard shortcut badge */
.home-kbd {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  font-family: var(--font-mono, monospace);
  font-size: 10px;
  font-style: normal;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Compose wrapper: vertically centered in remaining space */
.home-compose-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 0 48px;
}

.home-compose {
  width: 100%;
  max-width: 640px;
  text-align: center;
}

.home-compose__prompt {
  margin: 0 0 20px;
  font-family: var(--font-heading);
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-primary);
}

.home-compose__form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}

.home-compose__textarea {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--bg-input, var(--bg-secondary));
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.55;
  resize: vertical;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.home-compose__textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(var(--command-blue-rgb), 0.14);
}
.home-compose__textarea::placeholder {
  color: var(--text-muted);
}

.home-compose__footer {
  display: flex;
  align-items: center;
  gap: 12px;
}

.home-compose__context {
  font-size: 12px;
  color: var(--text-muted);
}
.home-compose__context--link {
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.home-compose__context--link:hover {
  color: var(--text-secondary);
}

/* Decision mode: full-screen overlay */
.home-decision-mode {
  position: fixed;
  inset: 0;
  z-index: 220;
  background:
    radial-gradient(circle at 18% 10%, rgba(var(--command-blue-rgb), 0.18), transparent 42%),
    rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
}
.home-decision-mode:focus {
  outline: none;
}

.home-decision-mode__inner {
  width: 100%;
  max-width: 760px;
  margin-top: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.home-decision-mode__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-color);
}

.home-decision-mode__eyebrow {
  margin: 0 0 4px;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.home-decision-mode__title {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 1.35rem;
  line-height: 1.2;
  color: var(--text-primary);
}

.home-decision-mode__controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding-top: 4px;
}

.home-decision-mode__body {
  padding: 20px 24px 24px;
}

.home-decision-mode__empty {
  text-align: center;
  padding: 32px 0;
  color: var(--text-secondary);
}
.home-decision-mode__empty p {
  margin: 0 0 16px;
}

/* Decision mode: one-at-a-time nav strip */
.home-decision-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 10px 0 14px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 16px;
}

.home-decision-nav__btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: 1px solid var(--border-color);
  border-radius: 7px;
  padding: 5px 10px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.12s ease, border-color 0.12s ease;
}
.home-decision-nav__btn:hover {
  color: var(--text-primary);
  border-color: var(--accent-primary);
}

.home-decision-nav__counter {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  min-width: 44px;
  text-align: center;
}

/* Wrapper for each proposal — only one visible at a time */
.home-decision-item {
  /* display block by default; hidden attr hides it */
}

.home-decision-undo-hint {
  margin: 0 0 12px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 6px;
  background: rgba(var(--command-blue-rgb), 0.08);
  border: 1px solid rgba(var(--command-blue-rgb), 0.18);
}

.home-decision-overflow {
  margin: 16px 0 0;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}
.home-decision-overflow__link {
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.home-decision-overflow__link:hover {
  color: var(--text-secondary);
}

@media (max-width: 640px) {
  .home-decision-mode {
    padding: 12px;
  }
  .home-decision-mode__inner {
    margin-top: 8px;
    border-radius: 12px;
  }
  .home-decision-mode__header {
    flex-direction: column;
    gap: 12px;
  }
  .home-decision-mode__controls {
    padding-top: 0;
  }
}

/* ── Auth pages (sign in / register) ───────────────────────────────────── */
.auth-page {
  min-height: calc(100vh - 200px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
}

.auth-page__inner {
  width: 100%;
  max-width: 440px;
  text-align: center;
}

.auth-page__wordmark {
  display: inline-block;
  font-family: var(--font-brand-display);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 3px;
  color: var(--text-primary);
  text-decoration: none;
  margin-bottom: 8px;
}

.auth-page__wordmark:hover {
  color: var(--text-primary);
}

.auth-page__wordmark-accent {
  color: var(--brand-magenta);
}

.auth-page__tagline {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 28px;
  line-height: 1.5;
}

/* Card */
.re-auth-card {
  width: 100%;
  padding: 32px 28px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-sizing: border-box;
  text-align: left;
}

.re-auth-card__title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  margin: 0 0 6px;
}

.re-auth-card__lead {
  font-size: 12px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 20px;
}

/* Fields */
.re-auth-field {
  display: block;
  width: 100%;
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--bg-input, var(--bg-primary));
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 15px;
  line-height: 1.4;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.re-auth-field::placeholder {
  color: var(--text-muted);
}

.re-auth-field:focus {
  outline: none;
  border-color: var(--accent-primary, #327ad1);
  box-shadow: 0 0 0 3px rgba(var(--command-blue-rgb), 0.14);
}

.re-auth-card .btn--block {
  margin-top: 6px;
}

/* Footer link */
.re-auth-footer {
  margin-top: 20px;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
}

.re-auth-footer-link {
  color: var(--brand-magenta);
  font-weight: 600;
  text-decoration: none;
}

.re-auth-footer-link:hover {
  text-decoration: underline;
}

/* Divider + SSO */
.re-auth-divider {
  margin: 24px 0;
  border: none;
  border-top: 1px solid var(--border-color);
}

.re-auth-sso-label {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 12px;
}

.re-auth-sso-form {
  display: block;
  width: 100%;
  margin-bottom: 10px;
}

.re-auth-sso-btn {
  width: 100%;
  padding: 10px 20px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-secondary);
  font-family: var(--font-primary);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.02em;
  line-height: 1.25;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.re-auth-sso-btn:hover {
  background: var(--bg-tertiary, var(--bg-primary));
  color: var(--text-primary);
}

/* Alerts inside card */
.re-auth-card .alert,
.re-auth-card .notice {
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}

/* ── Building-block icons (agent form + Rico chips) ── */
.agent-tool-icon,
.block-chip__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  flex-shrink: 0;
}
.agent-tool-icon { width: 18px; height: 18px; }
.agent-tool-icon svg { width: 13px; height: 13px; }
.block-chip__icon { width: 22px; height: 22px; }
.block-chip__icon svg { width: 15px; height: 15px; }
.agent-tool-icon--a, .block-chip__icon--a { background: linear-gradient(135deg, #2563eb, #60a5fa); }
.agent-tool-icon--b, .block-chip__icon--b { background: linear-gradient(135deg, #8b1a6e, #ec4899); }
.agent-tool-icon--c, .block-chip__icon--c { background: linear-gradient(135deg, #ec4899, #f59e0b); }
.agent-tool-icon--d, .block-chip__icon--d { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.agent-tool-icon--e, .block-chip__icon--e { background: linear-gradient(135deg, #2563eb, #8b1a6e); }
.agent-tool-icon--f, .block-chip__icon--f { background: linear-gradient(135deg, #60a5fa, #ec4899); }
.agent-tool-icon--g, .block-chip__icon--g { background: linear-gradient(135deg, #8b1a6e, #f59e0b); }
.agent-tool-icon--h, .block-chip__icon--h { background: linear-gradient(135deg, #fbbf24, #f59e0b); }

/* ── Rico snap-in block chips ── */
.block-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s;
}
.block-chip:hover { border-color: var(--accent, #2563eb); transform: translateY(-1px); }

/* ── Engine momentum panel/strip ── */
.momentum-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}
.momentum-badge--earned {
  border-color: transparent;
  background: linear-gradient(135deg, #2563eb, #8b1a6e);
  color: #fff;
}
.momentum-stat__value { font-size: 22px; font-weight: 700; line-height: 1; }
.momentum-stat__label { font-size: 11px; color: var(--text-secondary); }

/* ── Agent capability canvas ── */
.agent-canvas {
  position: relative;
  width: 100%;
  min-height: 380px;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  background:
    radial-gradient(circle, rgba(127,127,127,.10) 1px, transparent 1px) 0 0 / 22px 22px,
    var(--bg-input);
  overflow: hidden;
  touch-action: none;
}
.agent-canvas__edges {
  position: absolute;
  inset: 0;
  pointer-events: none;
  color: var(--text-secondary);
}
.agent-canvas__node--agent {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 14px 18px;
  border-radius: 14px;
  background: linear-gradient(135deg, #2563eb, #8b1a6e);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  box-shadow: 0 6px 20px rgba(0,0,0,.25);
  max-width: 160px;
  text-align: center;
  z-index: 1;
}
.agent-canvas__tile {
  position: absolute;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 96px;
  padding: 10px 8px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary, var(--bg-primary));
  cursor: grab;
  user-select: none;
  transition: border-color .15s, box-shadow .15s, opacity .15s, transform .05s;
}
.agent-canvas__tile:active { cursor: grabbing; }
.agent-canvas__tile.is-enabled {
  border-color: var(--accent, #2563eb);
  box-shadow: 0 0 0 1px var(--accent, #2563eb), 0 4px 14px rgba(37,99,235,.18);
}
.agent-canvas__tile:not(.is-enabled):not(.is-locked) { opacity: .72; }
.agent-canvas__tile.is-locked { cursor: not-allowed; opacity: .5; }
.agent-canvas__tile-name { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.agent-canvas__tile-soon {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .06em;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(127,127,127,.18);
  color: var(--text-secondary);
}

/* ── Workflow visual canvas (Phase 2) ── */
.wf-palette {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.wf-palette__label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.wf-palette__sep { width: 1px; height: 18px; background: var(--border-color); margin: 0 4px; }
.block-chip--xs { padding: 3px 9px 3px 5px; font-size: 12px; }
.block-chip--xs .block-chip__icon { width: 18px; height: 18px; }
.block-chip--xs .block-chip__icon svg { width: 12px; height: 12px; }

.wf-canvas {
  position: relative;
  width: 100%;
  min-height: 360px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background:
    radial-gradient(circle, rgba(127,127,127,.10) 1px, transparent 1px) 0 0 / 22px 22px,
    var(--bg-input);
  overflow: hidden;
  touch-action: none;
}
.wf-canvas__edges { position: absolute; inset: 0; pointer-events: none; color: var(--text-secondary); }
.wf-canvas__edges line[data-action] { pointer-events: stroke; }
.wf-canvas__hint {
  position: absolute;
  left: 12px;
  bottom: 8px;
  margin: 0;
  font-size: 11px;
  color: var(--text-muted);
  pointer-events: none;
  max-width: 90%;
}
.wf-kbd {
  display: inline-block;
  padding: 0 5px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary, var(--bg-primary));
  font-family: monospace;
  font-size: 10px;
}
.wf-node {
  position: absolute;
  z-index: 2;
  width: 168px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary, var(--bg-primary));
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
  cursor: grab;
  user-select: none;
}
.wf-node:active { cursor: grabbing; }
.wf-node.is-linking { border-color: var(--accent, #2563eb); box-shadow: 0 0 0 2px var(--accent, #2563eb); }
.wf-node__head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.wf-node__type {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(127,127,127,.16);
  color: var(--text-secondary);
}
.wf-node__type--llm { background: linear-gradient(135deg, #2563eb, #60a5fa); color: #fff; }
.wf-node__type--agent { background: linear-gradient(135deg, #8b1a6e, #ec4899); color: #fff; }
.wf-node__type--input_wait { background: linear-gradient(135deg, #b45309, #f59e0b); color: #fff; }
.wf-node__name { font-size: 13px; font-weight: 600; margin-top: 4px; color: var(--text-primary); }
.wf-node__tools { display: block; margin-top: 3px; font-size: 10px; color: var(--text-secondary); }
.wf-node__del, .wf-node__link, .wf-node__cfg {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
}
.wf-node__actions { display: flex; align-items: center; gap: 2px; }
.wf-node__link { position: absolute; right: 8px; bottom: 6px; font-weight: 700; color: var(--accent, #2563eb); }
.wf-node__del:hover { color: var(--signal-red, #dc2626); }
.wf-node__cfg:hover { color: var(--text-primary); }

/* Tool step config panel */
.wf-config-panel {
  position: absolute;
  z-index: 200;
  width: 260px;
  background: var(--bg-primary, #fff);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.wf-config-panel__title { font-size: 12px; font-weight: 700; color: var(--text-primary); margin-bottom: 2px; }
.wf-config-panel__label { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--text-secondary); font-weight: 600; }
.wf-config-panel__select,
.wf-config-panel__input,
.wf-config-panel__textarea {
  font-size: 12px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 4px 6px;
  background: var(--bg-secondary, #f8f8f8);
  color: var(--text-primary);
  width: 100%;
  box-sizing: border-box;
}
.wf-config-panel__textarea { font-family: monospace; resize: vertical; }
.wf-config-panel__actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 2px; }
.wf-config-panel__btn {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  cursor: pointer;
  background: var(--bg-secondary);
  color: var(--text-primary);
}
.wf-config-panel__btn--save {
  background: var(--accent, #2563eb);
  border-color: var(--accent, #2563eb);
  color: #fff;
}
