/* Project Planner — styles. Colours and typography follow sebastienbalbastre.com:
   deep green + orange accent, Verdana, light and dark themes. */

:root {
  --paper: #ffffff;
  --surface: #ffffff;
  --tint: #f6faf6;
  --mist: #edf4ee;
  --line: #e0e6e1;
  --line-strong: #c4d0c6;
  --ink: #101f13;
  --ink-soft: #4e594c;
  --pine: #1e4e22;
  --pine-hover: #3b723e;
  --on-fill: #ffffff;
  --ochre: #f37513;
  --ochre-ink: #b35300;
  --brick: #b42318;
  --brick-soft: #fbe7e4;
  --leaf: #2e7449;
  --leaf-soft: #ddefe3;
  --band: #1e4e22;
  --band-2: #063215;
  --band-ink: #ffffff;
  --scrim: rgba(6, 50, 21, 0.55);
  --shadow-soft: 0 4px 24px -8px rgba(30, 78, 34, 0.18);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.18), 0 4px 8px -4px rgba(0, 0, 0, 0.12);
  --sel-row: rgba(243, 117, 19, 0.13);
  --off-bg: rgba(16, 31, 19, 0.05);
  --bar: #2a7b9b;
  --bar-critical: #d92d20;
  --bar-summary: #101f13;
  --link: #a8b3aa;
  --font: Verdana, Geneva, 'DejaVu Sans', Tahoma, sans-serif;
  --r: 6px;
  --row-h: 34px;
  --head-h: 34px;
  --tap: 40px;
  color-scheme: light;
}

:root[data-theme='dark'] {
  --paper: #0b1a0e;
  --surface: #11241a;
  --tint: #0f2015;
  --mist: #1a3322;
  --line: #2a4531;
  --line-strong: #3a5a42;
  --ink: #e8f0e9;
  --ink-soft: #a9b8ab;
  --pine: #86c48f;
  --pine-hover: #a9d8b0;
  --on-fill: #0b1a0e;
  --ochre: #f58a3a;
  --ochre-ink: #f7a060;
  --brick: #f0998c;
  --brick-soft: #3c2321;
  --leaf: #86cfa1;
  --leaf-soft: #1d3828;
  --band: #12361a;
  --band-2: #04200d;
  --scrim: rgba(0, 0, 0, 0.62);
  --shadow-soft: 0 4px 24px -8px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.55), 0 4px 8px -4px rgba(0, 0, 0, 0.45);
  --sel-row: rgba(245, 138, 58, 0.17);
  --off-bg: rgba(255, 255, 255, 0.045);
  --bar: #5fb3d0;
  --bar-critical: #f0786b;
  --bar-summary: #e8f0e9;
  --link: #5d7563;
  color-scheme: dark;
}

@media (pointer: coarse) {
  :root {
    --row-h: 42px;
    --head-h: 40px;
    --tap: 44px;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 0.9375rem;
  line-height: 1.55;
  -webkit-tap-highlight-color: transparent;
}
body.modal-open { overflow: hidden; }
#app, .screen { min-height: 100vh; min-height: 100dvh; }
.screen { display: flex; flex-direction: column; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5rem; color: var(--pine); }
h1 { font-size: clamp(1.45rem, 1.2rem + 1.2vw, 1.9rem); letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; display: flex; align-items: center; gap: 0.5rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 0.75rem; }
a { color: var(--pine); text-underline-offset: 0.15em; }
a:hover { color: var(--pine-hover); }
ul { margin: 0.25rem 0 0.75rem; padding-left: 1.2rem; }
li { margin-bottom: 0.25rem; }
:focus-visible { outline: 3px solid var(--ochre); outline-offset: 2px; }
[hidden] { display: none !important; }
.grow { flex: 1 1 auto; min-width: 0; }
.icon { display: inline-flex; flex: none; line-height: 0; }
.icon-spacer { display: inline-block; width: 18px; }
.hint { color: var(--ink-soft); font-size: 0.8125rem; margin: 0.25rem 0 0; }
.lead { color: var(--ink-soft); }

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

/* ---- Buttons & fields -------------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: var(--tap); padding: 0.45rem 1rem;
  border: 1px solid var(--line-strong); border-radius: var(--r);
  background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 600; font-size: 0.875rem; cursor: pointer;
  text-decoration: none; transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.btn:hover { background: var(--mist); }
.btn:active { transform: scale(0.98); }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--pine); border-color: var(--pine); color: var(--on-fill); }
.btn-primary:hover { background: var(--pine-hover); border-color: var(--pine-hover); }
.btn-danger { background: var(--brick); border-color: var(--brick); color: #fff; }
:root[data-theme='dark'] .btn-danger { color: #1a0a08; }
.btn-danger:hover { filter: brightness(1.08); background: var(--brick); }
.btn-quiet { border-color: transparent; background: transparent; color: var(--pine); }
.btn-block { width: 100%; }
.btn-small { min-height: 32px; padding: 0.2rem 0.7rem; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: var(--tap); height: var(--tap); padding: 0;
  border: 1px solid transparent; border-radius: var(--r);
  background: transparent; color: inherit; cursor: pointer; text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.icon-btn:hover { background: var(--mist); }
.icon-btn[disabled] { opacity: 0.35; cursor: not-allowed; }
.icon-btn.accent { color: var(--pine); border-color: var(--line-strong); background: var(--surface); }
.icon-btn.danger-hover:hover { color: var(--brick); }
.icon-btn.ghost { height: 36px; width: 36px; }
.icon-btn.on-band { color: var(--band-ink); }
.icon-btn.on-band:hover { background: rgba(255, 255, 255, 0.14); }

.field { margin-bottom: 1rem; }
.field > label, .field > .label { display: block; font-weight: 600; font-size: 0.875rem; margin-bottom: 0.3rem; }
.field-row { position: relative; display: flex; }
.field-row .input { padding-right: 2.75rem; }
.field-toggle { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); color: var(--ink-soft); }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.input, .select {
  width: 100%; min-height: var(--tap); padding: 0.5rem 0.75rem;
  border: 1px solid var(--line-strong); border-radius: var(--r);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 1rem;
}
.select { appearance: auto; }
.select-compact { width: auto; min-height: 36px; padding: 0.2rem 0.5rem; font-size: 0.875rem; }
.input:focus-visible, .select:focus-visible { outline: 3px solid var(--ochre); outline-offset: 0; border-color: var(--ochre); }
.check { display: flex; align-items: center; gap: 0.6rem; margin: 0.25rem 0 1rem; cursor: pointer; font-size: 0.9rem; }
.check input { width: 1.2rem; height: 1.2rem; accent-color: var(--pine); flex: none; }
.form-error { color: var(--brick); background: var(--brick-soft); border-radius: var(--r); padding: 0.55rem 0.75rem; margin: 0 0 1rem; font-size: 0.875rem; }
.form-info { color: var(--pine); background: var(--leaf-soft); border-radius: var(--r); padding: 0.55rem 0.75rem; margin: 0 0 1rem; font-size: 0.875rem; }
.stack > * + * { margin-top: 0; }
.badge { display: inline-block; padding: 0.1rem 0.55rem; border-radius: 999px; background: var(--mist); color: var(--ink-soft); font-size: 0.75rem; white-space: nowrap; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-soft); }

/* ---- Bars -------------------------------------------------------------------------------- */

.appbar, .ws-top, .auth-bar {
  background: linear-gradient(135deg, var(--band) 0%, var(--band-2) 100%);
  color: var(--band-ink);
  padding-top: env(safe-area-inset-top);
}
.appbar-in { display: flex; align-items: center; gap: 0.5rem; max-width: 72rem; margin: 0 auto; padding: 0.5rem max(1rem, env(safe-area-inset-right)) 0.5rem max(1rem, env(safe-area-inset-left)); }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; font-weight: 700; font-size: 1.05rem; color: var(--pine); text-decoration: none; }
.brand.on-band { color: var(--band-ink); }
.brand-mark { display: inline-flex; line-height: 0; border-radius: 7px; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25); }

/* ---- Auth ------------------------------------------------------------------------------- */

.auth { flex: 1; display: flex; flex-direction: column; background: var(--tint); }
.auth-bar { display: flex; align-items: center; gap: 0.5rem; padding: calc(0.75rem + env(safe-area-inset-top)) 1rem 3.5rem; }
.auth-bar .select { background: rgba(255, 255, 255, 0.95); color: #101f13; border-color: transparent; }
.auth-card { width: calc(100% - 2rem); max-width: 28rem; margin: -2.5rem auto 0; padding: 1.5rem 1.5rem 1.25rem; }
.auth-card .switch { margin: 0.25rem 0 0; text-align: center; font-size: 0.9rem; }
.notice { display: flex; gap: 0.9rem; width: calc(100% - 2rem); max-width: 28rem; margin: 1rem auto 2rem; padding: 1rem 1.25rem; font-size: 0.85rem; color: var(--ink-soft); box-shadow: none; }
.notice .icon { color: var(--ochre-ink); margin-top: 0.1rem; }
.notice strong { color: var(--ink); }
.notice ul { margin: 0.4rem 0 0; }
.notice p { margin: 0.3rem 0 0; }

/* ---- Pages -------------------------------------------------------------------------------- */

.page { width: 100%; max-width: 72rem; margin: 0 auto; padding: 1.5rem max(1rem, env(safe-area-inset-right)) 3rem max(1rem, env(safe-area-inset-left)); flex: 1; }
.page-narrow { max-width: 46rem; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 1rem; margin-bottom: 1.25rem; }
.page-head h1 { margin: 0; }
.page-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.section { padding: 1.25rem 1.25rem 0.75rem; margin-bottom: 1rem; }
.section .btn { margin-bottom: 0.5rem; }
.danger-zone { border-color: var(--brick); }
.danger-zone h2 { color: var(--brick); }
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0.25rem; padding: 2.5rem 1.25rem; color: var(--ink-soft); }
.empty > .icon { color: var(--ochre); margin-bottom: 0.5rem; }
.empty h2 { justify-content: center; }
.privacy-line { display: flex; align-items: center; justify-content: center; gap: 0.35rem; margin-top: 2rem; font-size: 0.78rem; color: var(--ink-soft); text-align: center; }

.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); gap: 1rem; }
.project-card { position: relative; display: flex; align-items: flex-start; border-top: 3px solid var(--ochre); transition: transform 0.15s, box-shadow 0.15s; }
.project-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.project-card.is-archived { border-top-color: var(--line-strong); opacity: 0.8; }
.project-open { flex: 1; min-width: 0; padding: 1rem 0 1rem 1.1rem; color: inherit; text-decoration: none; }
.project-open h3 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-card .icon-btn { margin: 0.5rem 0.4rem 0 0; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; margin: 0.15rem 0; font-size: 0.8125rem; color: var(--ink-soft); }
.archived { margin-top: 1.5rem; }
.archived .project-grid { margin-top: 1rem; }

/* ---- Dialog, menu, toast ------------------------------------------------------------------ */

.overlay { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 1rem; background: var(--scrim); animation: fade 0.15s ease-out; }
.dialog { width: 100%; max-width: 28rem; max-height: calc(100dvh - 2rem); overflow: auto; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-lg); animation: rise 0.2s ease-out; }
.dialog-wide { max-width: 36rem; }
.dialog-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.75rem 0.75rem 0.5rem 1.25rem; background: var(--surface); border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin: 0; }
.dialog-body { padding: 1rem 1.25rem 1.25rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.5rem; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.menu { position: fixed; z-index: 120; min-width: 13rem; max-width: calc(100vw - 16px); padding: 0.3rem; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: var(--shadow-lg); max-height: calc(100dvh - 16px); overflow: auto; }
.menu-item { display: flex; align-items: center; gap: 0.6rem; width: 100%; min-height: var(--tap); padding: 0.4rem 0.7rem; border: 0; border-radius: 6px; background: transparent; color: var(--ink); font: inherit; font-size: 0.9rem; text-align: left; cursor: pointer; }
.menu-item:hover, .menu-item:focus-visible { background: var(--mist); }
.menu-item.danger { color: var(--brick); }
.menu-sep { height: 1px; margin: 0.3rem 0.4rem; background: var(--line); }
.menu-heading { padding: 0.4rem 0.7rem 0.2rem; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); }

.toasts { position: fixed; z-index: 200; left: 50%; bottom: calc(1rem + env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; flex-direction: column; gap: 0.5rem; width: min(30rem, calc(100vw - 2rem)); pointer-events: none; }
.toast { pointer-events: auto; padding: 0.7rem 1rem; border-radius: 8px; background: var(--ink); color: var(--paper); box-shadow: var(--shadow-lg); font-size: 0.875rem; animation: rise 0.2s ease-out; cursor: pointer; }
.toast-error { background: var(--brick); color: #fff; }
:root[data-theme='dark'] .toast-error { color: #1a0a08; }
.toast-success { background: var(--leaf); color: #fff; }
:root[data-theme='dark'] .toast-success { color: #0b1a0e; }
.update-banner { position: fixed; z-index: 150; left: 50%; bottom: calc(1rem + env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 0.6rem 0.5rem 1rem; border-radius: 999px; background: var(--ink); color: var(--paper); box-shadow: var(--shadow-lg); font-size: 0.85rem; }

/* ---- Country picker ----------------------------------------------------------------------- */

.country-list { margin-top: 0.5rem; max-height: 14rem; overflow: auto; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--tint); display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); }
.country { display: flex; align-items: center; gap: 0.5rem; min-height: 38px; padding: 0.2rem 0.6rem; cursor: pointer; font-size: 0.85rem; }
.country:hover { background: var(--mist); }
.country input { width: 1.1rem; height: 1.1rem; accent-color: var(--pine); flex: none; }
.country .flag { font-size: 1.1rem; }
.country .online { color: var(--ink-soft); display: inline-flex; }
.country-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.25rem 1rem; margin-top: 0.4rem; }
.country-foot .hint { margin: 0; display: inline-flex; align-items: center; gap: 0.25rem; }

/* ---- Workspace ---------------------------------------------------------------------------- */

.ws { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; background: var(--paper); }
.ws-top { display: flex; align-items: center; gap: 0.25rem; flex: none; padding-left: max(0.5rem, env(safe-area-inset-left)); padding-right: max(0.5rem, env(safe-area-inset-right)); padding-bottom: 0.25rem; }
.ws-title { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; padding: 0.1rem 0.5rem; border: 0; border-radius: var(--r); background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.ws-title:hover { background: rgba(255, 255, 255, 0.12); }
.ws-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; font-size: 1rem; }
.ws-sub { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.75rem; opacity: 0.8; }
.save-status { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.75rem; opacity: 0.9; white-space: nowrap; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #7ddc92; }
.status-dot.saving { background: #ffcf70; animation: pulse 1s infinite alternate; }
.status-dot.error { background: #ff8a7d; }
@keyframes pulse { from { opacity: 0.35; } to { opacity: 1; } }

.ws-tabs { display: flex; flex: none; gap: 0.25rem; padding: 0.35rem 0.5rem; background: var(--surface); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.ws-tab { flex: 1 1 0; display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; min-height: 38px; padding: 0.2rem 0.6rem; border: 1px solid transparent; border-radius: var(--r); background: transparent; color: var(--ink-soft); font: inherit; font-size: 0.8125rem; font-weight: 600; white-space: nowrap; cursor: pointer; }
.ws-tab:hover { background: var(--mist); }
.ws-tab[aria-selected='true'] { background: var(--leaf-soft); border-color: var(--leaf); color: var(--pine); }
.only-wide { display: none; }

.ws-toolbar { display: flex; flex: none; align-items: center; gap: 0.25rem; padding: 0.25rem 0.5rem; background: var(--surface); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.ws-toolbar::-webkit-scrollbar, .ws-tabs::-webkit-scrollbar { display: none; }
.tb-group { display: flex; align-items: center; gap: 0.15rem; padding-right: 0.4rem; margin-right: 0.15rem; border-right: 1px solid var(--line); }
.tb-group:last-child { border-right: 0; }
.tb-edit, .tb-gantt { display: none; }
.ws[data-mode='tasks'] .tb-edit, .ws[data-mode='split'] .tb-edit { display: flex; }
.ws[data-mode='split'] .tb-gantt, .ws[data-mode='gantt'] .tb-gantt { display: flex; }
.ws[data-mode='network'] .ws-toolbar { display: none; }

.ws-main { --split: 55%; flex: 1; min-height: 0; display: flex; position: relative; }
.pane { display: none; min-width: 0; min-height: 0; overflow: auto; position: relative; background: var(--surface); overscroll-behavior: contain; }
.split-handle { display: none; }
.ws[data-mode='tasks'] .pane-grid, .ws[data-mode='gantt'] .pane-gantt, .ws[data-mode='network'] .pane-network, .ws[data-mode='resources'] .pane-resources { display: block; flex: 1; }
.ws[data-mode='split'] .pane-grid { display: block; flex: 0 0 var(--split); }
.ws[data-mode='split'] .pane-gantt { display: block; flex: 1; }
.ws[data-mode='split'] .split-handle { display: block; flex: none; width: 8px; margin: 0 -2px; z-index: 5; cursor: col-resize; background: var(--line); position: relative; touch-action: none; }
.split-handle::after { content: ''; position: absolute; top: 50%; left: 50%; width: 3px; height: 44px; margin: -22px 0 0 -1.5px; border-radius: 2px; background: var(--ink-soft); opacity: 0.6; }
.split-handle:hover, .split-handle:focus-visible { background: var(--ochre); }

/* Task grid */
.wbs-table { border-collapse: separate; border-spacing: 0; table-layout: fixed; width: 1010px; font-size: 0.8125rem; }
.wbs-table th, .wbs-table td { height: var(--row-h); padding: 0 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; background: var(--surface); }
.wbs-table th { position: sticky; top: 0; z-index: 4; height: var(--head-h); background: var(--mist); color: var(--ink-soft); font-weight: 700; }
.wbs-table th[data-col='wbs'] { width: 56px; }
.wbs-table th[data-col='name'] { width: 250px; }
.wbs-table th[data-col='duration'] { width: 96px; }
.wbs-table th[data-col='predecessors'] { width: 120px; }
.wbs-table th[data-col='start'], .wbs-table th[data-col='finish'] { width: 118px; }
.wbs-table th[data-col='responsible'] { width: 130px; }
.wbs-table th[data-col='resources'] { width: 172px; }
.wbs-table th:nth-child(1), .wbs-table td:nth-child(1) { position: sticky; left: 0; z-index: 3; color: var(--ink-soft); }
.wbs-table th:nth-child(2), .wbs-table td:nth-child(2) { position: sticky; left: 56px; z-index: 3; box-shadow: 1px 0 0 var(--line-strong); }
.wbs-table th:nth-child(1), .wbs-table th:nth-child(2) { z-index: 6; }
.wbs-table tr.summary-row td { font-weight: 700; background: var(--mist); }
.wbs-table tr.selected-row td { background-image: linear-gradient(var(--sel-row), var(--sel-row)); }
.wbs-table td.selected { box-shadow: inset 0 0 0 2px var(--ochre); }
.wbs-table td:nth-child(2).selected { box-shadow: inset 0 0 0 2px var(--ochre), 1px 0 0 var(--line-strong); }
.wbs-table td.muted-cell { color: var(--ink-soft); }
.wbs-table td.critical-cell { color: var(--bar-critical); font-weight: 600; }
.wbs-table td.editing { padding: 0; }
.cell-input { width: 100%; height: 100%; padding: 0 8px; border: 2px solid var(--ochre); border-radius: 0; background: var(--surface); color: var(--ink); font: inherit; font-size: 1rem; outline: none; }
@media (min-width: 900px) { .cell-input { font-size: 0.8125rem; } }
.indent-spacer { display: inline-block; width: 16px; }
.collapse-toggle { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; padding: 0; margin-right: 2px; border: 0; background: transparent; color: var(--ink-soft); font-size: 0.7rem; cursor: pointer; vertical-align: middle; }
.bullet { display: inline-block; width: 24px; text-align: center; color: var(--ink-soft); }
.cell-text { vertical-align: middle; }

/* Gantt */
.pane-gantt { background: var(--surface); }
.gantt-head-wrap { position: sticky; top: 0; z-index: 4; height: var(--head-h); }
.gantt-head, .gantt-body { display: block; }
.g-head-bg { fill: var(--mist); }
.g-head-line { stroke: var(--line-strong); stroke-width: 1; }
.g-head-text { fill: var(--ink-soft); font-size: 10.5px; font-family: var(--font); }
.g-head-text.strong { fill: var(--ink); font-weight: 700; }
.g-grid { stroke: var(--line); stroke-width: 1; }
.g-off { fill: var(--off-bg); }
.g-sel { fill: var(--sel-row); pointer-events: none; }
.g-today { stroke: var(--ochre); stroke-width: 1.5; }
.g-target { stroke: var(--brick); stroke-width: 1.5; stroke-dasharray: 5 4; }
.g-bar { fill: var(--bar); }
.g-bar.critical, .g-milestone.critical { fill: var(--bar-critical); }
.g-milestone { fill: var(--ink); stroke: var(--surface); stroke-width: 2; }
.g-summary { fill: var(--bar-summary); }
.g-link { fill: none; stroke: var(--link); stroke-width: 1.4; }
.g-arrow { fill: var(--link); }
.g-link.critical { stroke: var(--bar-critical); }
.g-arrow.critical { fill: var(--bar-critical); }
.g-label { fill: var(--ink); font-size: 11px; font-family: var(--font); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; pointer-events: none; }

/* Network */
.pane-network { overflow: hidden; background: var(--tint); cursor: grab; touch-action: none; user-select: none; }
.pane-network:active { cursor: grabbing; }
.network-svg { display: block; width: 100%; height: 100%; }
.n-card { fill: var(--surface); stroke: var(--line-strong); stroke-width: 1.5; }
.n-node { cursor: pointer; }
.n-node.critical .n-card { stroke: var(--bar-critical); }
.n-node.selected .n-card { stroke: var(--ochre); stroke-width: 3; }
.n-wbs { fill: var(--ink-soft); font-size: 10px; font-family: var(--font); }
.n-name { fill: var(--ink); font-size: 12px; font-weight: 700; font-family: var(--font); }
.n-dates { fill: var(--ink-soft); font-size: 10px; font-family: var(--font); }
.n-who { fill: var(--pine); font-size: 10px; font-family: var(--font); }
.n-link { fill: none; stroke: var(--link); stroke-width: 1.8; }
.n-link.critical { stroke: var(--bar-critical); }
.n-arrow { fill: var(--link); }
.n-arrow.critical { fill: var(--bar-critical); }
.net-controls { position: absolute; left: max(12px, env(safe-area-inset-left)); bottom: calc(12px + env(safe-area-inset-bottom)); display: flex; gap: 0.35rem; padding: 0.25rem; border-radius: 10px; background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--shadow-soft); }

/* Resources */
.res-wrap { max-width: 44rem; margin: 0 auto; padding: 1rem max(1rem, env(safe-area-inset-right)) 3rem max(1rem, env(safe-area-inset-left)); }
.res-title { color: var(--pine); }
.res-list { list-style: none; margin: 1rem 0 0; padding: 0; }
.res-row { display: flex; align-items: flex-start; gap: 0.6rem; padding: 0.6rem 0; border-bottom: 1px solid var(--line); }
.res-row .badge { margin-top: 0.55rem; }
.res-empty { padding: 1.5rem 0; color: var(--ink-soft); }

/* ---- Wide screens ------------------------------------------------------------------------- */

@media (min-width: 900px) {
  .only-wide { display: inline-flex; }
  .ws-tab { flex: 0 0 auto; padding: 0.2rem 1rem; }
  .ws-tabs { padding: 0.35rem 0.75rem; }
  .ws-toolbar { padding: 0.2rem 0.75rem; }
}

/* ---- Phones ------------------------------------------------------------------------------- */

@media (max-width: 599px) {
  .overlay { align-items: flex-end; padding: 0; }
  .dialog, .dialog-wide { max-width: none; max-height: 92dvh; border-radius: 16px 16px 0 0; padding-bottom: env(safe-area-inset-bottom); animation: sheet 0.22s ease-out; }
  @keyframes sheet { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
  .dialog-actions { position: sticky; bottom: 0; background: var(--surface); padding-top: 0.75rem; }
  .dialog-actions .btn { flex: 1; }
  .field-grid { grid-template-columns: 1fr; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1 1 auto; }
  .page-head h1 { width: 100%; }
  .auth-card { padding: 1.25rem 1.1rem 1rem; }
  .ws-tab span:not(.icon) { font-size: 0.72rem; }
  .ws-tab { flex-direction: column; gap: 0.1rem; min-height: 46px; padding: 0.15rem 0.2rem; }
  .wbs-table th[data-col='wbs'] { width: 50px; }
  .wbs-table th:nth-child(2), .wbs-table td:nth-child(2) { left: 50px; }
  .wbs-table th:nth-child(1), .wbs-table td:nth-child(1) { padding: 0 4px; text-align: center; }
  .wbs-table th[data-col='name'] { width: 170px; }
  .wbs-table { width: 920px; }
  .wbs-table th, .wbs-table td { padding: 0 6px; }
  .toasts { bottom: calc(5rem + env(safe-area-inset-bottom)); }
}

@media print {
  .ws-top, .ws-tabs, .ws-toolbar, .appbar, .toasts { display: none !important; }
}
