/* ==========================================================================
   Reusable UI components shared across every page — v0.2
   One card language, one button hierarchy, one table style — used
   identically everywhere so the product reads as one system, not ten
   pages built at different times.
   ========================================================================== */

/* ---- Buttons ---------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 9px var(--sp-4);
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: var(--ls-snug);
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), transform var(--dur-instant) var(--ease);
  white-space: nowrap;
}
.btn [data-icon] { width: 16px; height: 16px; transition: transform var(--dur-med) var(--ease-out-expo); }
.btn:hover [data-icon] { transform: translateY(-1px) scale(1.06); }
.btn:active { transform: translateY(1px) scale(0.98); }

.btn-primary { background: var(--accent); color: var(--text-on-accent); box-shadow: 0 1px 1px rgba(0,0,0,0.06), 0 4px 10px rgba(143,191,167,0.35); }
.btn-primary:hover { background: var(--accent-strong); box-shadow: 0 1px 1px rgba(0,0,0,0.08), 0 6px 16px rgba(94,145,121,0.4); }

.btn-secondary { background: var(--bg-surface); color: var(--text-primary); border: 1px solid var(--border-strong); }
.btn-secondary:hover { background: var(--bg-surface-alt); border-color: var(--slate-400); }

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

.btn-sm { padding: 6px 11px; font-size: var(--fs-xs); }
.btn-lg { padding: 12px 20px; font-size: var(--fs-base); }
.btn-danger { background: var(--danger-soft); color: var(--danger-strong); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-icon-only { padding: 9px; }

.btn-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn-loading::after {
  content: '';
  position: absolute; width: 15px; height: 15px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: currentColor;
  color: var(--text-on-accent);
  animation: btn-spin 650ms linear infinite;
}
.btn-secondary.btn-loading::after, .btn-ghost.btn-loading::after { color: var(--text-primary); border-color: var(--border-strong); border-top-color: var(--text-primary); }
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* ---- Cards -------------------------------------------------------------- */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--dur-med) var(--ease-out-expo), border-color var(--dur-med) var(--ease-out-expo), transform var(--dur-med) var(--ease-out-expo);
}
.card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.card-header [data-icon] { transition: transform var(--dur-med) var(--ease-out-expo), color var(--dur-fast) var(--ease); }
.card:hover .card-header [data-icon] { color: var(--accent-strong); transform: scale(1.08) rotate(-3deg); }
.card-pad { padding: var(--sp-5); }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-5) var(--sp-5) var(--sp-4);
  border-bottom: 1px solid var(--border-subtle);
  gap: var(--sp-3);
}
.card-header h3 { font-size: var(--fs-base); }
.card-header .u-hint { margin-top: 3px; }

.grid { display: grid; gap: var(--sp-5); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) { .grid-cols-4 { grid-template-columns: repeat(2, 1fr); } .grid-cols-3 { grid-template-columns: repeat(2, 1fr);} }
@media (max-width: 680px) { .grid-cols-2, .grid-cols-3, .grid-cols-4 { grid-template-columns: 1fr; } }

/* ---- KPI tiles ------------------------------------------------------- */
.kpi-tile {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--dur-med) var(--ease-out-expo), transform var(--dur-med) var(--ease-out-expo), border-color var(--dur-med) var(--ease);
}
.kpi-tile:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--border-strong); }
.kpi-tile .kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-3); }
.kpi-tile .kpi-icon {
  width: 34px; height: 34px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent-strong);
}
.kpi-tile .kpi-icon [data-icon] { width: 17px; height: 17px; }
.kpi-tile .kpi-label { color: var(--text-secondary); font-size: var(--fs-sm); font-weight: 500; }
.kpi-tile .kpi-value { font-size: var(--fs-2xl); font-weight: 700; letter-spacing: var(--ls-tight); margin: 3px 0 7px; }
.kpi-delta { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-xs); font-weight: 600; }
.kpi-delta [data-icon] { width: 13px; height: 13px; }
.kpi-delta.up { color: var(--success-strong); }
.kpi-delta.down { color: var(--danger); }

/* ---- Status pills -------------------------------------------------- */
.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px 3px 8px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-xs);
  font-weight: 600;
  background: var(--status-soft, var(--slate-100));
  color: var(--status-color, var(--slate-600));
  white-space: nowrap;
}
.status-pill::before {
  content: '';
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--status-color, var(--slate-500));
  flex-shrink: 0;
}

/* ---- Tables ------------------------------------------------------------ */
.table-wrap { overflow-x: auto; }
.data-table { font-size: var(--fs-sm); }
.data-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: var(--ls-wide);
  color: var(--text-muted);
  font-weight: 700;
  padding: var(--sp-3) var(--sp-5);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
  background: var(--bg-surface-alt);
  position: sticky;
  top: 0;
  z-index: 1;
}
.data-table th.is-sortable { cursor: pointer; user-select: none; transition: color var(--dur-fast) var(--ease); }
.data-table th.is-sortable:hover { color: var(--text-primary); }
.data-table th.is-sortable .sort-arrow { display: inline-block; margin-left: 3px; opacity: 0.4; transition: opacity var(--dur-fast) var(--ease); }
.data-table th.is-sorted .sort-arrow { opacity: 1; color: var(--accent-strong); }
.data-table td {
  padding: 13px var(--sp-5);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  vertical-align: middle;
}
.data-table tbody tr { transition: background var(--dur-fast) var(--ease), transform var(--dur-med) var(--ease-out-expo); animation: client-row-in 360ms var(--ease-out-expo) both; }
.data-table tbody tr:nth-child(2){animation-delay:35ms}.data-table tbody tr:nth-child(3){animation-delay:70ms}.data-table tbody tr:nth-child(4){animation-delay:105ms}.data-table tbody tr:nth-child(5){animation-delay:140ms}
.data-table tbody tr:hover { background: var(--bg-surface-alt); transform: translateX(2px); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table td.num, .data-table th.num { text-align: right; }
.cell-primary { font-weight: 600; }
.cell-sub { color: var(--text-muted); font-size: var(--fs-xs); margin-top: 2px; }

.table-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-3) var(--sp-5);
  border-top: 1px solid var(--border-subtle);
  font-size: var(--fs-xs); color: var(--text-muted);
}
.pagination { display: flex; align-items: center; gap: 4px; }
.page-btn {
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); font-size: var(--fs-xs); font-weight: 600;
  color: var(--text-secondary); transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.page-btn:hover:not(:disabled) { background: var(--bg-surface-alt); color: var(--text-primary); }
.page-btn.is-active { background: var(--ink-900); color: #fff; }
.page-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.page-btn [data-icon] { width: 14px; height: 14px; }

/* ---- Avatars ----------------------------------------------------------- */
.avatar-chip { display: inline-flex; align-items: center; gap: var(--sp-2); }
.avatar-sm {
  width: 27px; height: 27px; border-radius: 50%;
  background: var(--steel-100); color: var(--steel-600);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
  box-shadow: var(--shadow-inset-hairline);
  transition: transform var(--dur-med) var(--ease-out-expo), box-shadow var(--dur-med) var(--ease-out-expo);
}
.avatar-chip:hover .avatar-sm { transform: translateY(-1px) scale(1.06); box-shadow: var(--shadow-sm); }

@keyframes client-row-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

/* ---- Progress bars --------------------------------------------------- */
.progress-track {
  height: 6px; border-radius: var(--radius-pill);
  background: var(--slate-100); overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: var(--radius-pill);
  background: var(--status-color, var(--accent));
  transition: width 900ms var(--ease-out-expo);
  width: 0;
}

/* ---- Tabs -------------------------------------------------------------- */
.tabs { display: flex; gap: var(--sp-1); border-bottom: 1px solid var(--border-subtle); margin-bottom: var(--sp-5); }
.tab-btn {
  padding: var(--sp-3) var(--sp-2);
  font-size: var(--fs-sm); font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.is-active { color: var(--accent-strong); border-color: var(--accent); }

/* ---- Filter bar ---------------------------------------------------- */
.filter-bar { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-5); flex-wrap: wrap; }
.select {
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  font-size: var(--fs-sm);
  color: var(--text-primary);
  transition: border-color var(--dur-fast) var(--ease);
}
.select:hover { border-color: var(--slate-400); }
.search-input {
  display: flex; align-items: center; gap: var(--sp-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  background: var(--bg-surface);
  min-width: 220px;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.search-input:focus-within { border-color: var(--accent); box-shadow: var(--shadow-focus); }
.search-input [data-icon] { width: 15px; height: 15px; color: var(--text-muted); }
.search-input input { border: none; outline: none; background: none; flex: 1; font-size: var(--fs-sm); }

/* ---- Kanban columns (Sales pipeline / Projects) ---------------------- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: 276px; gap: var(--sp-4); overflow-x: auto; padding-bottom: var(--sp-3); }
.kanban-col { background: var(--bg-surface-sunken); border-radius: var(--radius-lg); padding: var(--sp-3); }
.kanban-col-head { display: flex; align-items: center; justify-content: space-between; padding: var(--sp-2) var(--sp-2) var(--sp-3); }
.kanban-col-head h4 { font-size: var(--fs-sm); }
.kanban-count { font-size: 11px; font-weight: 600; color: var(--text-muted); background: var(--bg-surface); border-radius: var(--radius-pill); padding: 2px 8px; box-shadow: var(--shadow-inset-hairline); }
.kanban-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--sp-3);
  margin-bottom: var(--sp-3);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition: box-shadow var(--dur-med) var(--ease-out-expo), transform var(--dur-med) var(--ease-out-expo), border-color var(--dur-fast) var(--ease);
}
.kanban-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--border-strong); }
.kanban-card h5 { font-size: var(--fs-sm); margin-bottom: 4px; }
.kanban-card .value { font-weight: 700; font-size: var(--fs-base); margin: 6px 0; letter-spacing: var(--ls-tight); }
.kanban-card .meta { display: flex; align-items: center; justify-content: space-between; margin-top: var(--sp-2); }

/* ---- Empty states -------------------------------------------------- */
.empty-state { text-align: center; padding: var(--sp-10) var(--sp-5); color: var(--text-muted); }
.empty-state [data-icon] { width: 34px; height: 34px; margin: 0 auto var(--sp-3); color: var(--text-muted); }
.empty-state h4 { color: var(--text-secondary); margin-bottom: 4px; }

/* ---- Activity / timeline feed ---------------------------------------- */
.activity-feed { display: flex; flex-direction: column; }
.activity-item { display: flex; gap: var(--sp-3); padding: var(--sp-3) 0; border-bottom: 1px solid var(--border-subtle); }
.activity-item:last-child { border-bottom: none; }
.activity-icon {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--status-soft, var(--slate-100)); color: var(--status-color, var(--slate-600));
}
.activity-icon [data-icon] { width: 15px; height: 15px; }
.activity-body p { font-size: var(--fs-sm); }
.activity-body .time { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 2px; }

/* ---- Alerts / exception banner ---------------------------------------- */
.alert-row {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  margin-bottom: var(--sp-2);
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.alert-row:hover { background: var(--bg-surface-alt); border-color: var(--border-strong); }
.alert-row .alert-icon {
  width: 30px; height: 30px; border-radius: var(--radius-sm); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--status-soft); color: var(--status-color);
}
.alert-row .alert-icon [data-icon] { width: 15px; height: 15px; }
.alert-row .alert-text { flex: 1; min-width: 0; }
.alert-row .alert-text strong { display: block; font-size: var(--fs-sm); }
.alert-row .alert-text span { font-size: var(--fs-xs); color: var(--text-muted); }

/* ---- Modal --------------------------------------------------------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(10,12,17,0.55);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; opacity: 0; pointer-events: none;
  transition: opacity var(--dur-med) var(--ease);
}
.modal-overlay.is-open { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--bg-surface); border-radius: var(--radius-lg);
  width: 480px; max-width: 92vw; max-height: 86vh; overflow-y: auto;
  box-shadow: var(--shadow-xl);
  transform: translateY(14px) scale(0.97); opacity: 0;
  transition: transform var(--dur-med) var(--ease-out-expo), opacity var(--dur-med) var(--ease-out-expo);
}
.modal-overlay.is-open .modal { transform: translateY(0) scale(1); opacity: 1; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: var(--sp-5); border-bottom: 1px solid var(--border-subtle); }
.modal-body { padding: var(--sp-5); }
.modal-foot { display: flex; justify-content: flex-end; gap: var(--sp-2); padding: var(--sp-5); border-top: 1px solid var(--border-subtle); }

/* ---- Form fields ----------------------------------------------------- */
.field { margin-bottom: var(--sp-4); }
.field label { display: block; font-size: var(--fs-sm); font-weight: 600; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  background: var(--bg-surface);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); outline: none; box-shadow: var(--shadow-focus); }
.field-hint { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 4px; }

.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); color: var(--text-secondary); cursor: pointer; user-select: none; }
.checkbox-row input[type="checkbox"] {
  appearance: none; width: 17px; height: 17px; border: 1.5px solid var(--border-strong);
  border-radius: 5px; flex-shrink: 0; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.checkbox-row input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }
.checkbox-row input[type="checkbox"]:checked::after {
  content: ''; width: 5px; height: 9px; border: solid var(--text-on-accent); border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px,-1px);
}

/* ---- Toast notifications --------------------------------------------- */
#toast-root { position: fixed; bottom: var(--sp-5); right: var(--sp-5); z-index: 200; display: flex; flex-direction: column; gap: var(--sp-2); }
.toast {
  display: flex; align-items: center; gap: var(--sp-3);
  background: var(--ink-950); color: var(--text-on-dark);
  padding: var(--sp-3) var(--sp-4); border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  font-size: var(--fs-sm);
  animation: toast-in var(--dur-med) var(--ease-out-expo);
}
.toast [data-icon] { width: 16px; height: 16px; color: var(--success); flex-shrink: 0; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(0.96); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* ---- Calendar grid (calendar.html) ------------------------------------ */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--border-subtle); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); overflow: hidden; }
.cal-dow { background: var(--bg-surface-alt); padding: var(--sp-2); text-align: center; font-size: 11px; font-weight: 700; letter-spacing: var(--ls-wide); text-transform: uppercase; color: var(--text-muted); }
.cal-cell { background: var(--bg-surface); min-height: 108px; padding: var(--sp-2); position: relative; transition: background var(--dur-fast) var(--ease); }
.cal-cell:hover { background: var(--bg-surface-alt); }
.cal-cell .date-num { font-size: var(--fs-xs); color: var(--text-muted); font-weight: 600; }
.cal-cell.is-today { box-shadow: inset 0 0 0 1.5px var(--accent); }
.cal-cell.is-today .date-num { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: var(--text-on-accent); }
.cal-cell.is-outside { background: var(--bg-surface-sunken); }
.cal-cell.is-outside .date-num { color: var(--slate-300); }
.cal-event { font-size: 11px; padding: 2px 6px; border-radius: 4px; margin-top: 4px; background: var(--status-soft); color: var(--status-color); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- AI copilot chat (ai.html) ---------------------------------------- */
.ai-hero {
  background: radial-gradient(circle at 15% 20%, rgba(184,169,217,0.18), transparent 55%), var(--ink-950);
  border-radius: var(--radius-xl);
  padding: var(--sp-6);
  margin-bottom: var(--sp-6);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.ai-hero .ai-hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: var(--ls-widest); text-transform: uppercase;
  color: var(--accent); margin-bottom: var(--sp-3);
}
.ai-hero .ai-hero-badge [data-icon] { width: 13px; height: 13px; }
.ai-hero h2 { color: var(--text-on-dark); font-size: var(--fs-xl); margin-bottom: var(--sp-2); }
.ai-hero p { color: var(--text-on-dark-muted); max-width: 52ch; }

.insight-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-3); margin-top: var(--sp-5); }
.insight-card {
  background: rgba(255,255,255,0.045);
  border: 1px solid var(--border-on-dark);
  border-radius: var(--radius-md);
  padding: var(--sp-3) var(--sp-4);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.insight-card:hover { background: rgba(255,255,255,0.08); transform: translateY(-1px); }
.insight-card .insight-label { font-size: 11px; color: var(--text-on-dark-faint); font-weight: 600; letter-spacing: var(--ls-wide); text-transform: uppercase; margin-bottom: 4px; }
.insight-card .insight-value { font-size: var(--fs-md); font-weight: 700; color: var(--text-on-dark); }
@media (max-width: 780px) { .insight-strip { grid-template-columns: 1fr; } }

.chat-shell { display: flex; flex-direction: column; }
.chat-scroll { padding: var(--sp-2) 0 var(--sp-4); }
.chat-msg { display: flex; gap: var(--sp-3); max-width: 720px; margin-bottom: var(--sp-5); animation: fade-in-up var(--dur-med) var(--ease-out-expo) both; }
.chat-msg.from-user { margin-left: auto; flex-direction: row-reverse; }
.chat-avatar { width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.chat-msg.from-ai .chat-avatar { background: var(--ink-950); color: var(--accent); box-shadow: 0 0 0 1px var(--border-on-dark); }
.chat-msg.from-user .chat-avatar { background: var(--steel-100); color: var(--steel-600); }
.chat-avatar [data-icon] { width: 15px; height: 15px; }
.chat-bubble { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: var(--sp-3) var(--sp-4); font-size: var(--fs-sm); box-shadow: var(--shadow-xs); line-height: var(--lh-normal); }
.chat-msg.from-user .chat-bubble { background: var(--ink-950); color: var(--text-on-dark); border-color: var(--ink-950); }
.chat-bubble ul { margin: var(--sp-2) 0 0 var(--sp-4); list-style: disc; }
.chat-bubble li { margin-bottom: 4px; }
.chat-bubble strong { font-weight: 600; }
.chat-suggestions { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: var(--sp-2) 0 var(--sp-6); }
.chip-btn { font-size: var(--fs-xs); font-weight: 600; padding: 7px 13px; border-radius: var(--radius-pill); background: var(--bg-surface); border: 1px solid var(--border-strong); color: var(--text-secondary); transition: all var(--dur-fast) var(--ease); }
.chip-btn:hover { border-color: var(--accent); color: var(--accent-strong); background: var(--accent-soft); }
.chat-input-row { display: flex; gap: var(--sp-3); padding-top: var(--sp-4); border-top: 1px solid var(--border-subtle); position: sticky; bottom: 0; background: var(--bg-canvas); }
.chat-input-row input { flex: 1; padding: 13px 16px; border-radius: var(--radius-md); border: 1px solid var(--border-strong); transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease); }
.chat-input-row input:focus { outline: none; border-color: var(--accent); box-shadow: var(--shadow-focus); }
.typing-dots { display: inline-flex; gap: 3px; padding: 3px 0; }
.typing-dots span { width: 5px; height: 5px; border-radius: 50%; background: var(--text-muted); animation: typing 1.1s infinite ease-in-out; }
.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing { 0%, 60%, 100% { opacity: 0.3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
.typed-cursor { display: inline-block; width: 2px; height: 13px; background: var(--accent-strong); margin-left: 2px; vertical-align: middle; animation: caret-blink 850ms step-end infinite; }
@keyframes caret-blink { 50% { opacity: 0; } }

/* ---- Permissions matrix grid (settings.html) --------------------------- */
.perm-table th, .perm-table td { text-align: center; }
.perm-table td:first-child, .perm-table th:first-child { text-align: left; }
.perm-dot { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; }
.perm-dot.full { background: var(--success-soft); color: var(--success-strong); }
.perm-dot.partial { background: var(--warning-soft); color: var(--accent-strong); }
.perm-dot.none { background: var(--slate-100); color: var(--slate-400); }
.perm-dot [data-icon] { width: 13px; height: 13px; }

/* ---- Drawer (slide-in panel for forms) --------------------------------- */
.drawer-overlay {
  position: fixed; inset: 0; background: rgba(46,46,46,0.35);
  z-index: 110; opacity: 0; pointer-events: none;
  transition: opacity var(--dur-med) var(--ease);
}
.drawer-overlay.is-open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 420px; max-width: 92vw;
  background: var(--bg-surface);
  box-shadow: var(--shadow-xl);
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--dur-med) var(--ease-out-expo);
}
.drawer-overlay.is-open .drawer { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: var(--sp-5); border-bottom: 1px solid var(--border-subtle); flex-shrink: 0; }
.drawer-head p { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 2px; }
.drawer-body { flex: 1; overflow-y: auto; padding: var(--sp-5); }
.drawer-foot { display: flex; justify-content: flex-end; gap: var(--sp-2); padding: var(--sp-5); border-top: 1px solid var(--border-subtle); flex-shrink: 0; }

/* ---- Row action menu (edit/delete on kanban cards, table rows) --------- */
.row-actions { display: flex; gap: 6px; margin-top: var(--sp-3); }
.row-actions .btn { flex: 1; justify-content: center; }
.chart-box { position: relative; width: 100%; }
.chart-legend-row { display: flex; gap: var(--sp-4); margin-top: var(--sp-3); flex-wrap: wrap; }
.legend-tag { display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--text-secondary); font-weight: 500; }
.legend-tag .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* ---- Section reveal (progressive disclosure on the calm dashboard) ----- */
.reveal-toggle {
  display: flex; align-items: center; gap: 6px;
  font-size: var(--fs-sm); font-weight: 600; color: var(--text-secondary);
  padding: var(--sp-2) 0; margin: var(--sp-2) 0 var(--sp-5);
  transition: color var(--dur-fast) var(--ease);
}
.reveal-toggle:hover { color: var(--text-primary); }
.reveal-toggle [data-icon] { width: 15px; height: 15px; transition: transform var(--dur-med) var(--ease-out-expo); }
.reveal-toggle.is-open [data-icon] { transform: rotate(180deg); }
.reveal-section { overflow: hidden; max-height: 0; opacity: 0; transition: max-height var(--dur-slower) var(--ease-out-expo), opacity var(--dur-med) var(--ease); }
.reveal-section.is-open { max-height: 3000px; opacity: 1; }

/* ==========================================================================
   v0.3 — Executive Experience components
   Hero welcome, AI brief, redesigned KPI cards, quick actions, highlights,
   chart "question" framing, and the cross-module AI insight bar. Kept as
   distinct classes from their v0.1/v0.2 counterparts (.kpi-tile, .card,
   .alert-row) so Finance/Inventory/Team/etc. are untouched — only the
   Command Center and shared shell pick these up.
   ========================================================================== */

/* ---- Hero welcome ------------------------------------------------------ */
.hero-welcome {
  display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-6);
  margin-bottom: var(--sp-6); flex-wrap: wrap;
}
.hero-welcome .eyebrow-row { display: flex; align-items: center; gap: 8px; margin-bottom: var(--sp-2); }
.hero-welcome .eyebrow-row .live-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--success);
  box-shadow: 0 0 0 3px var(--success-soft);
  animation: pulse-dot 2.2s ease-in-out infinite;
}
@keyframes pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
.hero-welcome h1 { font-size: 1.9rem; margin-bottom: 8px; }
.hero-welcome .exec-summary { font-size: var(--fs-md); color: var(--text-secondary); max-width: 62ch; line-height: 1.6; }
.hero-welcome .exec-summary strong { color: var(--text-primary); font-weight: 600; }
.hero-welcome .hero-actions { display: flex; gap: var(--sp-2); flex-shrink: 0; }

/* ---- AI Business Brief card --------------------------------------------- */
.ai-brief-card {
  background: linear-gradient(155deg, var(--ink-950) 0%, var(--ink-900) 100%);
  border-radius: var(--radius-xl);
  padding: var(--sp-5) var(--sp-6);
  margin-bottom: var(--sp-6);
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}
.ai-brief-card::before {
  content: '';
  position: absolute; top: -30%; right: -10%; width: 260px; height: 260px;
  background: radial-gradient(circle, rgba(143,191,167,0.24), transparent 70%);
  pointer-events: none;
}
.ai-brief-card .brief-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-3); position: relative; }
.ai-brief-card .brief-badge { display: flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 700; letter-spacing: var(--ls-widest); text-transform: uppercase; color: var(--accent); }
.ai-brief-card .brief-badge [data-icon] { width: 13px; height: 13px; }
.ai-brief-card .brief-time { font-size: var(--fs-xs); color: var(--text-on-dark-faint); }
.ai-brief-card .brief-list { position: relative; display: flex; flex-direction: column; gap: 9px; }
.ai-brief-card .brief-item { display: flex; align-items: flex-start; gap: 10px; font-size: var(--fs-sm); color: var(--text-on-dark-muted); line-height: 1.55; }
.ai-brief-card .brief-item .brief-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); margin-top: 8px; flex-shrink: 0; }
.ai-brief-card .brief-item strong { color: var(--text-on-dark); font-weight: 600; }
.ai-brief-card .brief-foot { margin-top: var(--sp-4); position: relative; }
.ai-brief-card .brief-foot a { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-xs); font-weight: 600; color: var(--accent); }
.ai-brief-card .brief-foot a [data-icon] { width: 13px; height: 13px; }
.brief-skeleton-line { height: 13px; border-radius: 4px; background: rgba(255,255,255,0.12); }
.brief-skeleton-line::after { background: linear-gradient(90deg, transparent, rgba(255,255,255,0.22), transparent); }
.brief-skeleton-line:nth-child(1) { width: 92%; }
.brief-skeleton-line:nth-child(2) { width: 78%; margin-top: 10px; }
.brief-skeleton-line:nth-child(3) { width: 85%; margin-top: 10px; }

/* ---- Redesigned KPI cards (Command Center only) ------------------------ */
.kpi-card-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-4); margin-bottom: var(--sp-6); }
@media (max-width: 1100px) { .kpi-card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .kpi-card-grid { grid-template-columns: 1fr; } }

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--dur-med) var(--ease-out-expo), transform var(--dur-med) var(--ease-out-expo), border-color var(--dur-med) var(--ease);
  animation: fade-in-up var(--dur-slow) var(--ease-out-expo) both;
}
.kpi-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--border-strong); }
.kpi-card-link { color: inherit; text-decoration: none; cursor: pointer; position: relative; }
.kpi-card-link:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent-strong) 38%, transparent); outline-offset: 3px; border-color: var(--accent-strong); box-shadow: var(--shadow-md); }
.kpi-card-link:active { transform: translateY(0); box-shadow: var(--shadow-sm); }
.kpi-card .kc-open-cue { display: inline-flex; align-items: center; gap: 5px; margin-top: 10px; font-size: var(--fs-xs); font-weight: 600; color: var(--accent-strong); opacity: 0; transform: translateY(3px); transition: opacity .16s ease, transform .16s ease; }
.kpi-card .kc-open-cue [data-icon] { width: 13px; height: 13px; }
.kpi-card-link:hover .kc-open-cue, .kpi-card-link:focus-visible .kc-open-cue { opacity: 1; transform: translateY(0); }
@media (hover: none) { .kpi-card .kc-open-cue { opacity: 1; transform: none; } }
.kpi-card .kc-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-3); }
.kpi-card .kc-label { font-size: var(--fs-sm); font-weight: 500; color: var(--text-secondary); }
.kpi-card .kc-icon { width: 32px; height: 32px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent-strong); flex-shrink: 0; }
.kpi-card .kc-icon [data-icon] { width: 16px; height: 16px; }
.kpi-card .kc-value { font-size: var(--fs-2xl); font-weight: 700; letter-spacing: var(--ls-tight); margin-bottom: 6px; }
.kpi-card .kc-trend { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-xs); font-weight: 600; padding-bottom: var(--sp-3); border-bottom: 1px dashed var(--border-subtle); margin-bottom: var(--sp-3); width: 100%; }
.kpi-card .kc-trend [data-icon] { width: 13px; height: 13px; }
.kpi-card .kc-trend.up { color: var(--success-strong); }
.kpi-card .kc-trend.down { color: var(--danger); }
.kpi-card .kc-insight { display: flex; align-items: flex-start; gap: 6px; font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.kpi-card .kc-insight [data-icon] { width: 12px; height: 12px; margin-top: 2px; color: var(--accent-strong); flex-shrink: 0; }

/* ---- Quick actions -------------------------------------------------- */
.quick-actions-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--sp-3); }
@media (max-width: 900px) { .quick-actions-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 560px) { .quick-actions-grid { grid-template-columns: repeat(2, 1fr); } }
.quick-action-btn {
  display: flex; flex-direction: column; align-items: center; gap: 9px;
  padding: var(--sp-4) var(--sp-2);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  text-align: center;
  transition: border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease-out-expo), background var(--dur-fast) var(--ease);
}
.quick-action-btn:hover { border-color: var(--accent); transform: translateY(-2px); background: var(--accent-soft); }
.quick-action-btn .qa-icon {
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-surface-alt); color: var(--text-secondary);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.quick-action-btn:hover .qa-icon { background: var(--accent); color: var(--text-on-accent); }
.quick-action-btn .qa-icon [data-icon] { width: 18px; height: 18px; }
.quick-action-btn span.qa-label { font-size: var(--fs-xs); font-weight: 600; color: var(--text-secondary); }
.quick-action-btn:hover span.qa-label { color: var(--text-primary); }

/* ---- Chart "question" framing -------------------------------------- */
.chart-question { margin-bottom: var(--sp-4); }
.chart-question .cq-question { font-size: var(--fs-sm); font-weight: 600; color: var(--text-muted); margin-bottom: 3px; }
.chart-question .cq-answer { font-size: var(--fs-base); font-weight: 600; color: var(--text-primary); line-height: 1.4; }
.chart-question .cq-answer .cq-highlight { color: var(--accent-strong); }

/* ---- Cross-module AI insight bar ---------------------------------------- */
.ai-insight-bar {
  display: flex; align-items: center; gap: var(--sp-3);
  background: var(--accent-soft);
  border: 1px solid #D6EAE1;
  border-radius: var(--radius-md);
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-5);
  animation: fade-in-up var(--dur-slow) var(--ease-out-expo) both;
}
.ai-insight-bar .ai-insight-icon {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--text-on-accent);
}
.ai-insight-bar .ai-insight-icon [data-icon] { width: 15px; height: 15px; }
.ai-insight-bar .ai-insight-text { flex: 1; font-size: var(--fs-sm); color: var(--slate-700); line-height: 1.5; }
.ai-insight-bar .ai-insight-text strong { color: var(--accent-strong); font-weight: 700; }
.ai-insight-bar .ai-insight-action { flex-shrink: 0; }

/* ---- Today's Highlights (renamed notifications concept) ---------------- */
.highlight-row {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-md);
  transition: background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease-out-expo);
}
.highlight-row:hover { background: var(--bg-surface-alt); transform: translateX(2px); }
.highlight-row .hl-icon {
  width: 32px; height: 32px; border-radius: var(--radius-sm); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--status-soft); color: var(--status-color);
}
.highlight-row .hl-icon [data-icon] { width: 16px; height: 16px; }
.highlight-row .hl-text { flex: 1; min-width: 0; }
.highlight-row .hl-text strong { display: block; font-size: var(--fs-sm); }
.highlight-row .hl-text span { font-size: var(--fs-xs); color: var(--text-muted); }

/* ---- Stagger entrance for grouped cards --------------------------------- */
.kpi-card:nth-child(1) { animation-delay: 0ms; }
.kpi-card:nth-child(2) { animation-delay: 60ms; }
.kpi-card:nth-child(3) { animation-delay: 120ms; }
.kpi-card:nth-child(4) { animation-delay: 180ms; }

/* ==========================================================================
   v0.5 — Living Workspace additions
   Search results dropdown, unread notification state, leave balance cards,
   the manager approval queue, inline form validation, and the leave
   request success state. Kept as their own section so they're easy to
   find/remove if this pattern changes later.
   ========================================================================== */

/* ---- Global search results ------------------------------------------- */
.topbar-search { position: relative; }
.search-results-panel {
  left: 0; right: auto; top: calc(100% + 8px);
  width: 100%; min-width: 380px; max-height: 420px; overflow-y: auto;
}
.search-result-row { cursor: pointer; }
.search-result-row:hover, .search-result-row:focus-visible { background: var(--bg-surface-alt); }

/* ---- Notification unread state ----------------------------------------- */
.dd-item[role="button"] { cursor: pointer; }
.dd-item.is-unread { background: var(--accent-soft); }
.dd-item .unread-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-strong); flex-shrink: 0; align-self: center; }

/* ---- Leave balance cards (My Leave) ------------------------------------- */
.leave-balance-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-4); }
@media (max-width: 900px) { .leave-balance-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .leave-balance-grid { grid-template-columns: 1fr; } }
.leave-balance-card {
  background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg);
  padding: var(--sp-4) var(--sp-5); box-shadow: var(--shadow-xs);
  transition: box-shadow var(--dur-med) var(--ease-out-expo), transform var(--dur-med) var(--ease-out-expo);
}
.leave-balance-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.leave-balance-card .lb-type { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); font-weight: 600; margin-bottom: var(--sp-3); }
.leave-balance-card .lb-type .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--status-color); flex-shrink: 0; }
.leave-balance-card .lb-available { font-size: var(--fs-2xl); font-weight: 700; letter-spacing: var(--ls-tight); }
.leave-balance-card .lb-available span { font-size: var(--fs-sm); font-weight: 500; color: var(--text-muted); }
.leave-balance-card .lb-breakdown { display: flex; gap: var(--sp-3); margin-top: var(--sp-3); padding-top: var(--sp-3); border-top: 1px dashed var(--border-subtle); font-size: var(--fs-xs); color: var(--text-muted); }
.leave-balance-card .lb-breakdown strong { color: var(--text-secondary); font-weight: 600; }

/* ---- Approval queue (Manager / Owner / Admin) --------------------------- */
.approval-card { border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: var(--sp-5); margin-bottom: var(--sp-4); background: var(--bg-surface); box-shadow: var(--shadow-xs); }
.approval-card .ac-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.approval-card .ac-who { display: flex; align-items: center; gap: var(--sp-3); }
.approval-card .ac-meta-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-4); margin-bottom: var(--sp-4); }
@media (max-width: 720px) { .approval-card .ac-meta-grid { grid-template-columns: 1fr 1fr; } }
.approval-card .ac-meta-grid .ac-label { font-size: 11px; font-weight: 600; letter-spacing: var(--ls-wide); text-transform: uppercase; color: var(--text-muted); margin-bottom: 3px; }
.approval-card .ac-meta-grid .ac-value { font-size: var(--fs-sm); font-weight: 600; }
.approval-card .ac-reason { background: var(--bg-surface-alt); border-radius: var(--radius-md); padding: var(--sp-3) var(--sp-4); font-size: var(--fs-sm); margin-bottom: var(--sp-4); }
.approval-card .ac-overlap { display: flex; align-items: center; gap: 8px; font-size: var(--fs-xs); color: var(--warning); margin-bottom: var(--sp-4); }
.approval-card .ac-overlap [data-icon] { width: 14px; height: 14px; }
.approval-card .ac-actions { display: flex; gap: var(--sp-2); }
.approval-card .ac-comment-input { width: 100%; margin-bottom: var(--sp-3); }

/* ---- Inline form validation --------------------------------------------- */
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }
.field-error-text { display: none; align-items: center; gap: 5px; font-size: var(--fs-xs); color: var(--danger-strong); margin-top: 5px; font-weight: 500; }
.field.has-error .field-error-text { display: flex; }
.field-error-text [data-icon] { width: 13px; height: 13px; flex-shrink: 0; }

/* ---- Duration summary + success state (Request Leave) ------------------ */
.duration-summary { display: flex; align-items: center; gap: var(--sp-3); background: var(--accent-soft); border-radius: var(--radius-md); padding: var(--sp-4); margin-bottom: var(--sp-4); }
.duration-summary .ds-icon { width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: var(--text-on-accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.duration-summary .ds-text strong { display: block; font-size: var(--fs-base); }
.duration-summary .ds-text span { font-size: var(--fs-xs); color: var(--text-secondary); }

.success-state { text-align: center; padding: var(--sp-8) var(--sp-5); }
.success-state .ss-icon {
  width: 56px; height: 56px; border-radius: 50%; margin: 0 auto var(--sp-4);
  background: var(--success-soft); color: var(--success-strong);
  display: flex; align-items: center; justify-content: center;
  animation: success-pop 420ms var(--ease-spring) both;
}
@keyframes success-pop { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.success-state .ss-icon [data-icon] { width: 28px; height: 28px; }
.success-state h3 { margin-bottom: var(--sp-2); }
.success-state p { color: var(--text-secondary); max-width: 38ch; margin: 0 auto; }

/* ---- Approval timeline (My Requests detail) ------------------------------ */
.approval-timeline { position: relative; padding-left: 24px; }
.approval-timeline::before { content: ''; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 1.5px; background: var(--border-strong); }
.timeline-step { position: relative; padding-bottom: var(--sp-4); }
.timeline-step:last-child { padding-bottom: 0; }
.timeline-step::before {
  content: ''; position: absolute; left: -24px; top: 3px; width: 11px; height: 11px; border-radius: 50%;
  background: var(--status-color, var(--slate-400)); border: 2px solid var(--bg-surface); box-shadow: 0 0 0 1.5px var(--status-color, var(--slate-400));
}
.timeline-step strong { display: block; font-size: var(--fs-sm); }
.timeline-step .ts-meta { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 2px; }
.timeline-step .ts-comment { font-size: var(--fs-xs); color: var(--text-secondary); margin-top: 4px; font-style: italic; }

/* ---- Undo toast ---------------------------------------------------------- */
.toast.toast-with-action { padding-right: var(--sp-2); }
.toast .toast-undo-btn {
  font-size: var(--fs-xs); font-weight: 700; color: var(--accent); padding: 4px 10px;
  border-radius: var(--radius-sm); margin-left: var(--sp-2); flex-shrink: 0;
  transition: background var(--dur-fast) var(--ease);
}
.toast .toast-undo-btn:hover { background: rgba(255,255,255,0.1); }

/* ---- Manpower snapshot (Owner / Command Center) -------------------------- */
.manpower-bar { display: flex; height: 8px; border-radius: var(--radius-pill); overflow: hidden; background: var(--slate-100); margin: var(--sp-3) 0; }
.manpower-bar .mb-available { background: var(--success); }
.manpower-bar .mb-away { background: var(--warning); }

/* ---- Attendance summary strip -------------------------------------------- */
.attendance-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-3); }
@media (max-width: 640px) { .attendance-strip { grid-template-columns: repeat(2, 1fr); } }
.attendance-mini { text-align: center; padding: var(--sp-4); border-radius: var(--radius-md); background: var(--bg-surface-alt); }
.attendance-mini .am-value { font-size: var(--fs-xl); font-weight: 700; letter-spacing: var(--ls-tight); }
.attendance-mini .am-label { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 2px; }


/* v0.7 consolidation: deep-link highlight and calm demo polish */
.record-highlight { animation: nexus-record-pulse 1.8s ease both; position: relative; }
@keyframes nexus-record-pulse { 0%,100% { box-shadow:none; background:transparent; } 20%,65% { box-shadow:0 0 0 3px color-mix(in srgb, var(--sage) 35%, transparent); background:color-mix(in srgb, var(--sage) 10%, transparent); } }
html[data-density="compact"] .card-pad { padding: var(--sp-4); }
html[data-density="compact"] .data-table th, html[data-density="compact"] .data-table td { padding-top:9px; padding-bottom:9px; }
html[data-motion="reduce"] *, html[data-motion="reduce"] *::before, html[data-motion="reduce"] *::after { animation-duration:0.01ms !important; animation-iteration-count:1 !important; transition-duration:0.01ms !important; }

/* RC1 012-dev3 — purposeful content motion */
.card,.kpi-card,.metric-card,.priority-item,.health-card{animation:client-content-rise .62s cubic-bezier(.16,1,.3,1) both}
.kpi-card:nth-child(2),.metric-card:nth-child(2){animation-delay:.08s}.kpi-card:nth-child(3),.metric-card:nth-child(3){animation-delay:.16s}.kpi-card:nth-child(4),.metric-card:nth-child(4){animation-delay:.24s}
.kpi-value,.metric-value{animation:client-value-focus .75s .28s cubic-bezier(.16,1,.3,1) both}
.status-dot,.live-dot{animation:client-live-pulse 2.4s ease-in-out infinite}
.btn:active,.icon-btn:active,.chip-btn:active{transform:scale(.96)}
@keyframes client-content-rise{from{opacity:0;transform:translateY(18px) scale(.992)}to{opacity:1;transform:none}}
@keyframes client-value-focus{from{opacity:0;filter:blur(5px);transform:translateY(8px)}to{opacity:1;filter:blur(0);transform:none}}
@keyframes client-live-pulse{0%,100%{box-shadow:0 0 0 0 rgba(92,150,128,0)}50%{box-shadow:0 0 0 6px rgba(92,150,128,.14)}}
@media(prefers-reduced-motion:reduce){.card,.kpi-card,.metric-card,.priority-item,.health-card,.kpi-value,.metric-value,.status-dot,.live-dot{animation:none!important}}
.shortcut-list > div { padding:12px 0; border-bottom:1px solid var(--border); gap:24px; }


/* RC1 Build 001 — shared semantic link buttons and capability notes */
.link-button {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  color: var(--accent-strong);
  font: inherit;
  font-size: var(--fs-xs);
  font-weight: 600;
  cursor: pointer;
}
.link-button:hover { color: var(--accent-strong); text-decoration: underline; }
.link-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.capability-note {
  display: flex;
  gap: var(--sp-3);
  align-items: flex-start;
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-soft, var(--bg-subtle));
  color: var(--text-muted);
}
.capability-note > [data-icon] { flex: 0 0 auto; margin-top: 2px; }
.capability-note div { display: grid; gap: 2px; }
.capability-note strong { color: var(--text); font-size: var(--fs-sm); }
.capability-note span { font-size: var(--fs-xs); line-height: 1.5; }
.search-result-row.is-selected { background: var(--accent-soft); }

/* Ask Nexus answer action: a complete, readable navigation card. */
.nexus-answer-action {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 30px;
  align-items: center;
  gap: 11px;
  width: min(100%, 390px);
  margin-top: 14px;
  padding: 10px 11px;
  border: 1px solid color-mix(in srgb, var(--accent) 62%, var(--border));
  border-radius: 13px;
  background: color-mix(in srgb, var(--accent-soft) 82%, white);
  color: var(--text-primary);
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(18, 24, 38, 0.07);
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.nexus-answer-action-icon,
.nexus-answer-action-arrow {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}
.nexus-answer-action-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--text-on-accent);
}
.nexus-answer-action-icon svg { width: 17px; height: 17px; }
.nexus-answer-action-copy { display: grid; gap: 2px; min-width: 0; }
.nexus-answer-action-label { display: block; color: var(--text-primary); font-size: var(--fs-sm); font-weight: 700; line-height: 1.3; }
.nexus-answer-action-hint { display: block; color: var(--text-muted); font-size: 11px; font-weight: 500; line-height: 1.35; }
.nexus-answer-action-arrow {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--bg-surface);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border));
  color: var(--accent-strong);
}
.nexus-answer-action-arrow svg { width: 16px; height: 16px; }
.nexus-answer-action:hover { border-color: var(--accent-strong); background: color-mix(in srgb, var(--accent-soft) 70%, white); box-shadow: 0 6px 16px rgba(18, 24, 38, 0.1); transform: translateY(-1px); }
.nexus-answer-action:hover .nexus-answer-action-arrow { background: var(--accent); color: var(--text-on-accent); }
.nexus-answer-action:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
@media (max-width: 560px) {
  .nexus-answer-action { width: 100%; grid-template-columns: 32px minmax(0, 1fr) 28px; }
}


/* RC1 Build 003 — Executive Intelligence response system */
.nexus-answer-card { min-width: min(620px, 72vw); }
.nexus-answer-head { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:8px; }
.nexus-answer-kicker { display:inline-flex; align-items:center; gap:6px; color:var(--accent-strong); font-size:10px; font-weight:800; letter-spacing:.11em; text-transform:uppercase; }
.nexus-answer-kicker svg { width:13px; height:13px; }
.nexus-confidence,.nexus-answer-metric { display:inline-flex; align-items:center; min-height:24px; padding:4px 8px; border-radius:999px; background:var(--bg-subtle); color:var(--text-muted); font-size:10px; font-weight:700; white-space:nowrap; }
.nexus-answer-title { margin:0 0 5px; color:var(--text-primary); font-size:var(--fs-md); line-height:1.35; }
.nexus-answer-body { margin:0; color:var(--text-secondary); line-height:1.55; }
.nexus-answer-why { display:flex; gap:9px; align-items:flex-start; margin-top:12px; padding:10px 11px; border-radius:11px; background:var(--bg-subtle); color:var(--text-muted); font-size:11px; line-height:1.45; }
.nexus-answer-why > svg { width:15px; height:15px; flex:0 0 auto; margin-top:1px; color:var(--accent-strong); }
.nexus-answer-why span { display:grid; gap:2px; }
.nexus-answer-why strong { color:var(--text-primary); font-size:11px; }
.nexus-brief-list { display:grid; gap:8px; margin-top:14px; }
.nexus-brief-item { display:grid; grid-template-columns:26px minmax(0,1fr) 18px; align-items:center; gap:10px; padding:10px 11px; border:1px solid var(--border-subtle); border-radius:12px; color:inherit; text-decoration:none; background:var(--bg-surface); transition:.16s ease; }
.nexus-brief-item:hover { transform:translateY(-1px); border-color:var(--accent); box-shadow:var(--shadow-xs); }
.nexus-brief-rank { display:grid; place-items:center; width:24px; height:24px; border-radius:8px; background:var(--bg-subtle); color:var(--text-muted); font-size:11px; font-weight:800; }
.nexus-brief-copy { display:grid; gap:2px; min-width:0; }
.nexus-brief-copy strong { color:var(--text-primary); font-size:12px; }
.nexus-brief-copy small { color:var(--text-muted); font-size:10px; line-height:1.4; }
.nexus-brief-arrow { width:15px; height:15px; color:var(--accent-strong); }
.nexus-brief-item.severity-high .nexus-brief-rank,.nexus-answer-card.severity-high .nexus-answer-metric { background:var(--danger-soft,#fff0ef); color:var(--danger,#b42318); }
.nexus-brief-item.severity-medium .nexus-brief-rank,.nexus-answer-card.severity-medium .nexus-answer-metric { background:var(--warning-soft,#fff7e6); color:var(--warning-strong,#9a6700); }
.nexus-brief-item.severity-low .nexus-brief-rank,.nexus-answer-card.severity-low .nexus-answer-metric { background:var(--success-soft,#eaf8f1); color:var(--success-strong,#18794e); }
@media (max-width:700px){.nexus-answer-card{min-width:0}.nexus-answer-head{align-items:flex-start}.nexus-confidence,.nexus-answer-metric{white-space:normal;text-align:right}}


/* RC1 Build 003.1 — collision-proof Nexus CTA layout */
.chat-msg.from-ai > div { min-width: 0; max-width: 100%; }
.chat-msg.from-ai .chat-bubble { min-width: 0; overflow: visible; }
.nexus-answer-card { width: 100%; max-width: 100%; }
.nexus-answer-action {
  box-sizing: border-box;
  grid-template-columns: 36px minmax(0, 1fr) 34px;
  min-height: 62px;
  max-width: 430px;
  overflow: hidden;
}
.nexus-answer-action > * { min-width: 0; }
.nexus-answer-action-copy { overflow: hidden; }
.nexus-answer-action-label,
.nexus-answer-action-hint { overflow-wrap: anywhere; }
.nexus-answer-action-arrow { justify-self: end; }
@media (max-width: 620px) {
  .nexus-answer-card { min-width: 0; }
  .nexus-answer-action {
    width: 100%;
    max-width: none;
    grid-template-columns: 34px minmax(0, 1fr) 32px;
    gap: 10px;
    padding: 11px;
  }
}
@media (max-width: 380px) {
  .nexus-answer-action { grid-template-columns: 32px minmax(0, 1fr) 30px; gap: 8px; }
  .nexus-answer-action-icon { width: 32px; height: 32px; }
  .nexus-answer-action-arrow { width: 30px; height: 30px; }
}

/* RC1 Build 011.4 — actionable calendar */
.cal-cell:not(.is-outside) { cursor: pointer; }
.cal-cell:not(.is-outside):focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: -3px; z-index: 1; }
.cal-cell.is-selected { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-event { cursor: pointer; border: 0; display: block; width: 100%; text-align: left; font-family: inherit; }
.cal-event:hover { filter: brightness(.97); transform: translateY(-1px); }
.cal-event:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.cal-event-time { opacity: .76; margin-right: 4px; }
.cal-event.is-user-event::after { content: '•'; float: right; opacity: .55; }
.calendar-form-grid { display:grid; grid-template-columns:1fr 1fr; gap:var(--sp-4); }
.calendar-form-grid .field-full { grid-column:1 / -1; }
.calendar-event-meta { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:var(--sp-3); padding:var(--sp-4); border:1px solid var(--border-subtle); border-radius:var(--radius-md); background:var(--bg-surface-alt); }
.calendar-event-meta > div span { display:block; color:var(--text-muted); font-size:var(--fs-xs); margin-bottom:4px; }
.calendar-event-meta > div strong { display:block; overflow-wrap:anywhere; }
.calendar-empty-hint { font-size:10px; color:var(--text-muted); margin-top:6px; opacity:0; transition:opacity var(--dur-fast) var(--ease); }
.cal-cell:hover .calendar-empty-hint, .cal-cell:focus-visible .calendar-empty-hint { opacity:1; }
@media (max-width:760px){ .calendar-form-grid,.calendar-event-meta{grid-template-columns:1fr}.calendar-form-grid .field-full{grid-column:auto}.cal-header-actions{flex-wrap:wrap}.cal-grid{overflow-x:auto;grid-template-columns:repeat(7,minmax(112px,1fr))} }
.calendar-event-meta .field-full { grid-column: 1 / -1; }


/* RC1 Build 011.5 — persistent calendar month navigation */
.calendar-toolbar{display:flex;align-items:center;justify-content:space-between;gap:var(--sp-4);margin-bottom:var(--sp-4);flex-wrap:wrap}
.calendar-month-nav{display:flex;align-items:center;gap:var(--sp-2);min-width:0}
.calendar-month-nav h3{min-width:170px;text-align:center;margin:0}
.calendar-nav-btn{width:40px;padding-left:0;padding-right:0;justify-content:center}
@media (max-width:760px){.calendar-toolbar{align-items:flex-start}.calendar-month-nav{width:100%;flex-wrap:wrap}.calendar-month-nav h3{flex:1;min-width:140px}.calendar-toolbar .chart-legend-row{overflow-x:auto;flex-wrap:nowrap;max-width:100%;padding-bottom:4px}}
