/* AirJaldi CRM — Material 3 inspired (Roboto, tonal surfaces, outlined fields, compact density)
   Brand: primary blue #1976d2. Complement: orange. Analogous: teal, violet, green, red. */
:root {
  --primary: #1976d2;
  --on-primary: #ffffff;
  --primary-container: #d3e4fa;
  --on-primary-container: #0b3d70;
  --secondary: #f57c00;
  --secondary-container: #ffe3c2;
  --on-secondary-container: #5c2c00;
  --tertiary: #00897b;
  --tertiary-container: #c4ece7;
  --on-tertiary-container: #00352f;
  --violet: #5e35b1;
  --violet-container: #e6def7;
  --success: #2e7d32;
  --success-container: #d7f0d9;
  --error: #b3261e;
  --error-container: #f9dedc;
  --warning-container: #fff0c2;
  --warning: #7a5a00;

  --surface: #f7faff;
  --surface-1: #eaf1fa;
  --surface-variant: #e6ebf3;
  --page: #d9e4f1;
  --outline: #7a8599;
  --outline-variant: #d2d9e5;
  --on-surface: #1b2330;
  --on-surface-variant: #4b5567;

  --elev-1: 0 1px 2px rgba(27, 35, 48, .10), 0 1px 3px 1px rgba(27, 35, 48, .06);
  --elev-2: 0 2px 6px rgba(27, 35, 48, .12), 0 1px 3px rgba(27, 35, 48, .08);
  --elev-3: 0 8px 24px -6px rgba(27, 35, 48, .22);

  --radius-card: 12px;
  --radius-field: 8px;
  --side-w: 248px;
  --side-w-collapsed: 72px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; font: 400 14px/1.45 Roboto, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--on-surface); background: var(--page); -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; font-weight: 500; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; line-height: 28px; font-weight: 500; letter-spacing: 0; margin: 0; color: var(--on-surface); }
h2 { font-size: 14px; line-height: 20px; font-weight: 500; margin: 0; color: var(--on-surface); letter-spacing: .1px; }
.muted { color: var(--on-surface-variant); }
.small { font-size: 12px; line-height: 16px; }
.center { text-align: center; }
.right { text-align: right; }
.strong { font-weight: 500; color: var(--on-surface); }
.bad { color: var(--error); font-weight: 500; }
.num { font-variant-numeric: tabular-nums; }

/* Material Symbols */
.mi {
  font-family: "Material Symbols Outlined"; font-weight: normal; font-style: normal; font-size: 20px; line-height: 1;
  letter-spacing: normal; text-transform: none; display: inline-block; white-space: nowrap; word-wrap: normal;
  direction: ltr; -webkit-font-feature-settings: "liga"; -webkit-font-smoothing: antialiased; font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 20; flex: none;
}

/* ---------- Shell: navigation drawer + top app bar ---------- */
.shell { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100vh; transition: grid-template-columns .2s ease; }
.sb-collapsed .shell { grid-template-columns: var(--side-w-collapsed) 1fr; }
.side {
  background: var(--surface); border-right: 1px solid var(--outline-variant); padding: 12px 12px 14px;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow: hidden; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 6px 10px 14px; color: var(--on-surface); min-width: 0; }
.brand:hover { text-decoration: none; }
.brand-text b { display: block; font-size: 14px; font-weight: 500; line-height: 18px; }
.brand-text small { display: block; font-size: 12px; color: var(--on-surface-variant); line-height: 16px; }
.logo {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: var(--primary); color: #fff; font-weight: 500; font-size: 18px; box-shadow: var(--elev-1);
}
.menu { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; overflow-x: hidden; }
.menu-title { font-size: 12px; line-height: 16px; color: var(--on-surface-variant); padding: 14px 14px 6px; font-weight: 500; white-space: nowrap; }
.menu > a {
  position: relative; display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 14px; border-radius: 20px;
  color: var(--on-surface-variant); font-weight: 500; font-size: 14px; white-space: nowrap;
}
.menu > a .mi { color: var(--on-surface-variant); }
.menu > a:hover { background: rgba(27, 35, 48, .06); color: var(--on-surface); text-decoration: none; }
.menu > a.active { background: var(--primary-container); color: var(--on-primary-container); }
.menu > a.active .mi { color: var(--on-primary-container); font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 20; }
.me { display: flex; align-items: center; gap: 10px; padding: 12px 6px 0; border-top: 1px solid var(--outline-variant); margin-top: 8px; min-width: 0; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--secondary-container); color: var(--on-secondary-container);
  display: grid; place-items: center; font-weight: 500; flex: none; font-size: 13px;
}
.who { flex: 1; min-width: 0; line-height: 1.25; }
.who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; font-size: 13px; }
.who small { color: var(--on-surface-variant); font-size: 12px; }
.logout-form { margin: 0; }

.icon-btn {
  position: relative; width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent;
  display: inline-grid; place-items: center; color: var(--on-surface-variant); padding: 0; cursor: pointer; box-shadow: none; flex: none;
}
.icon-btn:hover { background: rgba(27, 35, 48, .08); color: var(--on-surface); text-decoration: none; }
.icon-btn .mi { font-size: 22px; }
.dot-count {
  position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--error); color: #fff; font-size: 11px; font-weight: 500; line-height: 18px; text-align: center;
}

.content { min-width: 0; display: flex; flex-direction: column; }
.top {
  display: flex; align-items: center; gap: 8px; height: 60px; padding: 0 20px;
  background: var(--surface); border-bottom: 1px solid var(--outline-variant); position: sticky; top: 0; z-index: 20;
}
.search { position: relative; flex: 1; max-width: 560px; margin: 0 8px; }
.search input {
  width: 100%; height: 40px; padding: 0 16px 0 44px; border-radius: 20px; background: var(--surface-variant); border: 0; color: var(--on-surface);
}
.search input:focus { box-shadow: 0 0 0 2px var(--primary); background: #fff; }
.search-ic { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--on-surface-variant); pointer-events: none; }
.top .btn { margin-left: 8px; }

/* Collapsed rail */
.sb-collapsed .side { padding: 12px 10px; align-items: stretch; }
.sb-collapsed .brand { justify-content: center; padding: 6px 0 14px; }
.sb-collapsed .brand-text, .sb-collapsed .who, .sb-collapsed .lbl { display: none; }
.sb-collapsed .menu-title { font-size: 0; padding: 10px 0; border-top: 1px solid var(--outline-variant); margin: 6px 6px 0; }
.sb-collapsed .menu > a { justify-content: center; padding: 0; width: 48px; margin: 0 auto; }
.sb-collapsed .me { flex-direction: column; padding-top: 12px; }
.sb-collapsed .side [data-tip]:hover::after {
  content: attr(data-tip); position: fixed; left: 84px; transform: translateY(-50%); background: #2b3340; color: #fff;
  padding: 4px 10px; border-radius: 6px; font-size: 12px; white-space: nowrap; pointer-events: none; z-index: 99;
}

/* ---------- Main ---------- */
main { padding: 20px 24px 40px; max-width: 1440px; width: 100%; }
main.auth { display: grid; place-items: center; min-height: 100vh; }
.flash { padding: 10px 14px; border-radius: var(--radius-field); margin-bottom: 14px; background: var(--success-container); color: var(--success); font-weight: 500; font-size: 13px; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head .muted { margin-top: 2px; font-size: 13px; }
.crumbs { font-size: 12px; color: var(--on-surface-variant); margin-bottom: 2px; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

/* ---------- Buttons (Material: filled, tonal, outlined, text) ---------- */
.btn, button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 16px;
  border: 1px solid transparent; border-radius: 18px; font: inherit; font-size: 14px; font-weight: 500; letter-spacing: .1px;
  cursor: pointer; background: var(--primary); color: var(--on-primary); line-height: 1; box-shadow: none;
  transition: background .15s, box-shadow .15s;
}
.btn .mi { font-size: 18px; }
.btn:hover, button:hover { text-decoration: none; background: #1565c0; box-shadow: var(--elev-1); }
.btn.filled, .btn.primary, .btn.grad, button.grad { background: var(--primary); color: var(--on-primary); }
.btn.tonal { background: var(--primary-container); color: var(--on-primary-container); }
.btn.tonal:hover { background: #c2dcf8; }
.btn.outline, .btn.ghost, .btn.outlined { background: transparent; color: var(--primary); border-color: var(--outline); }
.btn.outline:hover, .btn.ghost:hover, .btn.outlined:hover { background: rgba(25, 118, 210, .08); box-shadow: none; }
.btn.accent { background: var(--secondary); color: #fff; }
.btn.accent:hover { background: #e65100; }
.btn.danger, button.danger { background: var(--error); color: #fff; }
.btn.danger:hover { background: #8c1d18; }
.btn.small, button.small { height: 30px; padding: 0 12px; font-size: 13px; border-radius: 15px; }
.btn:disabled, button:disabled { background: var(--surface-variant); color: #7a8599; border-color: transparent; box-shadow: none; cursor: not-allowed; }
.btn.outline:disabled, .btn.outlined:disabled { background: transparent; border-color: var(--outline-variant); }

/* ---------- Form fields: outlined, same height everywhere ---------- */
input, select, textarea {
  font: inherit; font-size: 14px; height: 40px; padding: 0 12px; border: 1px solid var(--outline); border-radius: var(--radius-field);
  background: var(--surface); color: var(--on-surface); width: 100%; transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: #6e7889; }
textarea { height: auto; min-height: 88px; padding: 10px 12px; resize: vertical; line-height: 1.45; }
input:hover, select:hover, textarea:hover { border-color: #3d4658; }
input:focus, select:focus, textarea:focus { outline: none; border: 2px solid var(--primary); padding: 0 11px; box-shadow: none; }
textarea:focus { padding: 9px 11px; }
select {
  appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, #4b5567 50%), linear-gradient(135deg, #4b5567 50%, transparent 50%);
  background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; padding: 0; accent-color: var(--primary); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters input[name=q] { width: 280px; }
.filters select { width: auto; min-width: 150px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--outline-variant);
  background: var(--surface-1); cursor: pointer; font-weight: 500; font-size: 13px; color: var(--on-surface-variant);
}
.chip input { width: 16px; height: 16px; }
.field { margin-bottom: 14px; min-width: 0; }
.field label, .field > label, .card form label {
  display: block; font-size: 12px; line-height: 16px; font-weight: 500; color: var(--on-surface-variant); margin-bottom: 4px; letter-spacing: .2px;
}
.field .hint, .hint { font-size: 12px; color: var(--on-surface-variant); margin-top: 4px; line-height: 16px; }
.field input, .field select, .field textarea { max-width: none; }
.errorlist { color: var(--error); margin: 4px 0 0; padding: 0; list-style: none; font-size: 12px; font-weight: 500; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
.span-2 { grid-column: span 2; }
@media (max-width: 760px) { .form-grid { grid-template-columns: 1fr; } .span-2 { grid-column: auto; } }
.form-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }

.role-form { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--outline-variant); }
.role-form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 150px; gap: 16px; align-items: end; }
.role-form-grid .field { margin: 0; }
.role-form-grid .field.action .btn { width: 100%; }
@media (max-width: 900px) { .role-form-grid { grid-template-columns: 1fr; } }

/* Type cards (radio) */
.type-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.type-card {
  position: relative; display: grid; gap: 2px; padding: 14px 14px 14px 46px; border-radius: var(--radius-card);
  border: 1px solid var(--outline); cursor: pointer; background: var(--surface); transition: background .15s, border-color .15s;
}
.type-card input { position: absolute; left: 15px; top: 17px; width: 18px; height: 18px; }
.type-card:hover { background: var(--surface-1); }
.type-card:has(input:checked) { border: 2px solid var(--primary); background: var(--primary-container); padding: 13px 13px 13px 45px; }
.type-card:has(input:checked) input { left: 14px; top: 16px; }
.t-title { font-weight: 500; color: var(--on-surface); }
.t-sub { color: var(--on-surface-variant); font-size: 12.5px; line-height: 16px; }

/* ---------- Cards (Material elevated) ---------- */
.card {
  background: var(--surface); border-radius: var(--radius-card); padding: 16px; margin-bottom: 16px; box-shadow: var(--elev-1);
  overflow: hidden; border: 0;
}
.card > .card-head { margin: -16px -16px 14px; padding: 12px 16px; border-bottom: 1px solid var(--outline-variant); background: var(--surface); }
.card > .table-wrap, .card > table { margin: 0 -16px; width: calc(100% + 32px); }
.card > .table-wrap > table { width: 100%; }
.card.flush { padding: 0; }
.card.flush > .card-head { margin: 0; padding: 14px 16px; }
.card.flush > * { margin: 0; }
.card > h2:first-child { margin-bottom: 12px; }
.card > form > .form-actions:last-child { margin-bottom: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.card-head a { font-size: 13px; font-weight: 500; }
.card-head h2 { display: flex; align-items: center; gap: 8px; font-size: 16px; line-height: 22px; font-weight: 500; }
.card-head .small { font-weight: 400; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); margin-bottom: 16px; }
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); margin-bottom: 16px; }
.grid-3 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); margin-bottom: 16px; }
.grid > .card, .grid-2 > .card, .grid-3 > .card { margin-bottom: 0; }
.chart-box { position: relative; min-height: 210px; }
dl.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 16px; margin: 0; font-size: 13.5px; }
dl.kv dt { color: var(--on-surface-variant); font-weight: 500; }
dl.kv dd { margin: 0; color: var(--on-surface); }

/* ---------- KPI cards: tonal icon chip + coloured top edge ---------- */
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 16px; }
.kpi {
  position: relative; display: flex; flex-direction: column; gap: 2px; padding: 14px 16px 12px; border-radius: var(--radius-card);
  background: var(--surface); box-shadow: var(--elev-1); color: var(--on-surface); overflow: hidden; border-top: 3px solid var(--accent, var(--primary));
  transition: box-shadow .15s;
}
.kpi:hover { text-decoration: none; box-shadow: var(--elev-2); }
.k-top { display: flex; justify-content: space-between; align-items: center; }
.k-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--tint, var(--primary-container)); color: var(--accent, var(--on-primary-container)); }
.k-icon .mi { font-size: 20px; }
.k-label { font-size: 12px; line-height: 16px; font-weight: 500; color: var(--on-surface-variant); margin-top: 8px; }
.k-value { font-size: 24px; line-height: 30px; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--on-surface); }
.k-sub { font-size: 12px; line-height: 16px; color: var(--on-surface-variant); }
.k-indigo { --accent: #1976d2; --tint: #d3e4fa; }
.k-sky { --accent: #0277bd; --tint: #cde9fa; }
.k-amber { --accent: #e65100; --tint: #ffe3c2; }
.k-rose { --accent: #b3261e; --tint: #f9dedc; }
.k-rose .k-value { color: var(--error); }
.k-emerald { --accent: #2e7d32; --tint: #d7f0d9; }
.k-violet { --accent: #5e35b1; --tint: #e6def7; }
.k-teal { --accent: #00897b; --tint: #c4ece7; }
.kpi-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.mini { background: var(--surface); border-radius: var(--radius-card); padding: 10px 14px; min-width: 160px; box-shadow: var(--elev-1); border-top: 3px solid var(--primary); }
.mini span { display: block; font-size: 12px; color: var(--on-surface-variant); }
.mini b { font-size: 18px; font-weight: 500; font-variant-numeric: tabular-nums; }
.mini.warn { border-top-color: var(--error); }
.mini.warn b { color: var(--error); }

/* Summary band: primary surface, white text */
.org-strip {
  display: flex; gap: 28px; flex-wrap: wrap; margin-bottom: 16px; padding: 14px 18px; border-radius: var(--radius-card);
  background: var(--primary); color: #fff; box-shadow: var(--elev-1);
}
.org-stat { font-size: 12px; color: #d9ebfc; }
.org-stat span { display: block; font-size: 20px; font-weight: 500; color: #fff; font-variant-numeric: tabular-nums; line-height: 26px; }

/* ---------- Feeds ---------- */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--outline-variant); font-size: 13.5px; }
.feed li:last-child { border-bottom: 0; }
.feed li.unread { background: var(--primary-container); margin: 0 -10px 6px; padding: 9px 10px; border-radius: var(--radius-field); border-bottom: 0; }
.feed li.empty { color: var(--on-surface-variant); justify-content: center; padding: 18px 0; }
.feed.compact li { padding: 8px 0; }
.feed .meta { font-size: 12px; color: var(--on-surface-variant); margin-top: 1px; line-height: 16px; }
.feed li > div { flex: 1; min-width: 0; }
.dot { width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--primary); flex: none; }
.dot.read { background: var(--outline-variant); }
.feed-line { padding: 8px 0; border-bottom: 1px solid var(--outline-variant); display: flex; gap: 10px; align-items: center; justify-content: space-between; font-size: 13.5px; }

/* ---------- Tables (Material data table) ---------- */
table { width: 100%; border-collapse: collapse; }
.grid-table th, .grid-table td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--outline-variant); vertical-align: middle; font-size: 13.5px; }
.grid-table th { font-size: 12px; font-weight: 500; color: var(--on-surface-variant); background: var(--surface-1); height: 36px; }
.grid-table tbody tr:hover td { background: rgba(25, 118, 210, .05); }
.grid-table tbody tr:last-child td { border-bottom: 0; }
.grid-table.compact th, .grid-table.compact td { padding: 6px 10px; }
.card table th, .card table td { padding: 8px 10px; border-bottom: 1px solid var(--outline-variant); text-align: left; font-size: 13.5px; }
.table-wrap { overflow-x: auto; }
.matrix th, .matrix td { padding: 6px 10px; font-size: 13px; }
table.perm th { text-align: center; white-space: nowrap; font-size: 12px; font-weight: 500; color: var(--on-surface-variant); background: var(--surface-1); }
table.perm th.cap, table.perm td.cap { text-align: left; min-width: 280px; }
table.perm tr.grp td {
  background: var(--secondary-container); color: var(--on-secondary-container); font-weight: 500; font-size: 12px; letter-spacing: .3px;
  padding: 6px 12px; border-bottom: 1px solid var(--outline-variant);
}
table.perm td.tick { text-align: center; }
table.perm td.tick.on { background: var(--success-container); }
table.perm td.tick input { width: 18px; height: 18px; }

/* ---------- Tags & status pills ---------- */
.tag, .pill {
  display: inline-flex; align-items: center; font-size: 12px; font-weight: 500; height: 22px; padding: 0 9px; border-radius: 8px;
  background: var(--surface-variant); color: var(--on-surface); white-space: nowrap; line-height: 1;
}
.tag.internal { background: var(--primary-container); color: var(--on-primary-container); }
.tag.customer { background: var(--violet-container); color: var(--violet); }
.pill.p-low { background: var(--success-container); color: var(--success); }
.pill.p-medium { background: var(--primary-container); color: var(--on-primary-container); }
.pill.p-high { background: var(--secondary-container); color: var(--on-secondary-container); }
.pill.p-urgent { background: var(--error-container); color: var(--error); }
.pill.s-open { background: var(--primary-container); color: var(--on-primary-container); }
.pill.s-in_progress { background: var(--warning-container); color: var(--warning); }
.pill.s-waiting { background: var(--violet-container); color: var(--violet); }
.pill.s-resolved { background: var(--success-container); color: var(--success); }
.pill.s-closed { background: var(--surface-variant); color: #3b4456; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 14px; font-size: 13px; }

/* ---------- Segmented control (Material segmented button) ---------- */
.seg { display: inline-flex; border: 1px solid var(--outline); border-radius: 18px; overflow: hidden; background: var(--surface); }
.seg a { padding: 0 14px; height: 34px; display: inline-flex; align-items: center; color: var(--on-surface); font-weight: 500; font-size: 13px; border-left: 1px solid var(--outline); }
.seg a:first-child { border-left: 0; }
.seg a:hover { text-decoration: none; background: rgba(27, 35, 48, .06); }
.seg a.on { background: var(--primary-container); color: var(--on-primary-container); }
.seg.small a { height: 30px; font-size: 12px; padding: 0 11px; }
.inline-label { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--on-surface-variant); font-weight: 500; }
.inline-label select { width: auto; min-width: 130px; }

/* ---------- Comments ---------- */
.comment { padding: 10px 12px; border-radius: var(--radius-field); border: 1px solid var(--outline-variant); margin-bottom: 8px; background: var(--surface); font-size: 13.5px; }
.comment.internal { background: var(--surface-1); border-style: dashed; }
.c-head { display: flex; gap: 8px; align-items: center; margin-bottom: 3px; font-size: 13px; }
.comment-form { margin-top: 12px; }
.comment-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }

/* ---------- Team / roles ---------- */
.role-strip { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 16px; }
.role-chip { background: var(--surface); border-radius: var(--radius-card); padding: 10px 12px; color: var(--on-surface-variant); font-size: 12px; font-weight: 500; box-shadow: var(--elev-1); }
.role-chip span { display: block; font-size: 20px; color: var(--on-surface); font-weight: 500; font-variant-numeric: tabular-nums; }
.who-cell { display: flex; align-items: center; gap: 10px; }
.avatar.sm { width: 28px; height: 28px; font-size: 12px; background: var(--primary-container); color: var(--on-primary-container); }

/* ---------- Deal board ---------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.col { background: var(--surface-1); border-radius: var(--radius-card); padding: 12px; min-height: 120px; }
.col h2 { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.deal { background: var(--surface); border-radius: var(--radius-field); padding: 10px; margin-top: 8px; box-shadow: var(--elev-1); }
.deal select { font-size: 13px; height: 32px; margin-top: 6px; width: auto; }

/* ---------- Mentions & pickers ---------- */
.mention-menu {
  position: absolute; left: 0; right: 0; top: 100%; margin-top: 4px; z-index: 30; max-width: 420px;
  background: var(--surface); border-radius: var(--radius-field); box-shadow: var(--elev-3); padding: 4px; max-height: 240px; overflow-y: auto;
}
.mention-item { display: flex; gap: 10px; align-items: center; padding: 7px 10px; border-radius: 6px; cursor: pointer; font-size: 13.5px; }
.mention-item.active, .mention-item:hover { background: var(--primary-container); }
.mention-item small { display: block; color: var(--on-surface-variant); font-size: 12px; }
.mention-avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 500; font-size: 12px; flex: none; }
.ts-wrapper { font-size: 14px; }
.ts-wrapper.single .ts-control, .ts-wrapper.multi .ts-control {
  border: 1px solid var(--outline); border-radius: var(--radius-field); padding: 6px 10px; background: var(--surface); min-height: 40px; box-shadow: none; font-size: 14px;
}
.ts-wrapper.focus .ts-control { border: 2px solid var(--primary); padding: 5px 9px; }
.ts-dropdown { border: 1px solid var(--outline-variant); border-radius: var(--radius-field); box-shadow: var(--elev-3); font-size: 14px; z-index: 60; }
.ts-dropdown .active { background: var(--primary-container); color: var(--on-primary-container); }
.ts-wrapper.multi .ts-control > div { background: var(--primary-container); color: var(--on-primary-container); border-radius: 6px; border: 0; }

/* ---------- Timeline ---------- */
.tl { background: var(--surface); border-radius: var(--radius-card); box-shadow: var(--elev-1); overflow: hidden; }
.tl-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.tl-toolbar select { width: auto; min-width: 140px; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; margin-left: auto; font-size: 12px; color: var(--on-surface-variant); align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.sw.c-lead { background: #90caf9; }
.sw.c-qualified { background: #42a5f5; }
.sw.c-proposal { background: #1976d2; }
.sw.c-negotiation { background: #0d47a1; }
.sw.c-won { background: #2e7d32; }
.sw.c-lost { background: #9e9e9e; }
.sw.c-low { background: #66bb6a; }
.sw.c-medium { background: #42a5f5; }
.sw.c-high { background: #ffa726; }
.sw.c-urgent { background: #ef5350; }
.sw.overdue { background: #fff; border: 2px solid var(--error); }
.ms { display: inline-block; width: 8px; height: 8px; background: var(--secondary); transform: rotate(45deg); }
.tl-scroll { overflow: auto; max-height: calc(100vh - 260px); }
.tl-canvas { position: relative; min-width: 100%; }
.tl-head { display: flex; position: sticky; top: 0; z-index: 6; background: var(--surface-1); border-bottom: 1px solid var(--outline-variant); }
.tl-corner {
  position: sticky; left: 0; z-index: 7; background: var(--surface-1); padding: 6px 12px; font-size: 12px; font-weight: 500;
  color: var(--on-surface-variant); border-right: 1px solid var(--outline-variant); display: flex; align-items: flex-end;
}
.tl-hdr { position: relative; height: 46px; flex: none; }
.tl-month { position: absolute; top: 0; height: 22px; line-height: 22px; padding-left: 6px; font-size: 12px; font-weight: 500; color: var(--primary); border-left: 1px solid var(--outline-variant); white-space: nowrap; overflow: hidden; }
.tl-tick { position: absolute; top: 24px; font-size: 11px; color: var(--on-surface-variant); padding-left: 3px; border-left: 1px solid var(--outline-variant); height: 20px; line-height: 12px; white-space: nowrap; }
.tl-tick.strong { color: var(--on-surface); font-weight: 500; }
.tl-row { display: flex; border-bottom: 1px solid var(--outline-variant); min-height: 40px; }
.tl-row:hover .tl-label { background: var(--primary-container); }
.tl-label {
  position: sticky; left: 0; z-index: 4; background: var(--surface); padding: 5px 12px; flex: none;
  border-right: 1px solid var(--outline-variant); display: flex; flex-direction: column; justify-content: center; min-width: 0;
}
.tl-label a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; font-size: 13px; }
.tl-label small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; color: var(--on-surface-variant); }
.tl-track { position: relative; flex: none; height: 40px; }
.tl-groupbar { cursor: pointer; list-style: none; display: flex; }
.tl-groupbar::-webkit-details-marker { display: none; }
.tl-group > summary { display: flex; }
.tl-group > summary .tl-label { background: var(--surface-1); flex-direction: row; align-items: center; gap: 8px; color: var(--on-surface); font-size: 13px; }
.tl-group > summary .tl-track { background: var(--surface-1); }
.caret { width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid var(--on-surface-variant); transition: transform .15s; }
.tl-group:not([open]) .caret { transform: rotate(-90deg); }
.tl-bar {
  position: absolute; top: 7px; height: 26px; border-radius: 6px; background: #90caf9; overflow: hidden;
  display: flex; align-items: center; min-width: 6px;
}
.tl-bar:hover { text-decoration: none; box-shadow: var(--elev-2); }
.tl-bar.c-lead { background: #90caf9; }
.tl-bar.c-qualified { background: #42a5f5; }
.tl-bar.c-proposal { background: #1976d2; }
.tl-bar.c-negotiation { background: #0d47a1; }
.tl-bar.c-won { background: #2e7d32; }
.tl-bar.c-lost { background: #9e9e9e; }
.tl-bar.c-low { background: #66bb6a; }
.tl-bar.c-medium { background: #42a5f5; }
.tl-bar.c-high { background: #ffa726; }
.tl-bar.c-urgent { background: #ef5350; }
.tl-bar.overdue { box-shadow: inset 0 0 0 2px var(--error); }
.tl-fill { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(255, 255, 255, .3); }
.tl-text { position: relative; padding: 0 8px; font-size: 11px; font-weight: 500; color: #fff; white-space: nowrap; }
.tl-bar.c-lead .tl-text, .tl-bar.c-qualified .tl-text, .tl-bar.c-low .tl-text, .tl-bar.c-medium .tl-text, .tl-bar.c-high .tl-text { color: #072a4e; }
.tl-ms {
  position: absolute; top: 15px; width: 9px; height: 9px; background: var(--secondary); transform: rotate(45deg) translateX(-4px);
  border: 2px solid #fff; z-index: 2;
}
.tl-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--error); opacity: .8; z-index: 5; pointer-events: none; }

/* ---------- Report tabs ---------- */
.report-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.report-tabs .tab { padding: 0 14px; height: 34px; display: inline-flex; align-items: center; border-radius: 17px; background: var(--surface); color: var(--on-surface-variant); border: 1px solid var(--outline); font-weight: 500; font-size: 13px; }
.report-tabs .tab.active { background: var(--primary-container); color: var(--on-primary-container); border-color: transparent; }
.report-tabs .tab:hover { text-decoration: none; }

/* ---------- Login ---------- */
.login { width: min(400px, 92vw); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.login-brand b { display: block; font-size: 16px; font-weight: 500; }
.login-brand small { color: var(--on-surface-variant); font-size: 12px; }
.login .card { width: 100%; padding: 24px; margin: 0; }
.login .card > * { margin-left: 0; margin-right: 0; }
.login h1 { font-size: 22px; }
.btn.wide { width: 100%; height: 40px; margin-top: 6px; }

@media (max-width: 960px) {
  .shell, .sb-collapsed .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  main { padding: 16px 12px 40px; }
  .top { padding: 0 12px; }
}

/* Tom Select controls match native fields */
.ts-wrapper.single .ts-control { height: 40px; min-height: 40px; padding: 0 12px; display: flex; align-items: center; }
.ts-wrapper.single .ts-control > input { height: auto; padding: 0; border: 0; }
.ts-wrapper.multi .ts-control { min-height: 40px; padding: 4px 10px; }
.ts-wrapper.focus .ts-control { padding: 0 11px; }
.ts-wrapper.multi.focus .ts-control { padding: 3px 9px; }
.tl-toolbar .ts-wrapper { min-width: 180px; }
.filters .ts-wrapper, .inline-label .ts-wrapper { min-width: 160px; }
.chip input[type=checkbox] { margin: 0; flex: none; }
.comment-actions .chip { height: 34px; }

/* Page actions (contacts, lists) and inline search */
.page-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.search-inline { position: relative; margin: 0; }
.search-inline .mi { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--on-surface-variant); pointer-events: none; font-size: 18px; }
.search-inline input { width: 280px; padding-left: 36px; }
.btn .mi { margin-right: -2px; }
/* Forms sit on the tinted page; fields stay white so entries stand out */
.card form input, .card form select, .card form textarea { background: #ffffff; }
.card .field label, .card form label { color: var(--on-surface); }

/* ---------- Material data tables (applies to every list) ---------- */
.grid-table { border-collapse: separate; border-spacing: 0; background: var(--surface); }
.grid-table thead th {
  position: sticky; top: 0; z-index: 2; height: 44px; padding: 0 16px; background: #e3ecf7;
  color: #33415a; font-size: 12px; font-weight: 500; letter-spacing: .3px; text-transform: none;
  border-bottom: 2px solid #b8cbe4; white-space: nowrap;
}
.grid-table tbody td { height: 52px; padding: 0 16px; font-size: 13.5px; color: var(--on-surface); border-bottom: 1px solid #e1e8f2; }
.grid-table tbody tr:nth-child(even) td { background: #f2f6fc; }
.grid-table tbody tr:hover td { background: #e2eefc; }
.grid-table tbody td:first-child { font-weight: 500; }
.grid-table tbody td:first-child a { display: inline-flex; align-items: center; gap: 10px; color: var(--on-surface); }
.grid-table tbody td:first-child a:hover { color: var(--primary); text-decoration: none; }
.grid-table tbody td a.strong:hover { color: var(--primary); }
.grid-table .who-cell .avatar.sm { box-shadow: 0 0 0 2px #fff; }
.card.flush { border-radius: var(--radius-card); box-shadow: var(--elev-2); }
.card.flush .table-wrap { max-height: calc(100vh - 230px); overflow: auto; }
.pager { background: var(--surface); border-radius: 999px; padding: 6px 10px; width: fit-content; margin: 14px auto 0; box-shadow: var(--elev-1); }
.ini {
  width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  background: var(--primary-container); color: var(--on-primary-container); font-size: 12px; font-weight: 500;
}

/* =====================================================================
   AirJaldi "Fiber" theme — Manrope, deep blue gradient, soft glow,
   white rounded cards, gradient actions. Brand blue #1976d2 + orange #f57c00.
   ===================================================================== */
:root {
  --g-deep: linear-gradient(135deg, #061a3a 0%, #0d3b80 52%, #1976d2 100%);
  --g-btn: linear-gradient(135deg, #0d3b80 0%, #1565c0 52%, #1e88e5 100%);
  --g-accent: linear-gradient(135deg, #e65100 0%, #f57c00 60%, #ffa040 100%);
  --page: #eef3fa;
  --surface: #ffffff;
  --surface-1: #f4f7fc;
  --radius-card: 16px;
  --radius-field: 10px;
  --elev-1: 0 1px 2px rgba(13, 59, 128, .06), 0 6px 20px -8px rgba(13, 59, 128, .18);
  --elev-2: 0 2px 4px rgba(13, 59, 128, .08), 0 14px 32px -12px rgba(13, 59, 128, .30);
}
body { font-family: Manrope, system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 14px; background: var(--page); letter-spacing: -.05px; }
h1 { font-weight: 800; letter-spacing: -.4px; }
h2, .card-head h2 { font-weight: 700; }

/* Sidebar: deep gradient with a warm glow */
.side {
  background: var(--g-deep); border-right: 0; color: #dbe8fb; position: sticky; isolation: isolate;
}
.side::before {
  content: ""; position: absolute; width: 320px; height: 320px; right: -160px; bottom: -120px; z-index: -1;
  background: radial-gradient(circle, rgba(255, 160, 64, .38), transparent 65%); filter: blur(10px);
}
.side::after {
  content: ""; position: absolute; width: 260px; height: 260px; left: -140px; top: -110px; z-index: -1;
  background: radial-gradient(circle, rgba(100, 181, 246, .35), transparent 65%);
}
.brand { color: #fff; }
.brand-text b { font-weight: 800; font-size: 15px; }
.brand-text small { color: #9fc3ee; }
.logo { background: var(--g-accent); box-shadow: 0 6px 16px -4px rgba(245, 124, 0, .7); border-radius: 12px; font-weight: 800; }
.menu-title { color: #8fb3e3; text-transform: uppercase; letter-spacing: 1px; font-size: 10.5px; font-weight: 700; }
.menu > a { color: #d3e3f8; border-radius: 12px; font-weight: 600; }
.menu > a .mi { color: #9fc3ee; }
.menu > a:hover { background: rgba(255, 255, 255, .09); color: #fff; }
.menu > a.active { background: rgba(255, 255, 255, .96); color: #0d3b80; box-shadow: 0 8px 20px -10px rgba(0, 0, 0, .5); }
.menu > a.active .mi { color: #f57c00; }
.me { border-top-color: rgba(255, 255, 255, .14); }
.who b { color: #fff; } .who small { color: #9fc3ee; }
.avatar { background: var(--g-accent); color: #fff; font-weight: 700; }
.side .icon-btn { color: #dbe8fb; }
.side .icon-btn:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.sb-collapsed .menu-title { border-top-color: rgba(255, 255, 255, .14); }

/* Top bar: glassy */
.top { background: rgba(255, 255, 255, .82); backdrop-filter: blur(12px); border-bottom: 1px solid #dfe7f3; height: 64px; }
.search input { background: #eef3fa; border: 1px solid #dfe7f3; border-radius: 12px; }
.search input:focus { border-color: #1976d2; box-shadow: 0 0 0 4px rgba(25, 118, 210, .15); background: #fff; }

/* Buttons: gradient with coloured shadow */
.btn, button { border-radius: 10px; height: 38px; font-weight: 700; background: var(--g-btn); border: 0;
  box-shadow: 0 2px 10px rgba(21, 101, 192, .3); }
.btn:hover, button:hover { background: var(--g-btn); filter: brightness(1.08); box-shadow: 0 6px 18px rgba(21, 101, 192, .38); }
.btn.filled, .btn.primary, .btn.grad, button.grad { background: var(--g-btn); }
.btn.accent { background: var(--g-accent); box-shadow: 0 2px 10px rgba(245, 124, 0, .35); }
.btn.outline, .btn.ghost, .btn.outlined { background: #fff; color: #0d3b80; border: 1.5px solid #c3d4ec; box-shadow: none; }
.btn.outline:hover, .btn.ghost:hover, .btn.outlined:hover { background: #eef4fd; border-color: #1976d2; filter: none; }
.btn.danger, button.danger { background: linear-gradient(135deg, #8e1414, #c62828); box-shadow: 0 2px 10px rgba(198, 40, 40, .3); }
.btn.small, button.small { height: 30px; border-radius: 8px; }
.btn:disabled, button:disabled { background: #e3e9f2; color: #7a8599; box-shadow: none; filter: none; }
.icon-btn { background: transparent; box-shadow: none; border-radius: 12px; }
.icon-btn:hover { background: #eef3fa; filter: none; box-shadow: none; }
.logout-form button.icon-btn { background: transparent; }

/* Fields like the reference: light border, glow on focus */
input, select, textarea { border: 1px solid #cdd8e8; border-radius: 10px; height: 40px; background: #fff; }
input:hover, select:hover, textarea:hover { border-color: #9db6d8; }
input:focus, select:focus, textarea:focus { border: 1px solid #1976d2; padding: 0 12px; box-shadow: 0 0 0 4px rgba(25, 118, 210, .15); }
textarea:focus { padding: 10px 12px; }
.field label, .card form label { color: #1b2a44; font-weight: 600; font-size: 12.5px; }
.ts-wrapper.single .ts-control, .ts-wrapper.multi .ts-control { border: 1px solid #cdd8e8; border-radius: 10px; }
.ts-wrapper.focus .ts-control { border: 1px solid #1976d2; box-shadow: 0 0 0 4px rgba(25, 118, 210, .15); padding: 0 12px; }

/* Cards */
.card { border-radius: 16px; box-shadow: var(--elev-1); border: 1px solid #e3eaf5; }
.card > .card-head { border-bottom: 1px solid #edf1f8; }
.card-head h2::before { content: ""; width: 4px; height: 16px; border-radius: 4px; background: var(--g-btn); display: inline-block; }

/* ---------- Dashboard hero ---------- */
.hero {
  position: relative; overflow: hidden; isolation: isolate; border-radius: 20px; padding: 24px 26px 22px; margin-bottom: 18px;
  background: var(--g-deep); color: #fff; box-shadow: 0 18px 40px -18px rgba(13, 59, 128, .65);
}
.hero::before { content: ""; position: absolute; z-index: -1; width: 460px; height: 460px; right: -120px; top: -220px;
  background: radial-gradient(circle, rgba(255, 160, 64, .45), transparent 62%); }
.hero::after { content: ""; position: absolute; z-index: -1; width: 380px; height: 380px; left: 30%; bottom: -260px;
  background: radial-gradient(circle, rgba(100, 181, 246, .35), transparent 62%); }
.hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.hero h1 { color: #fff; font-size: 24px; }
.hero .sub { color: #bcd5f5; margin-top: 4px; font-size: 13.5px; }
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.hero-actions .btn { background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .28); box-shadow: none; backdrop-filter: blur(6px); }
.hero-actions .btn:hover { background: rgba(255, 255, 255, .24); }
.hero-actions .btn.accent { background: var(--g-accent); border: 0; box-shadow: 0 6px 16px -4px rgba(245, 124, 0, .7); }
.hero .kpis { margin: 0; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.hero .kpi {
  background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .18); border-top: 1px solid rgba(255, 255, 255, .18);
  box-shadow: none; color: #fff; backdrop-filter: blur(8px); border-radius: 14px; padding: 14px 16px;
}
.hero .kpi:hover { background: rgba(255, 255, 255, .17); color: #fff; transform: translateY(-2px); box-shadow: 0 10px 24px -12px rgba(0, 0, 0, .5); }
.hero .k-icon { background: rgba(255, 255, 255, .16); color: #fff; }
.hero .k-label { color: #cfe1f8; }
.hero .k-value { color: #fff; font-weight: 800; font-size: 26px; }
.hero .k-sub { color: #a9c6ec; }
.hero .k-rose .k-icon { background: rgba(239, 83, 80, .9); }
.hero .k-amber .k-icon { background: var(--g-accent); }
.hero .k-emerald .k-icon { background: rgba(67, 160, 71, .9); }
.hero .k-violet .k-icon { background: rgba(126, 87, 194, .9); }
.hero .k-sky .k-icon { background: rgba(41, 182, 246, .85); }
.hero .k-indigo .k-icon { background: rgba(30, 136, 229, .95); }
.hero .k-rose .k-value { color: #ffcdd2; }
.hero-strip { display: flex; gap: 26px; flex-wrap: wrap; margin-top: 16px; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .14); font-size: 12.5px; color: #bcd5f5; }
.hero-strip b { color: #fff; font-size: 16px; font-weight: 800; margin-right: 6px; }

/* Login like the reference */
main.auth { background: var(--g-deep); position: relative; overflow: hidden; isolation: isolate; }
main.auth::before { content: ""; position: absolute; z-index: -1; width: 620px; height: 620px; right: -160px; top: -200px;
  background: radial-gradient(circle, rgba(255, 160, 64, .4), transparent 62%); }
main.auth::after { content: ""; position: absolute; z-index: -1; width: 520px; height: 520px; left: -160px; bottom: -220px;
  background: radial-gradient(circle, rgba(100, 181, 246, .35), transparent 62%); }
.login-brand b { color: #fff; } .login-brand small { color: #bcd5f5; }
.login .card { border-radius: 20px; border: 0; box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .55); }

/* Pills slightly rounder */
.tag, .pill { border-radius: 999px; padding: 0 10px; font-weight: 700; }
.kpi:not(.hero .kpi) { border-radius: 16px; }
.nowrap { white-space: nowrap; }
.grid-table td.subj { min-width: 220px; }
.mi.tiny { font-size: 16px; vertical-align: -3px; margin-right: 4px; color: var(--on-surface-variant); }
.bad .mi.tiny { color: var(--error); }
.grid-table .who-cell { gap: 8px; }
.grid-table .who-cell .ini { width: 26px; height: 26px; font-size: 11px; }
.filters .chip { height: 40px; border-radius: 10px; background: #fff; border-color: #cdd8e8; }

/* ---------- Deal board ---------- */
.board { grid-auto-columns: minmax(270px, 1fr); gap: 14px; align-items: start; }
.col { background: #e6edf7; border: 0; border-radius: 16px; padding: 10px; max-height: calc(100vh - 190px); overflow-y: auto; }
.col-head { display: flex; align-items: center; gap: 8px; padding: 6px 6px 10px; position: sticky; top: -10px; background: #e6edf7; z-index: 1; }
.col-head b { font-weight: 800; font-size: 13.5px; }
.col-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c, #1976d2); box-shadow: 0 0 0 3px rgba(255,255,255,.8); }
.col-count { font-size: 11.5px; font-weight: 700; color: var(--on-surface-variant); background: #fff; border-radius: 999px; padding: 1px 8px; }
.col-total { margin-left: auto; font-size: 12.5px; font-weight: 800; color: var(--c, #1976d2); }
.stage-lead { --c: #64b5f6; } .stage-qualified { --c: #1e88e5; } .stage-proposal { --c: #5e35b1; }
.stage-negotiation { --c: #f57c00; } .stage-won { --c: #2e7d32; } .stage-lost { --c: #9e9e9e; }
.deal { background: #fff; border: 0; border-left: 4px solid var(--c, #1976d2); border-radius: 12px; padding: 11px 12px 10px; margin: 0 0 8px;
  box-shadow: 0 1px 2px rgba(13,59,128,.06), 0 4px 12px -6px rgba(13,59,128,.2); transition: transform .12s, box-shadow .12s; }
.deal:hover { transform: translateY(-1px); box-shadow: 0 8px 20px -10px rgba(13,59,128,.4); }
.deal-title { display: block; font-weight: 700; color: var(--on-surface); font-size: 13.5px; line-height: 1.35; }
.deal-title:hover { color: var(--primary); text-decoration: none; }
.deal-meta { font-size: 12px; color: var(--on-surface-variant); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deal-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.deal-value { font-weight: 800; font-size: 14px; color: var(--on-surface); }
.deal-foot .ini { width: 26px; height: 26px; font-size: 11px; }
.deal-move { display: flex; align-items: center; gap: 4px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed #e1e8f2; }
.deal-move select { height: 28px; border: 0; background-color: transparent; padding: 0 26px 0 2px; font-size: 12px; font-weight: 600; color: var(--on-surface-variant); width: auto; box-shadow: none; }
.deal-move select:hover, .deal-move select:focus { color: var(--primary); box-shadow: none; border: 0; }
.col-empty { text-align: center; color: var(--on-surface-variant); font-size: 12.5px; padding: 18px 0; }
.grid-table thead th, .grid-table tbody td { padding: 0 12px; }
.role-chip { border-radius: 16px; border: 0; border-top: 0; position: relative; overflow: hidden; padding: 14px 16px; box-shadow: var(--elev-1); }
.role-chip::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--g-btn); }
.role-chip:nth-child(2n)::before { background: var(--g-accent); }
.role-chip span { font-weight: 800; font-size: 22px; }

/* Restore select arrow (theme set background shorthand) */
select, .card form select {
  background-color: #fff;
  background-image: linear-gradient(45deg, transparent 50%, #4b5567 50%), linear-gradient(135deg, #4b5567 50%, transparent 50%);
  background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
  padding-right: 36px;
}

/* Stat row (timeline, reports) */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat { display: flex; align-items: center; gap: 12px; background: #fff; border-radius: 14px; padding: 12px 14px; box-shadow: var(--elev-1); border: 1px solid #e3eaf5; }
.stat > .mi { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 22px; color: #fff; background: var(--sc, var(--g-btn)); box-shadow: 0 6px 14px -6px var(--ss, rgba(21,101,192,.6)); }
.stat small { display: block; font-size: 12px; color: var(--on-surface-variant); font-weight: 600; }
.stat b { font-size: 20px; font-weight: 800; color: var(--on-surface); font-variant-numeric: tabular-nums; }
.s-blue { --sc: linear-gradient(135deg, #1565c0, #42a5f5); }
.s-indigo { --sc: linear-gradient(135deg, #0d3b80, #1976d2); }
.s-orange { --sc: var(--g-accent); --ss: rgba(245,124,0,.6); }
.s-red { --sc: linear-gradient(135deg, #8e1414, #e53935); --ss: rgba(198,40,40,.6); }
.s-red b { color: var(--error); }
.s-green { --sc: linear-gradient(135deg, #1b5e20, #43a047); --ss: rgba(46,125,50,.6); }
.s-violet { --sc: linear-gradient(135deg, #4527a0, #7e57c2); --ss: rgba(94,53,177,.6); }
/* Timeline group header aligned left */
.tl-group > summary .tl-label { justify-content: flex-start; font-weight: 800; }
.tl-group > summary .tl-label b { font-weight: 800; }
.grp-meta { font-size: 12px; font-weight: 700; color: var(--primary); background: #e3effb; border-radius: 999px; padding: 1px 9px; }
.tl { border-radius: 16px; box-shadow: var(--elev-1); border: 1px solid #e3eaf5; }

/* Deal stage track */
.stage-track { display: flex; gap: 4px; margin: 0 0 16px; background: #fff; padding: 6px; border-radius: 14px; box-shadow: var(--elev-1); overflow-x: auto; }
.stage-track .st { flex: 1; min-width: 100px; text-align: center; padding: 8px 6px; font-size: 12.5px; font-weight: 700; color: var(--on-surface-variant);
  background: #eef3fa; clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%); }
.stage-track .st:first-child { clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%); border-radius: 9px 0 0 9px; }
.stage-track .st.on { background: var(--g-btn); color: #fff; }
.stage-track .st.on.st-won { background: linear-gradient(135deg, #1b5e20, #43a047); }
.stage-track .st.on.st-lost { background: linear-gradient(135deg, #616161, #9e9e9e); }
.big-val { font-size: 18px; font-weight: 800; }
dl.kv dd .who-cell { display: inline-flex; }

/* Searchable dropdowns render at page level so cards never clip them */
body > .ts-dropdown { z-index: 1000; max-height: 320px; }
body > .ts-dropdown .ts-dropdown-content { max-height: 300px; }

/* @mention list renders at page level (fixed) so cards never clip it */
.mention-menu { position: fixed; right: auto; margin: 0; z-index: 1000; max-width: 420px; }

/* ---------- Inbox & chat ---------- */
.nav-count { margin-left: auto; min-width: 22px; height: 20px; padding: 0 7px; border-radius: 999px; background: var(--g-accent);
  color: #fff; font-size: 11px; font-weight: 800; display: inline-grid; place-items: center; }
.sb-collapsed .nav-count { position: absolute; top: 4px; right: 6px; min-width: 16px; height: 16px; font-size: 10px; padding: 0 4px; }
.tab-count { margin-left: 6px; background: var(--g-accent); color: #fff; border-radius: 999px; padding: 0 7px; font-size: 11px; font-weight: 800; }
.presence-form { margin: 0; }
.presence { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 999px;
  background: #eef3fa; color: var(--on-surface-variant); border: 1px solid #d6e0ee; box-shadow: none; font-weight: 700; font-size: 13px; }
.presence:hover { background: #e3ecf7; filter: none; box-shadow: none; }
.presence .presence-dot { width: 10px; height: 10px; border-radius: 50%; background: #9aa5b5; }
.presence.on { background: #e6f6ea; color: #1b5e20; border-color: #b9e2c2; }
.presence.on .presence-dot { background: #2e7d32; box-shadow: 0 0 0 4px rgba(46, 125, 50, .18); animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 3px rgba(46,125,50,.25); } 50% { box-shadow: 0 0 0 6px rgba(46,125,50,.05); } }
.chat-card { display: flex; flex-direction: column; }
.chat-log { display: flex; flex-direction: column; gap: 8px; max-height: 420px; min-height: 160px; overflow-y: auto; padding: 4px 2px 10px; }
.bubble { max-width: 78%; padding: 9px 12px; border-radius: 14px; font-size: 13.5px; line-height: 1.45; word-wrap: break-word; }
.bubble small { display: block; font-size: 11px; opacity: .7; margin-top: 3px; }
.bubble.visitor { align-self: flex-start; background: #eef3fa; border-bottom-left-radius: 4px; }
.bubble.agent { align-self: flex-end; background: var(--g-btn); color: #fff; border-bottom-right-radius: 4px; }
.bubble.system { align-self: center; background: transparent; color: var(--on-surface-variant); font-size: 12px; padding: 2px 8px; }
.chat-compose { display: flex; gap: 8px; border-top: 1px solid #edf1f8; padding-top: 12px; }
.chat-compose input { flex: 1; }
.live-dot { font-size: 12px; font-weight: 700; color: var(--on-surface-variant); }
.live-dot.ok { color: #2e7d32; } .live-dot.ok::before { content: "● "; }
.live-dot.bad { color: var(--error); }
.chat-toast { position: fixed; right: 20px; top: 76px; z-index: 2000; display: flex; gap: 12px; align-items: center;
  background: var(--g-deep); color: #fff; padding: 14px 18px; border-radius: 14px; box-shadow: 0 18px 40px -12px rgba(6,26,58,.6);
  animation: toast-in .25s ease-out; }
.chat-toast:hover { text-decoration: none; filter: brightness(1.08); }
.chat-toast .mi { font-size: 26px; color: #ffb74d; }
.chat-toast b { display: block; } .chat-toast small { color: #bcd5f5; }
@keyframes toast-in { from { transform: translateY(-12px); opacity: 0; } to { transform: none; opacity: 1; } }
pre.code { background: #0f2540; color: #d6e8ff; padding: 14px 16px; border-radius: 12px; font-size: 13px; overflow-x: auto; white-space: pre-wrap; word-break: break-all; }
code { background: #eef3fa; padding: 1px 6px; border-radius: 6px; font-size: 12.5px; }

.card form label.type-card { display: grid; color: inherit; font-size: inherit; font-weight: inherit; margin: 0; }
.card form label.type-card .t-title { font-size: 14px; color: var(--on-surface); }
.secret-row { display: flex; gap: 8px; }
.secret-row input { flex: 1; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; background: #f4f7fc; }
.card-head h2 .mi { font-size: 20px; }

/* Wide screens: login background fills the window; app content uses the width, centred beyond 1760px */
main { max-width: 1760px; margin-left: auto; margin-right: auto; }
main.auth { max-width: none; width: 100%; margin: 0; }
