/* Gantt (project + portfolio), deliverables, import. Silos neutrals + accent tokens; status tints are the data palette.
   Every text pair here is measured on the rendered DOM by the harness (dark ink #1B2140 on
   the mid tints clears 7:1; muted #565D72 is used only on white / raised grounds). */

/* ---------- toolbar ---------- */
.g-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px 14px; }
.g-range { display: inline-flex; align-items: center; gap: 8px; }
.g-range label { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--color-text-muted); font-weight: 500; }
.g-range input[type="date"] { padding: 5px 8px; font-size: 12.5px; min-height: 32px; width: 138px; }
.g-zoom { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.g-zoom .seg button { padding: 5px 10px; font-size: 12.5px; }
.g-step { width: 30px; height: 30px; font-size: 18px; line-height: 1; font-weight: 600; border: 1px solid var(--color-border-strong); border-radius: var(--radius-md); background: var(--color-surface); color: var(--color-text); }
.g-step:disabled { opacity: .45; cursor: default; }
.g-zoom-lbl { min-width: 54px; text-align: center; font-size: 12.5px; font-weight: 600; color: var(--color-text); }

/* ---------- frame ---------- */
.gantt { border-top: 1px solid var(--color-border); }
.g-scroll { overflow: auto; max-height: min(72vh, 780px); position: relative; overscroll-behavior-x: contain; background: #FFFFFF; }
.g-scroll:focus-visible { outline: 2px solid var(--color-focus); outline-offset: -2px; }
.g-canvas { position: relative; }
.g-headrow { display: flex; position: sticky; top: 0; z-index: 7; height: 54px; background: #FAFBFD; border-bottom: 1px solid var(--color-border); }
.g-corner { position: sticky; left: 0; z-index: 8; flex: 0 0 var(--name-w); width: var(--name-w); background: #FAFBFD; border-right: 1px solid var(--color-border);
  display: flex; align-items: flex-end; padding: 0 12px 8px; font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--color-text-muted); }
.g-scale { position: relative; flex: none; height: 54px; }
.g-tier1, .g-tier2 { position: absolute; left: 0; right: 0; }
.g-tier1 { top: 0; height: 26px; }
.g-tier2 { top: 26px; height: 28px; }
.g-t1 { position: absolute; top: 0; height: 26px; line-height: 26px; padding-left: 8px; font-size: 12px; font-weight: 600; color: #2F3552; white-space: nowrap; overflow: hidden; border-left: 1px solid var(--color-border); }
.g-t2 { position: absolute; top: 0; height: 28px; line-height: 28px; text-align: center; font-size: 11.5px; color: var(--color-text-muted); white-space: nowrap; overflow: hidden; border-left: 1px solid #ECEEF4; }
.g-t2.is-wkend { background: #F0F2F7; }
.g-t2.is-today, .g-t2.is-now { background: var(--accent-tint); color: var(--accent-tint-ink); font-weight: 700; }
.g-today-flag { position: absolute; top: 4px; transform: translateX(-50%); z-index: 2; background: var(--accent-ink); color: #FFFFFF; font-size: 11px; font-weight: 700; line-height: 18px; padding: 0 8px; border-radius: 999px; white-space: nowrap; box-shadow: 0 0 0 2px #FAFBFD; }

.g-bodyrow { display: flex; position: relative; }
.g-names { position: sticky; left: 0; z-index: 5; flex: 0 0 var(--name-w); width: var(--name-w); background: #FFFFFF; border-right: 1px solid var(--color-border); }
.g-name { height: var(--row-h); display: flex; align-items: center; gap: 6px; padding-right: 10px; border-bottom: 1px solid #ECEEF4; min-width: 0; font-size: 13px; color: var(--color-text); }
.g-name-group, .g-name-project { font-weight: 600; }
.g-name-group { background: #F6F7FA; }
.g-name-deliverable .g-nm { font-weight: 500; }
.g-nm { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--color-text); text-decoration: none; }
a.g-nm:hover { color: var(--color-link); text-decoration: underline; }
.g-sub { flex: none; font-size: 11.5px; font-weight: 500; color: var(--color-text-muted); white-space: nowrap; }
.g-gpct { flex: none; font-size: 12px; font-weight: 700; color: var(--color-text); }
.g-toggle { flex: none; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: #2F3552; display: inline-grid; place-items: center; cursor: pointer; }
.g-toggle:hover { background: #ECEEF4; }
.g-toggle svg { width: 16px; height: 16px; transition: transform .15s ease; }
.g-toggle[aria-expanded="true"] svg { transform: rotate(90deg); }

.g-plot { position: relative; flex: none; }
.g-bg, .g-deps { position: absolute; left: 0; top: 0; pointer-events: none; }
.g-deps { z-index: 1; }
.g-empty { padding: 8px 16px 24px; }

/* ---------- bars ---------- */
.g-bar { position: absolute; z-index: 2; display: flex; align-items: center; border-radius: 8px; overflow: hidden; cursor: pointer; user-select: none;
  background: var(--gb); box-shadow: inset 0 0 0 1px var(--gbd); }
.g-bar .g-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--gf); }
.g-bar .g-lbl { position: relative; padding: 0 10px; font-size: 12.5px; font-weight: 600; color: #1B2140; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-bar.k-project .g-lbl { font-size: 13px; }
.g-bar.is-editable { cursor: grab; }
.g-bar .g-h { position: absolute; top: 0; bottom: 0; width: 9px; cursor: ew-resize; z-index: 1; }
.g-bar .g-h-l { left: 0; }
.g-bar .g-h-r { right: 0; }
.g-bar.is-editable:hover .g-h::after { content: ''; position: absolute; top: 28%; bottom: 28%; left: 3.5px; width: 2px; border-radius: 2px; background: rgba(31, 30, 27, .4); }
.g-bar.is-overdue { box-shadow: inset 0 0 0 2px #8F3B2B; }
.g-bar.is-dragging { cursor: grabbing; z-index: 6; box-shadow: 0 6px 18px rgba(20, 26, 50, .22), inset 0 0 0 2px var(--accent-ink); }
.g-bar:focus-visible, .g-dia:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
body.g-dragging, body.g-dragging * { cursor: grabbing !important; user-select: none; }

.tone-todo        { --gb: #ECEEF4; --gf: #D3D8E4; --gbd: #C8CEDC; }
.tone-in_progress { --gb: #CFE3DF; --gf: #8FBFB8; --gbd: #8FBFB8; }
.tone-blocked     { --gb: #EFD8CF; --gf: #D9A08F; --gbd: #D9A08F; }
.tone-done        { --gb: #DCE2C4; --gf: #B6BC8E; --gbd: #B6BC8E; }
.tone-active    { --gb: #F2D9CF; --gf: #E0A28B; --gbd: #E0A28B; }
.tone-planning  { --gb: #CFE3DF; --gf: #8FBFB8; --gbd: #8FBFB8; }
.tone-on_hold   { --gb: #EFE0C2; --gf: #DDB77F; --gbd: #DDB77F; }
.tone-completed { --gb: #DCE2C4; --gf: #B6BC8E; --gbd: #B6BC8E; }
.tone-cancelled { --gb: #ECEEF4; --gf: #D3D8E4; --gbd: #C8CEDC; }

.g-out { position: absolute; z-index: 2; height: var(--row-h); line-height: var(--row-h); font-size: 12.5px; font-weight: 600; color: #2F3552; white-space: nowrap; pointer-events: none; }
.g-out-sum { font-size: 12px; font-weight: 700; color: #1B2140; }
.g-out-dia { font-weight: 500; }

.g-sum { position: absolute; z-index: 2; height: 10px; border-radius: 5px; background: #C8CEDC; overflow: hidden; }
.g-sum .g-fill { position: absolute; left: 0; top: 0; bottom: 0; background: #2F3552; }
.g-sum.tone-in_progress .g-fill, .g-sum.tone-ink .g-fill { background: #2C5C57; }
.g-sum.tone-done .g-fill { background: #5E6B3A; }
.g-sum.tone-blocked .g-fill { background: #8F3B2B; }

/* ---------- deliverable diamonds ---------- */
.g-dia { position: absolute; z-index: 3; width: 24px; height: 24px; margin: -12px 0 0 -12px; display: grid; place-items: center; cursor: pointer; border-radius: 6px; }
.g-dia i { display: block; width: 13px; height: 13px; transform: rotate(45deg); border-radius: 2px; background: var(--dc); border: 1.5px solid var(--dk); }
.g-dia:hover i { transform: rotate(45deg) scale(1.2); }
.g-dia.is-overdue i { box-shadow: 0 0 0 2px #FFFFFF, 0 0 0 4px #8F3B2B; }
.st-not_started         { --dc: #DCE2F0; --dk: #5E657A; }
.st-wip                 { --dc: #C2853A; --dk: #6E4A1B; }
.st-submitted           { --dc: #3F7E78; --dk: #2C5C57; }
.st-working_on_comments { --dc: #C0573C; --dk: #7A3223; }
.st-delivered           { --dc: #B6BC8E; --dk: #5E6B3A; }
.st-approved            { --dc: #5E6B3A; --dk: #3B4424; }

/* ---------- hover / focus card ---------- */
.g-card { position: fixed; z-index: 80; min-width: 240px; max-width: 320px; padding: 14px 16px; background: #FFFFFF; color: #1B2140; border: 1px solid var(--color-border); border-radius: 12px; box-shadow: var(--elevation-3); font-size: 13px; pointer-events: none; }
.g-card-top { display: flex; align-items: center; gap: 12px; }
.g-card-top h4 { margin: 0; font-size: 14px; font-weight: 700; line-height: 1.3; }
.g-card-top .g-when { display: block; margin-top: 2px; font-size: 12.5px; color: var(--color-text-muted); }
.g-card dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 5px 14px; margin: 12px 0 0; }
.g-card dt { color: var(--color-text-muted); }
.g-card dd { margin: 0; font-weight: 600; min-width: 0; }
.g-card .g-note { margin: 10px 0 0; font-size: 12.5px; color: #2F3552; font-style: italic; }
.g-card-drag { display: flex; flex-direction: column; gap: 2px; }
.g-card-drag strong { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--accent-ink); }
.g-ring { position: relative; display: inline-grid; place-items: center; flex: none; }
.g-ring svg { position: absolute; inset: 0; }
.g-ring b { position: relative; font-size: 12px; font-weight: 700; }

/* ---------- legend ---------- */
.g-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; padding: 12px 16px; font-size: 12.5px; color: var(--color-text-muted); border-top: 1px solid #ECEEF4; }
.g-legend > span { display: inline-flex; align-items: center; gap: 7px; }
.g-legend .sw { display: inline-block; width: 22px; height: 12px; border-radius: 4px; background: linear-gradient(90deg, var(--gf) 55%, var(--gb) 55%); box-shadow: inset 0 0 0 1px var(--gbd); }
.g-legend .sw.ov { --gb: #FFFFFF; --gf: #FFFFFF; box-shadow: inset 0 0 0 2px #8F3B2B; }
.g-legend .dm { display: inline-block; width: 10px; height: 10px; transform: rotate(45deg); border-radius: 2px; background: var(--dc); border: 1.5px solid var(--dk); }
.g-legend .tb { display: inline-block; width: 14px; height: 14px; background: var(--accent-tint); border-left: 2px solid var(--accent-ui); }
.g-legend .wk { display: inline-block; width: 14px; height: 14px; background: #F0F2F7; border: 1px solid #E1E4EC; }
.g-legend .ar { display: inline-block; width: 22px; height: 10px; border-top: 1.5px solid #5E657A; position: relative; top: 5px; }
.g-legend .ar::after { content: ''; position: absolute; right: -1px; top: -5px; border: 4px solid transparent; border-left: 6px solid #5E657A; }
.g-legend .lg-label { font-weight: 700; color: var(--color-text); }

/* ---------- project Gantt page ---------- */
.gantt-card .card-head { flex-wrap: wrap; gap: 10px 16px; }
.gantt-summary { display: flex; flex-wrap: wrap; gap: 10px 26px; align-items: center; padding: 14px 20px; border-bottom: 1px solid #ECEEF4; }
.gantt-summary .gs { display: flex; align-items: center; gap: 10px; }
.gantt-summary .gs .v { font-size: 20px; font-weight: 700; line-height: 1.1; color: var(--color-text); }
.gantt-summary .gs .l { font-size: 12px; color: var(--color-text-muted); }
.gantt-summary .gs .v.overdue { color: #8F3B2B; }
.gantt-hint { margin: 0; padding: 0 20px 12px; font-size: 12.5px; color: var(--color-text-muted); }

/* ---------- key facts strip ---------- */
.facts { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 14px 0 0; padding: 12px 0 0; border-top: 1px solid #ECEEF4; }
.facts > div { min-width: 0; max-width: 100%; }
.facts dt { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--color-text-muted); }
.facts dd { margin: 2px 0 0; font-size: 13.5px; font-weight: 600; color: var(--color-text); overflow-wrap: anywhere; }
.facts dd .tag { display: inline-block; margin: 0 4px 2px 0; padding: 1px 8px; border-radius: 999px; background: #ECEEF4; font-size: 12px; font-weight: 600; color: #2F3552; }
.facts dd.empty { color: var(--color-text-muted); font-weight: 500; font-style: italic; padding: 0; text-align: left; }

/* ---------- portfolio (home) ---------- */
.pulse { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr) minmax(0, 1.1fr); gap: var(--space-5); margin-bottom: var(--space-5); }
.pulse .card-body { padding-top: 6px; }
.pulse .chart-box { height: 170px; position: relative; }
.pulse-donut { display: grid; grid-template-columns: 150px minmax(0, 1fr); align-items: center; gap: 14px; }
.pulse-donut .chart-box { height: 150px; }
.pulse-donut .dl { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 12.5px; }
.pulse-donut .dl li { display: flex; align-items: center; gap: 8px; }
.pulse-donut .dl i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.pulse-donut .dl b { margin-left: auto; font-weight: 700; }
.pulse-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pulse-kpis .pk { background: #FAFBFD; border: 1px solid #ECEEF4; border-radius: 10px; padding: 10px 12px; }
.pulse-kpis .pk .v { font-size: 22px; font-weight: 700; line-height: 1.15; color: var(--color-text); }
.pulse-kpis .pk .v.warn { color: #7A3223; }
.pulse-kpis .pk .l { font-size: 12px; color: var(--color-text-muted); }
.pf-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 20px; border-bottom: 1px solid #ECEEF4; }
.pf-filters .chip-select { position: relative; display: inline-flex; align-items: center; }
.pf-filters .chip-select select { appearance: none; -webkit-appearance: none; border-radius: 999px; padding: 5px 30px 5px 12px; font-size: 12.5px; font-weight: 600; min-height: 32px; background: #FFFFFF url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%233D3D3A' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center / 14px; border: 1px solid var(--color-border-strong); color: var(--color-text); max-width: 220px; }
.pf-filters .chip-select select.is-set { background-color: var(--accent-tint); border-color: var(--accent-ui); color: var(--accent-tint-ink); }
.pf-filters .search { margin-left: auto; }
.pf-filters .pf-clear { font-size: 12.5px; }
.pf-count { font-size: 12.5px; color: var(--color-text-muted); padding: 0 4px; }

/* ---------- deliverables ---------- */
.dlv-status { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.dlv-status .orig { font-size: 12px; color: var(--color-text-muted); font-style: italic; max-width: 260px; }
.dlv-name { font-weight: 600; }

/* ---------- task modal extras ---------- */
.dep-list { max-height: 190px; overflow: auto; border: 1px solid var(--color-border-strong); border-radius: var(--radius-md); padding: 6px 10px; background: #FFFFFF; }
.dep-list .check { display: flex; gap: 8px; align-items: flex-start; padding: 4px 0; font-weight: 500; }
.dep-list .check small { color: var(--color-text-muted); margin-left: auto; white-space: nowrap; padding-left: 8px; }
.dep-filter { margin-bottom: 6px; }
.wd-readout { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; font-weight: 600; }
.range-row { display: flex; align-items: center; gap: 10px; }
.range-row input[type="range"] { flex: 1; accent-color: var(--accent-ink); }
.range-row input[type="number"] { width: 84px; }

/* ---------- import ---------- */
.imp-steps { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 var(--space-5); padding: 0; list-style: none; }
.imp-steps li { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: #ECEEF4; font-size: 12.5px; font-weight: 600; color: #2F3552; }
.imp-steps li[aria-current="step"] { background: var(--accent-ink); color: #FFFFFF; }
.imp-steps li .n { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: rgba(255, 255, 255, .6); font-size: 11.5px; color: #1B2140; }
.imp-totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: var(--space-5); }
.imp-totals .pk { background: #FFFFFF; border: 1px solid var(--color-border); border-radius: 12px; padding: 12px 14px; }
.imp-totals .pk .v { font-size: 24px; font-weight: 700; color: var(--color-text); line-height: 1.15; }
.imp-totals .pk .l { font-size: 12.5px; color: var(--color-text-muted); }
.imp-warn details { border-top: 1px solid #ECEEF4; padding: 10px 20px; }
.imp-warn details:first-child { border-top: 0; }
.imp-warn summary { cursor: pointer; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.imp-warn ul { margin: 8px 0 2px; padding-left: 20px; font-size: 13px; color: #2F3552; }
.imp-warn li { margin: 3px 0; }
.imp-steps li.skip { opacity: .55; text-decoration: line-through; }
/* v1.5 import wizard */
.imp-layouts { border: 0; margin: 0; padding: 0; display: grid; gap: 8px; }
.imp-layouts legend { font-weight: 600; margin-bottom: 6px; padding: 0; }
.imp-cols select, .imp-vals select { width: 100%; min-width: 200px; }
.imp-cols .imp-market { margin-top: 6px; width: 100%; }
.imp-samples span { display: inline-block; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 0 6px 2px 0;
  padding: 1px 8px; border-radius: 6px; background: #F3F4F8; font-size: 12.5px; color: #2F3552; vertical-align: middle; }
.imp-detail > td { background: #FAFBFD; padding: 8px 14px 14px; }
.imp-sub { margin-top: 8px; font-size: 13px; }
.imp-sub caption { text-align: left; font-weight: 600; padding: 4px 0; }
.imp-save .btn-row { flex-wrap: nowrap; }
.imp-save input { flex: 1; min-width: 0; }
.imp-done-list { margin: 0 0 var(--space-4); padding-left: 18px; }
.imp-done-list li { margin: 4px 0; }
.imp-top { margin: 0 0 var(--space-4); }
.imp-top summary, .imp-fine summary { cursor: pointer; font-size: 13px; color: var(--color-link); font-weight: 600; padding: 4px 0; }
.imp-top .table-wrap { max-height: 260px; overflow: auto; margin-top: 6px; }
.imp-top table td { white-space: nowrap; max-width: 180px; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.imp-top table th { font-size: 12px; color: var(--color-text-muted); }
.imp-top tr.imp-hrow td, .imp-top tr.imp-hrow th { background: var(--accent-tint); color: var(--accent-tint-ink); font-weight: 600; }
.imp-fine { border-top: 1px solid #ECEEF4; padding: 8px 20px 12px; }
.imp-totals-opt .help { display: block; margin-top: 4px; }
@media (max-width: 720px) {
  .imp-steps li { padding: 5px 9px; font-size: 12px; }
  .imp-steps li:not([aria-current="step"]) { font-size: 0; gap: 0; padding: 5px; }
  .imp-steps li:not([aria-current="step"]) .n { font-size: 11.5px; }
  .imp-cols select, .imp-vals select { min-width: 0; }
  .imp-samples span { max-width: 120px; }
  .imp-save .btn-row { flex-wrap: wrap; }
  .imp-detail > td { padding: 6px 0 10px; }
}

@media (max-width: 1200px) {
  .pulse { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .pulse > :last-child { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .pulse { grid-template-columns: minmax(0, 1fr); }
  .pulse > :last-child { grid-column: auto; }
  .pulse-donut { grid-template-columns: 120px minmax(0, 1fr); }
  .pulse-donut .chart-box { height: 120px; }
  .g-tools { justify-content: flex-start; }
  .g-range input[type="date"] { width: 128px; }
  .g-sub { display: none; }
  .g-scroll { max-height: 70vh; }
  .gantt-summary { padding: 12px 14px; gap: 10px 18px; }
  .pf-filters { padding: 10px 14px; }
  .pf-filters .search { margin-left: 0; width: 100%; }
  .pf-filters .chip-select select { max-width: 160px; }
  .g-card { max-width: calc(100vw - 16px); }
}
.g-card .dm-big { display: inline-block; flex: none; width: 18px; height: 18px; margin: 0 8px 0 6px; transform: rotate(45deg); border-radius: 3px; background: var(--dc); border: 1.5px solid var(--dk); }
