/* ============================================================================
   Ad Holic CRM — "Studio console"
   Calm, precise, brand-true. One signature: the Ad Holic magenta→blue gradient.
   ========================================================================== */

:root {
  /* Palette */
  --ink: #14172a;
  --ink-soft: #2c3350;
  --muted: #667085;
  --line: #e7e9f1;
  --line-soft: #f0f2f8;
  --canvas: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #fbfcff;

  --brand: #2e5bff;
  --brand-ink: #1e3eb8;
  --brand-tint: #eef2ff;
  --magenta: #c0117a;
  --grad: linear-gradient(115deg, #c0117a 0%, #6d3ae0 46%, #2e5bff 100%);

  --won: #12855c;
  --won-tint: #e6f6ef;
  --lost: #e5484d;
  --lost-tint: #fdecec;
  --amber: #b76e00;
  --amber-tint: #fff4e5;
  --warn: #e5484d;

  /* Type */
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;

  /* Scale */
  --radius: 16px;
  --radius-sm: 11px;
  --radius-xs: 8px;
  --shadow-sm: 0 1px 2px rgba(20, 23, 42, .05);
  --shadow: 0 1px 2px rgba(20, 23, 42, .04), 0 6px 20px rgba(20, 23, 42, .06);
  --shadow-lg: 0 12px 40px rgba(20, 23, 42, .16);

  --nav-h: 62px;         /* mobile bottom-nav height */

  font-family: var(--font-body);
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--canvas); color: var(--ink);
  font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -.02em; }
a { color: var(--brand); }
::selection { background: rgba(109, 58, 224, .16); }

:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(46, 91, 255, .38);
  border-radius: var(--radius-xs);
}

/* ---------------------------------------------------------------- Top bar */
.topbar {
  display: flex; align-items: center; gap: 18px;
  padding: 12px clamp(16px, 4vw, 28px); background: var(--surface);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30;
}
.brand {
  font-family: var(--font-display); font-weight: 700; font-size: 19px;
  letter-spacing: -.03em; display: flex; align-items: center; gap: 9px; white-space: nowrap;
}
.brand .crm {
  background: var(--grad); -webkit-background-clip: text; background-clip: text;
  color: transparent; font-weight: 700;
}
.brand-logo { height: 28px; width: auto; display: block; }

.tabs { display: none; gap: 2px; margin-left: 6px; flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  border: 0; background: transparent; color: var(--muted); font-family: var(--font-body);
  font-size: 14.5px; font-weight: 600; padding: 8px 14px; border-radius: 999px;
  cursor: pointer; white-space: nowrap; transition: background .14s, color .14s;
}
.tab:hover { color: var(--ink); background: var(--line-soft); }
.tab.active { background: var(--brand-tint); color: var(--brand-ink); }

.auth-area { display: none; align-items: center; gap: 10px; margin-left: auto; }
.auth-area .who { font-size: 13px; color: var(--muted); font-weight: 500; }

body.signed-in .tabs { display: flex; }
body.signed-in .auth-area { display: flex; }
body.signed-in #newLeadBtn { display: inline-flex; }

/* ------------------------------------------------------------------ Buttons */
.btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  padding: 9px 15px; border-radius: var(--radius-sm); font-weight: 600; font-size: 14px;
  cursor: pointer; font-family: var(--font-body); display: inline-flex; align-items: center;
  gap: 7px; line-height: 1; transition: background .14s, border-color .14s, box-shadow .14s, filter .14s;
}
.btn:hover { border-color: #d6dae8; background: var(--surface-2); }
.btn:active { transform: translateY(.5px); }
.btn.primary {
  background: var(--grad); color: #fff; border: 0; box-shadow: 0 4px 14px rgba(109, 58, 224, .28);
}
.btn.primary:hover { filter: brightness(1.05); background: var(--grad); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--line-soft); border-color: transparent; }
#newLeadBtn { display: none; margin-left: 6px; }

/* -------------------------------------------------------------------- Views */
.view { padding: clamp(18px, 3vw, 30px); max-width: 1200px; margin: 0 auto; }
body.signed-in .view { padding-bottom: 40px; }
h1 { font-size: 24px; margin: 0 0 2px; }
.sub { color: var(--muted); font-size: 13.5px; margin: 0 0 22px; }

/* KPI grid */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(184px, 1fr)); gap: 14px; }
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 18px 16px; box-shadow: var(--shadow-sm); transition: box-shadow .16s, transform .16s;
}
.kpi:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.kpi .val {
  font-family: var(--font-display); font-size: 30px; font-weight: 600; letter-spacing: -.03em;
  line-height: 1.05; font-feature-settings: "tnum" 1; color: var(--ink);
}
.kpi .lbl { color: var(--muted); font-size: 12.5px; font-weight: 500; margin-top: 6px; }
.kpi.warn .val { color: var(--warn); }

/* Pipeline board — fixed to the viewport height so the horizontal scrollbar sits
   at the bottom of the visible board (reachable without scrolling the page).
   Columns scroll vertically on their own; the board scrolls horizontally. */
.board {
  display: flex; gap: 14px; padding: 2px 2px 6px; scroll-snap-type: x proximity;
  overflow-x: auto; overflow-y: hidden;
  height: calc(100vh - 208px);
  height: calc(100dvh - 208px);
}
.column { min-width: 264px; flex: 0 0 264px; scroll-snap-align: start; display: flex; flex-direction: column; max-height: 100%; }
.col-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; padding: 0 2px; flex: 0 0 auto; }
.col-head b { font-size: 13.5px; font-weight: 700; }
.col-head small { color: var(--muted); font-size: 12px; font-feature-settings: "tnum" 1; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 13px;
  padding: 13px; margin-bottom: 10px; cursor: grab; box-shadow: var(--shadow-sm);
  transition: box-shadow .14s, border-color .14s, transform .1s;
}
.card:hover { border-color: #cdd4ea; box-shadow: var(--shadow); }
.card:active { cursor: grabbing; }
.card.dragging { opacity: .45; transform: scale(.98); }
.card .nm { font-weight: 700; font-size: 14.5px; }
.card .co { color: var(--muted); font-size: 13px; margin-top: 1px; }
.card .mt { color: var(--brand-ink); font-size: 12px; font-weight: 600; margin-top: 7px; font-feature-settings: "tnum" 1; }

.col-body {
  flex: 1 1 auto; min-height: 120px; overflow-y: auto; padding: 6px; border-radius: 13px;
  outline: 2px dashed transparent; transition: background .12s, outline-color .12s;
}
.column.drop-over .col-body { background: rgba(46, 91, 255, .07); outline-color: rgba(46, 91, 255, .5); }
.col-empty { color: var(--muted); text-align: center; padding: 22px 0; font-size: 13px; }

/* Contacts list */
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line-soft); cursor: pointer; transition: background .12s; }
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--surface-2); }
.row .meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.search {
  width: 100%; padding: 13px 15px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: 15px; margin-bottom: 16px; font-family: inherit; background: var(--surface);
  transition: border-color .14s, box-shadow .14s;
}
.search:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(46, 91, 255, .14); }

/* Badges */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; letter-spacing: .01em; }
.badge.HOT { background: var(--lost-tint); color: var(--lost); }
.badge.WARM { background: var(--amber-tint); color: var(--amber); }
.badge.COLD { background: var(--brand-tint); color: var(--brand-ink); }
.badge.WON { background: var(--won-tint); color: var(--won); }
.badge.LOST { background: var(--lost-tint); color: var(--lost); }

/* ------------------------------------------------------------------- Drawer */
.drawer { position: fixed; inset: 0; z-index: 60; }
.drawer.hidden { display: none; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(20, 23, 42, .42); backdrop-filter: blur(2px); animation: fade .18s ease; }
.drawer-panel {
  position: absolute; right: 0; top: 0; height: 100%; width: min(468px, 94vw);
  background: var(--surface); box-shadow: var(--shadow-lg);
  padding: 24px 24px calc(28px + env(safe-area-inset-bottom)); overflow-y: auto;
  animation: slidein .22s cubic-bezier(.22, 1, .36, 1);
}
@keyframes slidein { from { transform: translateX(24px); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.drawer-panel h2 { margin: 0 0 4px; font-size: 21px; }
.field { display: block; margin: 13px 0; }
.field label { display: block; font-size: 12.5px; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--radius-xs);
  font-size: 15px; font-family: inherit; background: var(--surface); color: var(--ink);
  transition: border-color .14s, box-shadow .14s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(46, 91, 255, .14);
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 4px; }
.chip {
  border: 1px solid var(--line); background: var(--surface); padding: 7px 13px; border-radius: 999px;
  font-size: 13px; font-weight: 600; color: var(--ink-soft); cursor: pointer; transition: all .12s;
}
.chip:hover { border-color: #cdd4ea; }
.chip.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.section-t { font-family: var(--font-display); font-weight: 600; margin: 24px 0 9px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.timeline .item { padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.timeline .item .t { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.timeline .item .b { font-size: 14px; margin-top: 3px; }
.task { display: flex; align-items: center; gap: 11px; padding: 9px 0; }
.task input[type=checkbox] { width: 19px; height: 19px; accent-color: var(--brand); flex: none; }
.task.done .tt { text-decoration: line-through; color: var(--muted); }

/* --------------------------------------------------- Activities: List / Cal */
.act-top { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.act-top h1 { margin: 0; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); padding: 3px; gap: 2px; }
.seg-btn { border: 0; background: transparent; padding: 7px 15px; font-size: 13.5px; font-weight: 600; color: var(--muted); cursor: pointer; border-radius: 8px; font-family: inherit; }
.seg-btn.on { background: var(--brand-tint); color: var(--brand-ink); }
.od { color: var(--lost); font-weight: 700; }

.cal-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.cal-nav .btn { padding: 7px 12px; }
.cal-range { color: var(--muted); font-size: 14px; margin-left: 4px; font-weight: 500; }

.cal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.cal-scroll { max-height: 64vh; overflow: auto; -webkit-overflow-scrolling: touch; }
.cal-head, .cal-grid { display: grid; grid-template-columns: 60px repeat(7, minmax(96px, 1fr)); min-width: 720px; }
.cal-head { border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.cal-gut { padding: 11px 8px; font-size: 10.5px; font-weight: 700; color: var(--muted); letter-spacing: .04em; }
.cal-dh { padding: 10px 8px; text-align: center; font-size: 12.5px; font-weight: 600; color: var(--muted); border-left: 1px solid var(--line-soft); }
.cal-dh .dnum { display: inline-block; min-width: 24px; height: 24px; line-height: 24px; border-radius: 999px; font-family: var(--font-display); }
.cal-dh.is-today { color: var(--brand-ink); }
.cal-dh.is-today .dnum { background: var(--grad); color: #fff; }
.cal-time { font-size: 10.5px; color: var(--muted); padding: 4px 8px; text-align: right; height: 48px; box-sizing: border-box; border-top: 1px solid var(--line-soft); font-feature-settings: "tnum" 1; }
.cal-cell { height: 48px; box-sizing: border-box; border-top: 1px solid var(--line-soft); border-left: 1px solid var(--line-soft); padding: 2px; cursor: pointer; overflow: hidden; transition: background .1s; }
.cal-cell:hover { background: rgba(46, 91, 255, .045); }
.cal-ev {
  display: flex; align-items: center; gap: 5px; background: var(--brand-tint); color: var(--brand-ink);
  border-radius: 7px; padding: 4px 7px; font-size: 12px; font-weight: 600; margin-bottom: 2px;
  cursor: pointer; white-space: nowrap; overflow: hidden;
}
.cal-ev:hover { filter: brightness(.97); }
.cal-ev .ev-t { overflow: hidden; text-overflow: ellipsis; }
.cal-ev.done { opacity: .5; text-decoration: line-through; }

/* -------------------------------------------------------------------- Admin */
.admin { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.admin-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 20px; }
.admin-card h3 { margin: 0 0 6px; font-size: 16px; }
.admin-card .btn.primary { margin-left: 0; }
.ed-row { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.ed-row .ed-val { flex: 1; min-width: 0; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius-xs); font-size: 14px; font-family: inherit; }
.ed-row .ed-type { padding: 9px; border: 1px solid var(--line); border-radius: var(--radius-xs); font-family: inherit; }
.ed-row .btn { padding: 7px 9px; }
.ed-head { display: flex; gap: 6px; font-size: 11.5px; color: var(--muted); margin-bottom: 8px; font-weight: 700; letter-spacing: .02em; }
.ed-head span:first-child { flex: 1; }
.ed-head span + span { flex: 0 0 52px; text-align: center; }
.ed-head span:last-child { margin-right: 72px; }
.ed-cell { flex: 0 0 52px; display: flex; justify-content: center; align-items: center; }
.ed-cell input { accent-color: var(--brand); width: 18px; height: 18px; }
.core-row .ed-val:disabled, .ed-cell input:disabled { opacity: .5; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.kv span { color: var(--muted); }
.kv b { text-align: right; }
.csv-tbl { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 6px; }
.csv-tbl th, .csv-tbl td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
.csv-tbl th { color: var(--muted); font-weight: 700; }
#csvTemplate { display: inline-block; text-decoration: none; }

/* --------------------------------------------------------------------- Auth */
.auth-wrap { min-height: calc(100vh - 120px); display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: var(--shadow-lg); padding: 34px 30px; width: min(392px, 100%);
}
.auth-card h1 { font-size: 24px; margin: 0 0 4px; }
.auth-card .btn.primary { width: 100%; margin-left: 0; margin-top: 10px; justify-content: center; padding: 12px; }
.auth-card .switch { text-align: center; margin-top: 16px; font-size: 13px; color: var(--muted); }
.auth-card .switch a { color: var(--brand); cursor: pointer; font-weight: 600; }
.auth-err { color: var(--lost); font-size: 13px; min-height: 18px; margin-top: 6px; }

/* ------------------------------------------------------- Mobile nav + FAB */
.mobile-nav {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: rgba(255, 255, 255, .92); backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.mnav-item {
  flex: 1; border: 0; background: transparent; cursor: pointer; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 2px 8px; font-family: var(--font-body); font-size: 10.5px; font-weight: 600;
  position: relative; -webkit-tap-highlight-color: transparent;
}
.mnav-item svg { width: 22px; height: 22px; stroke-width: 1.9; }
.mnav-item.active { color: var(--brand-ink); }
.mnav-item.active::before {
  content: ""; position: absolute; top: 0; width: 26px; height: 3px; border-radius: 0 0 3px 3px;
  background: var(--grad);
}
.fab {
  display: none; position: fixed; z-index: 41;
  right: 18px; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px);
  width: 56px; height: 56px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--grad); color: #fff; font-size: 30px; font-weight: 400; line-height: 1;
  box-shadow: 0 8px 24px rgba(109, 58, 224, .42); align-items: center; justify-content: center;
}
.fab:active { transform: scale(.94); }

/* ---------------------------------------------------------------- Utilities */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(24px + env(safe-area-inset-bottom));
  background: var(--ink); color: #fff; padding: 11px 18px; border-radius: var(--radius-sm);
  z-index: 80; font-size: 14px; font-weight: 500; box-shadow: var(--shadow-lg); max-width: 90vw;
}
.toast.hidden { display: none; }
.muted { color: var(--muted); }
.empty { color: var(--muted); text-align: center; padding: 48px 24px; }

/* -------------------------------------------------------------- Responsive */
@media (max-width: 760px) {
  body.signed-in .tabs, body.signed-in #newLeadBtn { display: none; }
  body.signed-in .mobile-nav { display: flex; }
  body.signed-in .fab { display: flex; }
  body.signed-in .view { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 24px); }
  body.signed-in .toast { bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 20px); }
  .auth-area .who { display: none; }
  .brand { font-size: 17px; }
  h1 { font-size: 21px; }
  .kpi .val { font-size: 27px; }
  .drawer-panel { width: 100%; border-radius: 0; }
  .admin { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------ Motion / a11y */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ------------------------------------------------------------------- Dark */
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #eef0f6; --ink-soft: #c9cde0; --muted: #9aa0b4;
    --line: #272c42; --line-soft: #20243a; --canvas: #0f1220;
    --surface: #181c2e; --surface-2: #1c2138; --brand-tint: #26305a;
    --won-tint: #13332a; --lost-tint: #38222a; --amber-tint: #3a2f1c;
  }
  .btn:hover { border-color: #333a56; background: var(--surface-2); }
  .mobile-nav { background: rgba(24, 28, 46, .92); }
  .drawer-backdrop { background: rgba(0, 0, 0, .55); }
}

/* ============================================================================
   Team CRM additions — layered on top of the shared "Studio console" base.
   ========================================================================== */

/* Priority + status badges (reuse .badge base above) */
.badge.URGENT { background: var(--lost-tint); color: var(--lost); }
.badge.HIGH   { background: var(--amber-tint); color: var(--amber); }
.badge.MEDIUM { background: var(--brand-tint); color: var(--brand-ink); }
.badge.LOW    { background: var(--line-soft); color: var(--muted); }
.badge.ACTIVE  { background: var(--won-tint); color: var(--won); }
.badge.PAUSED, .badge.ON_HOLD { background: var(--amber-tint); color: var(--amber); }
.badge.ARCHIVED, .badge.DONE  { background: var(--line-soft); color: var(--muted); }
.badge.dot::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: currentColor; margin-right: 6px; vertical-align: middle; }

/* Avatars — coloured initials, deterministic per person */
.avatar {
  --a: var(--brand);
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 26px; height: 26px; border-radius: 50%; background: var(--a); color: #fff;
  font-size: 11px; font-weight: 700; font-family: var(--font-body); letter-spacing: .01em;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
}
.avatar.lg { width: 40px; height: 40px; font-size: 15px; }
.avatar.sm { width: 20px; height: 20px; font-size: 9.5px; }
.avatar.none { background: var(--line); color: var(--muted); box-shadow: none; }

/* Toolbar row above boards/lists (filters + search) */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .search { margin: 0; flex: 1 1 220px; min-width: 160px; }
.toolbar select {
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: 14px; font-family: inherit; background: var(--surface); color: var(--ink); cursor: pointer;
}
.crumbs { display: flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--muted); margin-bottom: 12px; flex-wrap: wrap; }
.crumbs a { cursor: pointer; font-weight: 600; }
.crumbs .sep { opacity: .5; }

/* Board task cards (extends .card) */
.card .task-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.card .task-title { font-weight: 700; font-size: 14px; line-height: 1.35; }
.card .task-sub { color: var(--muted); font-size: 12px; margin-top: 3px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.card .task-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; gap: 8px; }
.card .task-foot .due { font-size: 11.5px; font-weight: 600; color: var(--muted); font-feature-settings: "tnum" 1; }
.card .task-foot .due.od { color: var(--lost); }
.card .chip-type { font-size: 10.5px; font-weight: 700; color: var(--muted); background: var(--line-soft); border-radius: 999px; padding: 2px 8px; }
.card .cl-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--brand); }

/* Cards grid (clients / projects) */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.tile {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 18px; cursor: pointer;
  transition: box-shadow .16s, transform .16s, border-color .14s;
}
.tile:hover { box-shadow: var(--shadow); transform: translateY(-1px); border-color: #cdd4ea; }
.tile .tile-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.tile .tile-head .cl-dot { width: 11px; height: 11px; }
.tile h3 { margin: 0; font-size: 16px; }
.tile .tile-sub { color: var(--muted); font-size: 13px; }
.tile .tile-foot { display: flex; align-items: center; gap: 14px; margin-top: 13px; font-size: 12.5px; color: var(--muted); }
.tile .tile-foot b { color: var(--ink); font-feature-settings: "tnum" 1; }

/* Workload (dashboard) */
.work-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 13px; }
.work-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 15px; }
.work-card .wc-head { display: flex; align-items: center; gap: 10px; }
.work-card .wc-name { font-weight: 700; font-size: 14.5px; }
.work-card .wc-role { color: var(--muted); font-size: 12px; }
.work-card .wc-stats { display: flex; gap: 16px; margin-top: 13px; }
.work-card .wc-stat .n { font-family: var(--font-display); font-size: 22px; font-weight: 600; font-feature-settings: "tnum" 1; }
.work-card .wc-stat .l { font-size: 11px; color: var(--muted); font-weight: 500; }
.work-card .wc-stat.od .n { color: var(--lost); }
.work-bar { height: 6px; border-radius: 999px; background: var(--line-soft); margin-top: 12px; overflow: hidden; }
.work-bar > i { display: block; height: 100%; background: var(--grad); }

/* Attachments list (task drawer) */
.att-list { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.att {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: var(--radius-xs); background: var(--surface-2);
}
.att .att-ico { width: 30px; height: 30px; border-radius: 7px; background: var(--brand-tint); color: var(--brand-ink);
  display: flex; align-items: center; justify-content: center; flex: none; font-size: 13px; font-weight: 700; }
.att .att-name { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att .att-name a { color: var(--ink); text-decoration: none; }
.att .att-name a:hover { color: var(--brand); }
.att .att-size { font-size: 11.5px; color: var(--muted); font-feature-settings: "tnum" 1; }
.att .att-x { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 16px; padding: 2px 6px; border-radius: 6px; }
.att .att-x:hover { background: var(--lost-tint); color: var(--lost); }
.dropzone { border: 1.5px dashed var(--line); border-radius: var(--radius-sm); padding: 16px; text-align: center; color: var(--muted); font-size: 13px; cursor: pointer; transition: border-color .14s, background .14s; }
.dropzone:hover, .dropzone.over { border-color: var(--brand); background: rgba(46,91,255,.05); color: var(--brand-ink); }

/* Comment composer + timeline authorship */
.comment-box { display: flex; gap: 9px; align-items: flex-start; margin: 10px 0 4px; }
.comment-box textarea { flex: 1; min-height: 40px; resize: vertical; }
.timeline .item .who { font-weight: 700; color: var(--ink); }
.timeline .item.evt .b { color: var(--muted); font-size: 13px; }
.timeline .item .del { float: right; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; }
.timeline .item .del:hover { color: var(--lost); }

/* Meta line inside drawer (assignee + priority summary) */
.drawer-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 6px 0 4px; color: var(--muted); font-size: 13px; }
.pill { display: inline-flex; align-items: center; gap: 6px; background: var(--line-soft); border-radius: 999px; padding: 4px 10px; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }

/* Board column tint by header (subtle) */
.column .col-head .stage-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); margin-right: 6px; }

@media (max-width: 760px) {
  .work-grid, .grid-cards { grid-template-columns: 1fr; }
}

/* The header "+ New task" button (this app's id differs from the base's). */
#newTaskBtn { display: none; margin-left: 6px; }
body.signed-in #newTaskBtn { display: inline-flex; }
@media (max-width: 760px) { body.signed-in #newTaskBtn { display: none; } }

/* ------------------------------------------------------- Drawer close button */
/* Lives outside the scrolling panel, so it never scrolls out of reach. */
.drawer-close {
  position: fixed; z-index: 70;
  top: calc(12px + env(safe-area-inset-top)); right: 14px;
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  font-size: 15px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm); transition: background .14s, color .14s, transform .1s;
}
.drawer-close:hover { background: var(--line-soft); color: var(--ink); }
.drawer-close:active { transform: scale(.94); }
/* Keep drawer headings clear of the button. */
.drawer-panel h2 { padding-right: 44px; }

/* Small "Edit" affordance on project/client tiles (top-right of the tile head) */
.tile-head { position: relative; }
.tile-edit {
  margin-left: auto; flex: none;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  font-family: var(--font-body); font-size: 12px; font-weight: 600;
  padding: 4px 10px; border-radius: 999px; cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.tile-edit:hover { background: var(--brand-tint); color: var(--brand-ink); border-color: var(--brand-tint); }

/* ---------------------------------------------------- Command palette (⌘K) */
.search-btn { display: none; margin-left: 6px; gap: 8px; color: var(--muted); }
body.signed-in .search-btn { display: inline-flex; }
.search-btn svg { width: 16px; height: 16px; }
.search-btn:hover { color: var(--ink); }
.search-kbd, .palette-hint kbd {
  font-family: var(--font-body); font-size: 11px; font-weight: 600; color: var(--muted);
  border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; background: var(--surface-2);
}
@media (max-width: 760px) { .search-btn-label, .search-kbd { display: none; } }

.palette { position: fixed; inset: 0; z-index: 90; }
.palette.hidden { display: none; }
.palette-backdrop { position: absolute; inset: 0; background: rgba(20, 23, 42, .42); backdrop-filter: blur(2px); animation: fade .14s ease; }
.palette-box {
  position: absolute; left: 50%; top: 12vh; transform: translateX(-50%);
  width: min(600px, 94vw); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden;
  animation: paletteIn .16s cubic-bezier(.22, 1, .36, 1);
}
@keyframes paletteIn { from { transform: translateX(-50%) translateY(-8px); opacity: .5; } to { transform: translateX(-50%) translateY(0); opacity: 1; } }
.palette-inputwrap { display: flex; align-items: center; gap: 11px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.palette-inputwrap svg { width: 19px; height: 19px; color: var(--muted); flex: none; }
.palette-input { flex: 1; border: 0; outline: none; background: transparent; font-family: inherit; font-size: 16px; color: var(--ink); }
.palette-input::placeholder { color: var(--muted); }

.palette-results { max-height: 56vh; overflow-y: auto; padding: 6px; -webkit-overflow-scrolling: touch; }
.palette-group { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 10px 12px 5px; }
.palette-row { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: var(--radius-xs); cursor: pointer; }
.palette-row.active { background: var(--brand-tint); }
.palette-ico {
  width: 28px; height: 28px; border-radius: 8px; flex: none; display: flex; align-items: center; justify-content: center;
  background: var(--line-soft); color: var(--muted);
}
.palette-ico svg { width: 15px; height: 15px; }
.palette-row.active .palette-ico { background: var(--surface); color: var(--brand-ink); }
.palette-txt { min-width: 0; flex: 1; }
.palette-lbl { font-size: 14px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.palette-badge { font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; flex: none; }
.palette-empty { padding: 34px 18px; text-align: center; color: var(--muted); font-size: 14px; }
.palette-hint { display: flex; gap: 16px; padding: 9px 16px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted); }
.palette-hint span { display: inline-flex; align-items: center; gap: 5px; }
@media (max-width: 760px) { .palette-box { top: 0; width: 100vw; border-radius: 0; height: 100%; } .palette-results { max-height: none; height: calc(100% - 118px); } .palette-hint { display: none; } }

/* Board height: leave room for the mobile bottom nav; never collapse too far. */
.board { min-height: 320px; }
@media (max-width: 760px) {
  .board { height: calc(100dvh - 250px); }
}

/* Task status pill (Not yet / In progress / Done) */
.badge.NOT_STARTED { background: var(--line-soft); color: var(--muted); }
.badge.IN_PROGRESS { background: var(--amber-tint); color: var(--amber); }
.badge.DONE        { background: var(--won-tint); color: var(--won); }
.card .task-status { font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }

/* Palette close button (essential on mobile, where the palette is full-screen) */
.palette-close {
  flex: none; border: 0; background: transparent; color: var(--muted);
  font-size: 17px; line-height: 1; cursor: pointer; padding: 6px 8px; border-radius: 8px;
  margin: -4px -6px -4px 0;
}
.palette-close:hover { background: var(--line-soft); color: var(--ink); }
