/* ============================================================
   EMPIRE OS — Component library (shared across every tab)
   ============================================================ */

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  height: 36px; padding: 0 14px; border-radius: var(--r-sm);
  font-size: var(--fs-sm); font-weight: 560; color: var(--text-200);
  background: var(--surface-2); border: 1px solid var(--border);
  transition: background var(--t-fast) var(--ease-smooth), border-color var(--t-fast) var(--ease-smooth), color var(--t-fast) var(--ease-smooth), box-shadow var(--t-fast) var(--ease-smooth), transform var(--t-fast) var(--ease-smooth);
  white-space: nowrap; user-select: none;
}
.btn { background: var(--surface-0); border: 1px solid var(--border-strong); }
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); color: var(--text-100); }
.btn:active { transform: scale(0.98); }
.btn svg, .btn .ico { width: 16px; height: 16px; }
.btn-primary {
  color: var(--accent-fg); font-weight: 600;
  background: var(--accent);
  border: 1px solid var(--accent); box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-fg); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border); }
.btn-sm { height: 30px; padding: 0 11px; font-size: var(--fs-xs); border-radius: var(--r-xs); }

/* Global keyboard focus ring (a11y) — visible only for keyboard users.
   Views may declare their own scoped :focus-visible; these are the OS-wide defaults. */
.btn:focus-visible, .btn-icon:focus-visible,
.segmented button:focus-visible, .subtabs button:focus-visible, .toggle:focus-visible,
[role="button"]:focus-visible, [role="tab"]:focus-visible {
  outline: none; box-shadow: 0 0 0 3px var(--accent-ring);
}
.card-hover:focus-visible, .kard:focus-visible {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring);
}
.btn-icon { width: 36px; padding: 0; }
.btn-icon.btn-sm { width: 30px; }
.btn-danger { color: var(--red-400); }
.btn-danger:hover { background: var(--red-bg); border-color: var(--red-400); color: var(--red-400); }

/* ---------- Cards ---------- */
.card {
  background: var(--surface-0);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
}
.card-pad { padding: var(--sp-5); }
.card-hover { transition: transform var(--t-med) var(--ease-smooth), border-color var(--t-med) var(--ease-smooth), box-shadow var(--t-med) var(--ease-smooth); }
.card-hover:hover { transform: translateY(-2px); border-color: var(--border-strong); box-shadow: var(--shadow-elevated); }
.card-glow { position: relative; overflow: hidden; }
.card-glow::before { content: none; }
.panel { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--r-md); }

/* ---------- Section header ---------- */
.section-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: var(--sp-5); gap: var(--sp-4); }
.section-head h2 { font-size: var(--fs-h2); }
.section-title { display: flex; align-items: center; gap: var(--sp-3); }
.section-title .ico { color: var(--text-300); }

/* ---------- Tags / pills / badges ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px;
  border-radius: var(--r-pill); font-size: var(--fs-2xs); font-weight: 600;
  letter-spacing: 0.02em; border: 1px solid transparent; white-space: nowrap;
  background: var(--surface-3); color: var(--text-300);
}
.tag .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag-green  { color: var(--green-400);  background: var(--green-bg);  border-color: color-mix(in srgb, var(--green-400) 20%, transparent); }
.tag-red    { color: var(--red-400);    background: var(--red-bg);    border-color: color-mix(in srgb, var(--red-400) 20%, transparent); }
.tag-amber  { color: var(--amber-400);  background: var(--amber-bg);  border-color: color-mix(in srgb, var(--amber-400) 20%, transparent); }
.tag-blue   { color: var(--blue-400);   background: var(--blue-bg);   border-color: color-mix(in srgb, var(--blue-400) 20%, transparent); }
.tag-violet { color: var(--violet-400); background: var(--violet-bg); border-color: color-mix(in srgb, var(--violet-400) 20%, transparent); }
.tag-teal   { color: var(--teal-400);   background: var(--teal-bg);   border-color: color-mix(in srgb, var(--teal-400) 20%, transparent); }
.tag-pink   { color: var(--pink-400);   background: var(--pink-bg);   border-color: color-mix(in srgb, var(--pink-400) 20%, transparent); }
.tag-gold   { color: var(--text-100);   background: var(--accent-soft); border-color: var(--border-strong); }
.badge { display:inline-flex; align-items:center; justify-content:center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-pill); font-size: var(--fs-2xs); font-weight: 600; background: var(--accent); color: var(--accent-fg); }
.badge-soft { background: var(--surface-3); color: var(--text-300); }

/* ---------- Skeleton shimmer (shared) ----------
   Global loading-placeholder class. Views that already emit `.skeleton` boxes
   (workflows/integrations/team/settings) get a real shimmer here; matches the
   per-view idiom (home `.bsk`, budget `.bsk`, scheduling `.sk-bar`): a subtle
   monochrome surface-2→surface-3 sweep. prefers-reduced-motion is honoured by
   the global clamp in motion.css; the explicit rule below is a belt-and-braces
   fallback that freezes it to a static neutral surface. */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%);
  background-size: 400% 100%;
  border-radius: var(--r-xs);
  animation: skel 1.3s linear infinite;
}
@keyframes skel { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; background: var(--surface-2); }
}

/* status dot */
.sdot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 0 3px rgba(255,255,255,0.04); }
.sdot.green { background: var(--green-400); box-shadow: 0 0 0 3px var(--green-bg), 0 0 8px var(--green-400); }
.sdot.amber { background: var(--amber-400); box-shadow: 0 0 0 3px var(--amber-bg); }
.sdot.red   { background: var(--red-400);   box-shadow: 0 0 0 3px var(--red-bg); }
.sdot.gray  { background: var(--text-500); }
.sdot.blue  { background: var(--blue-400); box-shadow: 0 0 0 3px var(--blue-bg); }

/* ---------- Avatars ---------- */
.avatar {
  --sz: 32px; width: var(--sz); height: var(--sz); border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 600; color: var(--text-100); letter-spacing: 0.02em;
  background: var(--surface-3);
  border: 1px solid var(--border-strong); box-shadow: none;
  overflow: hidden; background-size: cover; background-position: center;
}
.avatar.sm { --sz: 24px; font-size: 0.62rem; }
.avatar.lg { --sz: 44px; font-size: 0.92rem; }
.avatar.xl { --sz: 64px; font-size: 1.3rem; }
.avatar.sq { border-radius: var(--r-sm); }
.avatar-stack { display: flex; }
.avatar-stack .avatar { margin-left: -8px; border: 2px solid var(--ink-800); }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* avatar color variants (hashed) — neutral monochrome tints */
.av-1, .av-2, .av-3, .av-4, .av-5, .av-6 { background: var(--surface-3); color: var(--text-200); border-color: var(--border-strong); }

/* ---------- Inputs ---------- */
.input, .textarea, .select {
  width: 100%; height: 38px; padding: 0 12px; border-radius: var(--r-sm);
  background: var(--surface-1); border: 1px solid var(--border);
  color: var(--text-100); font-size: var(--fs-sm); transition: border-color var(--t-fast) var(--ease-smooth), background var(--t-fast) var(--ease-smooth), box-shadow var(--t-fast) var(--ease-smooth);
}
.textarea { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--text-500); }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--accent); background: var(--surface-0); box-shadow: 0 0 0 3px var(--accent-ring); }
.input-group { position: relative; display: flex; align-items: center; }
.input-group .ico { position: absolute; left: 11px; color: var(--text-400); width: 16px; height: 16px; pointer-events: none; }
.input-group .input { padding-left: 34px; }
.field-label { font-size: var(--fs-xs); font-weight: 600; color: var(--text-300); margin-bottom: 6px; display: block; }
.toggle { width: 38px; height: 22px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--border); position: relative; transition: background var(--t-fast) var(--ease-smooth), border-color var(--t-fast) var(--ease-smooth); flex-shrink: 0; cursor: pointer; }
.toggle:active { transform: scale(0.96); }
.toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--text-300); transition: all var(--t-med) var(--ease-spring); }
.toggle.on { background: var(--accent); border-color: var(--accent); }
.toggle.on::after { left: 18px; background: var(--accent-fg); }

/* ---------- Segmented control / sub-tabs ---------- */
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--r-sm); }
.segmented button { display: inline-flex; align-items: center; gap: 6px; padding: 6px 13px; border-radius: var(--r-xs); font-size: var(--fs-sm); font-weight: 560; color: var(--text-400); transition: background var(--t-fast) var(--ease-smooth), color var(--t-fast) var(--ease-smooth), box-shadow var(--t-fast) var(--ease-smooth), transform var(--t-fast) var(--ease-smooth); white-space: nowrap; line-height: 1; }
.segmented button svg, .segmented button .ico { width: 15px; height: 15px; flex-shrink: 0; }
.segmented button:hover { color: var(--text-200); }
.segmented button:active { transform: scale(0.97); }
.segmented button.active { background: var(--surface-3); color: var(--text-100); box-shadow: var(--shadow-sm); }

.subtabs { display: flex; gap: var(--sp-1); border-bottom: 1px solid var(--border); }
.subtabs button { position: relative; padding: 11px 4px; margin-right: 18px; font-size: var(--fs-sm); font-weight: 560; color: var(--text-400); transition: color var(--t-fast); }
.subtabs button:hover { color: var(--text-200); }
.subtabs button.active { color: var(--text-100); }
.subtabs button.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); }

/* ---------- KPI / stat cards ---------- */
.kpi { padding: var(--sp-5); display: flex; flex-direction: column; gap: 10px; position: relative; overflow: hidden; }
.kpi .kpi-label { font-size: var(--fs-xs); color: var(--text-400); font-weight: 560; display: flex; align-items: center; gap: 7px; }
.kpi .kpi-label .ico { width: 15px; height: 15px; color: var(--text-400); }
.kpi .kpi-value { font-family: var(--font-display); font-size: 2rem; font-weight: 560; color: var(--text-100); letter-spacing: -0.02em; line-height: 1; }
.kpi .kpi-value.mono { font-family: var(--font-mono); font-size: 1.7rem; }
.kpi .kpi-delta { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-xs); font-weight: 600; }
.kpi-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table thead th { text-align: left; padding: 10px 14px; font-size: var(--fs-2xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-400); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border-soft); color: var(--text-200); vertical-align: middle; }
.table tbody tr { transition: background var(--t-fast); }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: none; }
.table .num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.table-wrap { overflow: hidden; border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--surface-1); }
.cell-strong { color: var(--text-100); font-weight: 560; }

/* ---------- Kanban ---------- */
.board { display: flex; gap: var(--sp-4); overflow-x: auto; padding-bottom: var(--sp-4); align-items: flex-start; }
.board-col { flex: 0 0 290px; display: flex; flex-direction: column; gap: var(--sp-3); }
.board-col-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px; }
.board-col-head .row { gap: 8px; }
.board-col-head .title { font-size: var(--fs-sm); font-weight: 640; color: var(--text-100); }
.board-col-body { display: flex; flex-direction: column; gap: var(--sp-3); min-height: 60px; }
.kard {
  position: relative;
  background: var(--surface-0);
  border: 1px solid var(--border); border-radius: var(--r-md); padding: 13px;
  display: flex; flex-direction: column; gap: 9px; cursor: pointer;
  transition: border-color var(--t-fast) var(--ease-smooth), transform var(--t-fast) var(--ease-smooth), box-shadow var(--t-fast) var(--ease-smooth); box-shadow: var(--shadow-card);
}
.kard:hover { border-color: var(--border-strong); transform: translateY(-1px); box-shadow: var(--shadow-elevated); }
.kard:active { transform: scale(0.994); }
.kard-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.kard-title { font-size: var(--fs-sm); font-weight: 560; color: var(--text-100); line-height: 1.35; }
.kard-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 2px; }

/* ---------- Bulk selection (SHARED: CRM leads, Tasks, Content pieces) ----------
   One design for every board/table with multi-select. Views must use these
   classes so selection looks + works identically everywhere:
   • .selbar  — the bulk action bar (container with [data-bulkbar])
   • .sel-check — the checkbox button on a card/row ([data-sel] / [data-selall]); add .on when selected
   • .kard.is-sel — selected card ring;  tr.is-sel — selected table row;  .td-sel — the checkbox cell
   Selection toggling must be done IN-PLACE (toggle classes, never repaint the whole body). */
.selbar[hidden] { display: none !important; }
/* Floating bulk-action bar — ONE design for every board/table (CRM, Tasks,
   Content). Docks bottom-center and springs up when a selection exists; the count
   leads (with a single accent dot), actions are quiet ghost buttons so the bar
   reads calm, not like a row of heavy controls. Shared so multi-select looks and
   feels identical everywhere. */
.selbar {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  z-index: var(--z-dock);
  display: flex; align-items: center; gap: 3px;
  padding: 7px 8px 7px 4px;
  max-width: min(720px, calc(100vw - 28px));
  background: var(--surface-0); border: 1px solid var(--border-strong);
  border-radius: var(--r-pill); box-shadow: var(--shadow-xl);
  animation: selbar-in var(--t-slow) var(--ease-spring);
}
@keyframes selbar-in {
  from { opacity: 0; transform: translateX(-50%) translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0)    scale(1); }
}
.selbar-count {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: var(--fs-sm); font-weight: 600; color: var(--text-100);
  white-space: nowrap; padding: 0 6px 0 13px; font-variant-numeric: tabular-nums;
}
.selbar-count::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); flex-shrink: 0;
}
.selbar-divider { width: 1px; align-self: stretch; background: var(--border); margin: 6px 2px; }
.selbar-actions { display: flex; align-items: center; gap: 2px; flex-wrap: nowrap; }
.selbar-actions .btn { height: 34px; background: transparent; border-color: transparent; color: var(--text-200); border-radius: var(--r-sm); }
.selbar-actions .btn:hover { background: var(--surface-2); color: var(--text-100); }
.selbar-actions .btn .ico { color: var(--text-300); }
.selbar-actions .btn:hover .ico { color: var(--text-100); }
.selbar-actions .select, .selbar-actions .select-sm { height: 34px; font-size: var(--fs-sm); }
.selbar-del, .selbar-del .ico { color: var(--red-400); }
.selbar-del:hover, .selbar-del:hover .ico { color: var(--red-400); }
.selbar-del:hover { background: var(--red-bg); }

.sel-check {
  width: 18px; height: 18px; border-radius: 6px; flex-shrink: 0;
  border: 1.5px solid var(--border-strong); background: var(--surface-1);
  display: grid; place-items: center; cursor: pointer; color: var(--accent-fg);
  transition: opacity var(--t-fast), background var(--t-fast), border-color var(--t-fast);
}
.sel-check .ico { width: 12px; height: 12px; }
.sel-check.on { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.sel-check:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }

/* kanban card checkbox: floats top-LEFT in a reserved gutter, revealed on
   hover or when selected. Cards that carry this control add .kard-selectable,
   which reserves a permanent left gutter on the card's first content row so the
   checkbox never overlaps title/score/icon, and revealing it (opacity only,
   no display change) causes no layout shift. */
.kard > .sel-check { position: absolute; top: 11px; left: 11px; opacity: 0; z-index: 2; }
.kard:hover > .sel-check, .kard.is-sel > .sel-check { opacity: 1; }
.kard:focus-within > .sel-check, .kard > .sel-check:focus-visible { opacity: 1; }
/* reserved gutter so content clears the checkbox slot (18px box + gap) */
.kard-selectable > .kard-top,
.kard-selectable > .kard-title { padding-left: 28px; }
.kard.is-sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.kard.is-sel:hover { box-shadow: 0 0 0 1px var(--accent), var(--shadow-md); }

/* table row selection */
tr.is-sel { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.td-sel { width: 34px; text-align: center; }
.td-sel .sel-check { opacity: .55; margin: 0 auto; }
tr:hover .td-sel .sel-check, tr.is-sel .td-sel .sel-check { opacity: 1; }

@media (max-width: 640px) {
  .selbar { left: 12px; right: 12px; bottom: 12px; transform: none; max-width: none; border-radius: var(--r-xl); flex-wrap: wrap; animation-name: selbar-in-m; }
  .selbar-actions { flex: 1 1 auto; justify-content: flex-end; }
}
@keyframes selbar-in-m { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------- Progress ---------- */
.bar { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.bar.green > i { background: var(--green-400); }
.bar.blue > i  { background: var(--blue-400); }
.ring { --p: 60; --sz: 44px; position: relative; width: var(--sz); height: var(--sz); border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--accent) calc(var(--p)*1%), var(--surface-3) 0); }
.ring::after { content: ""; position: absolute; width: calc(var(--sz) - 9px); height: calc(var(--sz) - 9px); border-radius: 50%; background: var(--surface-0); }
.ring span { position: relative; font-size: var(--fs-2xs); font-weight: 700; }

/* ---------- List rows ---------- */
.lrow { display: flex; align-items: center; gap: var(--sp-3); padding: 11px 14px; border-radius: var(--r-sm); transition: background var(--t-fast) var(--ease-smooth); }
.lrow:hover { background: var(--surface-2); }
.lrow + .lrow { border-top: 1px solid var(--border-soft); }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.divider { height: 1px; background: var(--border); border: none; margin: var(--sp-4) 0; }
.vdivider { width: 1px; align-self: stretch; background: var(--border); margin: 0 4px; }

/* ---------- Empty / placeholder ---------- */
.empty { display: flex; flex-direction: row; align-items: center; justify-content: center; gap: var(--sp-3); padding: var(--sp-9); text-align: left; color: var(--text-400); }
.empty .ico { flex-shrink: 0; width: 36px; height: 36px; color: var(--text-500); }
/* multi-line empty states wrap their text so the icon stays left of the block */
.empty .empty-text { display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-2); }

/* ---------- Dropdown / menu / popover ---------- */
.menu { background: var(--ink-600); border: 1px solid var(--border-strong); border-radius: var(--r-md); box-shadow: var(--shadow-xl); padding: 6px; min-width: 200px; }
.menu-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-xs); font-size: var(--fs-sm); color: var(--text-200); cursor: pointer; transition: background var(--t-fast); }
.menu-item:hover { background: var(--surface-3); }
.menu-item:active { transform: scale(0.98); }
.menu-item .ico { width: 16px; height: 16px; color: var(--text-400); }
.menu-sep { height: 1px; background: var(--border); margin: 5px 0; }

/* ---------- Icon chip ---------- */
.ichip { width: 38px; height: 38px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--surface-3); border: 1px solid var(--border); color: var(--text-300); flex-shrink: 0; }
.ichip.gold { background: var(--accent-soft); border-color: var(--border-strong); color: var(--text-100); }
.ichip.lg { width: 46px; height: 46px; border-radius: var(--r-md); }
.ichip svg { width: 18px; height: 18px; }

/* ---------- Generic grid ---------- */
.grid { display: grid; gap: var(--sp-4); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1280px) { .grid-4 { grid-template-columns: repeat(2,1fr); } .grid-3 { grid-template-columns: repeat(2,1fr);} }
@media (max-width: 860px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ---------- Tooltip ---------- */
/* A small, subtle, slightly-delayed hint — not a big instant overlay. */
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%) translateY(2px); background: var(--ink-600); color: var(--text-100);
  font-size: var(--fs-2xs); line-height: 1.3; font-weight: 500; padding: 4px 8px; border-radius: var(--r-xs);
  white-space: nowrap; box-shadow: var(--shadow-sm); border: 1px solid var(--border-strong); z-index: var(--z-toast);
  pointer-events: none; opacity: 0; transition: opacity var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out);
}
[data-tip]:hover::after, [data-tip]:focus-visible::after { opacity: 1; transform: translateX(-50%) translateY(0); transition-delay: .35s; }

/* ---------- AI accents (used in chat/setter/workflows) ---------- */
.ai-pill { display:inline-flex; align-items:center; gap:7px; padding:5px 11px; border-radius:var(--r-pill); font-size:var(--fs-xs); font-weight:600; color:var(--text-300); background: var(--surface-2); border:1px solid var(--border); }
.ai-pill .dot { width:6px;height:6px;border-radius:50%;background:var(--green-400); animation: eos-pulse 2s infinite; }
@keyframes eos-pulse { 0%,100%{opacity:1;} 50%{opacity:.4;} }
.typing { display:inline-flex; gap:3px; }
.typing i { width:5px;height:5px;border-radius:50%;background:var(--text-400); animation: eos-typing 1.2s infinite; }
.typing i:nth-child(2){animation-delay:.15s;} .typing i:nth-child(3){animation-delay:.3s;}
@keyframes eos-typing { 0%,60%,100%{transform:translateY(0);opacity:.4;} 30%{transform:translateY(-4px);opacity:1;} }

/* sparkline svg sizing */
.spark { width: 100%; height: 40px; display:block; overflow: visible; }

/* scroll area used inside views */
.scroll-y { overflow-y: auto; }
.scroll-x { overflow-x: auto; }

/* ============================================================
   Shared DETAIL DRAWER (assets/js/drawer.js)
   Slide-in-from-right panel. Reused by CRM + Tasks. Monochrome,
   soft radii, hairline borders, tokens only. Mobile = full sheet.
   ============================================================ */
.drawer-scrim {
  position: fixed; inset: 0; z-index: var(--z-modal);
  display: flex; justify-content: flex-end;
  background: color-mix(in srgb, var(--ink-900, #04070d) 46%, transparent);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  opacity: 0; transition: opacity var(--t-med) var(--ease-out);
}
.drawer-scrim.in { opacity: 1; }
.drawer {
  --drawer-w: 440px;
  width: min(var(--drawer-w), 94vw); height: 100%;
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface-0); border-left: 1px solid var(--border-strong);
  box-shadow: var(--shadow-xl);
  transform: translateX(28px); opacity: .6;
  transition: transform var(--t-med) var(--ease-out), opacity var(--t-med) var(--ease-out);
}
.drawer-scrim.in .drawer { transform: none; opacity: 1; }

.drawer-head {
  flex-shrink: 0; display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-5) var(--sp-5) var(--sp-4);
  border-bottom: 1px solid var(--border); position: relative;
}
.drawer-head-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.drawer-title { font-family: var(--font-display); font-size: 1.3rem; font-weight: 560; line-height: 1.15; color: var(--text-100); word-break: break-word; }
.drawer-sub { font-size: var(--fs-sm); color: var(--text-400); line-height: 1.3; }
.drawer-sub[hidden] { display: none; }
.drawer-head-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.drawer-head-actions:empty { display: none; }
.drawer-close {
  flex-shrink: 0; width: 32px; height: 32px; border-radius: var(--r-sm);
  display: grid; place-items: center; color: var(--text-400);
  background: transparent; border: 1px solid transparent; transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.drawer-close:hover { background: var(--surface-2); color: var(--text-100); border-color: var(--border); }

.drawer-body { flex: 1; min-height: 0; overflow-y: auto; padding: var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-5); }

/* tabbed body (drawerTabs) */
.drawer-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: calc(var(--sp-5) * -1) calc(var(--sp-5) * -1) 0; padding: 0 var(--sp-5); position: sticky; top: calc(var(--sp-5) * -1); background: var(--surface-0); z-index: 2; }
.drawer-tab { display: inline-flex; align-items: center; gap: 6px; padding: 11px 12px; font-size: var(--fs-sm); font-weight: 560; color: var(--text-400); position: relative; transition: color var(--t-fast); }
.drawer-tab:hover { color: var(--text-200); }
.drawer-tab.active { color: var(--text-100); }
.drawer-tab.active::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--text-100); }
.drawer-tab-badge { font-size: var(--fs-2xs); font-weight: 700; background: var(--surface-3); color: var(--text-400); border-radius: var(--r-pill); padding: 0 6px; }
.drawer-panels { display: flex; flex-direction: column; }
.drawer-panel { display: flex; flex-direction: column; gap: var(--sp-4); padding-top: var(--sp-5); }
.drawer-panel.hidden { display: none; }

/* mobile (≤640px): full-screen sheet */
@media (max-width: 640px) {
  .drawer { width: 100vw; border-left: none; border-radius: 0; }
}
