:root {
  /* Core Colors - Structured Mono palette (light) */
  --bg-app: #fafafa;
  --bg-surface: #ffffff;
  --bg-subtle: #f4f4f5;

  --primary: #7248e0;
  --primary-hover: #633fc3;
  --primary-subtle: #f2eeff;
  /* Solid, white-text-safe variant of --primary. Use ONLY as a background under
     white/near-white text (e.g. .btn-primary, .settings-subnav-tab.active).
     --primary itself must stay light enough to work as TEXT on dark surfaces
     (--primary-subtle, --bg-surface) in dark mode; see ui-ux-fix-todo.md #26. */
  --primary-strong: #7248e0;

  --ink-base: #18181b;
  --ink-soft: #52525b;
  --ink-muted: #71717a;

  --border-base: #e4e4e7;
  --border-subtle: #f4f4f5;

  --success: #0e9f6e;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #0284c7;

  /* Spacing & Radius */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-full: 9999px;

  /* Shadows - reserved for floating elements only (modals, dropdowns) */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.04);
  --shadow-md: 0 8px 20px -6px rgb(0 0 0 / 0.14), 0 2px 6px -2px rgb(0 0 0 / 0.08);
  --shadow-lg: 0 20px 44px -12px rgb(0 0 0 / 0.18), 0 4px 12px -2px rgb(0 0 0 / 0.1);

  /* Sidebar configuration */
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 80px;
  --topbar-height: 64px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-app: #0a0a0b;
    --bg-surface: #131316;
    --bg-subtle: #1c1c20;

    --primary: #9575ff;
    --primary-hover: #a78bfa;
    --primary-subtle: #201a3a;
    --primary-strong: #7d4bdb;

    --ink-base: #fafafa;
    --ink-soft: #a1a1aa;
    --ink-muted: #83838c;

    --border-base: #27272a;
    --border-subtle: #1c1c20;

    --success: #34d399;
    --warning: #fbbf24;
    --danger: #f87171;
    --info: #38bdf8;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-md: 0 8px 20px -6px rgb(0 0 0 / 0.55), 0 2px 6px -2px rgb(0 0 0 / 0.4);
    --shadow-lg: 0 20px 44px -12px rgb(0 0 0 / 0.65), 0 4px 12px -2px rgb(0 0 0 / 0.45);

    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg-app: #0a0a0b;
  --bg-surface: #131316;
  --bg-subtle: #1c1c20;

  --primary: #9575ff;
  --primary-hover: #a78bfa;
  --primary-subtle: #201a3a;
  --primary-strong: #7d4bdb;

  --ink-base: #fafafa;
  --ink-soft: #a1a1aa;
  --ink-muted: #83838c;

  --border-base: #27272a;
  --border-subtle: #1c1c20;

  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;
  --info: #38bdf8;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
  --shadow-md: 0 8px 20px -6px rgb(0 0 0 / 0.55), 0 2px 6px -2px rgb(0 0 0 / 0.4);
  --shadow-lg: 0 20px 44px -12px rgb(0 0 0 / 0.65), 0 4px 12px -2px rgb(0 0 0 / 0.45);

  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg-app: #fafafa;
  --bg-surface: #ffffff;
  --bg-subtle: #f4f4f5;

  --primary: #7248e0;
  --primary-hover: #633fc3;
  --primary-subtle: #f2eeff;
  --primary-strong: #7248e0;

  --ink-base: #18181b;
  --ink-soft: #52525b;
  --ink-muted: #71717a;

  --border-base: #e4e4e7;
  --border-subtle: #f4f4f5;

  --success: #0e9f6e;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #0284c7;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.04);
  --shadow-md: 0 8px 20px -6px rgb(0 0 0 / 0.14), 0 2px 6px -2px rgb(0 0 0 / 0.08);
  --shadow-lg: 0 20px 44px -12px rgb(0 0 0 / 0.18), 0 4px 12px -2px rgb(0 0 0 / 0.1);

  color-scheme: light;
}

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

body {
  margin: 0;
  padding: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-app);
  color: var(--ink-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
}

/* Layout Shell */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.app-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-base);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
  min-height: var(--topbar-height);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 8px;
  padding: var(--space-sm) var(--space-lg);
  border-bottom: 1px solid var(--border-subtle);
}

.brand-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.brand-logo img {
  height: 28px;
  width: auto;
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.nav-section {
  margin-bottom: var(--space-sm);
}

.nav-item-parent {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--ink-soft);
  font-weight: 500;
  transition: all 0.15s ease;
}

.nav-item-parent:hover {
  background: var(--bg-subtle);
  color: var(--ink-base);
}

.nav-item-parent.active {
  background: var(--primary-subtle);
  color: var(--primary);
}

.nav-submenu {
  padding-left: calc(var(--space-md) + 20px + var(--space-sm));
  margin-top: var(--space-xs);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.nav-subitem {
  display: block;
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--ink-muted);
  font-size: 0.875rem;
  transition: all 0.15s ease;
}

.nav-subitem:hover {
  background: var(--bg-subtle);
  color: var(--ink-soft);
}

.nav-subitem.active {
  background: var(--primary-subtle);
  color: var(--primary);
  font-weight: 500;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: var(--space-xl);
  border-top: 1px solid var(--border-base);
}

.theme-toggle {
  display: flex;
  border: 1px solid var(--border-base);
  border-radius: var(--radius-md);
  padding: 3px;
  background: var(--bg-subtle);
  margin-bottom: var(--space-sm);
}
.theme-toggle button {
  flex: 1;
  padding: 6px 8px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-muted);
  cursor: pointer;
}
.theme-toggle button.is-on {
  background: var(--bg-surface);
  color: var(--ink-base);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9375rem;
  transition: all 0.2s ease;
}

.nav-item:hover {
  background: var(--bg-subtle);
  color: var(--ink-base);
}

.nav-item.active {
  background: var(--primary-subtle);
  color: var(--primary);
}

.nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Main Content Area */
.app-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-topbar {
  height: var(--topbar-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-base);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-xl);
  position: sticky;
  top: 0;
  z-index: 90;
}

.topbar-heading {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--ink-base);
  font-size: 1.5rem;
  line-height: 2rem;
}

.mobile-menu-toggle {
  display: none;
  min-width: 42px;
  padding-inline: 0;
}

.mobile-sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 95;
}

body.mobile-sidebar-open .mobile-sidebar-backdrop {
  opacity: 1;
  pointer-events: auto;
}

.page-content {
  padding: var(--space-xl);
  max-width: none;
  margin: 0;
  width: 100%;
  min-width: 0;
}

.page-content > * {
  min-width: 0;
}

.page-content.offers-page {
  padding: var(--space-lg);
}

/* Typography */
h1, h2, h3, h4 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--ink-base);
}

h1 { font-size: 1.875rem; line-height: 2.25rem; }
h2 { font-size: 1.5rem; line-height: 2rem; }
h3 { font-size: 1.25rem; line-height: 1.75rem; }

.text-muted { color: var(--ink-muted); font-size: 0.875rem; }
.text-right { text-align: right; }
.tag-nums { font-variant-numeric: tabular-nums; }
.mono {
  font-family: ui-monospace, "SF Mono", "Cascadia Code", "Consolas", monospace;
  font-size: 0.8125rem;
  letter-spacing: -0.01em;
  color: var(--ink-soft);
}
.text-success { color: #16a34a; }
.text-danger { color: #dc2626; }

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

/* Table styling */
.tabular {
  font-variant-numeric: tabular-nums;
}
.tabular tbody tr.total td {
  font-weight: 600;
  background: var(--bg-subtle);
}

/* Components: Cards */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
}

/* Card header */
.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.card-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

/* Components: Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, filter 0.15s ease;
  border: 1px solid transparent;
  gap: var(--space-sm);
  text-decoration: none;
}
.btn-primary { background: var(--primary-strong); color: #ffffff; }
.btn-primary:hover { filter: brightness(1.06); }
.btn-secondary { background: var(--bg-surface); border-color: var(--border-base); color: var(--ink-soft); }
.btn-secondary:hover { background: var(--bg-subtle); border-color: var(--ink-muted); }

/* Components: Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge-success { background: color-mix(in srgb, var(--success) 14%, var(--bg-surface)); color: color-mix(in srgb, var(--success) 60%, var(--ink-base)); }
.badge-warning { background: color-mix(in srgb, var(--warning) 16%, var(--bg-surface)); color: color-mix(in srgb, var(--warning) 55%, var(--ink-base)); }
.badge-warm { background: color-mix(in srgb, var(--warning) 16%, var(--bg-surface)); color: color-mix(in srgb, var(--warning) 55%, var(--ink-base)); }
.badge-danger { background: color-mix(in srgb, var(--danger) 14%, var(--bg-surface)); color: color-mix(in srgb, var(--danger) 82%, var(--ink-base)); }
.badge-info { background: color-mix(in srgb, var(--info) 16%, var(--bg-surface)); color: color-mix(in srgb, var(--info) 65%, var(--ink-base)); }
.badge-muted { background: var(--bg-subtle); color: var(--ink-soft); }

/* KPI Tiles */
.kpi {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid var(--border-base);
  border-radius: 10px;
  background: var(--bg-surface);
}
.kpi-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  font-weight: 600;
}
.kpi-val {
  font-family: ui-monospace, "SF Mono", "Cascadia Code", "Consolas", monospace;
  font-size: 18px;
  font-weight: 600;
}

/* Aging Buckets */
.aging-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.agingrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-subtle, var(--border-base));
  font-size: 13px;
}
.agingrow:last-child {
  border-bottom: none;
}
.agingrow .lbl {
  color: var(--ink-muted);
  font-weight: 500;
}
.agingrow .amt {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* Mobile Adaptations */
@media (max-width: 1024px) {
  .mobile-menu-toggle {
    display: inline-flex;
    margin-right: var(--space-sm);
  }

  .app-sidebar {
    transform: translateX(-100%);
    width: min(320px, calc(100vw - 36px));
    box-shadow: var(--shadow-lg);
  }
  .app-main {
    margin-left: 0;
  }
  .app-sidebar.is-open {
    transform: translateX(0);
  }
  .app-topbar {
    padding: var(--space-sm) var(--space-md);
    height: auto;
    min-height: var(--topbar-height);
    flex-wrap: wrap;
    row-gap: var(--space-sm);
  }
  .app-topbar > .flex-row {
    flex-wrap: wrap;
    min-width: 0;
  }
  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-md);
  }
  .page-header-actions {
    flex-wrap: wrap;
  }
  .dashboard-grid,
  .dashboard-layout-workspace {
    grid-template-columns: 1fr;
  }
  .dashboard-hero {
    padding: var(--space-lg);
  }
  .dashboard-reminder-item {
    grid-template-columns: 1fr;
  }
  .dashboard-reminder-actions {
    justify-content: flex-end;
  }
  .dashboard-span-2 {
    grid-column: auto;
  }
  .dashboard-span-3 {
    grid-column: auto;
  }
  .dashboard-layout-row {
    flex-direction: column;
    align-items: stretch;
  }
  .dashboard-layout-row-controls,
  .dashboard-layout-canvas-head {
    flex-direction: column;
    align-items: stretch;
  }
  .content-showcase {
    grid-template-columns: 1fr;
  }
  .workspace-layout {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }
  .sidebar-stack,
  .detail-stack {
    min-width: 0;
  }
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .filter-bar > * {
    flex: 1 1 auto;
  }
  .grid-cols-2,
  .grid-cols-3,
  .grid-cols-4,
  .grid-cols-2-equal,
  .field-grid,
  .grid-sidebar-detail {
    grid-template-columns: 1fr;
  }
  .col-span-2 {
    grid-column: auto;
  }
}

/* Inputs & Forms */
input, select, textarea {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-base);
  background: var(--bg-surface);
  font-family: inherit;
  font-size: 0.875rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-subtle);
}

label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: var(--space-xs);
}

.required-mark {
  color: var(--danger, #dc2626);
  margin-left: 2px;
}

.filter-bar {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
  align-items: flex-end;
  background: var(--bg-subtle);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-lg);
}

.filter-bar > * {
  flex: 1 1 200px;
}

/* Layout Utilities */
.workspace-layout {
  display: grid;
  grid-template-columns: clamp(360px, 30%, 460px) minmax(0, 1fr);
  gap: var(--space-xl);
  align-items: start;
  width: 100%;
}

.workspace-layout.workspace-layout-full {
  grid-template-columns: minmax(0, 1fr);
}

.sidebar-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  min-width: 0;
}

.sidebar-stack.is-hidden {
  display: none;
}

.detail-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  min-width: 0;
}

.workspace-layout > *,
.content-showcase > *,
.card-grid > *,
.grid > *,
.card {
  min-width: 0;
}

.contact-sidebar-list {
  display: grid;
  gap: var(--space-sm);
}

.contact-sidebar-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  padding: var(--space-md);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
}

.contact-sidebar-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-md);
}

.contact-sidebar-card-meta {
  display: grid;
  gap: var(--space-sm);
}

.contact-sidebar-card-meta div {
  display: grid;
  gap: 2px;
}

.contact-sidebar-card-meta span {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.contact-sidebar-card-meta strong {
  font-size: 0.875rem;
  color: var(--ink-base);
  word-break: break-word;
}

.contact-sidebar-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.recurring-table-shell {
  width: 100%;
  overflow-x: auto;
}

.recurring-table {
  width: 100%;
  min-width: max-content;
}

.recurring-table th,
.recurring-table td {
  vertical-align: top;
  white-space: normal;
}

.recurring-table td {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.recurring-table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.is-hidden { display: none !important; }

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  width: min(560px, calc(100vw - var(--space-xl)));
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 48px);
}

.modal-header {
  padding: var(--space-md);
  border-bottom: 1px solid var(--border-base);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.modal-body {
  padding: var(--space-md);
  flex: 1;
  overflow-y: auto;
  min-width: 0;
}

.modal-overlay.is-hidden { display: none; }
.modal-overlay.is-open { display: flex; }

.modal-wide { width: min(840px, calc(100vw - var(--space-xl))); }

.w-modal { width: min(700px, calc(100vw - var(--space-xl))); }

input.is-auto-calculated {
  background: var(--primary-subtle);
  border-color: var(--primary);
  font-weight: 600;
  cursor: help;
}

.is-selected {
  background: var(--primary-subtle) !important;
  border-color: var(--primary) !important;
  color: var(--primary) !important;
}

/* Utility Classes */

/* === SPACING UTILITIES === */
/* Margin */
.mt-auto { margin-top: auto; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mb-0 { margin-bottom: 0; }
.mb-xs { margin-bottom: var(--space-xs); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }
.mr-md { margin-right: var(--space-md); }

/* Padding */
.p-xs { padding: var(--space-xs); }
.p-sm { padding: var(--space-sm); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }
.p-xl { padding: var(--space-xl); }
.pt-lg { padding-top: var(--space-lg); }
.pt-xl { padding-top: var(--space-xl); }
.pb-10 { padding-bottom: 10px; }

/* === DISPLAY & LAYOUT === */
/* Flexbox */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.flex-row { display: flex; align-items: center; gap: var(--space-md); }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-between-start { display: flex; justify-content: space-between; align-items: flex-start; }
.flex-1 { flex: 1; }

/* Gap utilities */
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }

/* Grid */
.grid { display: grid; gap: var(--space-lg); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-cols-5 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-cols-2-equal { grid-template-columns: 1fr 1fr; }
.grid-cols-3-equal { grid-template-columns: 1fr 1fr 1fr; }
.grid-cols-sidebar { grid-template-columns: 350px 1fr; }
.grid-span-2 { grid-column: span 2; }

/* === WIDTH UTILITIES === */
.w-full { width: 100%; }
.w-auto { width: auto; }
.w-fit { width: fit-content; }
.w-modal { width: min(700px, calc(100vw - var(--space-xl))); }
.min-w-140 { min-width: 140px; }
.min-w-200 { min-width: 200px; }

/* === TEXT & TYPOGRAPHY === */
.text-center { text-align: center; }
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.font-semibold { font-weight: 600; }

/* === COLORS === */
.bg-subtle { background-color: var(--bg-subtle); }
.bg-transparent { background: transparent; }
.color-muted { color: var(--ink-muted); }

/* === SPECIFIC GRID TEMPLATES === */
.grid-todo-form { grid-template-columns: 1fr 180px 150px auto; }
.grid-time-form { grid-template-columns: 150px 1fr 180px 100px; }
.grid-planner-filter { grid-template-columns: repeat(4, 1fr); }

/* === BORDERS === */
.border-t { border-top: 1px solid var(--border-base); }
.border { border: 1px solid var(--border-base); }
.border-dashed { border-style: dashed; }
.rounded-md { border-radius: var(--radius-md); }
.overflow-hidden { overflow: hidden; }

/* === MISC === */
.cursor-pointer { cursor: pointer; }
.hidden { display: none; }

/* === BUTTON SIZES === */
.btn-sm { padding: var(--space-xs) var(--space-md); font-size: 0.8125rem; }
.btn-xs { padding: 4px 8px; font-size: 0.75rem; }
.btn-icon { padding: 4px; }
.btn-back { padding: 4px 12px; }

/* Modal Utilities */
.modal-actions {
  padding: var(--space-md);
  border-top: 1px solid var(--border-base);
  flex-shrink: 0;
}

.pt-24 { padding-top: 24px; }
.p-4-8 { padding: 4px 8px; }

/* Page Layout Utilities */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.page-header-content {
  flex: 1 1 auto;
  min-width: 0;
}

.page-header-content h1 {
  margin-bottom: var(--space-xs);
}

.page-header-actions {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
}

.settings-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-base);
}

.settings-subnav-tab {
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink-soft);
  background: var(--bg-subtle);
  text-decoration: none;
  white-space: nowrap;
}

.settings-subnav-tab:hover {
  background: var(--primary-subtle);
  color: var(--primary);
}

.settings-subnav-tab.active {
  background: var(--primary-strong);
  color: #fff;
}

.billing-tenant-switch {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.billing-tenant-switch-label {
  margin: 0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  color: var(--ink-muted);
}

.billing-tenant-switch-label-only {
  font-size: 12px;
  color: var(--ink-muted);
  opacity: 0.7;
}

#billing-tenant-select {
  width: 100%;
  min-width: 0;
}

.content-showcase {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
  gap: var(--space-lg);
  padding: var(--space-xl);
  margin-bottom: var(--space-lg);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--primary-subtle), var(--bg-surface));
  box-shadow: var(--shadow-sm);
  width: 100%;
}

.content-showcase-main {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.content-showcase-main h3,
.content-showcase-main p {
  margin: 0;
}

.content-showcase-side {
  display: grid;
  gap: var(--space-md);
}

.offers-page .page-header {
  margin-bottom: var(--space-md);
}

.offers-page .content-showcase {
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  gap: var(--space-md);
}

.offers-page .content-showcase-main {
  gap: var(--space-xs);
}

.offers-page .content-showcase-side {
  gap: var(--space-sm);
}

.offers-page .mb-lg {
  margin-bottom: var(--space-md);
}

.offers-page .gap-lg {
  gap: var(--space-md);
}

.offers-page .workspace-layout {
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-lg);
}

.offers-page .workspace-layout.workspace-layout-full {
  grid-template-columns: minmax(0, 1fr);
}

.offers-page .sidebar-stack,
.offers-page .detail-stack {
  gap: var(--space-md);
}

.offers-page .card {
  padding: var(--space-md);
}

.offers-page #offer-detail-empty {
  padding: var(--space-lg);
}

.offers-page #offer-lead-meta,
.offers-page #offer-preview-items {
  gap: var(--space-sm);
}

.offers-page #offer-items-editor {
  gap: var(--space-xs);
}

.offers-page .offer-item-row {
  padding: var(--space-xs) !important;
}

.offers-page .offer-item-row .grid {
  gap: var(--space-xs) !important;
}

.offers-page .offer-items-header {
  display: grid;
  grid-template-columns: minmax(0, 2.3fr) minmax(90px, 0.55fr) minmax(120px, 0.85fr) minmax(100px, 0.7fr) minmax(140px, 1.1fr) minmax(100px, 0.7fr) minmax(160px, 1fr);
  gap: var(--space-xs);
  padding: 0 var(--space-xs);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.offers-page .offer-items-header-actions {
  text-align: right;
}

.offer-item-label {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink-muted);
  margin-bottom: 2px;
}

.offers-page .offer-item-top-grid,
.offers-page .offer-item-bottom-grid {
  align-items: end;
}

.offers-page .offer-item-top-grid {
  grid-template-columns: minmax(0, 2.3fr) minmax(90px, 0.55fr) minmax(120px, 0.85fr) minmax(100px, 0.7fr);
}

.offers-page .offer-item-bottom-grid {
  grid-template-columns: minmax(140px, 1.1fr) minmax(100px, 0.7fr) minmax(160px, 1fr);
}

.offers-page .offer-item-top-grid > div,
.offers-page .offer-item-bottom-grid > div {
  min-width: 0;
}

.offers-page .offer-item-main-field {
  min-width: 0;
}

.offers-page .offer-item-row input {
  font-size: 0.875rem;
}

.offers-page .offer-item-row input[type="text"],
.offers-page .offer-item-row input[type="number"] {
  padding-block: 0.55rem;
}

.offers-page .offer-item-row textarea {
  min-height: 2.25rem;
}

.offers-page #offer-preview-summary {
  padding: var(--space-sm) !important;
  line-height: 1.5 !important;
}

.offers-page .meta-grid {
  gap: var(--space-xs);
}

.offers-page .meta-block {
  padding: var(--space-xs) var(--space-sm);
}

.offers-page .meta-label {
  margin-bottom: 2px;
}

@media (max-width: 1024px) {
  .offers-page .offer-item-top-grid,
  .offers-page .offer-item-bottom-grid {
    grid-template-columns: 1fr 1fr;
  }

  .offers-page .offer-items-header {
    display: none;
  }

  .offers-page .offer-item-top-grid > div:last-child,
  .offers-page .offer-item-bottom-grid > div:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .offers-page .offer-item-top-grid,
  .offers-page .offer-item-bottom-grid {
    grid-template-columns: 1fr;
  }
}

.content-mini-metric {
  padding: var(--space-md);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.content-mini-metric span {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.content-mini-metric strong {
  display: block;
  margin-top: var(--space-xs);
  color: var(--ink-base);
  line-height: 1.45;
}

.dashboard-shell {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

.dashboard-kicker {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #0f766e;
}

.dashboard-hero {
  display: block;
  padding: calc(var(--space-xl) * 0.95);
  border: 1px solid rgba(12, 18, 36, 0.08);
  border-radius: calc(var(--radius-lg) + 6px);
  background:
    radial-gradient(circle at top left, rgba(16, 185, 129, 0.12), transparent 28%),
    radial-gradient(circle at 82% 18%, rgba(79, 70, 229, 0.14), transparent 24%),
    linear-gradient(145deg, var(--bg-app) 0%, #eef4ff 52%, var(--bg-surface) 100%);
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.06);
}

.dashboard-hero-copy {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  min-width: 0;
}

.dashboard-hero-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-lg);
}

.dashboard-hero-actions {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.dashboard-hero-highlights {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-md);
}

.dashboard-hero-copy h1 {
  margin-top: var(--space-xs);
  font-size: clamp(2rem, 2.2vw, 2.65rem);
  line-height: 1.06;
  max-width: 13ch;
}

.dashboard-hero-copy .text-muted {
  max-width: 72ch;
  font-size: 0.95rem;
  line-height: 1.7;
}

.dashboard-hero-chip {
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: var(--bg-surface);
  backdrop-filter: blur(8px);
}

.dashboard-hero-chip span {
  display: block;
  margin-bottom: 6px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.dashboard-hero-chip strong {
  display: block;
  font-size: 1rem;
  line-height: 1.45;
  color: var(--ink-base);
}

.dashboard-hero-chip-accent {
  background: linear-gradient(135deg, var(--primary-subtle), var(--bg-surface));
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-lg);
  align-items: start;
}

.dashboard-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
}

.dashboard-section-head p {
  margin-top: var(--space-xs);
}

.dashboard-summary-grid .card {
  position: relative;
  overflow: hidden;
  min-height: 138px;
  border-color: rgba(15, 23, 42, 0.08);
  background: linear-gradient(180deg, var(--bg-surface), var(--bg-subtle));
}

.dashboard-summary-grid .card::after {
  content: "";
  position: absolute;
  inset: auto -24px -24px auto;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.12), transparent 70%);
}

.summary-tile-highlight {
  border-color: rgba(15, 118, 110, 0.25) !important;
  box-shadow: 0 16px 34px rgba(15, 118, 110, 0.12);
}

.summary-tile-highlight::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, #0f766e, var(--success));
}

@keyframes skeleton-pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

.skeleton-tile {
  height: 84px;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  animation: skeleton-pulse 1.4s ease-in-out infinite;
}

.skeleton-line {
  height: 14px;
  width: 60%;
  border-radius: 4px;
  background: var(--bg-subtle);
  animation: skeleton-pulse 1.4s ease-in-out infinite;
}

.load-error-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-md);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  color: var(--ink-soft);
  font-size: 0.875rem;
}

.dashboard-priority-card {
  background: linear-gradient(180deg, var(--bg-surface), var(--bg-subtle));
}

.dashboard-span-2 {
  grid-column: span 2;
}

.dashboard-span-3 {
  grid-column: span 3;
}

.dashboard-layout-panel {
  border-style: solid;
  border-color: rgba(79, 70, 229, 0.12);
  background: linear-gradient(180deg, var(--primary-subtle), var(--bg-surface));
}

.dashboard-layout-panel-head {
  padding-bottom: var(--space-md);
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.dashboard-layout-panel-actions {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.dashboard-layout-workspace {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: var(--space-lg);
  align-items: start;
}

.dashboard-layout-toolbar,
.dashboard-layout-canvas {
  display: grid;
  gap: var(--space-md);
}

.dashboard-layout-summary,
.dashboard-layout-controls-card,
.dashboard-layout-canvas-head {
  display: grid;
  gap: var(--space-md);
  padding: var(--space-lg);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
}

.dashboard-layout-canvas-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.dashboard-layout-summary-head {
  display: grid;
  gap: var(--space-xs);
}

.dashboard-layout-summary-head h4 {
  margin: 0;
  font-size: 1.15rem;
}

.dashboard-layout-summary-stats {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.dashboard-layout-stat {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: var(--radius-full);
  background: rgba(79, 70, 229, 0.08);
  color: var(--primary-hover);
  font-size: 0.78rem;
  font-weight: 700;
}

.dashboard-layout-note {
  padding: var(--space-md);
  border-radius: var(--radius-md);
  background: rgba(79, 70, 229, 0.05);
  color: var(--ink-soft);
  font-size: 0.86rem;
  line-height: 1.55;
}

.dashboard-layout-editor {
  display: grid;
  gap: var(--space-sm);
}

.dashboard-layout-toolbar-group {
  display: grid;
  gap: var(--space-xs);
}

.dashboard-layout-toolbar-group label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
}

.dashboard-layout-toolbar-inline {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  align-items: center;
}

.dashboard-layout-toolbar-inline .dashboard-layout-preset-select {
  flex: 1 1 180px;
}

.dashboard-layout-device-tabs {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

.dashboard-layout-device-tabs .btn.is-active {
  background: var(--ink-base);
  color: white;
  border-color: var(--ink-base);
}

.dashboard-layout-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-md);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.dashboard-layout-row.is-muted {
  background: var(--bg-subtle);
}

.dashboard-layout-row.is-dragging {
  opacity: 0.64;
}

.dashboard-layout-row.is-drop-target {
  border-color: #0f766e;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.dashboard-layout-row-main {
  display: grid;
  gap: var(--space-md);
  min-width: 0;
  flex: 1 1 auto;
}

.dashboard-layout-row-top {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  min-width: 0;
}

.dashboard-layout-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  color: var(--ink-muted);
  cursor: grab;
  font-size: 1rem;
  line-height: 1;
}

.dashboard-layout-row-copy {
  display: grid;
  gap: 6px;
  min-width: 0;
  flex: 1 1 auto;
}

.dashboard-layout-row-title-line {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.dashboard-layout-row-title-line strong {
  font-size: 0.95rem;
}

.dashboard-layout-status {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.12);
  color: #047857;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dashboard-layout-status.is-off {
  background: rgba(245, 158, 11, 0.14);
  color: #b45309;
}

.dashboard-layout-row-meta {
  color: var(--ink-muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

.dashboard-layout-row-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.dashboard-layout-toggle-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin: 0;
  min-width: 0;
}

.dashboard-layout-toggle-row span {
  font-size: 0.9rem;
  color: var(--ink-base);
}

.dashboard-layout-toggle-row input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.dashboard-layout-preset-select {
  width: 100%;
  min-width: 0;
}

.dashboard-layout-size-group {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

.dashboard-layout-size-group .btn.is-active {
  background: #0f766e;
  color: white;
  border-color: #0f766e;
}

.dashboard-layout-row-actions {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  align-items: center;
}

.dashboard-feed,
.dashboard-reminder-list,
.dashboard-signal-list {
  display: grid;
  gap: var(--space-sm);
}

.dashboard-feed-item,
.dashboard-focus-item,
.dashboard-reminder-item,
.dashboard-signal-item {
  display: block;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.dashboard-feed-item,
.dashboard-focus-item {
  padding: var(--space-md);
}

.dashboard-feed-item:hover,
.dashboard-focus-item:hover,
.dashboard-reminder-item:hover,
.dashboard-signal-item:hover {
  transform: translateY(-1px);
  border-color: rgba(15, 23, 42, 0.14);
  box-shadow: var(--shadow-sm);
}

.dashboard-feed-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.dashboard-feed-title {
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.4;
  color: var(--ink-base);
  text-decoration: none;
}

.dashboard-feed-meta {
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--ink-muted);
}

.dashboard-feed-note {
  margin-top: 6px;
  font-size: 0.76rem;
  line-height: 1.55;
  color: var(--ink-soft);
}

.dashboard-focus-bucket + .dashboard-focus-bucket {
  margin-top: var(--space-lg);
}

.dashboard-focus-label {
  margin-bottom: var(--space-sm);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.dashboard-reminder-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-md);
  padding: var(--space-md);
}

.dashboard-reminder-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--space-sm);
  align-items: start;
  cursor: pointer;
}

.dashboard-reminder-checkbox {
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.dashboard-reminder-copy {
  min-width: 0;
}

.dashboard-reminder-badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.dashboard-reminder-actions {
  display: flex;
  align-items: center;
}

.dashboard-action-card {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  border: 1px solid rgba(15, 23, 42, 0.08);
  text-decoration: none;
  color: var(--ink-base);
  background: linear-gradient(180deg, var(--bg-surface), var(--bg-app));
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.dashboard-action-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  border-color: rgba(15, 23, 42, 0.14);
}

.dashboard-action-card.is-primary {
  background: linear-gradient(135deg, #0f766e, #0f9f94);
  color: white;
  border-color: transparent;
}

.dashboard-action-icon {
  width: 1.15rem;
  height: 1.15rem;
  display: inline-flex;
  flex: 0 0 auto;
}

.dashboard-action-icon svg {
  width: 100%;
  height: 100%;
}

.dashboard-action-label {
  font-weight: 700;
  line-height: 1.4;
}

.dashboard-signal-item {
  padding: var(--space-md);
  border-left: 4px solid transparent;
}

.dashboard-signal-item.is-warn {
  border-left-color: #dc2626;
  background: linear-gradient(90deg, color-mix(in srgb, var(--danger) 15%, var(--bg-surface)), var(--bg-surface));
}

.dashboard-signal-item.is-success {
  border-left-color: #059669;
  background: linear-gradient(90deg, color-mix(in srgb, var(--success) 15%, var(--bg-surface)), var(--bg-surface));
}

.dashboard-signal-item.is-info {
  border-left-color: #2563eb;
  background: linear-gradient(90deg, color-mix(in srgb, var(--info) 15%, var(--bg-surface)), var(--bg-surface));
}

.dashboard-signal-title {
  font-weight: 600;
  color: var(--ink-base);
}

.dashboard-signal-time {
  margin-top: 4px;
  font-size: 0.76rem;
  color: var(--ink-muted);
}

.dashboard-empty {
  padding: var(--space-lg);
  border: 1px dashed var(--border-base);
  border-radius: var(--radius-md);
  color: var(--ink-muted);
  text-align: center;
  font-size: 0.875rem;
  background: var(--bg-subtle);
}

/* Card Grid for Dashboard-style Layouts */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: var(--space-lg);
}

.table-shell {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  min-width: 0;
}

.table-shell > .data-table {
  width: 100%;
  min-width: max-content;
}

.table-row-error {
  background: color-mix(in srgb, var(--danger) 10%, var(--bg-surface));
  box-shadow: inset 3px 0 0 var(--danger);
}

.cfo-drilldown-toggle {
  cursor: pointer;
}
.cfo-drilldown-toggle:hover {
  background: var(--bg-subtle);
}
.cfo-drilldown-panel td {
  padding: 0;
  border-bottom: none;
}
.data-table-compact {
  margin: 4px 0 8px;
  font-size: 12.5px;
}
.data-table-compact th,
.data-table-compact td {
  padding: 4px 10px;
}

.workspace-layout.payroll-workspace {
  grid-template-columns: minmax(0, 1.7fr) minmax(320px, 420px);
}

.payroll-workspace .table-shell {
  overflow-x: visible;
}

.payroll-workspace .data-table {
  table-layout: fixed;
}

.payroll-workspace .data-table th,
.payroll-workspace .data-table td {
  vertical-align: top;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs, 6px);
  border-bottom: 1px solid var(--border-subtle, #e5e7eb);
  padding-bottom: var(--space-xs, 6px);
}

.tab-btn {
  border: none;
  background: transparent;
  padding: 8px 14px;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  color: var(--text-muted, #6b7280);
  font-weight: 600;
  font-size: 0.875rem;
}

.tab-btn.active {
  background: var(--brand-primary, #4f46e5);
  color: #fff;
}

.cfo-tab-panel.is-hidden {
  display: none;
}


.payment-qr-panel {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: var(--space-lg);
  align-items: center;
}

.payment-qr-image {
  display: block;
  width: 220px;
  max-width: 100%;
  height: auto;
  padding: var(--space-sm);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-md);
  background: white;
}

.payment-qr-copy {
  min-width: 0;
}

.mobile-feed-list {
  display: grid;
  gap: var(--space-md);
}

.mobile-feed-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  padding: var(--space-md);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
}

.mobile-feed-top {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.mobile-feed-copy {
  min-width: 0;
}

.mobile-feed-copy h3 {
  font-size: 1rem;
  line-height: 1.35;
}

.mobile-feed-subtitle {
  color: var(--ink-muted);
  font-size: 0.8125rem;
  overflow-wrap: anywhere;
}

.mobile-feed-badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.mobile-feed-grid,
.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-sm);
}

.meta-block {
  padding: var(--space-sm);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  min-width: 0;
}

.meta-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  margin-bottom: 4px;
}

.meta-value {
  font-size: 0.875rem;
  color: var(--ink-base);
  overflow-wrap: anywhere;
}

.mobile-feed-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.mobile-feed-actions .btn {
  flex: 1 1 140px;
}

.card-link {
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  position: relative;
  display: block;
}

.card-link:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
}

.card-link:hover .chevron {
  transform: translateX(4px);
}

.card-kicker {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
  margin-bottom: var(--space-sm);
}

.card-link h3 {
  margin-bottom: var(--space-xs);
  color: var(--ink-base);
}

.card-link p {
  font-size: 0.875rem;
  color: var(--ink-soft);
  line-height: 1.5;
  margin: 0;
}

.chevron {
  display: inline-block;
  margin-top: var(--space-md);
  color: var(--primary);
  font-weight: 600;
  transition: transform 0.2s ease;
}

/* Additional page layout classes */
.section-copy {
  font-size: 0.9375rem;
  color: var(--ink-soft);
  line-height: 1.5;
}

.lead {
  font-size: 1rem;
  color: var(--ink-soft);
  line-height: 1.6;
}

.page-context {
  padding: var(--space-md);
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--primary);
  margin-bottom: var(--space-lg);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.stack-sections {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

/* Scrollbar styling */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-app); }
::-webkit-scrollbar-thumb { background: var(--border-base); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-muted); }

/* Additional utility classes */
.m-0 { margin: 0; }
.col-span-2 { grid-column: span 2; }
.icon-sm { width: 16px; height: 16px; }
.align-items-center { align-items: center; }
.align-items-end { align-items: flex-end; }
.justify-space-between { justify-content: space-between; }

/* Auto width input */
.checkbox-input { width: auto; }

/* Overflow */
.overflow-x-auto { overflow-x: auto; }

/* Grid template for attachment upload */
.grid-attachment-upload { grid-template-columns: 150px 1fr auto; }

/* File input compact */
.file-input-compact { padding: 4px; }

/* === ADDITIONAL LAYOUT UTILITIES === */
/* Sidebar spacing */
.sidebar-bottom-spacing {
  margin-top: auto;
  padding-top: var(--space-xl);
}

/* Grid templates */
.grid-sidebar-detail {
  grid-template-columns: 350px 1fr;
  gap: var(--space-lg);
}

/* Specific padding values */

/* Section header layout */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

/* Form sections */
.form-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.form-section-head {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

/* Field grid */
.field-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
}

/* Settings specific layouts */
.settings-filter-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.settings-save-bar {
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border-base);
}

.bg-orb {
  position: fixed;
  width: 28rem;
  height: 28rem;
  border-radius: 9999px;
  filter: blur(60px);
  opacity: 0.32;
  pointer-events: none;
  z-index: 0;
}

.orb-a {
  top: -8rem;
  left: -7rem;
  background: rgba(79, 70, 229, 0.28);
}

.orb-b {
  right: -8rem;
  bottom: -9rem;
  background: rgba(14, 165, 233, 0.22);
}

.login-page {
  min-height: 100vh;
  position: relative;
  background: linear-gradient(180deg, var(--bg-app) 0%, var(--bg-subtle) 100%);
}

.login-layout {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: clamp(20px, 3vw, 32px);
  max-width: 1240px;
  margin: 0 auto;
  padding: clamp(20px, 3vw, 32px);
}

.login-branding,
.login-panel {
  display: flex;
  min-width: 0;
}

.login-branding-panel,
.login-page .login-shell {
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(28px, 4vw, 44px);
  border-radius: 24px;
  border: 1px solid var(--border-base);
  background: var(--bg-surface);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}

.login-branding-panel {
  min-height: min(720px, calc(100vh - clamp(40px, 6vw, 64px)));
}

.login-branding-inner {
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.login-branding-logo {
  width: clamp(120px, 16vw, 180px);
  height: auto;
}

.login-branding-inner h1 {
  font-size: clamp(2.1rem, 4vw, 3.25rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.login-branding .section-copy {
  max-width: 36rem;
  font-size: 1rem;
}

.login-summary-card {
  margin-top: var(--space-lg);
  display: grid;
  gap: var(--space-sm);
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
  background: var(--bg-subtle);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.login-summary-item {
  display: grid;
  gap: 2px;
}

.login-summary-item strong {
  font-size: 0.9375rem;
  color: var(--ink-base);
}

.login-summary-item span {
  font-size: 0.875rem;
  color: var(--ink-soft);
}

.login-panel {
  justify-content: center;
}

.login-page .login-shell {
  gap: var(--space-xl);
  max-width: none;
}

.login-shell-head {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
}

.login-brand-logo {
  width: 124px;
  height: auto;
  flex-shrink: 0;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.login-input {
  min-height: 46px;
}

.login-password-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-sm);
  align-items: center;
}

.login-password-toggle {
  min-width: 92px;
}

.login-meta-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.login-submit {
  width: 100%;
  min-height: 48px;
  font-size: 0.9375rem;
  font-weight: 600;
}

.login-submit:disabled {
  opacity: 0.7;
  cursor: wait;
}

.login-status {
  margin: 0;
  border: 1px solid rgba(239, 68, 68, 0.14);
  background: rgba(254, 242, 242, 0.9);
  color: #991b1b;
}

@media (max-width: 1024px) {
  .login-layout {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
    padding: clamp(16px, 3vw, 24px);
  }

  .login-branding-panel {
    min-height: auto;
  }

  .login-panel {
    justify-content: stretch;
  }

  .login-page .login-shell {
    width: 100%;
  }

  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-md);
  }

  .page-header-actions {
    flex-wrap: wrap;
  }

  .content-showcase,
  .workspace-layout,
  .grid-cols-2,
  .grid-cols-3,
  .grid-cols-4,
  .grid-cols-2-equal,
  .field-grid,
  .grid-sidebar-detail {
    grid-template-columns: 1fr;
  }

  .workspace-layout {
    gap: var(--space-lg);
  }

  .sidebar-stack,
  .detail-stack {
    min-width: 0;
  }

  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-bar > * {
    flex: 1 1 auto;
  }

  .payment-qr-panel {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .meta-grid,
  .mobile-feed-grid {
    grid-template-columns: 1fr;
  }

  .col-span-2 {
    grid-column: auto;
  }
}

@media (max-width: 720px) {
  .login-branding-panel,
  .login-page .login-shell {
    padding: var(--space-lg);
  }

  .login-branding-inner h1 {
    font-size: 2rem;
  }

  .login-shell-head {
    flex-direction: column;
  }

  .login-password-row {
    grid-template-columns: 1fr;
  }

  .login-password-toggle {
    width: 100%;
  }

  .dashboard-shell {
    gap: var(--space-md);
  }
  .dashboard-hero-head {
    flex-direction: column;
    align-items: stretch;
  }
  .dashboard-hero-highlights {
    grid-template-columns: 1fr;
  }
  .dashboard-hero-copy h1 {
    max-width: none;
    font-size: 1.85rem;
  }
  .dashboard-section-head {
    flex-direction: column;
    align-items: stretch;
  }
  .dashboard-action-card {
    padding: var(--space-sm) var(--space-md);
  }
  .dashboard-reminder-main {
    grid-template-columns: 1fr;
  }
  .dashboard-reminder-checkbox {
    margin-top: 0;
  }
  .payments-page {
    padding: var(--space-md);
  }

  .payments-page .page-header {
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
  }

  .payments-page .page-header-content h1 {
    font-size: 1.4rem;
    line-height: 1.25;
  }

  .payments-page .page-header-actions {
    width: 100%;
    justify-content: stretch;
  }

  .payments-page .page-header-actions .btn {
    flex: 1 1 100%;
  }

  .payments-page .content-showcase {
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
  }

  .payments-page .content-showcase-side {
    display: none;
  }

  .payments-page .card,
  .payments-page .mobile-feed-card {
    padding: var(--space-md);
  }

  .payments-page .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-md);
  }

  .payments-page .filter-bar {
    padding: var(--space-sm);
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
  }

  .payments-page .filter-bar .page-header-actions {
    width: 100%;
  }

  .payments-page .filter-bar .page-header-actions .btn,
  .payments-page #payroll-load {
    width: 100%;
  }

  .payments-page #payroll-orders-list-view,
  .payments-page #bank-matching-list-view {
    gap: var(--space-md);
  }

  .payments-page .detail-stack {
    gap: var(--space-md);
  }

  .payments-page #payroll-detail-empty,
  .payments-page #payroll-detail-view,
  .payments-page #bank-matching-detail-empty,
  .payments-page #bank-matching-detail-view {
    order: 1;
  }

  .payments-page .payroll-files-card {
    order: 2;
  }

  .payments-page .result {
    font-size: 0.6875rem;
    padding: var(--space-sm);
  }

  .payments-page .mobile-feed-actions .btn {
    flex-basis: 100%;
  }
}

/* Detail empty state */
.detail-empty {
  background: var(--bg-surface);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  text-align: center;
}

/* List view */
.list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

/* Hint / Meta messages */
.hint {
  padding: var(--space-sm);
  background: var(--primary-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--ink-soft);
}

.meta {
  font-size: 0.875rem;
  color: var(--ink-muted);
  line-height: 1.5;
}

/* Result display */
.result {
  font-size: 0.75rem;
  color: var(--ink-muted);
  padding: var(--space-md);
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  white-space: pre-wrap;
  font-family: monospace;
}

/* RBAC permission matrix */
.rbac-permission-matrix {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
}

/* Compact toggle */
.compact-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
}

/* Form group */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.form-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.form-control {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-base);
  background: var(--bg-surface);
  font-family: inherit;
  font-size: 0.875rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-subtle);
}

/* Form grid for inline fields */
.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
}

/* Row layout for inline actions */
.row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.inline {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.inline-actions {
  display: flex;
  gap: var(--space-sm);
}

/* Branding preview */
.branding-preview {
  padding: var(--space-lg);
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-base);
}

.branding-preview-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: var(--space-md);
}

.branding-preview-image {
  max-width: 200px;
  max-height: 100px;
  object-fit: contain;
}

.global-loading-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 1300;
  background: var(--primary);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.global-loading-bar.is-active {
  opacity: 1;
  animation: global-loading-bar-sweep 1.1s ease-in-out infinite;
}

@keyframes global-loading-bar-sweep {
  0% { transform: scaleX(0); transform-origin: left; }
  50% { transform: scaleX(1); transform-origin: left; }
  50.001% { transform-origin: right; }
  100% { transform: scaleX(0); transform-origin: right; }
}

.toast-root {
  position: fixed;
  right: var(--space-lg);
  bottom: var(--space-lg);
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  width: min(360px, calc(100vw - 2 * var(--space-lg)));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  color: #fff;
  box-shadow: var(--shadow-lg);
  transform: translateY(10px);
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

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

.toast-info {
  background: #1e3a8a;
}

.toast-success {
  background: #166534;
}

.toast-error {
  background: #991b1b;
}

.notification-center {
  position: relative;
}

.notification-bell {
  position: relative;
}

.notification-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.notification-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(420px, calc(100vw - 24px));
  max-height: min(70vh, 640px);
  overflow: auto;
  padding: var(--space-md);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  box-shadow: var(--shadow-lg);
  z-index: 1100;
}

.notification-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.notification-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.notification-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  text-align: left;
  padding: var(--space-sm);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  cursor: pointer;
}

.notification-item.is-unread {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.notification-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}

.notification-title {
  font-weight: 700;
  color: var(--ink-base);
}

.notification-message {
  color: var(--ink-soft);
  font-size: 0.875rem;
}

#browser-notification-toggle {
  white-space: nowrap;
}

.native-notification-prompt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  padding: var(--space-md);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #eff6ff, var(--bg-app));
}

.native-notification-prompt-copy {
  min-width: 0;
}

.native-notification-prompt-title {
  font-weight: 700;
  color: var(--ink-base);
  margin-bottom: 4px;
}

.native-notification-prompt-text {
  font-size: 0.875rem;
  color: var(--ink-soft);
}

.native-notification-prompt-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

@media (max-width: 720px) {
  .toast-root {
    left: var(--space-md);
    right: var(--space-md);
    bottom: calc(var(--space-md) + env(safe-area-inset-bottom, 0px));
    width: auto;
  }

  .notification-panel {
    position: fixed;
    left: var(--space-md);
    right: var(--space-md);
    top: calc(var(--topbar-height) + 10px);
    width: auto;
    max-height: calc(100vh - var(--topbar-height) - 24px);
  }

  .native-notification-prompt {
    flex-direction: column;
    align-items: stretch;
  }

  .native-notification-prompt-actions .btn {
    width: 100%;
  }
}

/* === COMPACT UI IMPROVEMENTS === */

/* Compact cards - reduced padding and gaps */
.card.is-compact {
  padding: var(--space-md);
  gap: var(--space-sm);
}

.card.is-compact > * {
  margin-bottom: 0;
}

.card.is-compact .mb-lg { margin-bottom: var(--space-sm); }
.card.is-compact .mb-md { margin-bottom: var(--space-sm); }
.card.is-compact .pt-24 { padding-top: 0; }
.card.is-compact .pb-10 { padding-bottom: 0; }

/* Compact page header */
.page-header.is-compact {
  gap: var(--space-md);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
}

.page-header.is-compact h1 {
  margin-bottom: 0;
}

/* Compact sidebar */
.sidebar-stack.is-compact {
  gap: var(--space-sm);
}

/* Small input size */
.input-sm {
  padding: var(--space-xs) var(--space-sm) !important;
  font-size: 0.8125rem !important;
  height: 32px;
}

/* Text sizes */
.text-lg { font-size: 1.125rem; line-height: 1.3; }
.text-sm { font-size: 0.875rem; line-height: 1.3; }
.text-xs { font-size: 0.75rem; line-height: 1.2; }

/* Compact grid for planner filters */
.grid-planner-filter-compact {
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

/* Compact grid for todo form */
.grid-todo-form-compact {
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
}

/* Compact grid for time form */
.grid-time-form-compact {
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
}

/* Compact spacing utilities */
.mb-md { margin-bottom: var(--space-md); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-xs { margin-bottom: var(--space-xs); }
.mt-md { margin-top: var(--space-md); }
.mt-sm { margin-top: var(--space-sm); }

/* Flex helpers */
.ml-auto { margin-left: auto; }
.gap-xs { gap: var(--space-xs); }

/* Min width utilities */
.min-w-100 { min-width: 100px; }
.min-w-150 { min-width: 150px; }

/* Button size adjustments */
.btn-xs {
  padding: var(--space-xs) var(--space-sm);
  font-size: 0.75rem;
  height: auto;
}

/* Modal compact */
.modal.w-modal {
  max-width: 600px;
}

/* Summary card compact */
#projects-summary .content-mini-metric,
#projects-planner-summary .content-mini-metric {
  padding: var(--space-sm);
}

/* List items with compact spacing */
#projects-list > *,
#projects-planner-list > * {
  gap: var(--space-xs);
}

/* Responsive compact grids */
@media (max-width: 1024px) {
  .grid-planner-filter-compact {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  }
  
  .grid-todo-form-compact {
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  }
  
  .grid-time-form-compact {
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  }
}
