/* ==========================================================================
   BUGLE CONSTRUCTION BUSINESS OS STANDARD - SYSTEM STYLESHEET
   Identity: Warm Architectural Ivory, Deep Charcoal, Forest Green & Bronze
   ========================================================================== */

:root {
  /* Color Tokens */
  --bg-canvas: #FBF9F5;
  --bg-surface: #FFFFFF;
  --bg-subtle: #F4F0EA;
  --bg-card: #FAF8F4;
  --bg-hover: #F0EAE1;
  --bg-active: #E8E0D5;
  
  --sidebar-bg: #1F2421;
  --sidebar-text: #E5E7E5;
  --sidebar-text-muted: #8E9690;
  --sidebar-hover: #2B322D;
  --sidebar-active: #38423B;
  --sidebar-border: #2E3631;

  --text-primary: #1C221F;
  --text-secondary: #525B55;
  --text-tertiary: #88928A;
  --text-inverse: #FFFFFF;

  --brand-forest: #2D4A3E;
  --brand-forest-hover: #233B31;
  --brand-forest-light: #EAF1ED;
  --brand-forest-border: #9BB8A9;

  --brand-bronze: #A67C52;
  --brand-bronze-hover: #8D6741;
  --brand-bronze-light: #FAF2EA;
  --brand-bronze-border: #D8BF9A;

  --status-success: #2E7D32;
  --status-success-bg: #EDF7ED;
  --status-warning: #D97706;
  --status-warning-bg: #FFFBEB;
  --status-danger: #C53030;
  --status-danger-bg: #FFF5F5;
  --status-info: #0284C7;
  --status-info-bg: #F0F9FF;

  --border-color: #E2DDD5;
  --border-dark: #C8C2B8;
  --border-focus: #2D4A3E;

  /* Fonts */
  --font-serif: 'Newsreader', Georgia, Cambria, "Times New Roman", Times, serif;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Elevation & Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.10);
  --shadow-drawer: -8px 0 24px rgba(0, 0, 0, 0.12);

  /* Dimensions */
  --sidebar-width: 260px;
  --header-height: 64px;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

/* Reset & Base Setup */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  width: 100%;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background-color: var(--bg-canvas);
  -webkit-font-smoothing: antialiased;
}

/* App Shell Layout */
#app-root {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* Sidebar Navigation */
.app-sidebar {
  width: var(--sidebar-width);
  background-color: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--sidebar-border);
  flex-shrink: 0;
  z-index: 20;
}

.sidebar-header {
  height: var(--header-height);
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--sidebar-border);
}

.bugle-logo-mark {
  height: 34px;
  width: auto;
  object-fit: contain;
}

.brand-title-group {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: #FFFFFF;
}

.brand-sub {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--brand-bronze);
  font-weight: 600;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--sidebar-text-muted);
  margin: 16px 8px 8px 8px;
}

.nav-section-label:first-child {
  margin-top: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  color: var(--sidebar-text);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast);
  margin-bottom: 2px;
  user-select: none;
}

.nav-item:hover {
  background-color: var(--sidebar-hover);
  color: #FFFFFF;
}

.nav-item.active {
  background-color: var(--brand-forest);
  color: #FFFFFF;
  font-weight: 600;
}

.nav-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.85;
  filter: grayscale(1);
  font-size: 14px;
}

.nav-item.active .nav-icon {
  opacity: 1;
}

.nav-badge {
  margin-left: auto;
  background-color: var(--brand-bronze);
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--sidebar-border);
  background-color: rgba(0, 0, 0, 0.15);
}

.user-profile-widget {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background-color: var(--brand-bronze);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  border: 1px solid var(--brand-bronze-border);
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: #FFFFFF;
}

.user-role {
  font-size: 11px;
  color: var(--sidebar-text-muted);
}

/* Main View Container */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: var(--bg-canvas);
}

/* Top App Header */
.app-header {
  height: var(--header-height);
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  z-index: 10;
}

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

.mobile-nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-primary);
  cursor: pointer;
  padding: 4px;
}

.page-heading-group {
  display: flex;
  flex-direction: column;
}

.page-title {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.page-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.demo-data-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: var(--brand-bronze-light);
  border: 1px solid var(--brand-bronze-border);
  color: var(--brand-bronze);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  cursor: help;
  position: relative;
}

.demo-data-badge::after {
  content: 'ⓘ Demo Data (Synthetic) • Staged Locally';
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  background-color: var(--sidebar-bg);
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 400;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-fast);
  pointer-events: none;
  z-index: 50;
  box-shadow: var(--shadow-md);
}

.demo-data-badge:hover::after {
  opacity: 1;
  visibility: visible;
}

/* Button System */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  font-family: var(--font-sans);
}

.btn-primary {
  background-color: var(--brand-forest);
  color: #FFFFFF;
  border-color: var(--brand-forest);
}

.btn-primary:hover {
  background-color: var(--brand-forest-hover);
  border-color: var(--brand-forest-hover);
}

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

.btn-secondary:hover {
  background-color: var(--bg-subtle);
  border-color: var(--border-dark);
}

.btn-accent {
  background-color: var(--brand-bronze);
  color: #FFFFFF;
  border-color: var(--brand-bronze);
}

.btn-accent:hover {
  background-color: var(--brand-bronze-hover);
  border-color: var(--brand-bronze-hover);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

.btn-icon {
  padding: 6px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

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

/* Main Workspace Canvas */
.workspace-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Workspace Tab Panels */
.tab-panel {
  display: none;
  flex-direction: column;
  gap: 24px;
  animation: fadeIn var(--transition-fast);
}

.tab-panel.active {
  display: flex;
}

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

/* Card System */
.card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.card-title {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
}

.activity-title { white-space: nowrap; font-size: 16px; }

.card-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: normal;
}

/* Grid Layouts */
.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

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

.grid-2-1 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}

/* KPI Summary Cards */
.kpi-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background-color: var(--brand-forest);
}

.kpi-card.accent-bronze::before {
  background-color: var(--brand-bronze);
}

.kpi-card.accent-warning::before {
  background-color: var(--status-warning);
}

.kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.kpi-value {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.kpi-sub {
  font-size: 12px;
  color: var(--text-tertiary);
}

/* Exception & Risk Cards */
.exception-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--status-warning);
  border-radius: var(--radius-md);
}

.exception-item.high {
  border-left-color: var(--status-danger);
  background-color: #FFF8F8;
}

.exception-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.exception-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-warning { background-color: var(--status-warning-bg); color: var(--status-warning); border: 1px solid rgba(217,119,6,0.3); }
.badge-danger { background-color: var(--status-danger-bg); color: var(--status-danger); border: 1px solid rgba(197,48,48,0.3); }
.badge-success { background-color: var(--status-success-bg); color: var(--status-success); border: 1px solid rgba(46,125,50,0.3); }
.badge-info { background-color: var(--status-info-bg); color: var(--status-info); border: 1px solid rgba(2,132,199,0.3); }

/* Table Styling */
.table-container {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-surface);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.data-table th {
  background-color: var(--bg-subtle);
  padding: 12px 16px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover {
  background-color: var(--bg-card);
}

/* Kanban / Pipeline View */
.kanban-board {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 16px;
  align-items: flex-start;
}

.kanban-column {
  flex: 0 0 280px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 200px);
}

.kanban-header {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-surface);
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
}

.kanban-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.kanban-stage-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.kanban-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
}

.kanban-count {
  font-size: 11px;
  background-color: var(--bg-subtle);
  color: var(--text-secondary);
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 600;
}

.lightning-auto-btn {
  background: none;
  border: 1px solid var(--brand-bronze-border);
  color: var(--brand-bronze);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all var(--transition-fast);
}

.lightning-auto-btn:hover {
  background-color: var(--brand-bronze-light);
}

.kanban-cards {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  flex: 1;
}

.lead-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.lead-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-dark);
}

.lead-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary);
}

.lead-client {
  font-size: 12px;
  color: var(--text-secondary);
}

.lead-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--bg-subtle);
}

.lead-value {
  font-family: var(--font-serif);
  font-weight: 700;
  color: var(--brand-forest);
}

/* Modal & Drawer System */
.modal-overlay, .drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(15, 20, 17, 0.5);
  backdrop-filter: blur(2px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.modal-overlay.active, .drawer-overlay.active {
  display: flex;
  opacity: 1;
}

.modal-dialog {
  background-color: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

.modal-title, .drawer-title {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-body, .drawer-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.modal-footer, .drawer-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  background-color: var(--bg-card);
}

/* Contextual Slide-Over Drawer */
.drawer-dialog {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 480px;
  max-width: 90vw;
  background-color: var(--bg-surface);
  box-shadow: var(--shadow-drawer);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--transition-normal);
}

.drawer-overlay.active .drawer-dialog {
  transform: translateX(0);
}

/* Signature Scope-to-Estimate Wizard Styling */
.wizard-steps {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}

.wizard-step {
  flex: 1;
  padding: 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  border-bottom: 2px solid transparent;
  cursor: pointer;
}

.wizard-step.active {
  color: var(--brand-forest);
  border-bottom-color: var(--brand-forest);
}

.wizard-step.completed {
  color: var(--status-success);
}

.source-notes-box {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  font-size: 13px;
  line-height: 1.6;
}

.estimate-group-row {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  overflow: hidden;
}

.estimate-group-header {
  background-color: var(--bg-subtle);
  padding: 10px 16px;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background-color: var(--sidebar-bg);
  color: #FFFFFF;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-left: 4px solid var(--brand-forest);
  animation: slideInRight var(--transition-fast);
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Client Portal Mode Overlay Header */
.client-portal-wrapper {
  background-color: #F7F5F0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.client-portal-banner {
  background-color: var(--brand-forest);
  color: #FFFFFF;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Responsive Mobile Rules */
@media (max-width: 900px) {
  html, body, #app-root { min-height: 100%; height: auto; }
  #app-root { overflow: visible; }
  .app-main { min-width: 0; min-height: 100vh; overflow: visible; }

  .app-sidebar {
    position: fixed;
    left: -260px;
    top: 0;
    bottom: 0;
    transition: left var(--transition-normal);
  }

  .app-sidebar.open { left: 0; }

  .mobile-nav-toggle {
    display: block;
    min-width: 44px;
    min-height: 44px;
    padding: 8px;
  }

  .app-header {
    height: 64px;
    padding: 0 12px;
    position: sticky;
    top: 0;
  }

  .header-left { min-width: 0; gap: 4px; }
  .page-heading-group { min-width: 0; }
  .page-title { font-size: 18px; white-space: nowrap; }
  .page-subtitle { display: none; }
  .header-actions { margin-left: auto; gap: 6px; }
  .demo-data-badge { padding: 4px 7px; white-space: nowrap; }

  #btn-toggle-client-portal,
  #btn-quick-scope-assistant {
    font-size: 0;
    padding: 0;
    min-width: 44px;
    min-height: 44px;
  }
  #btn-toggle-client-portal::before { content: '👁'; font-size: 17px; }
  #btn-quick-scope-assistant::before { content: '✨'; font-size: 17px; }

  .workspace-content { padding: 16px 12px 44px; gap: 16px; }
  .tab-panel { gap: 16px; }
  .card { padding: 16px; }
  .card-header { align-items: flex-start; flex-direction: column; }
  .kpi-card { min-height: 112px; }
  .kpi-label { font-size: 12px; color: var(--text-primary); }
  .kpi-sub, .card-subtitle { color: #59635c; }

  #panel-brief .grid-2-1 > .card:first-child > div:nth-child(2) {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  #panel-brief .grid-2-1 > .card:first-child .card-subtitle {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }
  #panel-brief .grid-2-1 > .card:first-child > div:nth-child(2) > div {
    min-width: 0;
    width: 100%;
    overflow-wrap: anywhere;
    line-height: 1.55;
  }
  #panel-brief .grid-2-1 > .card:first-child > div:nth-child(2) > img {
    width: 100% !important;
    height: 190px !important;
  }
  #panel-brief .grid-2-1 > .card:first-child .btn {
    width: 100%;
    min-height: 44px;
    white-space: normal;
  }
  #panel-brief .grid-2-1 > .card:first-child div[style*="display: flex; gap: 10px"] {
    flex-direction: column;
  }

  .grid-4, .grid-3, .grid-2, .grid-2-1 { grid-template-columns: 1fr; }
  .kanban-board { flex-direction: column; overflow-x: visible; }
  .kanban-column { width: 100%; max-height: none; }
  .table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table { min-width: 760px; }
  .modal-dialog { width: calc(100% - 16px); max-height: calc(100vh - 16px); }
  .modal-header, .modal-body, .modal-footer { padding-left: 16px; padding-right: 16px; }
  .wizard-steps { overflow-x: auto; }
  .wizard-step { min-width: 130px; }
}

@media (max-width: 430px) {
  .demo-data-badge { font-size: 0; min-width: 36px; min-height: 36px; justify-content: center; }
  .demo-data-badge::before { content: 'DEMO'; font-size: 9px; letter-spacing: .08em; }
  .header-actions { gap: 4px; }
}
