:root{
    --clear-gutter: 24px;
    --caret-gutter: 28px;
    --label-gutter: 140px;
    --data-gutter: 0px;

    --rail-gap: 10px;

    --board-pad-top: 18px;
    --board-pad-right: 16px;
    --board-pad-bottom: 20px;

    /* Extra space between board bottom and window bottom (set on a per-page shell if needed) */
    --board-bottom-offset: 0px;

    --header-nudge: 15px;
    --header-nudge-week: 0px;
    --grid-nudge: 15px;

    --tutorial-header-nudge-day: -175px;
    --tutorial-header-nudge-week: -175px;

    /* Sizing */
    --cell-size: 28px;
    --cell-gap: 6px;

    /* Airy Minimal palette */
    --bg-app: #F8FAFC;
    --bg-surface: #FFFFFF;
    --text: #0F172A;
    --muted: #64748B;
    --border: #E5E7EB;
    --accent: #2563EB;
    --accent-soft: #E8F0FF;

    /* Radii & shadow */
    --radius-lg: 12px;
    --radius-md: 8px;
    --radius-sm: 6px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06), 0 0 0 1px rgba(15, 23, 42, 0.03);
    --shadow-focus: 0 0 0 3px var(--accent-soft);
}

*{ box-sizing: border-box; }

html, body{ height: 100%; overflow:hidden }

body{
    margin: 0;
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
    background: var(--bg-app);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ------------------------------------
   Topbar & nav
------------------------------------- */
.topbar{
    width: min(1100px, 92vw);
    margin: 28px auto 0;
    display:flex;
    align-items:center;
    justify-content: space-between;
    gap: 16px;
}

.topbar__left{
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.topbar h2{
    margin:0;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.link-team{
    font-size: 13px;
    text-decoration: none;
    color: var(--accent);
}
.link-gantt{
    font-size: 13px;
    text-decoration: none;
    color: var(--accent);
}
.link-team:hover{ text-decoration: underline; }

/* View toggle (pill) */
.view-toggle{
    display:inline-flex;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 2px;
    background:#fff;
    box-shadow: var(--shadow-sm);
}
.view-toggle button{
    padding: 8px 14px;
    border:0;
    background:transparent;
    cursor:pointer;
    color: var(--muted);
    font-size: 13px;
    border-radius: 999px;
    transition: background-color .15s ease, color .15s ease;
}
.view-toggle button[aria-selected="true"]{
    background: var(--accent-soft);
    color: var(--accent);
}
.view-toggle button:focus-visible{
    outline: none;
    box-shadow: var(--shadow-focus);
}
.toolbar{
    display:flex;
    align-items:center;
    justify-content:space-between;
    margin: 8px;
}
.toolbar-right{
    display:flex;
    align-items:center;
    gap:12px;
}
/* ------------------------------------
   Board container
------------------------------------- */
.board{
    padding: var(--board-pad-top) var(--board-pad-right) var(--board-pad-bottom) 0;
    position: relative;               /* anchor for sticky */
    overflow-x: auto;
    overflow-y: auto;
    scrollbar-gutter: stable;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    max-height: calc(100vh - 80px - var(--board-bottom-offset)); /* viewport fit, with optional bottom offset */
}

.team-shell{ --board-bottom-offset: 100px; }

.team-shell .board::before{
    display: none;
}

/* Fixed action cluster in the board's top-left */


/* "Bold" the active row (day & week) */
.line-row.row-focused .cell,
.line-row.row-focused .weekcell{
    border-width: 2px;
    box-shadow: 0 0 0 2px var(--active-soft, #e6efff) inset;
}
.line-row.row-focused .btn-clear-left{
    opacity: 1;
    pointer-events: auto;
}
/* Team table should grow with added cells */
#teamTable{
    width: max-content;
    min-width: 100%;
    border-collapse: separate;
}
#teamTable .timeline-td{
    width: max-content;
    padding: 0;
    padding-left: 12px;
}
/* Header grids inside the table should also expand freely */
#teamTable .team-header-day .month-row,
#teamTable .team-header-day .day-row,
#teamTable .team-header-week .month-row{
    width: max-content;
}

/* =========================
   Team sticky Name/Hours columns
   ========================= */

:root{
    --team-name-col-w: 220px;
    --team-hours-col-w: 96px;
}

/* keep table in its current expandable model */
#teamTable{
    border-collapse: separate;
    border-spacing: 0;
}

/* base cell styling for the two fixed columns */
#teamTable th.team-col-name,
#teamTable td.team-col-name,
#teamTable th.team-col-hours,
#teamTable td.team-col-hours{
    position: sticky;
    background: #fff;
    white-space: nowrap;
}

/* column widths */
#teamTable th.team-col-name,
#teamTable td.team-col-name{
    min-width: var(--team-name-col-w);
    width: var(--team-name-col-w);
    max-width: var(--team-name-col-w);
    left: 0;
    z-index: 30;
    text-align: left;
    padding: 10px 12px;
}

#teamTable th.team-col-hours,
#teamTable td.team-col-hours{
    min-width: var(--team-hours-col-w);
    width: var(--team-hours-col-w);
    max-width: var(--team-hours-col-w);
    left: var(--team-name-col-w);
    z-index: 31;
    text-align: left;
    padding: 10px 12px;
}

/* header cells should sit above body cells */
#teamTable thead th.team-col-name,
#teamTable thead th.team-col-hours{
    position: sticky;
    top: 0;
    z-index: 60;
    background: #fff;
}

/* extend white cover downward */
#teamTable thead th.team-col-name::after,
#teamTable thead th.team-col-hours::after{
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -50px;   /* adjust if needed */
    height: 50px;
    background: #fff;
    pointer-events: none;
}

/* because your header row itself is sticky in the board,
   make sure the sticky left columns stay opaque and layered */
#teamTable thead .team-header-day th.team-col-name,
#teamTable thead .team-header-day th.team-col-hours,
#teamTable thead .team-header-week th.team-col-name,
#teamTable thead .team-header-week th.team-col-hours{
    background: #fff;
}

/* subtle divider between fixed columns and scrolling timeline */
#teamTable th.team-col-hours,
#teamTable td.team-col-hours{
    box-shadow:
            1px 0 0 var(--border),
            10px 0 12px -12px rgba(15, 23, 42, 0.18);
}

/* keep timeline content visually underneath the sticky columns */
#teamTable .timeline-td{
    position: relative;
    z-index: 1;
}

/* optional: nicer truncation for long names */
#teamTable td.team-col-name{
    overflow: hidden;
    text-overflow: ellipsis;
}
/* ------------------------------------
   Headers (dates)
------------------------------------- */
.header{
    margin-bottom: 10px;
    user-select: none;
}

.header-row{
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    z-index: 10;
}
.header-spacer{
    /* Spacer equals both gutters so headers align with cells */
    flex: 0 0 calc(var(--caret-gutter) + var(--label-gutter) + var(--rail-gap) + var(--grid-nudge));
    margin-right: var(--rail-gap);
    position: sticky;
    left: 0;
    z-index: 5;
    background: #fff;
    pointer-events: none;
}

/* Header label boxes */
.header .label-day,
.header .label-week{
    width: var(--cell-size);
    height: var(--cell-size);
    display: grid;
    place-items: center;   /* centers the number */
    font-size: 12px;
    color: var(--muted);
    border-radius: var(--radius-sm);
    border: 0;             /* prevents 1px oversize vs. cells */
}

/* Day header = stacked month band + day numbers */
.header-day{ display:block; }
.header-day .month-row,
.team-header-day .month-row{
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: var(--cell-size);
    gap: var(--cell-gap);
    width: max-content;
    margin-bottom: 0px;
    margin-left: var(--header-nudge);
}
.header-day .day-row,
.header-week{
    /* Keep header tracks identical to .line-day */
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: var(--cell-size);
    gap: var(--cell-gap);
    width: 0;
    margin-left: var(--header-nudge);
}

.header-week .month-row,
.team-header-week .month-row{
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: var(--cell-size);
    gap: var(--cell-gap);
    width: max-content;
    margin-left: var(--header-nudge);
    margin-bottom: 4px; /* optional, to match day view spacing */
}

/* Add extra offset only for week header */
.header-week{
    margin-left: calc(var(--header-nudge) + var(--header-nudge-week)) !important;
}

/* Prevent double-nudging if .header-week .month-row already has a margin-left */
.header-week .month-row{
    margin-left: 0 !important;
}

/* Month band */
.month-seg{
    display:grid;
    place-items:center;
    height: calc(var(--cell-size) - 6px);
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    background: #F1F5FF;
    border: 1px solid #DCE6FF;
    border-radius: var(--radius-sm);
    background-image: linear-gradient(to bottom, rgba(37,99,235,0.08), rgba(37,99,235,0.02));
}
.header-day .day-row .label-day{ font-variant-numeric: tabular-nums; }

.team-header-day .day-row{
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: var(--cell-size);
    gap: var(--cell-gap);
    width: max-content;
    margin-left: 0; /* IMPORTANT: no header nudge inside the table */
}

/* Month band already uses .team-header-day .month-row in style.css; cancel the nudge */
.team-header-day .month-row{ margin-left: 0; }

/* Visual for the little day boxes */
.team-header-day .label-day{
    width: var(--cell-size);
    height: var(--cell-size);
    display: grid;
    place-items: center;
    font-size: 12px;
    color: var(--muted);
    border-radius: var(--radius-sm);
    border: 0;
}
/* ------------------------------------
   Row groups & lines
------------------------------------- */
.row-group{ width: max-content; overflow:visible; }

.group-header{
    position: sticky;
    left: calc(var(--caret-gutter));
    z-index: 5;
    background: #fff;
    display: inline-block;
    padding: 0 4px;
    font-weight: 600;
    font-size: 18px;
    color: var(--muted);
}

.hub-group-header{
    position: sticky;
    left: calc(var(--caret-gutter));
    z-index: 5;
    background: #fff;
    display: inline-block;
    padding: 0 4px;
    font-weight: 600;
    font-size: 18px;
    color: var(--muted);
}

/* one timeline row:
   Col 1 = sticky rail (clear, caret, label, data)
   Col 2 = scrolling timeline track (day/week cells) */
.line-row{
    display: grid;
    grid-template-columns:
        max-content
        max-content;
    align-items: center;
    margin: 8px 0;
    gap: 0;
    min-height: var(--cell-size);
}

/* Sticky left rail holding all controls */
.line-rail{
    position: sticky;
    left: 0;
    z-index: 6;
    background: #fff;
    display: grid;
    grid-template-columns:
        var(--caret-gutter)
        var(--label-gutter);
    column-gap: var(--rail-gap);
    padding-right: calc(var(--rail-gap) + var(--grid-nudge));
    box-shadow: 0 10px 0 #fff;
}
.line-rail::before{
    content: "";
    position: absolute;
    top: -6px;       /* extend upward */
    left: 0;
    right: 0;
    height: 6px;     /* just the paint thickness */
    background: #fff;
    pointer-events: none;
}
.line-row .line-rail{ grid-column: 1 / 2; }
.line-row .line{ grid-column: 2 / 3; justify-self: start; margin-left :var(--grid-nudge) }

/* Individual rail items are no longer sticky themselves */
.btn-clear-left,
.tier-caret,
.line-label{
    width: 100%;
    min-width: 0;
    justify-self: stretch;
}

/* Clear button in rail col 1 */
.btn-clear-left{
    justify-self: center;
    background: #fff;
    border: 1px solid #d3d7df;
    border-radius: 6px;
    width: 22px;
    height: 22px;
    line-height: 20px;
    text-align: center;
    font-weight: 600;
    opacity: 0;
    pointer-events: none;
    transition: opacity 120ms ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    z-index: 4;
}
.line-row:hover .btn-clear-left{
    opacity: 1;
    pointer-events: auto;
}

/* Caret in rail col 2 */
.tier-caret{
    justify-self: center;
    align-self: center;
    z-index: 4;
    width: 22px;
    height: 22px;
    place-items: center;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--muted);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    font-size: 22px;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.tier-caret:hover{ background:#F3F6FB; color: var(--text); }

/* Expanded (not collapsed): slightly larger down-caret */
.tier-caret[aria-expanded="true"]{
    font-size: 22px;
}

/* Collapsed: right-caret + stronger outline */
.tier-caret[aria-expanded="false"]{
    font-size: 22px;
    color: var(--text);
    border-color: #9aa6b2;
    box-shadow: inset 0 0 0 1px #9aa6b2;
}
.tier-caret.is-hidden{ visibility: hidden; pointer-events: none; }

/* Label button inside the sticky rail */
.line-label{
    display: flex;
    align-items: center;
    min-width: var(--label-gutter);
    height: var(--cell-size);
    line-height: var(--cell-size);
    text-align: left;
    justify-content: flex-start;
    border-left: 4px solid var(--tier-color);
    padding: 0 6px;
    width: 100%;
}

.hub-line-label{
    grid-column: 2;
    grid-row: 3 / -1;
    display: flex;
    align-self: center;
    min-width: var(--label-gutter);
    height: var(--cell-size);
    line-height: var(--cell-size);
    text-align: left;
    justify-content: flex-start;
    border-left: 4px solid var(--tier-color);
    padding: 0 6px;
    width: 100%;
}

.line-label[contenteditable="true"]{ outline: none; }
.line-label:focus-visible{ box-shadow: var(--shadow-focus); }

/* Legacy data panel: hidden now that row details live in the modal */
.line-data{
    display:none !important;
}

/* The grid containers go in the right column and shrink-wrap */
.line-row .line{ justify-self: start; }

/* ------------------------------------
   Day/Week cells
------------------------------------- */
.line-day{
    display:grid;
    grid-auto-flow: column;
    grid-auto-columns: var(--cell-size);
    gap: var(--cell-gap);
    align-items: center;
}
.line-week{
    display:grid;
    grid-auto-flow: column;
    grid-auto-columns: var(--cell-size);
    gap: var(--cell-gap);
    align-items: center;
    justify-content: start;
    width: max-content;
}

/* Base box styles shared */
.cell,
.weekcell{
    width: var(--cell-size);
    height: var(--cell-size);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background:#fff;
    cursor: crosshair;
    transition: box-shadow .12s ease, background-color .12s ease, border-color .12s ease, transform .06s ease;
}
.cell:hover{ box-shadow: inset 0 0 0 3px var(--accent-soft); }
.weekcell:hover{ box-shadow: inset 0 0 0 3px var(--accent-soft); }

/* Active state shared (leaf overrides later) */
.cell.active,
.weekcell.active{
    background: var(--accent);
    border-color: #1E4FD3;
    box-shadow: 0 0 0 2px #1E4FD3, 0 0 0 4px var(--accent-soft);
}

.cell.hidden{ display:none !important; }

/* ------------------------------------
   Utilities
------------------------------------- */
.hidden{ display:none !important; }



/* =========================================================
   Tier color-coding
========================================================= */

/* Highlight leaf tiers with orange fill */
.line-row.leaf-tier .cell.active,
.line-row.leaf-tier .weekcell.active{
    background: orange;
    border-color: #cc6600;
    box-shadow: 0 0 0 2px #cc6600, 0 0 0 4px var(--accent-soft);
}

/* ===== Span popup ===== */






/* Generic small buttons used in the popup */

/* =========================================================
   Section vs Task row coloring (palette-aligned)
   - Section rows: palette blue (uses --accent / --accent-soft)
   - Task rows (leaf tiers): orange (explicit), unchanged
   These overrides live late in the cascade to win specificity.
========================================================= */

.line-row.section-row { --tier-color: var(--accent); }

/* Section spans = blue */
.line-row.section-row .cell.active,
.line-row.section-row .weekcell.active{
    background: var(--accent);
    border-color: #1E4FD3;                 /* matches existing blue border tone */
    box-shadow: 0 0 0 2px #1E4FD3, 0 0 0 4px var(--accent-soft);
}

/* Keep task (leaf) spans = orange (already defined earlier, but reinforce here) */
.line-row.leaf-tier { --tier-color: #cc6600; }
.line-row.leaf-tier .cell.active,
.line-row.leaf-tier .weekcell.active{
    background: orange;
    border-color: #cc6600;
    box-shadow: 0 0 0 2px #cc6600, 0 0 0 4px var(--accent-soft);
}

/* Label border (left stripe) follows the tier color */
.line-row.section-row .line-label{ border-left-color: var(--accent); }
.line-row.leaf-tier    .line-label{ border-left-color: #cc6600; }


/* =========================================================
   Corrected Section vs Task row coloring (scoped, high specificity)
========================================================= */
:root {
    --section-blue: var(--accent);
    --section-blue-border: #1E4FD3;
    --task-orange: #ff9900;
    --task-orange-border: #cc6600;
}

/* Force section rows to palette blue */
.line-row.section-row .cell.active,
.line-row.section-row .weekcell.active {
    background: var(--section-blue) !important;
    border-color: var(--section-blue-border) !important;
    box-shadow: 0 0 0 2px var(--section-blue-border),
    0 0 0 4px var(--accent-soft) !important;
}

/* Force task rows to orange */
.line-row.task-row .cell.active,
.line-row.task-row .weekcell.active {
    background: var(--task-orange) !important;
    border-color: var(--task-orange-border) !important;
    box-shadow: 0 0 0 2px var(--task-orange-border),
    0 0 0 4px var(--accent-soft) !important;
}

/* Label border (left stripe) */
.line-row.section-row .line-label { border-left-color: var(--section-blue) !important; }
.line-row.task-row    .line-label { border-left-color: var(--task-orange) !important; }

/* Hub-right: remove caret & clear button but keep rail layout */
.hub-right-table .btn-clear-left,
.hub-right-table .tier-caret {
    visibility: hidden;     /* hide but preserve column width */
    pointer-events: none;   /* make them inert */
}

/* Optional: override hover fade-in on right side */
.hub-right-table .line-row:hover .btn-clear-left {
    opacity: 0 !important;
}

/* =========================================================
   Hub-right should visually match scheduler header/toggle
========================================================= */

#board-right #hubRightViewToggle{
    display: inline-flex;
}

#board-right .hub-right-topbar .toolbar{
    margin: 0;
    min-height: 36px;
}

#board-right .hub-right-topbar{
    padding: 8px 0 10px 0;
    background: #fff;
    border-bottom: 1px solid var(--border);
}

#board-right .hub-right-header-row{
    display: flex;
    align-items: flex-start;
    margin-bottom: 10px;
    z-index: 20;
    background: #fff;
}

/* Use the scheduler spacer instead of margin-left hacks */
#board-right .hub-right-header .month-row,
#board-right .hub-right-header .day-row{
    margin-left: 0 !important;
}

/* Keep header tracks identical to scheduler */
#board-right .hub-right-header-day{
    display: block;
}

#board-right .hub-right-header-week{
    display: block;
}

#board-right .hub-right-header-day .month-row{
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: var(--cell-size);
    gap: var(--cell-gap);
    width: max-content;
    margin-bottom: 4px;
}

#board-right .hub-right-header-day .day-row{
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: var(--cell-size);
    gap: var(--cell-gap);
    width: max-content;
}

#board-right .hub-right-header-week .month-row{
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: var(--cell-size);
    gap: var(--cell-gap);
    width: max-content;
    margin-bottom: 4px;
}

/* Week labels should match the same small boxed look */
#board-right .hub-right-header .label-day{
    width: var(--cell-size);
    height: var(--cell-size);
    display: grid;
    place-items: center;
    font-size: 12px;
    color: var(--muted);
    border-radius: var(--radius-sm);
    border: 0;
    white-space: nowrap;
}

#board-right .hub-right-header-week .label-week{
    flex: 0 0 var(--cell-size);
}

/* Keep the right board's sticky chrome consistent with the main board */
#board-right > .board-sticky{
    position: sticky;
    top: 0;
    z-index: 1000;
    background: #fff;
    left: 0;
    right: 0;
    width: 100%;
}

#board-right > .board-sticky::before{
    content: "";
    position: absolute;
    left: 0;
    right: -600px;
    top: calc(-1 * var(--board-pad-top));
    height: var(--board-pad-top);
    background: #fff;
    z-index: -1;
    pointer-events: none;
}

#board-right > .board-sticky::after{
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: -600px;
    background: #fff;
    z-index: -1;
    pointer-events: none;
}

#board-right .board-topbar::before{
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: -600px;
    background: #fff;
    z-index: -1;
    pointer-events: none;
}

#board-right .board-topbar::after{
    content: "";
    position: absolute;
    left: 0;
    right: -600px;
    bottom: -1px;
    height: 1px;
    background: var(--border);
    pointer-events: none;
}

#board-right .hub-right-header-row::before{
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: -600px;
    background: #fff;
    z-index: -1;
    pointer-events: none;
}

/* Make week rows feel like scheduler, not cramped */
#board-right .line-week{
    justify-content: start;
    width: max-content;
}

/* Right-side row groups should sit under the sticky header cleanly */
#board-right .hub-right-table{
    width: max-content;
    min-width: 100%;
}

/* ===== Right-board header gutter (align with sticky rail) ===== */
.hub-right-header {
    position: relative;
}

/* Push month + day rows past the left rail (clear + caret + label + data + gap) */
.hub-right-header .month-row,
.hub-right-header .day-row {
    margin-left: calc(
            var(--caret-gutter)
            + var(--label-gutter)
            + (2 * var(--rail-gap))
    );
}

/* Keep right-side header aligned exactly with the grid */
.hub-right-header .month-row,
.hub-right-header .day-row{
    padding-left: 0;
}

/* -----------------------------
   Issue rows (purple)
------------------------------ */

:root{
    --issue-purple: #7C3AED;         /* vivid but readable */
    --issue-purple-border: #5B21B6;  /* deeper edge */
}

/* Issue spans = purple */
.line-row.issue-row .cell.active,
.line-row.issue-row .weekcell.active{
    background: var(--issue-purple) !important;
    border-color: var(--issue-purple-border) !important;
    box-shadow: 0 0 0 2px var(--issue-purple-border),
    0 0 0 4px var(--accent-soft) !important;
}

/* Label stripe for issues */
.line-row.issue-row .line-label{
    border-left-color: var(--issue-purple) !important;
}

/* Issues are not directly editable */
.line-row.issue-row .cell,
.line-row.issue-row .weekcell{
    cursor: default;
}

.line-row.issue-row.issue-completion-pending .line-label{
    color: #dc2626 !important;
    font-weight: 700 !important;
}
.modal-backdrop{
    position: fixed; inset: 0;
    background: rgba(0,0,0,.25);
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
    z-index: 9999;
}
.modal-backdrop.hidden{ display:none; }

.modal{
    width: min(520px, 100%);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
    padding: 14px;
}

.modal-header{
    display:flex; align-items:center; justify-content: space-between;
    gap: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}
.modal-close{
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 10px;
    padding: 6px 10px;
    cursor: pointer;
}
.modal-body{ padding: 12px 0; display:grid; gap: 10px; }
.modal-label{ display:grid; gap: 6px; color: var(--text); font-size: 14px; }
.modal-label input{
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 14px;
}
.modal-actions{
    display:flex; align-items:center; gap: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}
.modal-actions .spacer{ flex: 1; }
.btn{
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 10px;
    padding: 8px 12px;
    cursor: pointer;
}
.btn-primary{ background: #F3F6FB; }
.btn-danger{ background: #fff; border-color: #f2b8b8; }
/* Hub left list should NEVER render as a box */
.hub-left-list {
    background: transparent !important;
    border-right: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    min-height: 0 !important;
}
/* Task list in the hub card */
.hub-task-li { font-size: 13px; }

/* Task text */
.hub-task-line { display:block; }

/* Issue line under a task:
   - italic
   - no bullet (it isn't a <li>)
   - aligns with task text because it's inside the task <li> */
.hub-issue-line{
    display:block;
    font-style: italic;
    margin-top: 2px;
    color: var(--muted, #666);
}
.line-label{
    border-left: none !important;
    padding-left: 6px;   /* was implicitly larger due to stripe */
}
/* Put + and N on the line; keep the rest compact */
.data-panel {
    padding: 0;            /* remove “popup” feel */
    border: 0;
    box-shadow: none;
    background: transparent;
}

.data-header {
    display: flex;
    gap: 6px;
    align-items: center;
}
/* 1) Sticky control bar (buttons + toggle) */
.board-topbar{
    position: sticky;
    top: 0;
    z-index: 30;
    background: #fff;         /* important so it covers rows underneath */
    border-bottom: 1px solid var(--border);
}

/* 2) Sticky date header (months/days) sits under the control bar */
.header-row{
    position: sticky;
    top: 44px;                /* adjust to your control bar height */
    z-index: 20;
    background: #fff;
}
.project-filter-menu{
    position: fixed;   /* was absolute */
    z-index: 999999;
}


/* ============================================================================
   Events
============================================================================ */
.line-row.section-row .cell.event{
    background: #2fbf71 !important; /* green that plays well with blue/orange/purple */
    color: #0b1a12;
}
.line-row.section-row .cell.event .event-label{
    font-size: 11px;
    line-height: 1;
    padding: 2px 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}

/* Modal */
.event-modal-backdrop{
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
.event-modal-backdrop.hidden{ display:none; }

.event-modal{
    background: #151a1f;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 12px;
    padding: 14px;
    width: 340px;
    box-shadow: 0 18px 50px rgba(0,0,0,0.5);
}
.event-modal-title{
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
}
.event-modal-input{
    width: 100%;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.14);
    background: rgba(255,255,255,0.06);
    color: inherit;
    padding: 10px 10px;
    outline: none;
    margin-bottom: 12px;
}
.event-modal-input.event-modal-input-error{
    border-color: rgba(255, 90, 90, 0.9);
}
.event-modal-buttons{
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}
.event-modal-btn{
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.14);
    background: rgba(255,255,255,0.06);
    color: inherit;
    padding: 8px 10px;
    cursor: pointer;
}
.event-modal-btn:hover{ background: rgba(255,255,255,0.10); }
.event-modal-btn:disabled,
.event-modal-btn.disabled{
    opacity: 0.5;
    cursor: default;
}
.event-modal-delete{
    background: rgba(255,80,80,0.12);
    border-color: rgba(255,80,80,0.25);
}
.event-modal-ok{
    background: rgba(80,190,120,0.14);
    border-color: rgba(80,190,120,0.25);
}

/* === LOCK TOPBAR + HEADER ROW TOGETHER === */
.board-sticky {
    position: sticky;
    top: 0;
    z-index: 100;

    /* Opaque sheet that spans the full visible board area */
    background: #fff;
    width: 100%;
    left: 0;
    right: 0;
}

/* Children shouldn't be sticky themselves; also force full-width background */
.board-topbar,
.header-row {
    position: relative;
    top: 0;
    width: max-content;
    background: #fff;
}

/* === V12: TOPBAR FIXED, HEADER-ROW SCROLLS HORIZONTALLY ===
   - .board-sticky holds ONLY the topbar and stays fixed horizontally (full width).
   - .header-row stays in the scroll content so it can move left/right with the grid.
*/
.board > .board-sticky{
    position: sticky;
    top: 0;
    z-index: 1000;
    background: #fff;

    /* fixed horizontally within the board viewport */
    left: 0;
    right: 0;
    width: 100%;
}

/* Keep the gap filled (white) above the topbar — EXTENDED to the right */
.board > .board-sticky::before{
    content: "";
    position: absolute;
    left: 0;
    right: -600px;                 /* <- same trick as .board-sticky::after */
    top: calc(-1 * var(--board-pad-top));
    height: var(--board-pad-top);
    background: #fff;
    z-index: -1;                    /* keep it behind the sticky content */
    pointer-events: none;
}


/* Header row sticks under the topbar, but remains horizontally scrollable with the board */
.header-row{
    position: sticky !important;
    top: var(--topbar-h, 44px) !important;
    z-index: 900 !important;
    background: #fff !important;
}

/* Ensure the topbar itself is opaque */
.board-topbar{
    background: #fff !important;
}

/* === V15: BACKGROUND SHEET TO COVER RIGHT-SIDE SEE-THROUGH ===
   This paints a solid white sheet behind:
   - the top padding gap
   - the fixed topbar
   - the sticky header-row
   It is pinned both vertically and horizontally (top + left) so it never slides away on horizontal scroll.
*/
.board > .board-chrome-bg{
    position: sticky;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 850;          /* behind header-row (900) and topbar (1000) */
    background: #fff;
    pointer-events: none;
    display: block;
}



/* === PATCH: extend sticky header backgrounds & lines to the right edge === */
/* These pseudo-elements paint beyond the element's own width without changing layout/scrollWidth. */

.board-sticky,
.board-topbar,
.header-row{
    position: relative; /* anchor pseudos */
}

/* Full-width white sheet behind the sticky cluster */
.board-sticky::after{
    content:"";
    position:absolute;
    top:0;
    bottom:0;
    left:0;
    right:-600px; /* paint far to the right so there is never a viewport gap */
    background:#fff;
    z-index:-1;
    pointer-events:none;
}

/* Topbar background extension */
.board-topbar::before{
    content:"";
    position:absolute;
    top:0;
    bottom:0;
    left:0;
    right:-600px;
    background:#fff;
    z-index:-1;
    pointer-events:none;
}

/* The 1px line that appears above the month row (usually topbar's bottom border) */
.board-topbar::after{
    content:"";
    position:absolute;
    left:0;
    right:-600px;
    bottom:-1px; /* align with border-bottom */
    height:1px;
    background: var(--border);
    pointer-events:none;
}

/* Header row background extension (covers month-row area too) */
.header-row::before{
    content:"";
    position:absolute;
    top:0;
    bottom:0;
    left:0;
    background:#fff;
    z-index:-1;
    pointer-events:none;
}

/* Day-row white background should continue as you scroll right (keep this even if already present) */
#teamTable .team-header-day .day-row,
#teamTable .team-header-day .month-row,
#teamTable .team-header-week .month-row,
.header-day .day-row,
.header-day .month-row,
.header-week .month-row{
    background: #fff;
}

/* Ensure header tracks don't clip the painted extension */
.board-topbar,
.header-row{
    overflow: visible;
}

.topbar__left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar__left .btn {
    text-decoration: none;
}

/* Remove link styling inside the topbar buttons */
.topbar__left a.btn,
.topbar__left a.btn:visited,
.topbar__left a.btn:hover,
.topbar__left a.btn:active {
    text-decoration: none;
    color: inherit;
}

/* Ensure visited links don't turn purple */
.topbar__left a.btn:visited {
    color: inherit;
}
.topbar__left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar__left .btn {
    text-decoration: none;
}

/* Remove link styling inside the topbar buttons */
.topbar__left a.btn,
.topbar__left a.btn:visited,
.topbar__left a.btn:hover,
.topbar__left a.btn:active {
    text-decoration: none;
    color: inherit;
}

/* Ensure visited links don't turn purple */
.topbar__left a.btn:visited {
    color: inherit;
}

/* === Scheduler startup width fix: prevent decorative sticky pseudos from inflating scrollWidth === */

/* Stop the fake 4000px background runways */
.board > .board-sticky::before,
.board-sticky::after,
.board-topbar::before,
.board-topbar::after,
.header-row::before {
}

/* Clip decorative overflow on the chrome rows only */
.board-topbar,
.header-row {
    overflow: visible !important;
}

/* Do NOT clip the main sticky wrapper; it contains real scrollable content */
.board > .board-sticky {
    overflow: visible !important;
}

/* Tutorial-only right header nudges */
#board-right.tutorial-hub-right-board .tutorial-hub-right-header-day .month-row,
#board-right.tutorial-hub-right-board .tutorial-hub-right-header-day .day-row{
    margin-left: calc(
            var(--caret-gutter)
            + var(--label-gutter)
            + (2 * var(--rail-gap))
            + var(--tutorial-header-nudge-day)
    ) !important;
}

#board-right.tutorial-hub-right-board .tutorial-hub-right-header-week{
    margin-left: calc(
            var(--caret-gutter)
            + var(--label-gutter)
            + (2 * var(--rail-gap))
            + var(--tutorial-header-nudge-week)
    ) !important;
}

#board-right.tutorial-hub-right-board .tutorial-hub-right-header-week .month-row{
    margin-left: 0 !important;
}

body.tutorial-scheduler-page{
    height: 100vh;
    min-height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

body.tutorial-scheduler-page app-topbar,
body.tutorial-scheduler-page .tutorial-view-toggle-shell{
    flex: 0 0 auto;
}

.tutorial-view-toggle-shell{
    display: flex;
    justify-content: center;
    padding: 8px 16px 0;
}

body.tutorial-scheduler-page #board.board{
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    height: auto;
    margin: 8px 16px 0;
}