/* Enhanced workspace layout. Loaded after the shared color contract. */
:root {
  --space-section: 32px;
  --space-card: 32px;
  --space-grid: 24px;
  --row-line: #f1f5f9;
  --control-radius: 8px;
}

/* Keep the familiar sidebar and dashboard, with a consistent spacing rhythm. */
.sidebar { width: 232px; padding: 28px 16px 20px; }
.main-shell { margin-left: 232px; min-width: 0; }
.topbar { min-height: 72px; padding: 18px 40px; }
main { max-width: 1520px; margin: 0 auto; padding: 32px 40px 0; }
.page-heading { margin-bottom: 32px; align-items: center; gap: 24px; }
.page-heading h1 { margin: 8px 0 12px; font-size: 28px; letter-spacing: -.4px; }
.page-heading p { font-size: 14px; line-height: 1.7; color: #8f959e; }
.heading-actions { padding-top: 0; gap: 12px; flex-wrap: wrap; }
.toolbar { gap: 24px; margin-bottom: 28px; }
.mode-banner { margin-bottom: 32px; padding: 12px 16px; border-radius: 8px; }
.mode-banner.demo-banner { background: #f0f9ff; border-color: #e0f2fe; color: #475569; }
.overview-note { margin-bottom: 16px; gap: 16px; line-height: 1.6; }
.overview-grid { grid-template-columns: minmax(0,1.6fr) minmax(0,1fr); gap: var(--space-grid); margin-bottom: var(--space-section); }
.settings-grid, .arena-grid { gap: var(--space-grid); }
.dashboard-actions { margin: 0 0 24px; }
.panel { margin-bottom: var(--space-section); }
.panel-heading, .daily-list .list-heading, .business-stores .list-heading,
.assistant-output .list-heading { padding: 28px var(--space-card) 24px; gap: 20px; }
.panel-heading h2, .list-heading h2 { font-size: 17px; line-height: 1.5; }
.panel-heading p, .list-heading p { margin-top: 8px; line-height: 1.7; font-size: 13px; }
.panel-heading .eyebrow { margin-bottom: 8px; }
.padded, .detail-body, .assistant-compose { padding: var(--space-card); }
.panel.padded>h2, .panel.padded>h3 { margin-bottom: 16px; }
.panel.padded>h3:not(:first-child) { margin-top: 28px; }
.panel.padded>p { line-height: 1.85; margin-bottom: 16px; }
.panel-foot, .brand-panel>.quiet-note { padding: 20px var(--space-card); line-height: 1.8; }
.page-footer { margin-top: 40px; padding: 24px 0; }

/* Independent KPI cards: small labels, prominent numbers, no vertical rules. */
.metrics, .business-summary {
  display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 16px;
  padding: 0; margin-bottom: var(--space-section); background: transparent;
  border: 0; border-radius: 0; box-shadow: none;
}
.metrics.three { grid-template-columns: repeat(3,minmax(0,1fr)); }
.metrics .metric, .business-summary>div {
  min-width: 0; padding: 24px; background: #fff;
  border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--card-shadow);
}
.metrics .metric>span, .business-summary>div>span {
  display: block; font-size: 14px; font-weight: 500; line-height: 1.5; color: #64748b;
}
.metrics .metric strong, .metrics .metric strong.amount, .business-summary strong {
  display: block; margin: 16px 0 12px; font-size: 32px; font-weight: 650;
  line-height: 1.2; letter-spacing: -.8px; overflow-wrap: anywhere; color: #0f172a;
}
.metrics .metric strong small, .business-summary strong small {
  margin-left: 8px; font-size: 12px; font-weight: 400; letter-spacing: 0;
}
.metrics .metric p { font-size: 12px; line-height: 1.6; margin: 0; }
.business-summary>div:last-child { grid-column: auto; }

/* Tables stay inside their own horizontal scroll area on smaller screens. */
.panel:has(>.table-scroll) { border: 0; }
.table-scroll { border: 0; padding: 0 24px 16px; }
.table-scroll table { width: 100%; min-width: 760px; border: 0; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.table-scroll th { height: 56px; padding: 16px; border: 0; border-bottom: 1px solid var(--row-line); font-size: 12px; font-weight: 500; }
.table-scroll td { height: 80px; padding: 18px 16px; border: 0; border-bottom: 1px solid var(--row-line); line-height: 1.6; }
.table-scroll td small { margin-top: 6px; font-size: 12px; }
.table-scroll tbody tr:last-child td { border-bottom: 0; }
.table-scroll .customer-link { gap: 14px; font-size: 14px; text-decoration: none; }
.customer-link>span:last-child { min-width: 0; }
.customer-link b { font-weight: 600; }
.customer-link small { display: block; font-size: 12px; line-height: 1.6; margin-top: 5px; }
.customer-link .avatar, .client-row .customer-link .avatar {
  width: 44px; height: 44px; font-size: 16px; font-weight: 600;
  background: var(--brand-pale); color: var(--brand); border: 0;
}
.shop-progress { gap: 8px; flex-wrap: wrap; }
.shop-chip, .shop-chip.available, .shop-chip.won, .badge, .badge.success, .badge.muted {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 4px 10px; min-height: 26px; border: 0; border-radius: 999px;
  font-size: 11px; font-weight: 500; line-height: 1.5; background: var(--brand-pale);
}
.client-list { border: 0; padding: 0 24px; }
.client-row { padding: 24px 8px; min-height: 96px; gap: 24px; border-color: var(--row-line); }
.service-state { border-radius: 999px; padding: 8px 12px; background: var(--brand-pale); }
.filter-line { margin: 0 0 24px; gap: 20px; font-size: 12px; }
.tabs { gap: 28px; }
.tabs button { min-height: 40px; padding: 10px 0; font-size: 13px; }

/* Quiet column backgrounds separate the board from its white customer cards. */
.kanban { grid-template-columns: repeat(5,minmax(248px,1fr)); gap: 20px; padding: 4px 4px 24px; align-items: stretch; }
.kanban-column { min-width: 0; min-height: 360px; padding: 20px 16px; border: 0; border-radius: 16px; background: #f8fafc; box-shadow: none; }
.kanban-column h2 { padding: 4px 8px; margin: 0 0 20px; font-size: 13px; font-weight: 600; }
.kanban-column h2>span:last-child { min-width: 24px; padding: 2px 7px; text-align: center; border-radius: 999px; background: #fff; font-size: 11px; }
.deal-card { padding: 24px; margin-bottom: 16px; border: 1px solid rgba(0,0,0,.025); border-radius: 12px; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.04); }
.deal-card:hover { border-color: #dedede; box-shadow: 0 4px 12px rgba(0,0,0,.06); }
.deal-store { display: inline-block; margin-bottom: 4px; font-size: 12px; }
.deal-card h3 { margin: 10px 0 8px; font-size: 16px; font-weight: 600; }
.deal-card p { font-size: 12px; line-height: 1.7; white-space: normal; overflow-wrap: anywhere; }
.deal-bottom { margin-top: 24px; padding-top: 16px; gap: 12px; font-size: 12px; border-color: var(--row-line); }
.deal-card>small { margin-top: 12px; font-size: 11px; line-height: 1.6; }

/* Consistent controls; reserve an outline for focus rather than idle borders. */
.button, .button.small, .button.ghost, .button.primary, .account-button,
.task-end .button, .simple-task .button, .heading-actions .button,
.assistant-compose .button, .assistant-output .button, .form-footer .button {
  height: 36px; min-height: 36px; padding: 0 14px; border-radius: var(--control-radius);
  font-size: 13px; line-height: 1.4; border: 1px solid transparent;
}
.button:not(.primary), .button.ghost, .account-button { background: var(--brand-pale); }
.button:hover, .button.ghost:hover, .button.primary:hover { border-color: transparent; }
.icon-button { width: 36px; height: 36px; border-radius: var(--control-radius); }
input:not([type=checkbox]):not([type=radio]), select, textarea {
  min-height: 40px; padding: 10px 12px; border: 1px solid transparent;
  border-radius: var(--control-radius); background: #f6f6f6; font-size: 14px;
}
textarea { min-height: 112px; resize: vertical; line-height: 1.7; }
input:not([type=checkbox]):not([type=radio]):focus, select:focus, textarea:focus {
  border-color: var(--brand); background: #fff; outline: 2px solid rgba(78,83,92,.1); outline-offset: 1px;
}
.search { width: 300px; min-height: 40px; padding: 0 12px; border: 1px solid transparent; border-radius: var(--control-radius); background: #f2f2f2; }
.search input { min-height: 38px!important; height: 38px; margin: 0; padding: 0!important; border: 0!important; background: transparent!important; outline: none!important; font-size: 13px; }
.search:focus-within { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 2px rgba(78,83,92,.1); }
.segmented { padding: 4px; border: 0; border-radius: 10px; }
.segmented button { min-height: 32px; padding: 6px 12px; border-radius: 7px; }

/* Rounded, inset navigation selection instead of a full-width heavy block. */
.sidebar-navigation { padding: 0 4px; }
.sidebar-navigation .nav-item { width: 100%; min-height: 44px; padding: 10px 12px; margin-bottom: 6px; border-left: 3px solid transparent; border-radius: 0; font-size: 13px; }
.sidebar-navigation .nav-item.active, .sidebar-navigation .nav-item.active:hover { background: transparent; border-left: 3px solid var(--brand); font-weight: 700; color: #0f172a; }
.sidebar-navigation .nav-item.active::before { display: none; }
.sidebar-navigation .nav-label { margin: 8px 12px 16px; font-size: 11px; }
.sidebar-navigation .lower-label { margin-top: 28px; }
.workspace-label { padding: 14px 12px; margin-bottom: 28px; box-shadow: none; }
.workspace-avatar { width: 32px; height: 32px; border-radius: 8px; }

/* Followups, business and dialogs use the same content gutters. */
.task-row { padding: 24px var(--space-card); gap: 20px; border-color: var(--row-line); }
.panel.agenda { background: transparent; border: 0; box-shadow: none; overflow: visible; }
.agenda .panel-heading { padding: 0 0 20px; }
.followup-list { display: grid; gap: 12px; }
.followup-list>.task-row { margin: 0; padding: 24px; background: #fff; border: 0; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.followup-list .date-box, .followup-list .date-box.late { background: #eff6ff; color: #1e40af; border: 0; border-radius: 6px; }
.agenda>.panel-foot { padding: 16px 0 0; background: transparent; border: 0; }
.task-info .text-button { font-size: 14px; line-height: 1.6; }
.task-info p { margin: 8px 0; font-size: 13px; line-height: 1.7; }
.task-info small { font-size: 12px; }
.date-box { min-width: 48px; padding: 10px 8px; border: 0; border-radius: 8px; }
.task-end { gap: 12px; flex-shrink: 0; }
.brand-row { padding: 28px var(--space-card); border-color: var(--row-line); }
.brand-row .brand-word { display: block; font-size: 18px; font-weight: 700; line-height: 1.5; }
.brand-row .brand-alias { display: block; margin-top: 4px; font-size: 11px; color: var(--muted); letter-spacing: .6px; }
.brand-row .brand-opportunities { display: flex; align-items: baseline; gap: 6px; margin-top: 8px; font-size: 13px; color: #64748b; }
.brand-opportunities b { font-size: 16px; font-weight: 600; }
.brand-results { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; margin-left: auto; }
.brand-results b { font-size: 24px; font-weight: 650; }
.brand-results>span { font-size: 12px; color: var(--muted); }
.simple-task { padding: 24px var(--space-card); gap: 24px; border-color: var(--row-line); }
.task-tabs { padding: 0 var(--space-card); }
.business-store { padding: 28px var(--space-card); border-color: var(--row-line); }
.business-links { gap: 24px; margin: 32px 0; }
.business-links>button { padding: 24px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--card-shadow); }
.cohort-bar { margin-bottom: 24px; gap: 24px; }
.assistant-layout { gap: 24px; }
.assistant-answer { padding: var(--space-card); }
.assistant-choice { padding: 20px; }
.assistant-choices .assistant-choice { margin-bottom: 16px; }
.assistant-choice small { line-height: 1.8; margin-top: 8px; }
.dialog-head { padding: 28px 32px; }
.form-grid { gap: 24px; }
.detail-shop { padding: 24px; }
.detail-consent, .invite-box { padding: 24px; }
.rule-row { padding: 20px 0; gap: 16px; }

@media(max-width:1280px) {
  :root { --space-card: 24px; }
  main { padding: 28px 28px 0; }
  .topbar { padding-left: 28px; padding-right: 28px; }
  .metrics, .business-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .overview-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .metrics .metric, .business-summary>div { padding: 24px; }
}
@media(max-width:900px) {
  .sidebar { width: 208px; }
  .main-shell { margin-left: 208px; }
  main { padding: 24px 24px 0; }
  .topbar { padding: 16px 24px; }
  .assistant-layout { grid-template-columns: 1fr; }
  .toolbar, .cohort-bar { flex-wrap: wrap; }
  .search { width: 100%; max-width: none; }
  .task-row { gap: 16px; }
  .task-info .muted-text { display: none; }
}
@media(max-width:640px) {
  :root { --space-card: 24px; --space-section: 24px; --space-grid: 20px; }
  .sidebar { width: 240px; padding: 24px 16px; }
  .main-shell { margin-left: 0; }
  main { padding: 24px 16px 0; }
  .topbar { padding: 12px 16px; min-height: 64px; }
  .page-heading { align-items: flex-start; flex-wrap: wrap; gap: 16px; margin-bottom: 24px; }
  .page-heading h1 { font-size: 28px; }
  .page-heading p { font-size: 14px; }
  .heading-actions { flex-shrink: 0; gap: 8px; }
  .heading-actions .button.export-button { display: inline-flex; }
  .toolbar { gap: 16px; margin-bottom: 24px; }
  .metrics, .metrics.three, .business-summary { grid-template-columns: 1fr; gap: 16px; }
  .metrics .metric, .business-summary>div { padding: 24px; }
  .metrics .metric strong, .metrics .metric strong.amount, .business-summary strong { font-size: 32px; letter-spacing: -.6px; }
  .metrics .metric p { font-size: 11px; }
  .panel-heading, .daily-list .list-heading, .business-stores .list-heading,
  .assistant-output .list-heading { padding: 24px; flex-wrap: wrap; gap: 12px; }
  .panel-heading>.text-button { min-height: 36px; }
  .table-scroll { padding: 0 8px 12px; }
  .table-scroll th { padding: 16px; }
  .table-scroll td { padding: 18px 16px; }
  .table-scroll table { font-size: 13px; }
  .filter-line { gap: 12px; }
  .tabs { gap: 24px; }
  .task-row { flex-wrap: wrap; align-items: flex-start; padding: 24px; gap: 16px; }
  .agenda .panel-heading { padding: 0 0 20px; }
  .task-info { min-width: 150px; }
  .task-end { width: 100%; display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
  .task-end .badge { margin-right: auto; }
  .simple-task { gap: 16px; }
  .business-store { padding: 24px; }
  .business-links { flex-direction: column; }
  .button, .button.small, .button.ghost, .button.primary, .account-button,
  .task-end .button, .simple-task .button, .heading-actions .button,
  .assistant-compose .button, .assistant-output .button, .form-footer .button,
  .pagination .button { height: 44px; min-height: 44px; padding: 0 12px; font-size: 13px; }
  .icon-button { width: 44px; height: 44px; }
  input:not([type=checkbox]):not([type=radio]), select, textarea { min-height: 44px; font-size: 16px; }
  .search { min-height: 44px; }
  .search input { min-height: 42px!important; height: 42px; font-size: 16px; }
  .segmented { width: 100%; }
  .segmented button { min-height: 36px; }
  .kanban { grid-template-columns: repeat(5,minmax(260px,82vw)); gap: 16px; }
  .client-list { padding: 0 16px; }
  .client-row { padding: 24px 8px; gap: 16px; }
  .dialog-head { padding: 24px; }
  .form-grid { grid-template-columns: 1fr; gap: 24px; }
  .detail-shops { grid-template-columns: 1fr; }
  .detail-shop { padding: 24px; }
  .cohort-bar label { flex-wrap: wrap; }
}
@media(prefers-reduced-motion:reduce) { button { transition: none; } }
