/* =====================================================================
   A2+ Design — PROJECT TIMELINE
   Sibling to the Planning Board: same wordmark, same Inter, same
   light/dark discipline. Its own accent, and its own way of showing
   work — bars against dates rather than task cards.

   The rule this file follows: one job, one device. Status is a dot,
   progress is a bar, structure is a hairline. Nothing says the same
   thing twice.
   ===================================================================== */

:root {
  --bg:        #F7F5F2;
  --surface:   #FFFFFF;
  --surface-2: #F1EDE7;
  --line:      #E7E1D8;
  --line-2:    #D3CABD;
  --ink:       #1D1815;
  --ink-2:     #5F564C;
  --ink-3:     #948A7D;

  --accent:      #0E6E70;
  --accent-ink:  #FFFFFF;
  --accent-soft: #D8EAE9;

  --gold:      #A2761A;
  --gold-soft: #F3E7CD;
  --coral:     #C24429;
  --coral-soft:#F8E1DB;
  --green:     #2C7A4E;
  --green-soft:#DCEDE2;
  --slate:     #A79D8F;
  --rest:      rgba(29,24,21,.030);   /* Sunday tint on the chart */
  --labw:      152px;                 /* Gantt label column; JS reads this */
  --magenta:   #E8368F;   /* sampled from the A2+DESIGN artwork */

  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --tap: 44px;
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:        #131110;
    --surface:   #1C1917;
    --surface-2: #24201C;
    --line:      #2E2925;
    --line-2:    #443C34;
    --ink:       #F2EDE7;
    --ink-2:     #B6ABA0;
    --ink-3:     #857B70;

    --accent:      #3FBFBB;
    --accent-ink:  #0E1F1F;
    --accent-soft: #123634;

    --gold:      #DDB367;
    --gold-soft: #372C18;
    --coral:     #EE8168;
    --coral-soft:#3A1F17;
    --green:     #63C08A;
    --green-soft:#16301F;
    --slate:     #6D6459;
    --rest:      rgba(255,255,255,.030);
  }
}

:root[data-theme="dark"] {
  --bg:        #131110;
  --surface:   #1C1917;
  --surface-2: #24201C;
  --line:      #2E2925;
  --line-2:    #443C34;
  --ink:       #F2EDE7;
  --ink-2:     #B6ABA0;
  --ink-3:     #857B70;

  --accent:      #3FBFBB;
  --accent-ink:  #0E1F1F;
  --accent-soft: #123634;

  --gold:      #DDB367;
  --gold-soft: #372C18;
  --coral:     #EE8168;
  --coral-soft:#3A1F17;
  --green:     #63C08A;
  --green-soft:#16301F;
  --slate:     #6D6459;
  --rest:      rgba(255,255,255,.030);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

.hidden { display: none !important; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------------------------------------------------------- wordmark
   Rebuilt from the A2+DESIGN artwork. Measured against it: A2 stem
   0.089 of cap height (artwork 0.095), DESIGN stem 0.195 (0.202), the +
   at 0.390 cap height (0.392) sitting 0.228 above the cap line (0.244),
   and a 0.496 gap before the D (0.496). The letterforms take --ink so
   the mark inverts with the theme; the + keeps its magenta on both.  */
.wordmark { font-size: 13px; line-height: 1; white-space: nowrap; color: var(--ink); }
.wordmark .lite { font-weight: 300; letter-spacing: .03em; }
.wordmark .plus {
  color: var(--magenta); font-weight: 700; font-size: .592em;
  position: relative; top: -1.005em; margin-left: .03em;
}
.wordmark .bold { font-weight: 700; letter-spacing: .005em; margin-left: .247em; }
.wordmark.lg { font-size: 18px; }

/* ============================================================== LOGIN */
.login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: 100%; max-width: 340px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 18px; padding: 32px 26px 28px;
}
.app-name { font-size: 27px; font-weight: 700; letter-spacing: -.022em; margin: 24px 0 2px; }
.app-sub { margin: 0 0 28px; color: var(--ink-3); font-size: 13.5px; }

.field { display: block; margin-bottom: 16px; }
.field > span {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 11px; font-weight: 600; letter-spacing: .09em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: 7px;
}
.pct-val { font-size: 14px; letter-spacing: 0; color: var(--accent); font-variant-numeric: tabular-nums; }
.field input, .field select {
  width: 100%; height: var(--tap); padding: 0 14px;
  background: var(--bg); border: 1px solid var(--line-2);
  border-radius: 11px; outline: none;
}
.err { color: var(--coral); font-size: 13.5px; min-height: 20px; margin: 12px 0 0; }

/* =============================================================== BTNS */
.btn {
  height: var(--tap); padding: 0 18px; border-radius: 11px;
  border: 1px solid var(--line-2); background: var(--surface);
  font-weight: 600; cursor: pointer;
}
.btn.block { width: 100%; margin-top: 10px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:disabled { opacity: .5; }
.btn.ghost { background: transparent; }

.icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center;
  border: 0; background: transparent; border-radius: 9px; cursor: pointer; color: var(--ink-2);
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

/* ============================================================== SHELL */
#scApp { display: flex; flex-direction: column; height: 100dvh; }

.mast {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  gap: 10px; padding: 12px 14px;
  padding-top: calc(12px + env(safe-area-inset-top));
  background: var(--bg);
}
.mast-title {
  font-weight: 700; font-size: 12.5px; text-align: center;
  text-transform: uppercase; letter-spacing: .1em; color: var(--ink);
  white-space: nowrap;
}
.mast-right { display: flex; justify-content: flex-end; gap: 2px; }

.view { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* ------------------------------------------------------------ controls
   One quiet strip. The segmented control is a single object rather than
   two loose buttons, and the filters sit as text, not as boxes.      */
.segbar { display: flex; align-items: center; gap: 10px; padding: 4px 14px 14px; }
.segbar.wrap { flex-wrap: wrap; gap: 8px 10px; }
.seg-spacer { flex: 1; }

.segment {
  display: inline-flex; padding: 3px; gap: 2px;
  background: var(--surface-2); border-radius: 999px;
}
.segment .seg {
  height: 30px; padding: 0 16px; border: 0; border-radius: 999px;
  background: transparent; color: var(--ink-3);
  font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.segment .seg.on { background: var(--surface); color: var(--ink); }

.chip {
  height: 30px; padding: 0 4px; border: 0; background: transparent;
  font-size: 13px; font-weight: 500; color: var(--ink-3); cursor: pointer;
}
.chip[aria-pressed="true"] { color: var(--accent); font-weight: 600; }

.mini { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--ink-3); }
.mini select {
  height: 30px; padding: 0 22px 0 8px; border: 0; border-radius: 8px;
  background: var(--surface-2); color: var(--ink); font-weight: 600; font-size: 13px;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
                    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 13px) 13px, calc(100% - 8px) 13px;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}

/* ========================================================= TASK LIST
   Each site is one card. Inside it, tasks are rows split by a hairline —
   so the page has one border per project instead of one per task.    */
.list { flex: 1; overflow-y: auto; padding: 0 14px 28px; }
.list > .group + .group { margin-top: 22px; }

.group-head {
  display: flex; align-items: baseline; gap: 8px; padding: 0 4px 8px;
  font-size: 11px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-3);
}
.group-head .count { margin-left: auto; font-weight: 500; letter-spacing: .04em; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }

.task {
  position: relative; display: grid;
  grid-template-columns: 9px 1fr auto; align-items: center; gap: 0 11px;
  padding: 14px 15px 15px 13px; cursor: pointer;
}
.task + .task { border-top: 1px solid var(--line); }
.task:active { background: var(--surface-2); }

.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--slate); align-self: start; margin-top: 5px; }
.task.s-notstarted .dot { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line-2); }
.task.s-pending    .dot { background: transparent; box-shadow: inset 0 0 0 1.5px var(--gold); }
.task.s-inprogress .dot { background: var(--accent); }
.task.s-onhold     .dot { background: var(--gold); }
.task.s-completed  .dot { background: var(--green); }
.task.s-canceled   .dot { background: var(--line-2); }
.task.overdue      .dot { background: var(--coral); }

.task .name {
  font-size: 15px; font-weight: 600; line-height: 1.3; letter-spacing: -.005em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.task.s-canceled .name, .task.s-completed .name { color: var(--ink-2); }
.task.s-canceled .name { text-decoration: line-through; }

.task .meta {
  margin-top: 4px; font-size: 12.5px; color: var(--ink-3);
  font-variant-numeric: tabular-nums; line-height: 1.35;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.task .meta .sep { opacity: .45; margin: 0 6px; }
.task .meta .flag { color: var(--coral); font-weight: 600; }
.task .meta .flag.hold { color: var(--gold); }

.task .pct {
  font-size: 13px; font-weight: 600; color: var(--ink-3);
  font-variant-numeric: tabular-nums; align-self: start; margin-top: 2px;
}
.task.s-inprogress .pct { color: var(--ink); }
.task.s-completed .pct { color: var(--green); }

/* progress as a short measure under the line it belongs to, not a rule
   across the row — a full-width bar was reading as a divider */
.prog {
  margin-top: 9px; height: 3px; border-radius: 2px;
  background: var(--surface-2); overflow: hidden;
}
.prog i { display: block; height: 100%; border-radius: 2px; background: var(--accent); }
.task.s-completed .prog i { background: var(--green); }
.task.s-onhold .prog i, .task.s-pending .prog i { background: var(--gold); }
.task.overdue .prog i { background: var(--coral); }
.task.s-canceled .prog i { background: transparent; }

.empty { text-align: center; color: var(--ink-3); padding: 56px 20px; font-size: 14px; }

/* ============================================================= GANTT
   Only week boundaries are drawn. A line every day turned the chart
   into a fence; the bars are what should be read.                    */
.gantt { flex: 1; min-height: 0; display: flex; }
.gantt-scroll { flex: 1; overflow: auto; }
.gantt-inner { position: relative; min-width: max-content; padding-bottom: 20px; }

.g-row { display: flex; align-items: stretch; height: 46px; }
.g-row + .g-row:not(.group) .g-label { border-top: 1px solid var(--line); }

.g-label {
  position: sticky; left: 0; z-index: 3;
  width: var(--labw); min-width: var(--labw); padding: 0 12px 0 14px;
  background: var(--bg);
  display: flex; flex-direction: column; justify-content: center;
}
.g-label .name {
  font-size: 13.5px; font-weight: 600; line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.g-label .sub {
  font-size: 11.5px; color: var(--ink-3); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.g-track {
  position: relative; flex: 1;
  --dw: 30px;
  background-image:
    repeating-linear-gradient(to right,
      var(--rest) 0 var(--dw), transparent var(--dw) calc(var(--dw) * 7)),
    repeating-linear-gradient(to right,
      var(--line) 0 1px, transparent 1px calc(var(--dw) * 7));
  background-position: calc(var(--dw) * var(--sun, 0)) 0, calc(var(--dw) * var(--mon, 0)) 0;
}

/* header */
.g-head { position: sticky; top: 0; z-index: 5; background: var(--bg); height: 44px; }
.g-head .g-label { z-index: 6; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.g-head .g-track { background-image: none; }
.g-head + .g-row .g-label { border-top: 1px solid var(--line); }

.day {
  position: absolute; top: 0; bottom: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 10.5px; color: var(--ink-3); font-variant-numeric: tabular-nums;
}
.day.rest { color: var(--line-2); }
.day.today { color: var(--coral); font-weight: 700; }
.day .mon {
  position: absolute; top: 3px; left: 4px;
  font-size: 10px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-2); white-space: nowrap;
}
.day .num { margin-top: 8px; }

.today-line { position: absolute; top: 30px; bottom: 0; width: 1.5px; background: var(--coral); z-index: 2; pointer-events: none; opacity: .55; }

/* group divider */
.g-row.group { height: 34px; background: var(--bg); align-items: flex-end; }
.g-groupline {
  position: sticky; left: 0; display: inline-block; padding: 0 14px 7px;
  font-size: 11px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-2); white-space: nowrap;
}

/* bars — a tinted track with a solid fill to the progress mark */
.bar {
  position: absolute; top: 50%; transform: translateY(-50%);
  height: 22px; border-radius: 999px; overflow: hidden; z-index: 1;
  background: var(--surface-2); cursor: pointer;
}
.bar .fill { position: absolute; inset: 0 auto 0 0; }
.bar.s-notstarted { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.bar.s-pending    { background: var(--gold-soft); }
.bar.s-inprogress { background: var(--accent-soft); }
.bar.s-inprogress .fill { background: var(--accent); }
.bar.s-onhold     { background: var(--gold-soft); }
.bar.s-onhold .fill { background: var(--gold); opacity: .55; }
.bar.s-completed  { background: var(--green-soft); }
.bar.s-completed .fill { background: var(--green); opacity: .55; }
.bar.s-canceled   { background: var(--surface-2); opacity: .5; }
.bar.overdue      { background: var(--coral-soft); }
.bar.overdue .fill { background: var(--coral); }

/* ============================================================ TABBAR */
.tabbar {
  display: flex; border-top: 1px solid var(--line); background: var(--bg);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1; border: 0; background: transparent; cursor: pointer;
  padding: 9px 0 8px; display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--ink-3); font-size: 10.5px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
}
.tab svg { width: 22px; height: 22px; }
.tab.on { color: var(--accent); }

/* ============================================================= SHEET */
.sheet-root:empty { display: none; }
.scrim { position: fixed; inset: 0; background: rgba(19,17,16,.45); z-index: 40; animation: fade .16s ease; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41;
  background: var(--surface); border-radius: 20px 20px 0 0;
  padding: 8px 20px calc(22px + env(safe-area-inset-bottom));
  max-height: 88dvh; overflow-y: auto;
  animation: rise .22s cubic-bezier(.2,.8,.3,1);
}
@media (min-width: 640px) {
  .sheet {
    left: 50%; right: auto; bottom: auto; top: 50%; transform: translate(-50%,-50%);
    width: 430px; border-radius: 18px; border: 1px solid var(--line);
    animation: fade .16s ease;
  }
}
.grab { width: 36px; height: 4px; border-radius: 2px; background: var(--line-2); margin: 4px auto 16px; }
.sheet h2 { font-size: 19px; font-weight: 700; margin: 0 0 3px; letter-spacing: -.015em; }
.sheet .where { font-size: 13px; color: var(--ink-3); margin: 0 0 20px; }

.stepper { display: flex; align-items: center; gap: 8px; }
.stepper button {
  width: var(--tap); height: var(--tap); flex: 0 0 var(--tap);
  border: 1px solid var(--line-2); background: var(--bg); border-radius: 11px;
  font-size: 20px; font-weight: 600; cursor: pointer;
}
.stepper input { text-align: center; font-variant-numeric: tabular-nums; }

.pcts { display: flex; gap: 6px; margin-top: 8px; }
.pcts button {
  flex: 1; height: 34px; border-radius: 9px; border: 1px solid var(--line-2);
  background: var(--bg); font-size: 13px; font-weight: 600; cursor: pointer;
}
.pcts button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

input[type="range"] { width: 100%; accent-color: var(--accent); height: 32px; display: block; }

.statuses { display: flex; flex-wrap: wrap; gap: 6px; }
.statuses button {
  height: 34px; padding: 0 13px; border-radius: 999px;
  border: 1px solid var(--line-2); background: transparent;
  font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer;
}
.statuses button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.sheet-actions { display: flex; gap: 10px; margin-top: 22px; }
.sheet-actions .btn { flex: 1; }

.readonly-note {
  background: var(--gold-soft); color: var(--gold);
  border-radius: 11px; padding: 11px 13px; font-size: 13px; margin-bottom: 6px;
}

.menu-item {
  display: flex; width: 100%; align-items: center; gap: 10px;
  height: 50px; padding: 0 4px; border: 0; background: transparent;
  border-bottom: 1px solid var(--line); font-size: 15px; cursor: pointer; text-align: left;
}
.menu-item:last-child { border-bottom: 0; }
.menu-who { padding: 4px 4px 16px; }
.menu-who strong { display: block; font-size: 17px; }
.menu-who span { font-size: 13px; color: var(--ink-3); }

/* ============================================================= TOAST */
.toast {
  position: fixed; left: 50%; bottom: 88px; transform: translateX(-50%) translateY(12px);
  background: var(--ink); color: var(--bg); padding: 10px 17px; border-radius: 999px;
  font-size: 13.5px; font-weight: 500; opacity: 0; pointer-events: none;
  transition: opacity .18s, transform .18s; z-index: 60; max-width: 88vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@keyframes rise { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* -------------------------------------------------- wider screens */
@media (min-width: 760px) {
  :root { --labw: 230px; }
  .list { padding: 0 20px 36px; max-width: 860px; width: 100%; margin: 0 auto; }
  .segbar { padding: 4px 20px 16px; }
  .mast { padding-left: 20px; padding-right: 20px; }
}
