/* ============================================================================
   progressed — components.css
   Reusable component classes shared by components.html and every prototype.
   Depends on tokens.css + base.css. No literal colours/sizes — tokens only.
   Class naming: block  .c-btn ,  modifier  .c-btn--ghost ,  state  .is-active .
   ============================================================================ */

/* ---- Top bar + primary nav ------------------------------------------------ */
.c-topbar {
  height: 52px; flex: none; display: flex; align-items: center; gap: var(--space-5);
  padding: 0 18px; background: var(--surface);
  border-bottom: 1px solid var(--border); position: relative; z-index: var(--z-header);
}
.c-brand { display: inline-flex; align-items: center; gap: 9px; }
.c-brand__mark { width: 22px; height: 22px; }
/* The wordmark logo (PNG). Height set here; width follows the aspect ratio. The
   auth pages bump the height inline for a larger sign-in brand moment. */
.c-brand__logo { height: 22px; width: auto; display: block; }
.c-brand__word { font-family: var(--font-display); font-weight: var(--fw-bold);
  font-size: var(--fs-18); letter-spacing: var(--tracking-tight); color: var(--ink); }
.c-nav { display: flex; gap: 2px; }
.c-nav__item {
  appearance: none; border: 0; background: transparent; color: var(--ink-2);
  font-weight: var(--fw-semi); font-size: var(--fs-13);
  padding: 7px 12px; border-radius: var(--radius); display: flex; align-items: center; gap: 6px;
  transition: background var(--dur-fast) var(--ease);
}
.c-nav__item:hover { background: var(--surface-alt); }
.c-nav__item.is-active { background: var(--primary-soft); color: var(--primary); }
.c-nav__item--ai { color: var(--primary-hover); }

/* ---- Buttons -------------------------------------------------------------- */
.c-btn {
  appearance: none; border: 1px solid transparent; border-radius: var(--radius-md);
  font-weight: var(--fw-semi); font-size: var(--fs-13); padding: 9px 16px;
  display: inline-flex; align-items: center; gap: 7px; line-height: 1;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.c-btn--primary { background: var(--primary); color: var(--on-primary); }
.c-btn--primary:hover { background: var(--primary-hover); }
.c-btn--ghost { background: var(--surface); border-color: var(--border-strong); color: var(--ink-2); }
.c-btn--ghost:hover { border-color: var(--slate-400); }
.c-btn--danger { background: var(--danger-soft); border-color: var(--danger-soft); color: var(--danger); }
.c-btn--sm { padding: 6px 11px; font-size: var(--fs-12); }
.c-btn:disabled { opacity: .5; pointer-events: none; }

/* Segmented control (zoom, tabs-as-toggle) */
.c-seg { display: flex; gap: 3px; background: var(--surface-sunk); border-radius: var(--radius-md); padding: 3px; }
.c-seg__btn { appearance: none; border: 0; background: transparent; color: var(--ink-3);
  font-weight: var(--fw-semi); font-size: var(--fs-12); padding: 5px 13px; border-radius: var(--radius); }
.c-seg__btn.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* ---- Form controls -------------------------------------------------------- */
.c-input, .c-textarea, .c-select {
  width: 100%; background: var(--surface); color: var(--ink);
  border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  padding: 8px 11px; font-size: var(--fs-13); line-height: var(--lh-snug);
}
.c-textarea { resize: vertical; min-height: 38px; }
.c-input:focus, .c-textarea:focus, .c-select:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: var(--primary); }
.c-input.is-invalid { border-color: var(--danger); }
.c-input.is-invalid:focus { outline-color: var(--danger); }
.c-field { display: flex; flex-direction: column; gap: 4px; }
.c-label { font-size: var(--fs-11); font-weight: var(--fw-semi);
  letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--ink-3); }
.c-search { display: flex; align-items: center; gap: 8px; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-md); padding: 7px 11px; }
.c-search input { border: 0; outline: 0; background: none; flex: 1; font-size: var(--fs-13); }

/* Checkbox / radio (12–16px, hand-built so no dependency) */
.c-check { width: 16px; height: 16px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-strong); background: var(--surface); flex: none; }
.c-check.is-on { background: var(--primary); border-color: var(--primary); }
.c-radio { width: 15px; height: 15px; border-radius: 50%;
  border: 1.5px solid var(--border-strong); flex: none; }
.c-radio.is-on { border: 4px solid var(--primary); }

/* ---- Chips / tags / pills ------------------------------------------------- */
.c-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px;
  border-radius: var(--radius-pill); background: var(--surface-alt);
  border: 1px solid var(--border); font-size: var(--fs-12); font-weight: var(--fw-medium); color: var(--ink-2); }
.c-filter { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px;
  border-radius: var(--radius-pill); background: var(--surface); border: 1px solid var(--border-strong);
  font-size: var(--fs-12); font-weight: var(--fw-medium); color: var(--ink-2); }
.c-filter.is-active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }

/* ---- Badges (status + semantic) ------------------------------------------- */
.c-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px;
  border-radius: var(--radius-pill); font-size: var(--fs-11); font-weight: var(--fw-semi); }
.c-badge--done  { color: var(--ok);       background: var(--ok-soft); }
.c-badge--active{ color: var(--bar-active);background: var(--primary-soft); }
.c-badge--plan  { color: var(--ink-3);    background: var(--surface-alt); }
.c-badge--risk  { color: var(--warn);     background: var(--warn-soft); }
.c-badge--late  { color: var(--danger);   background: var(--danger-soft); }
.c-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; }

/* ---- Avatars -------------------------------------------------------------- */
.c-avatar { display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%; color: #fff;
  font-size: 10px; font-weight: var(--fw-semi); flex: none; letter-spacing: .2px; }

/* ---- Cards ---------------------------------------------------------------- */
.c-card { background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-xl); padding: 18px; }
.c-card--pad-sm { padding: 16px; }
.c-card--interactive { transition: border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease); }
.c-card--interactive:hover { border-color: var(--border-strong); transform: translateY(-1px); }

/* ---- Tables --------------------------------------------------------------- */
.c-table { border: 1px solid var(--border); border-radius: var(--radius-xl); overflow: hidden; background: var(--surface); }
.c-table__head, .c-table__row { display: grid; align-items: center; gap: var(--space-3); padding: 0 14px; }
.c-table__head { padding-top: 8px; padding-bottom: 8px; font-size: var(--fs-11);
  font-weight: var(--fw-semi); letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--ink-3); }
.c-table__group { display: flex; align-items: center; gap: 8px; padding: 11px 14px 7px;
  font-size: var(--fs-11); font-weight: var(--fw-bold); letter-spacing: .07em; text-transform: uppercase; color: var(--ink-2); }
.c-table__row { padding-top: 10px; padding-bottom: 10px; border-top: 1px solid var(--border);
  background: var(--surface); transition: background var(--dur-fast) var(--ease); }
.c-table__row:hover { background: var(--surface-alt); }

/* ---- Progress bar --------------------------------------------------------- */
.c-progress { height: 8px; border-radius: 5px; background: var(--surface-sunk); overflow: hidden; }
.c-progress__fill { height: 100%; border-radius: 5px; background: var(--bar-active);
  transition: width var(--dur) var(--ease); }

/* ---- Slide-over panel ----------------------------------------------------- */
.c-scrim { position: fixed; inset: 0; background: rgba(27,33,48,.28); z-index: var(--z-panel); animation: fadein var(--dur-fast) var(--ease); }
.c-panel { position: fixed; top: 0; right: 0; bottom: 0; width: 480px; max-width: 92vw;
  background: var(--surface); z-index: calc(var(--z-panel) + 1); box-shadow: var(--shadow-panel);
  display: flex; flex-direction: column; animation: slidein var(--dur-panel) var(--ease); }

/* ---- Tabs ----------------------------------------------------------------- */
.c-tabs { display: flex; border-bottom: 1px solid var(--border); }
.c-tab { appearance: none; border: 0; background: none; color: var(--ink-3);
  font-weight: var(--fw-semi); font-size: var(--fs-13); padding: 10px 2px; margin-right: 20px;
  border-bottom: 2px solid transparent; }
.c-tab.is-active { color: var(--ink); border-bottom-color: var(--primary); }

/* ---- Popover / menu ------------------------------------------------------- */
.c-popover { background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); padding: 14px; z-index: var(--z-popover);
  animation: popin var(--dur-fast) var(--ease); }

/* ---- Modal (ripple preview lives here) ------------------------------------ */
.c-modal-scrim { position: fixed; inset: 0; background: rgba(27,33,48,.40); z-index: var(--z-modal);
  display: flex; align-items: center; justify-content: center; animation: fadein var(--dur-fast) var(--ease); }
.c-modal { background: var(--surface); border-radius: var(--radius-2xl); box-shadow: var(--shadow-modal);
  display: flex; flex-direction: column; overflow: hidden; animation: popin var(--dur) var(--ease); }

/* ---- Toast ---------------------------------------------------------------- */
.c-toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; font-weight: var(--fw-medium); font-size: var(--fs-13);
  padding: 11px 18px; border-radius: 9px; z-index: var(--z-toast); box-shadow: var(--shadow-tooltip);
  display: flex; align-items: center; gap: 9px; animation: popin var(--dur) var(--ease); }

/* ---- Notification item ---------------------------------------------------- */
.c-notif { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.c-notif__body { flex: 1; font-size: var(--fs-13); line-height: var(--lh-snug); color: var(--ink-2); }
.c-notif__meta { font-size: var(--fs-11); color: var(--ink-4); margin-top: 2px; }

/* ---- Comment block -------------------------------------------------------- */
.c-comment { display: flex; gap: 10px; }
.c-comment__bubble { font-size: var(--fs-13); line-height: 1.55; color: var(--ink-2);
  padding: 9px 11px; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--surface-alt);
  white-space: pre-wrap; overflow-wrap: anywhere; }
/* Internal-only comments are visually distinct BEFORE posting — amber, never
   the same as a client-visible comment. Colour is paired with a lock + label. */
.c-comment__bubble.is-internal { background: var(--warn-soft); border-color: var(--warn-border); }
.c-mention { color: var(--primary); font-weight: var(--fw-semi); }

/* ---- File row ------------------------------------------------------------- */
.c-file { display: flex; align-items: center; gap: 11px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.c-file__icon { width: 34px; height: 34px; border-radius: var(--radius-md);
  background: var(--surface-alt); display: flex; align-items: center; justify-content: center; color: var(--ink-3); }
.c-dropzone { border: 1.5px dashed var(--border-strong); border-radius: var(--radius-lg);
  padding: 26px; text-align: center; color: var(--ink-3); font-size: var(--fs-13); }

/* ---- Empty state ---------------------------------------------------------- */
.c-empty { display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; color: var(--ink-3); padding: var(--space-12); gap: var(--space-2); }
.c-empty__title { font-family: var(--font-display); font-weight: var(--fw-semi); font-size: var(--fs-18); color: var(--ink); }

/* ---- Warning banner (amber + red) ----------------------------------------- *
   Accessibility rule: colour is NEVER the sole carrier of meaning. Every
   banner pairs its colour with the triangle icon AND a text label.          */
.c-banner { display: flex; gap: 11px; padding: 12px 13px; border-radius: var(--radius-lg);
  align-items: flex-start; }
.c-banner--amber { background: var(--warn-soft); border: 1px solid var(--warn-border); color: var(--warn); }
.c-banner--red   { background: var(--danger-soft); border: 1px solid var(--danger-border); color: var(--danger); }
.c-banner__title { font-size: var(--fs-13); font-weight: var(--fw-semi); margin-bottom: 2px; }
.c-banner__msg   { font-size: var(--fs-12); line-height: 1.5; color: var(--ink-2); }

/* ---- Icons ---------------------------------------------------------------- *
   All icons are inline Lucide-style SVG (outline, 2px stroke, round caps),
   authored in the markup. .c-icon just normalises sizing/flex.              */
.c-icon { flex: none; display: inline-block; vertical-align: middle; }

/* ---- Progress meter (four-bucket, day-weighted) --------------------------- *
   Done / In progress / To do / No status, sized by working days. Colour is
   NEVER the sole signal: each bucket is also named in the legend and in each
   segment's hover tooltip, and the figures use tabular numerals.             */
.c-pmeter { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.c-pmeter__bar { display: flex; width: 100%; height: 8px; overflow: hidden;
  border-radius: var(--radius-pill); background: var(--surface-sunk); }
.c-pmeter--compact .c-pmeter__bar { height: 6px; }
.c-pmeter__seg { min-width: 3px; }
.c-pmeter__seg--done        { background: var(--ok-bar); }
.c-pmeter__seg--in_progress { background: var(--primary); }
.c-pmeter__seg--todo        { background: var(--meter-todo); }
.c-pmeter__seg--none        { background: var(--ink-4); }
.c-pmeter__legend { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4);
  font-size: var(--fs-12); font-weight: var(--fw-medium); color: var(--ink-2); }
.c-pmeter__key { display: inline-flex; align-items: center; gap: 6px; }
.c-pmeter__key-l { color: var(--ink-3); }
.c-pmeter__dot { width: 9px; height: 9px; border-radius: var(--radius-sm); flex: none; }
.c-pmeter__dot--done        { background: var(--ok-bar); }
.c-pmeter__dot--in_progress { background: var(--primary); }
.c-pmeter__dot--todo        { background: var(--meter-todo); }
.c-pmeter__dot--none        { background: var(--ink-4); }
.c-pmeter__pct { color: var(--ink); font-weight: var(--fw-semi); font-variant-numeric: tabular-nums; }
.c-pmeter__cap { font-size: var(--fs-12); color: var(--ink-3); font-weight: var(--fw-medium);
  font-variant-numeric: tabular-nums; }
.c-pmeter__empty { font-size: var(--fs-12); color: var(--ink-4); font-weight: var(--fw-medium); }

/* ---- App footer (product attribution) -------------------------------------- */
.c-footer {
  flex: none;
  padding: var(--space-3) var(--space-6);
  text-align: center;
  font-family: var(--font-text);
  font-size: var(--fs-12);
  font-weight: var(--fw-regular);
  line-height: 1.5;
  color: var(--ink-3);
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.c-footer strong { font-weight: var(--fw-semi); color: var(--ink-2); }
