/* Parot client portal
   Grayscale shell inherited from the marketing site; colour appears only where
   it encodes status, so a hue always means something. */

:root {
    --ink: #131313;
    --panel: #1e1e1e;
    --raised: #2a2a2a;
    --line: #383838;
    --line-soft: #2e2e2e;
    --chalk: #f2efe9;
    --muted: #8f8b85;
    --muted-dim: #6a6660;

    --live: #d4a24c;   /* in progress */
    --done: #6f9e7a;   /* delivered / approved */
    --wait: #6b7f96;   /* queued, waiting on approval */
    --late: #b5654f;   /* past due */

    --display: 'Bricolage Grotesque', ui-sans-serif, system-ui, sans-serif;
    --body: 'Instrument Sans', ui-sans-serif, system-ui, sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

    --gap: 1.25rem;
    --radius: 10px;
    --shell: 1120px;

    /* Surfaces and lines that used to be written as literals. Naming them is
       what makes a second theme possible at all -- see .theme-light below. */
    --sunk: #171717;            /* inputs, wells */
    --sunk-deep: #101010;
    --sunk-focus: #1b1b1b;
    --row-alt: #1f1f1f;
    --raised-soft: #232323;
    --meter-track: #262626;
    --btn-hover: #333;
    --border-strong: #4a4a4a;
    --border-soft2: #454545;
    --idle: #3d3d3d;
    --chalk-hi: #fff;
    --on-chalk: #16130f;        /* text on a --chalk button */
    --on-done: #0f1a12;         /* text on a --done button */
    --done-hi: #7fae8a;
    --live-hi: #e8bd72;

    /* status tints: a wash of the status hue behind pills and callouts */
    --tint-live: #241d10;  --tint-live-bd: #4d3d22;
    --tint-done: #16211a;  --tint-done-bd: #2c4433;
    --tint-wait: #161c21;  --tint-wait-bd: #2f3b46;
    --tint-late: #241511;  --tint-late-bd: #4a2c23;

    --danger-fg: #d08c78; --danger-fg-hi: #e8a48e;
    --danger-bd: #5a3730; --danger-bg: #2a1a16; --err-fg: #d99b86;

    --signoff-copy: #cbc3b4; --signoff-grad-2: #1c1a15;

    /* gantt: frappe ships a light theme, so every painted surface is restated */
    --tick: #2f2f2f; --tick-thick: #3c3c3c; --gantt-line: #272727;
    --bar-stroke: #414141; --bar-hover: #383838;
    --bar-item-stroke: #363636; --bar-item-text: #a9a49d;
}

/* ---------- light theme: the client-facing portal ---------- */
/*
   Only the token layer is restated. Every rule below this point is written
   against tokens, so the client pages and /manage/ share one stylesheet and
   cannot drift apart structurally -- only in palette.

   Applied via <body class="theme-light">, set by client_base.html and by the
   two auth pages. /manage/ deliberately stays dark: it is our tool, not the
   client's, and the contrast makes it obvious which side you are looking at.

   The status hues are DARKER here than in the dark theme. #d4a24c amber reads
   at about 1.9:1 on white -- fine as a bar fill, unreadable as text -- so each
   hue is deepened to clear 4.5:1 while staying recognisably the same colour.
   Colour still only ever encodes status.
*/
body.theme-light {
    --ink: #f5f3ee;
    --panel: #ffffff;
    --raised: #faf8f3;
    --line: #dcd6ca;
    --line-soft: #ebe6dc;
    --chalk: #1c1917;
    --muted: #6b655c;
    --muted-dim: #7d766a;

    --live: #8f630d;
    --done: #3d7150;
    --wait: #4b647f;
    --late: #a04730;

    --sunk: #f1ede5;
    --sunk-deep: #ebe6dc;
    --sunk-focus: #ffffff;
    --row-alt: #f7f4ee;
    --raised-soft: #f2efe8;
    --meter-track: #e6e1d6;
    --btn-hover: #efebe3;
    --border-strong: #c4bcac;
    --border-soft2: #cfc7b7;
    --idle: #c9c2b4;
    --chalk-hi: #000;
    --on-chalk: #f7f5f1;
    --on-done: #f1f7f3;
    --done-hi: #2f5c3f;
    --live-hi: #6d4b08;

    --tint-live: #fbf3e2;  --tint-live-bd: #e6d2a6;
    --tint-done: #eaf3ed;  --tint-done-bd: #b7d5c2;
    --tint-wait: #eaf0f6;  --tint-wait-bd: #b6c9dc;
    --tint-late: #fbeee9;  --tint-late-bd: #ecc2b3;

    --danger-fg: #a4432a; --danger-fg-hi: #8a3721;
    --danger-bd: #e3bfb2; --danger-bg: #fbeee9; --err-fg: #a4432a;

    --signoff-copy: #4a443c; --signoff-grad-2: #fdf8ec;

    --tick: #e2ddd2; --tick-thick: #cfc8ba; --gantt-line: #e7e2d8;
    --bar-stroke: #cbc3b6; --bar-hover: #d5cec2;
    --bar-item-stroke: #ddd6ca; --bar-item-text: #6b655c;
}

/* The tick is drawn into a data URI, so its colour cannot come from a token.
   In the dark theme it is near-black on pale sage; here --done is deep enough
   that the tick has to invert or it disappears. */
body.theme-light .form-check-input:checked {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23f1f7f3' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round' d='M3.5 8.5l3 3 6-7'/%3E%3C/svg%3E");
}

/* Dark-theme panels lift off the page with a lighter fill; on paper that reads
   inverted, so lift comes from a shadow instead. */
body.theme-light .panel,
body.theme-light .phase-card,
body.theme-light .stat {
    box-shadow: 0 1px 2px rgba(28, 25, 23, 0.05);
}
body.theme-light .phase-card:hover,
body.theme-light a.stat:hover {
    box-shadow: 0 4px 14px rgba(28, 25, 23, 0.09);
}


*, *::before, *::after { box-sizing: border-box; }

/* Author `display` beats the UA rule for [hidden], so anything given a display
   value would ignore the attribute. Restate it once, with weight. */
[hidden] { display: none !important; }

body {
    margin: 0;
    background: var(--ink);
    color: var(--chalk);
    font-family: var(--body);
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

h1, h2, h3, h4 {
    font-family: var(--display);
    font-weight: 600;
    letter-spacing: -0.02em;
    margin: 0;
}

.shell {
    max-width: var(--shell);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.eyebrow {
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--muted-dim);
    margin: 0 0 0.6rem;
}

.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }

/* ---------- top bar ---------- */

.topbar {
    border-bottom: 1px solid var(--line-soft);
    background: rgba(19, 19, 19, 0.92);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar-inner {
    max-width: var(--shell);
    margin: 0 auto;
    padding: 0.85rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.topbar img { height: 30px; display: block; }
.topbar-spacer { flex: 1; }

.topbar-who {
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--muted);
}

.topbar-link {
    font-size: 0.85rem;
    color: var(--muted);
    text-decoration: none;
    padding: 0.3rem 0;
    border-bottom: 1px solid transparent;
}
.topbar-link:hover { color: var(--chalk); border-bottom-color: var(--line); }

/* ---------- messages ---------- */

.flash-stack { max-width: var(--shell); margin: 1.25rem auto 0; padding: 0 1.5rem; }

.flash {
    border: 1px solid var(--line);
    border-left-width: 3px;
    border-radius: var(--radius);
    background: var(--panel);
    padding: 0.7rem 1rem;
    margin-bottom: 0.6rem;
    font-size: 0.9rem;
}
.flash-success { border-left-color: var(--done); }
.flash-error { border-left-color: var(--late); }
.flash-info, .flash-warning { border-left-color: var(--wait); }

/* ---------- buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    font-family: var(--body);
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1;
    padding: 0.7rem 1.15rem;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--raised);
    color: var(--chalk);
    text-decoration: none;
    cursor: pointer;
    transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}
.btn:hover { background: var(--btn-hover); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--chalk); color: var(--on-chalk); border-color: var(--chalk); }
.btn-primary:hover { background: var(--chalk-hi); border-color: var(--chalk-hi); }

.btn-go { background: var(--done); border-color: var(--done); color: var(--on-done); }
.btn-go:hover { background: var(--done-hi); border-color: var(--done-hi); }

.btn-danger { background: transparent; border-color: var(--danger-bd); color: var(--danger-fg); }
.btn-danger:hover { background: var(--danger-bg); border-color: var(--late); color: var(--danger-fg-hi); }

.btn-ghost { background: transparent; }
.btn-sm { padding: 0.45rem 0.75rem; font-size: 0.8rem; }

/* ---------- forms ---------- */

.field { margin-bottom: 1.1rem; }

.field > label,
.form-label {
    display: block;
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 0.45rem;
}

.form-control,
.form-select {
    width: 100%;
    background: var(--sunk);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--chalk);
    font-family: var(--body);
    font-size: 0.95rem;
    padding: 0.65rem 0.8rem;
    transition: border-color 0.16s ease, background 0.16s ease;
}
.form-control::placeholder { color: var(--muted-dim); }
.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: var(--live);
    background: var(--sunk-focus);
}
.form-select { appearance: none; padding-right: 2.2rem;
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                      linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: right 1rem top 55%, right 0.72rem top 55%;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
}
textarea.form-control { resize: vertical; min-height: 5rem; line-height: 1.5; }

.form-check {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    background: var(--sunk);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.85rem 1rem;
}
.form-check-input {
    appearance: none;
    width: 18px; height: 18px;
    margin: 0.1rem 0 0;
    flex: none;
    border: 1px solid var(--border-strong);
    border-radius: 4px;
    background: var(--sunk-deep);
    cursor: pointer;
}
.form-check-input:checked {
    background: var(--done);
    border-color: var(--done);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%230f1a12' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round' d='M3.5 8.5l3 3 6-7'/%3E%3C/svg%3E");
    background-size: 100%;
}
.form-check label { font-size: 0.9rem; cursor: pointer; margin: 0; }

.help { font-size: 0.8rem; color: var(--muted); margin-top: 0.35rem; }
.errors { list-style: none; margin: 0.4rem 0 0; padding: 0; font-size: 0.82rem; color: var(--err-fg); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--gap); }
.form-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin-top: 1.4rem; }

:focus-visible { outline: 2px solid var(--live); outline-offset: 2px; }

/* ---------- panels ---------- */

.panel {
    background: var(--panel);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.panel-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.1rem;
}
.panel-head h2 { font-size: 1.15rem; }

.empty {
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    padding: 2.25rem 1.5rem;
    text-align: center;
    color: var(--muted);
}
.empty p { margin: 0 0 1rem; }

/* ---------- status pills ---------- */

.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--mono);
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.28rem 0.6rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    color: var(--muted);
    white-space: nowrap;
}
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-active { color: var(--live); border-color: var(--tint-live-bd); background: var(--tint-live); }
.pill-done { color: var(--done); border-color: var(--tint-done-bd); background: var(--tint-done); }
.pill-waiting { color: var(--wait); border-color: var(--tint-wait-bd); background: var(--tint-wait); }
.pill-idle { color: var(--muted); }
.pill-late { color: var(--late); border-color: var(--tint-late-bd); background: var(--tint-late); }

/* ---------- hero + the build rail (signature) ---------- */

.hero-block { padding: 3rem 0 2.25rem; }
.hero-block h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); font-weight: 700; line-height: 1.02; }
.hero-sub { color: var(--muted); margin: 0.6rem 0 0; font-size: 1rem; }

.rail-wrap { margin-top: 2.5rem; }

.rail-top {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.9rem;
}
.rail-figure {
    font-family: var(--mono);
    font-size: clamp(2.6rem, 8vw, 4.2rem);
    font-weight: 500;
    line-height: 0.9;
    letter-spacing: -0.04em;
}
.rail-figure span { font-size: 0.4em; color: var(--muted); margin-left: 0.1em; }
.rail-caption { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); text-align: right; }

.rail {
    display: flex;
    gap: 3px;
    height: 46px;
}

.rail-seg {
    flex-grow: var(--w, 1);
    flex-basis: 0;
    min-width: 8px;
    position: relative;
    background: var(--raised-soft);
    border: 1px solid var(--line-soft);
    border-radius: 5px;
    overflow: hidden;
    text-decoration: none;
    transition: border-color 0.18s ease, transform 0.18s ease;
}
.rail-seg:hover { border-color: var(--border-strong); transform: translateY(-2px); }

.rail-fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: var(--fill, 0%);
    background: var(--seg, var(--wait));
    opacity: 0.85;
    transform-origin: left center;
    animation: rail-in 0.85s cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: var(--delay, 0s);
}
@keyframes rail-in { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.rail-seg[data-tone='done'] { --seg: var(--done); }
.rail-seg[data-tone='active'] { --seg: var(--live); }
.rail-seg[data-tone='waiting'] { --seg: var(--wait); }
.rail-seg[data-tone='idle'] { --seg: var(--idle); }

.rail-legend {
    display: flex;
    gap: 3px;
    margin-top: 0.6rem;
}
.rail-legend div {
    flex-grow: var(--w, 1);
    flex-basis: 0;
    min-width: 8px;
    font-family: var(--mono);
    font-size: 0.7rem;
    color: var(--muted);
    overflow: hidden;
}
.rail-legend strong {
    display: block;
    color: var(--chalk);
    font-weight: 500;
    font-size: 0.72rem;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

/* ---------- gantt ---------- */

.gantt-section { margin-top: 3.25rem; }

.gantt-frame {
    background: var(--panel);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    padding: 0.5rem;
    overflow-x: auto;
}

.view-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.view-toggle button {
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: transparent;
    color: var(--muted);
    border: 0;
    padding: 0.45rem 0.8rem;
    cursor: pointer;
}
.view-toggle button + button { border-left: 1px solid var(--line); }
.view-toggle button:hover { color: var(--chalk); }
.view-toggle button[aria-pressed='true'] { background: var(--raised); color: var(--chalk); }

/* frappe-gantt is built for light backgrounds; re-skin it here. */
.gantt .grid-background { fill: transparent; }
.gantt .grid-row { fill: transparent; }
.gantt .grid-row:nth-child(even) { fill: var(--row-alt); }
.gantt .row-line { stroke: var(--raised); }
.gantt .tick { stroke: var(--tick); }
.gantt .tick.thick { stroke: var(--tick-thick); }
.gantt .today-highlight { fill: var(--live); opacity: 0.10; }
.gantt text { fill: var(--muted); font-family: var(--mono); font-size: 11px; }
.gantt .upper-text, .gantt .lower-text { fill: var(--muted); }
.gantt .bar { fill: var(--tick); stroke: var(--bar-stroke); }
.gantt .bar-label { fill: var(--chalk); font-family: var(--body); font-size: 12px; }
.gantt .bar-label.big { fill: var(--muted); }
.gantt .bar-wrapper:hover .bar { fill: var(--bar-hover); }
.gantt .bar-progress { fill: var(--wait); }
.gantt .bar-wrapper.bar-done .bar-progress { fill: var(--done); }
.gantt .bar-wrapper.bar-active .bar-progress { fill: var(--live); }
.gantt .bar-wrapper.bar-waiting .bar-progress { fill: var(--wait); }
.gantt .bar-wrapper.bar-idle .bar-progress { fill: var(--border-strong); }
.gantt .handle { display: none; }
.gantt .bar-item .bar { fill: var(--meter-track); stroke: var(--bar-item-stroke); }
.gantt .bar-item .bar-label { fill: var(--bar-item-text); font-size: 11px; }
.gantt .bar-item.bar-open .bar-progress { fill: var(--idle); }
.gantt .bar-item.bar-done .bar-progress { fill: var(--done); }

/* ---------- phase detail ---------- */

.phase-list { margin-top: 3.25rem; display: grid; gap: 1rem; }

.phase {
    background: var(--panel);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    padding: 1.5rem;
    scroll-margin-top: 5rem;
}
.phase.is-target { border-color: var(--live); }

.phase-head { display: flex; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.phase-index {
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--muted-dim);
    padding-top: 0.3rem;
}
.phase-title { flex: 1; min-width: 12rem; }
.phase-title h3 { font-size: 1.3rem; }
.phase-dates { font-family: var(--mono); font-size: 0.75rem; color: var(--muted); margin-top: 0.25rem; }
.phase-dates .late { color: var(--late); }

.phase-figure { font-family: var(--mono); font-size: 1.5rem; text-align: right; }
.phase-figure small { display: block; font-size: 0.68rem; color: var(--muted); letter-spacing: 0.08em; }

.meter { height: 5px; border-radius: 3px; background: var(--meter-track); overflow: hidden; margin: 1.1rem 0 0; }
.meter i { display: block; height: 100%; background: var(--tone, var(--wait)); }
.meter[data-tone='done'] { --tone: var(--done); }
.meter[data-tone='active'] { --tone: var(--live); }
.meter[data-tone='waiting'] { --tone: var(--wait); }
.meter[data-tone='idle'] { --tone: var(--idle); }

.phase-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 2rem; margin-top: 1.5rem; }

.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.55rem; }
.checklist li { display: flex; gap: 0.7rem; align-items: flex-start; font-size: 0.92rem; }
.check {
    flex: none;
    width: 17px; height: 17px;
    border-radius: 4px;
    border: 1px solid var(--border-soft2);
    margin-top: 0.2rem;
    display: grid;
    place-items: center;
    font-size: 11px;
    color: transparent;
}
.checklist li.done .check { background: var(--done); border-color: var(--done); color: var(--on-done); }
.checklist li.done .check::after { content: '✓'; }
.checklist li.done span { color: var(--muted); }
.checklist .when { font-family: var(--mono); font-size: 0.7rem; color: var(--muted-dim); display: block; }

.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.feed li { border-left: 2px solid var(--line); padding-left: 0.9rem; }
.feed li.completing { border-left-color: var(--done); }
.feed .feed-meta { font-family: var(--mono); font-size: 0.7rem; color: var(--muted-dim); }
.feed h4 { font-family: var(--body); font-size: 0.95rem; font-weight: 600; margin: 0.2rem 0 0.25rem; }
.feed p { margin: 0; font-size: 0.9rem; color: var(--muted); white-space: pre-line; }
.feed .tag { display: inline-block; font-family: var(--mono); font-size: 0.68rem; color: var(--done); margin-top: 0.4rem; }

/* ---------- auth ---------- */

.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1.25rem; }
.auth-card {
    width: 100%;
    max-width: 27rem;
    background: var(--panel);
    border: 1px solid var(--line-soft);
    border-radius: 14px;
    padding: 2.25rem;
}
.auth-card img { height: 54px; margin-bottom: 1.75rem; }
.auth-card h1 { font-size: 1.5rem; margin-bottom: 0.5rem; }
.auth-card > p { color: var(--muted); font-size: 0.92rem; margin: 0 0 1.75rem; }
.auth-foot { margin-top: 1.5rem; font-size: 0.85rem; color: var(--muted); }
.auth-foot a { color: var(--chalk); }

.code-input {
    font-family: var(--mono) !important;
    font-size: 1.9rem !important;
    letter-spacing: 0.5em;
    text-align: center;
    padding: 0.8rem 0.4rem 0.8rem 0.9rem !important;
}

/* ---------- manage ---------- */

.manage-grid { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 2.25rem; padding: 2rem 0 4rem; }

.side-nav { display: grid; gap: 0.15rem; align-content: start; position: sticky; top: 5rem; }
.side-nav a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--muted);
    font-size: 0.9rem;
    padding: 0.55rem 0.75rem;
    border-radius: 7px;
    border-left: 2px solid transparent;
}
.side-nav a:hover { background: var(--panel); color: var(--chalk); }
.side-nav a.active { background: var(--panel); color: var(--chalk); border-left-color: var(--live); }
.side-nav .count {
    font-family: var(--mono);
    font-size: 0.7rem;
    background: var(--live);
    color: var(--on-chalk);
    border-radius: 999px;
    padding: 0.05rem 0.4rem;
}
.side-nav hr { border: 0; border-top: 1px solid var(--line-soft); margin: 0.75rem 0.75rem; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.75rem; }
.page-head h1 { font-size: 1.75rem; }
.page-head p { color: var(--muted); margin: 0.35rem 0 0; font-size: 0.92rem; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 0.85rem; margin-bottom: 1.75rem; }
.stat {
    background: var(--panel);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem;
    text-decoration: none;
    display: block;
}
a.stat:hover { border-color: var(--border-strong); }
.stat b { display: block; font-family: var(--mono); font-size: 1.9rem; font-weight: 500; line-height: 1.1; }
.stat span { font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.stat.flag b { color: var(--live); }

.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th {
    text-align: left;
    font-family: var(--mono);
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted-dim);
    font-weight: 400;
    padding: 0 0.75rem 0.6rem;
    border-bottom: 1px solid var(--line-soft);
}
.table td { padding: 0.85rem 0.75rem; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table td.right, .table th.right { text-align: right; }
.table .sub { display: block; font-size: 0.78rem; color: var(--muted); }

.queue-item {
    background: var(--panel);
    border: 1px solid var(--line-soft);
    border-left: 3px solid var(--live);
    border-radius: var(--radius);
    padding: 1.25rem 1.4rem;
    margin-bottom: 0.85rem;
}
.queue-meta { display: flex; flex-wrap: wrap; gap: 0.5rem 0.9rem; align-items: center; font-family: var(--mono); font-size: 0.7rem; color: var(--muted); }
.queue-item h3 { font-size: 1.05rem; margin: 0.6rem 0 0.35rem; }
.queue-item .body { color: var(--muted); font-size: 0.9rem; white-space: pre-line; margin: 0; }
.queue-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: flex-end; margin-top: 1.1rem; }
.queue-actions form { display: flex; gap: 0.6rem; align-items: flex-end; flex-wrap: wrap; }
.queue-actions .form-control { min-width: 14rem; }

.filter-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1.25rem; }
.filter-row a {
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.32rem 0.75rem;
}
.filter-row a:hover { color: var(--chalk); border-color: var(--border-strong); }
.filter-row a.active { background: var(--raised); color: var(--chalk); border-color: var(--border-strong); }

.inline-form { display: flex; gap: 0.6rem; align-items: flex-start; flex-wrap: wrap; }
.inline-form .form-control { flex: 1; min-width: 12rem; }

.deliverable-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--line-soft);
}
.deliverable-row:last-of-type { border-bottom: 0; }
.deliverable-row .grow { flex: 1; min-width: 0; }
.deliverable-row form { display: inline; }

/* ---------- responsive ---------- */

@media (max-width: 900px) {
    .manage-grid { grid-template-columns: 1fr; gap: 1.25rem; }
    .side-nav { position: static; grid-auto-flow: column; grid-auto-columns: max-content; overflow-x: auto; padding-bottom: 0.5rem; }
    .side-nav hr { display: none; }
    .phase-body { grid-template-columns: 1fr; gap: 1.5rem; }
}

@media (max-width: 640px) {
    .form-row { grid-template-columns: 1fr; }
    .rail { height: 34px; }
    .rail-legend strong { font-size: 0.66rem; }
    .hero-block { padding: 2rem 0 1.5rem; }
    .auth-card { padding: 1.6rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ---------- review queue: target + completion control ---------- */

.queue-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.1rem;
}

.queue-target {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0 1.5rem;
    flex: 1;
    min-width: 17rem;
}
.queue-target .target-cell + .target-cell {
    border-left: 1px solid var(--line);
    padding-left: 1.5rem;
}

.target-label {
    display: block;
    font-family: var(--mono);
    font-size: 0.62rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--muted-dim);
    margin-bottom: 0.3rem;
}
.target-cell strong {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.3;
}
.target-cell.is-empty strong { color: var(--muted); font-weight: 500; }
.target-sub {
    display: block;
    font-family: var(--mono);
    font-size: 0.68rem;
    color: var(--muted);
    margin-top: 0.2rem;
}
.target-num {
    display: inline-block;
    font-family: var(--mono);
    font-size: 0.7rem;
    color: var(--muted-dim);
    margin-right: 0.45rem;
}

.queue-stamp {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.7rem;
    color: var(--muted);
}

.completion-box {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    background: var(--sunk);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.85rem 1rem;
    margin-top: 1.25rem;
    cursor: pointer;
    transition: border-color 0.16s ease, background 0.16s ease;
}
.completion-box:hover { border-color: var(--border-strong); }
.completion-box:has(input:checked) { border-color: var(--tint-done-bd); background: var(--tint-done); }
.completion-box.is-disabled { cursor: default; opacity: 0.55; }
.completion-box.is-disabled:hover { border-color: var(--line); }

.completion-box .form-check-input { margin-top: 0.12rem; }

.completion-copy { font-size: 0.9rem; line-height: 1.45; }
.completion-copy strong { font-weight: 600; }
.completion-impact {
    display: block;
    font-family: var(--mono);
    font-size: 0.7rem;
    color: var(--muted);
    margin-top: 0.25rem;
}

.queue-deny {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 0.85rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--line-soft);
}
.queue-deny .form-control { flex: 1; min-width: 12rem; font-size: 0.85rem; padding: 0.45rem 0.7rem; }

/* ---------- deliverable reordering ---------- */

.move-group { display: flex; flex-direction: column; gap: 2px; flex: none; width: 1.6rem; }

.move-btn {
    display: block;
    width: 100%;
    padding: 0.1rem 0;
    font-size: 0.7rem;
    line-height: 1.2;
    color: var(--muted);
    background: var(--raised-soft);
    border: 1px solid var(--line-soft);
    border-radius: 4px;
    cursor: pointer;
}
.move-btn:hover:not(:disabled) { background: var(--raised); color: var(--chalk); border-color: var(--border-strong); }
.move-btn:disabled { opacity: 0.28; cursor: default; }

.move-fixed {
    font-family: var(--mono);
    font-size: 0.55rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted-dim);
    text-align: center;
    line-height: 1.2;
}

.locked-note { border-left: 3px solid var(--live); }
.locked-note h2 { font-size: 1.05rem; margin-bottom: 0.6rem; }
.locked-note p { color: var(--muted); font-size: 0.92rem; margin: 0 0 0.7rem; }
.locked-note p:last-child { margin-bottom: 0; }

/* ---------- gantt interaction ---------- */

.gantt-controls { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.gantt-hint { margin: -0.4rem 0 0.9rem; }

.link-btn {
    background: none;
    border: 0;
    padding: 0;
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    cursor: pointer;
    border-bottom: 1px solid var(--line);
}
.link-btn:hover { color: var(--chalk); border-bottom-color: var(--muted); }

.gantt .bar-wrapper { cursor: pointer; }

/* frappe's popup, re-skinned rather than hidden -- it carries the detail that
   makes hovering worthwhile. */
.gantt-container .popup-wrapper {
    background: var(--sunk-deep);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.6rem 0.8rem;
    color: var(--chalk);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
    max-width: 22rem;
}
.gantt-container .popup-wrapper .pointer { display: none; }
.gantt-pop b { display: block; font-size: 0.88rem; margin-bottom: 0.2rem; }
.gantt-pop span { font-family: var(--mono); font-size: 0.7rem; color: var(--muted); }

/* target highlight, shared by phase cards and deliverable rows */
.checklist li.is-target {
    background: var(--tint-live);
    border-radius: 6px;
    margin: -0.25rem -0.5rem;
    padding: 0.25rem 0.5rem;
}

/* ---------- client sign-off ---------- */

.signoff {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-top: 3.25rem;
    padding: 1.6rem 1.75rem;
    background: linear-gradient(100deg, var(--tint-live), var(--signoff-grad-2));
    border: 1px solid var(--tint-live-bd);
    border-radius: var(--radius);
}
.signoff-copy { flex: 1; min-width: 18rem; }
.signoff-copy h2 { font-size: 1.35rem; margin-bottom: 0.4rem; }
.signoff-copy p { color: var(--signoff-copy); font-size: 0.94rem; margin: 0 0 0.7rem; }
.signoff-copy .eyebrow { color: var(--live); }
.signoff-note { font-size: 0.72rem; text-align: right; max-width: 11rem; }

.jump-link {
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--muted);
    text-decoration: none;
    border-bottom: 1px solid var(--line);
}
.jump-link:hover { color: var(--chalk); border-bottom-color: var(--muted); }
.signoff-link { color: var(--live); border-bottom-color: var(--tint-live-bd); }
.signoff-link:hover { color: var(--live-hi); }

.signed {
    font-size: 0.72rem;
    color: var(--done);
    margin: 0.85rem 0 0;
}

.phase.is-target { border-color: var(--live); }

/* ---------- chronological feed ---------- */

.feed-section { margin-top: 3.25rem; }

.stream { list-style: none; margin: 0; padding: 0; }
.stream li {
    display: grid;
    grid-template-columns: 4.5rem minmax(0, 1fr);
    gap: 1.25rem;
    padding: 1.15rem 0;
    border-top: 1px solid var(--line-soft);
}
.stream li:last-child { border-bottom: 1px solid var(--line-soft); }

.stream-when {
    font-size: 0.75rem;
    color: var(--chalk);
    padding-top: 0.15rem;
    text-align: right;
}
.stream-when span { display: block; font-size: 0.65rem; color: var(--muted-dim); }

.stream-body h4 {
    font-family: var(--body);
    font-size: 1rem;
    font-weight: 600;
    margin: 0.35rem 0 0.3rem;
}
.stream-body p { margin: 0; font-size: 0.92rem; color: var(--muted); white-space: pre-line; }
.stream-tag { display: inline-block; }
.stream li.completing .stream-when { color: var(--done); }

@media (max-width: 640px) {
    .stream li { grid-template-columns: 1fr; gap: 0.35rem; }
    .stream-when { text-align: left; }
    .stream-when span { display: inline; margin-left: 0.3rem; }
    .signoff { padding: 1.25rem; }
}

/* ==========================================================================
   Client portal: paged layout
   ========================================================================== */

.head-stack { position: sticky; top: 0; z-index: 30; }
.topbar { position: static; }

/* ---------- sign-off alert: follows them across every page ---------- */

.alert-bar {
    background: linear-gradient(96deg, #d9a950, #c68f2b);
    color: #17130b;
    border-bottom: 1px solid #8f671a;
}

.alert-inner {
    max-width: var(--shell);
    margin: 0 auto;
    padding: 0.7rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.alert-dot {
    flex: none;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #17130b;
    box-shadow: 0 0 0 0 rgba(23, 19, 11, 0.55);
    animation: alert-pulse 1.9s ease-out infinite;
}
@keyframes alert-pulse {
    70% { box-shadow: 0 0 0 9px rgba(23, 19, 11, 0); }
    100% { box-shadow: 0 0 0 0 rgba(23, 19, 11, 0); }
}

.alert-copy { flex: 1; min-width: 0; line-height: 1.35; }
.alert-copy strong { display: block; font-size: 0.95rem; font-weight: 700; }
.alert-copy span { font-size: 0.82rem; opacity: 0.82; }

.alert-action {
    flex: none;
    background: #17130b;
    border-color: #17130b;
    color: #f5e6c8;
}
.alert-action:hover { background: #000; border-color: #000; color: #fff; }

/* ---------- client sub-nav ---------- */

.client-nav {
    background: rgba(19, 19, 19, 0.94);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line-soft);
}
.client-nav-inner {
    max-width: var(--shell);
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}
.client-nav a {
    display: block;
    padding: 0.8rem 0;
    font-size: 0.88rem;
    color: var(--muted);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.client-nav a:hover { color: var(--chalk); }
.client-nav a.active { color: var(--chalk); border-bottom-color: var(--live); }
.client-nav-spacer { flex: 1; }
.client-nav-project { font-size: 0.72rem; color: var(--muted-dim); }

/* ---------- phase cards ---------- */

.phase-grid-section { margin-top: 3rem; }
.phase-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0.85rem; }

.phase-card {
    display: block;
    background: var(--panel);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.16s ease, transform 0.16s ease;
}
.phase-card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.phase-card-top { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.7rem; }
.phase-card h3 { font-size: 1.05rem; margin-bottom: 0.9rem; line-height: 1.25; }
.phase-card .meter { margin: 0; }
.phase-card-foot { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--muted); margin-top: 0.55rem; }
.phase-card-note { font-size: 0.68rem; color: var(--muted-dim); margin-top: 0.35rem; }
.phase-card-note.late { color: var(--late); }

/* ---------- detail pages ---------- */

.crumbs { padding: 1.75rem 0 0; font-size: 0.72rem; color: var(--muted-dim); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--chalk); }
.crumbs span { margin: 0 0.4rem; }

.detail-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
    padding: 0.9rem 0 1.4rem;
}
.detail-head h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); line-height: 1.05; }
.detail-dates { font-size: 0.78rem; color: var(--muted); margin: 0.5rem 0 0; }
.detail-dates .late { color: var(--late); }
.detail-figure { text-align: right; display: grid; gap: 0.4rem; justify-items: end; }
.detail-figure b { font-size: 1.8rem; font-weight: 500; }
.detail-figure small { font-size: 0.7rem; color: var(--muted); }
.detail-blurb { color: var(--muted); font-size: 0.95rem; margin: 1.2rem 0 0; max-width: 46rem; }

.detail-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 2.5rem; margin-top: 2.5rem; }

.deliverable-links { list-style: none; margin: 0; padding: 0; }
.deliverable-links a {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    padding: 0.7rem 0.6rem;
    margin: 0 -0.6rem;
    border-radius: 7px;
    text-decoration: none;
    color: inherit;
    font-size: 0.92rem;
}
.deliverable-links a:hover { background: var(--panel); }
.deliverable-links a.done .check { background: var(--done); border-color: var(--done); color: var(--on-done); }
.deliverable-links a.done .check::after { content: '✓'; }
.deliverable-links a.done .deliverable-name { color: var(--muted); }
.deliverable-name { flex: 1; }
.deliverable-name .when { display: block; font-family: var(--mono); font-size: 0.68rem; color: var(--muted-dim); margin-top: 0.15rem; }
.deliverable-links .chev { color: var(--muted-dim); }

.delivered-note {
    display: flex;
    align-items: baseline;
    gap: 0.8rem;
    flex-wrap: wrap;
    background: var(--tint-done);
    border: 1px solid var(--tint-done-bd);
    border-radius: var(--radius);
    padding: 0.9rem 1.1rem;
    margin-top: 1.5rem;
    font-size: 0.92rem;
}
.delivered-note strong { color: var(--done); font-weight: 600; }
.delivered-note span { font-size: 0.7rem; color: var(--muted); }

.detail-nav {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin: 3rem 0 4rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--line-soft);
    font-size: 0.88rem;
}
.detail-nav a { color: var(--muted); text-decoration: none; }
.detail-nav a:hover { color: var(--chalk); }

.portal-foot { padding: 3rem 0; color: var(--muted-dim); font-size: 0.82rem; }
.portal-foot a { color: var(--muted); }

/* ---------- gantt: finish the dark treatment ---------- */

.gantt-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.9rem;
}

.gantt-key { display: flex; flex-wrap: wrap; gap: 1.1rem; margin-top: 0.9rem; font-size: 0.68rem; color: var(--muted); }
.gantt-key span { display: inline-flex; align-items: center; gap: 0.4rem; }
.key-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }

.gantt-container { background: transparent; }
/* frappe ships a light theme; every painted surface needs restating or the
   calendar strip stays white against the dark page. */
.gantt .grid-header { fill: var(--sunk); stroke: var(--tick); }
.gantt .grid-background { fill: none; }
.gantt .grid-row { fill: var(--sunk-focus); }
.gantt .grid-row:nth-child(even) { fill: var(--row-alt); }
.gantt .row-line { stroke: var(--gantt-line); }
.gantt .tick { stroke: var(--tick); }
.gantt .tick.thick { stroke: var(--tick-thick); }
.gantt .today-highlight { fill: var(--live); opacity: 0.09; }
.gantt .lower-text, .gantt .upper-text { fill: var(--muted); font-family: var(--mono); }
.gantt .arrow { stroke: var(--border-strong); }
/* Clicking opens the real page, so frappe's modal never shows. */
.gantt-container .popup-wrapper { display: none !important; }

@media (max-width: 780px) {
    .detail-split { grid-template-columns: 1fr; gap: 2rem; }
    .alert-inner { flex-wrap: wrap; }
    .alert-copy { flex-basis: 100%; order: 2; }
    .alert-action { order: 3; margin-left: auto; }
}

/* ---------- confirmation modal ---------- */

.modal-scrim {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(8, 8, 8, 0.72);
    backdrop-filter: blur(3px);
    display: grid;
    place-items: center;
    padding: 1.5rem;
}

.modal {
    width: 100%;
    max-width: 30rem;
    background: var(--panel);
    border: 1px solid var(--line);
    border-left: 3px solid var(--live);
    border-radius: 12px;
    padding: 1.75rem;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
}
.modal h2 { font-size: 1.35rem; line-height: 1.2; margin-bottom: 0.7rem; }
.modal .eyebrow { color: var(--live); }
.modal-lead { color: var(--chalk); font-size: 0.95rem; margin: 0 0 1.1rem; }

.modal-consequences {
    list-style: none;
    margin: 0 0 1.1rem;
    padding: 0;
    display: grid;
    gap: 0.5rem;
}
.modal-consequences li {
    position: relative;
    padding-left: 1.15rem;
    font-size: 0.9rem;
    color: var(--muted);
}
.modal-consequences li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--muted-dim);
}
.modal-consequences strong { color: var(--chalk); font-weight: 600; }

.modal-note {
    font-family: var(--mono);
    font-size: 0.7rem;
    color: var(--muted-dim);
    margin: 0 0 1.4rem;
}

.modal-actions { display: flex; justify-content: flex-end; gap: 0.6rem; flex-wrap: wrap; }

.completes-phase-flag {
    font-size: 0.7rem;
    color: var(--live);
    margin: 0.9rem 0 0;
}

.reopen-warn {
    font-size: 0.82rem;
    color: var(--live);
    background: var(--tint-live);
    border: 1px solid var(--tint-live-bd);
    border-radius: 8px;
    padding: 0.7rem 0.9rem;
    margin: 1rem 0 0;
}

/* ---------- attached links ---------- */
/* Written against tokens only, so these read correctly in the dark /manage/
   side and the light client portal without a second rule. */

.update-links {
    list-style: none;
    margin: 0.7rem 0 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.update-links a {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    max-width: 22rem;
    padding: 0.3rem 0.6rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--raised-soft);
    color: var(--chalk);
    font-size: 0.82rem;
    text-decoration: none;
    /* Labels default to a hostname, but a long custom one should not push the
       feed sideways. */
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    transition: border-color 0.16s ease, background 0.16s ease;
}
.update-links a:hover {
    border-color: var(--border-strong);
    background: var(--raised);
}
.update-link-icon { color: var(--muted); font-size: 0.78rem; flex: none; }

/* ---------- link editor (manage) ---------- */

.links-block { margin: 0 0 1.1rem; }
.links-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 0.45rem;
}
.links-head .form-label { margin: 0; }
.links-count { font-size: 0.7rem; color: var(--muted-dim); }

.link-rows { display: flex; flex-direction: column; gap: 0.5rem; }
.link-row { display: flex; align-items: flex-start; gap: 0.5rem; }
/* Rows always exist so the formset's TOTAL_FORMS never changes; they are just
   not shown until "Attach link" reveals one. */
.link-row.is-empty { display: none; }
.link-row-fields {
    flex: 1;
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 0.5rem;
}
.link-row .errors { flex-basis: 100%; }
.link-del { display: none; }
.link-drop {
    flex: none;
    line-height: 1;
    padding: 0.55rem 0.7rem;
    color: var(--muted);
}
.link-drop:hover { color: var(--danger-fg); border-color: var(--danger-bd); }

#links-add:disabled { opacity: 0.5; cursor: not-allowed; }

@media (max-width: 640px) {
    .link-row-fields { grid-template-columns: 1fr; }
}

/* A long status such as "Pending approval of previous phase" cannot shrink
   inside a nowrap pill, so it used to spill past the edge of its card. Let the
   row wrap and let the pill soften its own rule; the short labels above mean it
   rarely needs to, but nothing overflows even when it does. */
.phase-card-top { flex-wrap: wrap; row-gap: 0.45rem; }
.phase-card-top .pill {
    white-space: normal;
    min-width: 0;
    max-width: 100%;
    line-height: 1.3;
}
