/* ============================================================
   Gael Talent Bridge — Fast Log and operations screens
   ============================================================
   Sits on top of portal.css and admin.css. Every class is prefixed
   .fl- and every colour, radius, shadow and step of spacing comes
   from the tokens in site.css: nothing new is invented here.

   The governing constraint: the whole Fast Log form has to fit in a
   900px-tall window without scrolling, so the vertical rhythm here is
   deliberately tighter than the rest of the portal.
   ============================================================ */

:root {
  --fl-field-h: 44px;
  --fl-control: 0.95rem;
}

/* ---------- shared shell ---------- */

.fl-page {
  display: grid;
  gap: var(--sp-4);
  align-items: start;
}
@media (min-width: 1024px) {
  .fl-page { grid-template-columns: 280px 1fr; }
}

.fl-head {
  display: flex;
  align-items: baseline;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin: 0 0 var(--sp-3);
}
.fl-head h1 {
  font-size: 1.25rem;
  margin: 0;
  letter-spacing: -0.02em;
}
.fl-head p { margin: 0; font-size: var(--text-micro); color: var(--stone); }
.fl-head-actions { margin-left: auto; display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }

.fl-card {
  background: var(--cloud);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: var(--sp-4);
}
.fl-card + .fl-card { margin-top: var(--sp-4); }

.fl-label {
  display: block;
  font-family: var(--font-body);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--stone);
  margin: 0 0 0.2rem;
}
.fl-muted { color: var(--stone); font-size: var(--text-micro); }
.fl-num { font-variant-numeric: tabular-nums; }

/* ---------- left rail: working on ---------- */

.fl-rail { display: grid; gap: var(--sp-2); align-content: start; }
.fl-rail-head {
  display: flex; align-items: baseline; gap: var(--sp-2);
  padding: 0 var(--sp-1);
}
.fl-rail-head h2 { font-size: 0.9375rem; margin: 0; }
.fl-rail-head span { margin-left: auto; font-size: 0.6875rem; color: var(--stone-light); }

.fl-cand {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--sp-2) var(--sp-3);
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  background: var(--cloud);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.7rem;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.fl-cand:hover { border-color: var(--line-strong); }
.fl-cand strong {
  display: block;
  font-family: var(--font-body);
  font-size: 0.9rem;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fl-cand small { display: block; font-size: 0.6875rem; color: var(--stone); }
.fl-cand .fl-cand-key {
  font-size: 0.625rem; color: var(--stone-light);
  border: 1px solid var(--line); border-radius: 4px;
  padding: 0 0.25rem; margin-right: 0.3rem;
}
.fl-cand.is-on {
  border: 2px solid var(--teal);
  background: var(--teal-quiet);
  padding: calc(0.55rem - 1px) calc(0.7rem - 1px);
}
.fl-cand.is-on strong { color: var(--teal-hover); }

.fl-badge {
  min-width: 1.75rem;
  text-align: center;
  font-size: var(--text-micro);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: var(--linen-warm);
  border-radius: 999px;
  padding: 0.1rem 0.4rem;
}
.fl-cand.is-on .fl-badge { background: var(--cloud); color: var(--teal-hover); }

/* ---------- log card ---------- */

.fl-log-head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
  padding-bottom: var(--sp-3);
  margin-bottom: var(--sp-3);
  border-bottom: 1px solid var(--line);
}
.fl-log-who { min-width: 0; }
.fl-log-who strong { display: block; font-family: var(--font-display); font-size: 1.0625rem; line-height: 1.2; }
.fl-log-who button {
  font: inherit; font-size: var(--text-micro); font-weight: 600;
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--teal); text-decoration: underline; text-underline-offset: 2px;
}
.fl-live {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.fl-live-text { font-size: var(--text-micro); color: var(--stone); font-variant-numeric: tabular-nums; text-align: right; }
.fl-live-text b { color: var(--ink); font-weight: 600; }
.fl-watch {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
  color: var(--stone-light);
  font-variant-numeric: tabular-nums;
}
.fl-ring { width: 34px; height: 34px; flex-shrink: 0; }
.fl-ring circle { fill: none; stroke-width: 3; }
.fl-ring .fl-ring-track { stroke: var(--line); }
.fl-ring .fl-ring-run {
  stroke: var(--teal);
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
  transition: stroke-dashoffset 0.4s var(--ease);
}

/* ---------- fields ---------- */

.fl-form { display: grid; gap: var(--sp-3); }
.fl-row { display: grid; gap: var(--sp-3); }
@media (min-width: 720px) { .fl-row-portal { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); } }
@media (min-width: 720px) { .fl-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.fl-field { min-width: 0; }
.fl-field input,
.fl-field select {
  width: 100%;
  height: var(--fl-field-h);
  font-family: var(--font-body);
  font-size: var(--fl-control);
  color: var(--slate);
  background: var(--cloud);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 0 0.7rem;
}
.fl-field input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(0, 123, 114, 0.15); }
.fl-field.is-bad input { border-color: var(--danger); }

/* segmented portal control */
.fl-seg { display: flex; gap: 0; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; }
.fl-seg button {
  flex: 1 1 0;
  min-width: 0;
  height: var(--fl-field-h);
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--stone);
  background: var(--cloud);
  border: 0;
  border-left: 1px solid var(--line);
  padding: 0 0.22rem;
  cursor: pointer;
  white-space: nowrap;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.12s var(--ease), color 0.12s var(--ease);
}
.fl-seg button:first-child { border-left: 0; }
.fl-seg button:hover { background: var(--linen); color: var(--ink); }
.fl-seg button[aria-checked="true"] { background: var(--teal); color: var(--cloud); }
.fl-seg button:focus-visible { outline: 3px solid var(--teal); outline-offset: -3px; }

/* primary action */
.fl-actions { display: flex; align-items: center; gap: var(--sp-3); }
.fl-submit {
  flex: 1 1 auto;
  height: 48px;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--cloud);
  background: var(--teal);
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s var(--ease);
}
.fl-submit:hover { background: var(--teal-hover); }
.fl-submit[disabled] { opacity: 0.6; cursor: default; }
.fl-finish {
  font: inherit; font-size: var(--text-small); font-weight: 600;
  background: none; border: 0; cursor: pointer;
  color: var(--stone); text-decoration: underline; text-underline-offset: 3px;
  white-space: nowrap;
}
.fl-finish:hover { color: var(--ink); }
.fl-hint { margin: 0; font-size: 0.6875rem; color: var(--stone-light); }
.fl-hint kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.6875rem;
  color: var(--stone);
}

/* duplicate strip and problems */
.fl-strip[hidden], .fl-pending[hidden], .fl-field[hidden], .fl-row[hidden] { display: none; }

.fl-strip {
  display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap;
  font-size: var(--text-small);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.7rem;
  background: var(--warn-bg);
  color: var(--warn);
  border: 1px solid var(--line);
}
.fl-strip b { color: var(--warn); }
.fl-strip .fl-strip-acts { margin-left: auto; display: flex; gap: var(--sp-2); }
.fl-strip button {
  font: inherit; font-size: var(--text-micro); font-weight: 700;
  border-radius: var(--radius-sm); border: 1px solid var(--warn);
  background: var(--cloud); color: var(--warn); padding: 0.3rem 0.6rem; cursor: pointer;
}
.fl-strip button.is-quiet { border-color: var(--line-strong); color: var(--stone); }
.fl-strip.is-bad { background: var(--danger-bg); color: var(--danger); }
.fl-strip.is-bad b, .fl-strip.is-bad button { color: var(--danger); border-color: var(--danger); }

.fl-pending {
  font-size: var(--text-micro); font-weight: 600;
  background: var(--warn-bg); color: var(--warn);
  border-radius: 999px; padding: 0.2rem 0.55rem;
}

/* last logged */
.fl-logged { list-style: none; margin: var(--sp-3) 0 0; padding: 0; }
.fl-logged li {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: var(--text-small);
  padding: 0.4rem 0;
  border-top: 1px solid var(--line);
}
.fl-logged li:first-child { border-top: 0; }
.fl-logged .fl-logged-main { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fl-logged .fl-logged-main b { font-weight: 600; color: var(--ink); }
.fl-logged .fl-secs { margin-left: auto; font-size: var(--text-micro); color: var(--stone); font-variant-numeric: tabular-nums; }
.fl-logged button {
  font: inherit; font-size: var(--text-micro); font-weight: 600;
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--teal); text-decoration: underline; text-underline-offset: 2px;
}
.fl-logged li.is-gone { opacity: 0.45; }

.fl-chip {
  font-size: 0.625rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  background: var(--teal-quiet); color: var(--teal-hover);
  border-radius: 999px; padding: 0.1rem 0.4rem; white-space: nowrap;
}

/* ---------- stat tiles, shared by My day and workforce ---------- */

.fl-tiles { display: grid; gap: var(--sp-3); grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 820px) { .fl-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.fl-tile {
  background: var(--cloud); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: var(--sp-3);
}
.fl-tile span { display: block; font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--stone); }
.fl-tile b {
  display: block; font-family: var(--font-display); font-size: 1.5rem; line-height: 1.15;
  color: var(--ink); font-variant-numeric: tabular-nums; margin-top: 0.15rem;
}
.fl-tile small { display: block; font-size: 0.6875rem; color: var(--stone-light); }

/* ---------- day timeline ---------- */

.fl-timeline { margin-top: var(--sp-3); }
.fl-bar {
  position: relative; height: 18px; border-radius: 999px;
  background: var(--linen-warm); border: 1px solid var(--line); overflow: hidden;
}
.fl-bar i { position: absolute; top: 0; bottom: 0; background: var(--teal); opacity: 0.85; }
.fl-split { display: flex; height: 8px; border-radius: 999px; overflow: hidden; margin-top: var(--sp-2); background: var(--line); }
.fl-split i { display: block; height: 100%; }
.fl-split .fl-split-active { background: var(--teal); }
.fl-split .fl-split-idle { background: var(--warn-bg); }
.fl-scale { display: flex; justify-content: space-between; font-size: 0.6875rem; color: var(--stone-light); margin-top: 0.2rem; }
.fl-legend { display: flex; gap: var(--sp-4); font-size: var(--text-micro); color: var(--stone); margin-top: var(--sp-2); }
.fl-legend span { display: inline-flex; align-items: center; gap: 0.35rem; }
.fl-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---------- pivot table ---------- */

.fl-pivot { width: 100%; border-collapse: collapse; font-size: var(--text-small); }
.fl-pivot th, .fl-pivot td { padding: 0.45rem var(--sp-3); text-align: left; }
.fl-pivot thead th {
  font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--stone); border-bottom: 1px solid var(--line-strong); white-space: nowrap;
}
.fl-pivot td.fl-n, .fl-pivot th.fl-n { text-align: right; font-variant-numeric: tabular-nums; }
.fl-pivot tr.fl-pivot-day td {
  background: var(--linen-warm); font-weight: 700; color: var(--ink);
  border-top: 1px solid var(--line-strong);
}
.fl-pivot tr.fl-pivot-role td { border-top: 1px solid var(--line); }
.fl-pivot tr.fl-pivot-total td { font-weight: 700; border-top: 1px solid var(--line-strong); }
.fl-pivot td.fl-zero { color: var(--stone-light); }

/* ---------- workforce ---------- */

.fl-wf { width: 100%; border-collapse: collapse; font-size: var(--text-small); }
.fl-wf th, .fl-wf td { padding: 0.55rem var(--sp-3); text-align: left; vertical-align: middle; }
.fl-wf thead th {
  font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--stone); border-bottom: 1px solid var(--line-strong); white-space: nowrap;
}
.fl-wf td.fl-n, .fl-wf th.fl-n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fl-wf tbody td:first-child { min-width: 15rem; }
.fl-wf tbody td:first-child .a-pill { vertical-align: middle; }
.fl-wf tbody tr { border-top: 1px solid var(--line); }
.fl-wf tr.fl-wf-day td { background: var(--linen); font-size: var(--text-micro); }
.fl-wf-toggle {
  font: inherit; font-weight: 600; text-align: left;
  background: none; border: 0; padding: 0; cursor: pointer; color: var(--ink);
}
.fl-wf-toggle:hover { color: var(--teal-hover); }
.fl-wf-toggle span { color: var(--stone-light); margin-right: 0.35rem; font-size: 0.6875rem; }

/* ---------- allocations ---------- */

.fl-panes { display: grid; gap: var(--sp-4); grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
@media (max-width: 900px) { .fl-panes { grid-template-columns: 1fr; } }
.fl-pick { list-style: none; margin: var(--sp-3) 0 0; padding: 0; }
.fl-pick li {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 0.5rem 0; border-top: 1px solid var(--line); font-size: var(--text-small);
}
.fl-pick li:first-child { border-top: 0; }
.fl-pick .fl-pick-main { min-width: 0; flex: 1; }
.fl-pick .fl-pick-main strong { display: block; font-family: var(--font-body); font-size: 0.9375rem; }
.fl-pick .fl-pick-main small { display: block; font-size: 0.6875rem; color: var(--stone); }
.fl-pick li.is-on { background: var(--teal-quiet); border-radius: var(--radius-sm); padding: 0.5rem; }
.fl-pick button.fl-pick-btn {
  font: inherit; font-size: var(--text-micro); font-weight: 600;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--cloud); color: var(--ink); padding: 0.3rem 0.6rem; cursor: pointer;
}
.fl-pick button.fl-pick-btn:hover { border-color: var(--teal); color: var(--teal-hover); }

/* ---------- candidate tabs, stages, account ---------- */

.fl-tabs {
  display: flex; gap: 0.3rem; flex-wrap: wrap;
  border-bottom: 1px solid var(--line); margin: 0 0 var(--sp-4);
}
.fl-tabs button {
  font: inherit; font-size: var(--text-small); font-weight: 600;
  background: none; border: 0; border-bottom: 2px solid transparent;
  padding: 0.45rem 0.6rem; cursor: pointer; color: var(--stone);
}
.fl-tabs button:hover { color: var(--ink); }
.fl-tabs button[aria-selected="true"] { color: var(--teal-hover); border-bottom-color: var(--teal); }

.fl-stages { width: 100%; border-collapse: collapse; font-size: var(--text-small); }
.fl-stages th, .fl-stages td { padding: 0.45rem var(--sp-3); text-align: left; }
.fl-stages thead th {
  font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--stone); border-bottom: 1px solid var(--line-strong);
}
.fl-stages tbody tr { border-top: 1px solid var(--line); }
.fl-stages .fl-stage-no { color: var(--stone-light); font-variant-numeric: tabular-nums; width: 2rem; }
.fl-stages select, .fl-stages input[type="date"],
.fl-stages input[type="text"], .fl-stages input[type="number"] {
  font-family: var(--font-body); font-size: var(--text-micro);
  padding: 0.3rem 0.45rem; border: 1px solid var(--line-strong);
  border-radius: 8px; background: var(--cloud); color: var(--ink); width: auto;
}
.fl-stages tr.is-done .fl-stage-name { color: var(--ok); }

.fl-money { display: grid; gap: var(--sp-3); grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 820px) { .fl-money { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.fl-progress { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; margin-top: var(--sp-2); }
.fl-progress i { display: block; height: 100%; background: var(--teal); border-radius: 999px; }

/* ---------- motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .fl-cand, .fl-seg button, .fl-submit, .fl-ring .fl-ring-run { transition: none; }
}
