:root {
    --navy: #112438;
    --blue: #1784c7;
    --cyan: #36b7d8;
    --orange: #f28c28;
    --surface: #f4f7f9;
    --line: #d6e1e8;
    --text: #1d2c38;
    --muted: #607582;
    --critical: #cf3f45;
    --success: #247654;
    --danger: #ad3037;
    --sidebar-width: 248px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: light; }
body { margin: 0; min-width: 320px; font: 14px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--text); background: var(--surface); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .58; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible { outline: 3px solid color-mix(in srgb, var(--cyan) 65%, white); outline-offset: 2px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-width); background: var(--navy); color: #dce8ef; overflow: auto; z-index: 10; }
.brand { height: 68px; display: flex; align-items: center; gap: 11px; padding: 0 20px; border-bottom: 1px solid #ffffff18; font-size: 19px; }
.brand > span, .brand-mark { background: linear-gradient(135deg, var(--cyan), var(--blue)); color: #fff; padding: 8px 7px; border-radius: 4px; font-weight: 800; }
.brand strong { letter-spacing: .2px; }
nav { padding: 12px 9px 30px; }
.nav-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 38px; text-align: left; color: #c7d6df; border: 0; background: transparent; border-radius: 5px; padding: 8px 12px; }
.nav-item:hover:not(:disabled), .nav-item.active { background: #ffffff12; color: #fff; }
.nav-item.active { box-shadow: inset 3px 0 var(--cyan); }
.nav-item small { flex: 0 0 auto; color: #91a6b3; font-size: 9px; text-transform: uppercase; letter-spacing: .35px; }
.nav-item.coming-soon { opacity: .62; cursor: not-allowed; }

.shell { margin-left: var(--sidebar-width); min-width: 0; }
.topbar { min-height: 68px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px; padding: 10px 24px; position: sticky; top: 0; z-index: 8; }
.topbar select { font-weight: 650; width: min(285px, 24vw); border: 1px solid transparent; background: transparent; padding: 7px 5px; }
.topbar #search { margin-left: auto; width: min(240px, 22vw); border: 1px solid var(--line); border-radius: 5px; padding: 8px 11px; }
.topbar .status { padding: 4px 9px; background: #e8f5ef; color: var(--success); border-radius: 999px; font-size: 12px; white-space: nowrap; }
.topbar .status[data-status="on-hold"] { background: #fff3df; color: #8a5b0e; }
.topbar .status[data-status="complete"], .topbar .status[data-status="archived"] { background: #edf0f2; color: #53636d; }
.topbar .user, #dataDate { white-space: nowrap; color: var(--muted); }
.schedule-dirty { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 8px; border: 1px solid #edc987; border-radius: 999px; background: #fff7e8; color: #805508; white-space: nowrap; font-size: 11px; font-weight: 750; }
.schedule-dirty button { padding: 3px 7px; border-radius: 999px; background: #9a6400; font-size: 10px; }
.logout-form { margin: 0; }

section { padding: 28px; }
.page-title { display: flex; justify-content: space-between; align-items: end; gap: 18px; margin-bottom: 22px; }
.page-title h1 { margin: 2px 0; font-size: 27px; }
.eyebrow { margin: 0; color: var(--blue); font-size: 11px; font-weight: 800; letter-spacing: 1.4px; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
button, .button { border: 0; background: var(--blue); color: #fff; border-radius: 5px; padding: 9px 13px; font-weight: 700; }
.secondary { background: #fff; color: var(--blue); border: 1px solid var(--line); }
.danger { background: #fff; color: var(--danger); border: 1px solid #e8bcbc; }
.ghost { border: 0; background: transparent; color: var(--muted); padding-inline: 5px; }
.compact { padding: 7px 10px; white-space: nowrap; }
.danger-text { color: var(--danger); }
.text-action { border: 0; background: transparent; color: var(--blue); padding: 4px 5px; font-weight: 700; }
.icon-row { border: 0; background: transparent; padding: 4px 6px; font-size: 17px; }

.empty-project { background: #fff; border: 1px dashed #aac1cf; border-radius: 9px; padding: 55px 25px; text-align: center; }
.empty-project h2 { margin-top: 0; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(140px, 1fr)); gap: 14px; margin-bottom: 18px; }
.metrics article, .panel { background: #fff; border: 1px solid var(--line); border-radius: 7px; box-shadow: 0 2px 7px #17354b0a; }
.metrics article { padding: 17px; border-top: 3px solid var(--blue); }
.metrics article > span { display: block; color: var(--muted); font-size: 12px; text-transform: uppercase; }
.metrics strong { font-size: 26px; display: block; margin-top: 8px; }
.milestone-dashboard-summary { display: flex; align-items: center; gap: 10px 18px; width: 100%; margin: -4px 0 18px; border: 1px solid var(--line); border-left: 3px solid var(--orange); border-radius: 6px; padding: 9px 13px; background: #fff; color: var(--text); text-align: left; box-shadow: 0 2px 7px #17354b0a; }
.milestone-dashboard-summary:hover { border-color: #aac8d9; background: #f9fcfd; }
.milestone-dashboard-summary > strong { color: var(--blue); font-size: 12px; text-transform: uppercase; }
.milestone-dashboard-summary span { color: var(--muted); font-size: 11px; white-space: nowrap; }
.milestone-dashboard-summary span b { color: var(--text); font-size: 13px; }
.milestone-dashboard-summary em { margin-left: auto; color: var(--blue); font-size: 11px; font-style: normal; white-space: nowrap; }
.panel { margin-bottom: 18px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.panel h2 { margin: 0; font-size: 16px; }
.panel p { margin: 4px 0 0; color: var(--muted); }
.zoom { display: flex; }
.zoom button, #pagination button { border: 1px solid var(--line); background: #fff; color: var(--text); padding: 6px 10px; border-radius: 0; }
.zoom button:first-child, #pagination button:first-child { border-radius: 4px 0 0 4px; }
.zoom button:last-child, #pagination button:last-child { border-radius: 0 4px 4px 0; }
.zoom .selected { color: var(--blue); background: #eaf5fb; }
.gantt-legend { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 7px 12px; margin-top: 7px; color: var(--muted); font-size: 10px; }
.gantt-legend span::before { content: ''; display: inline-block; width: 15px; height: 6px; margin-right: 5px; border-radius: 2px; vertical-align: 1px; }
.gantt-legend .actual::before { background: #36a982; }
.gantt-legend .remaining::before { background: var(--blue); }
.gantt-legend .dependency::before { height: 0; border-top: 2px solid #5c7080; border-radius: 0; }
.gantt-legend small { min-width: 120px; text-align: right; }
.activity-controls { display: flex; align-items: end; flex-wrap: wrap; gap: 8px 12px; padding: 10px 18px; border-bottom: 1px solid var(--line); background: #fbfcfd; }
.activity-controls > strong { align-self: center; color: var(--muted); font-size: 10px; text-transform: uppercase; }
.activity-controls label { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.activity-controls select { display: block; min-width: 125px; max-width: 230px; margin-top: 3px; border: 1px solid var(--line); border-radius: 4px; padding: 6px 8px; background: #fff; color: var(--text); }
.activity-controls > span { align-self: center; margin-left: auto; color: var(--muted); font-size: 11px; }
.column-menu { position: relative; align-self: end; }
.column-menu summary { cursor: pointer; list-style: none; border: 1px solid var(--line); border-radius: 4px; padding: 7px 10px; background: #fff; color: var(--blue); font-size: 11px; font-weight: 700; }
.column-menu[open] fieldset { position: absolute; right: 0; z-index: 20; display: grid; gap: 5px; min-width: 150px; margin: 4px 0 0; border: 1px solid var(--line); border-radius: 5px; padding: 10px; background: #fff; box-shadow: 0 8px 24px #15354a24; }
.column-menu fieldset { display: none; }
.column-menu label { display: flex; align-items: center; gap: 6px; color: var(--text); font-size: 11px; text-transform: none; }

.grid-wrap { overflow: auto; max-height: 560px; position: relative; }
.activity-table { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; }
.activity-table th { position: sticky; top: 0; height: 42px; background: #f7fafb; z-index: 3; text-align: left; color: #566c79; font-size: 11px; text-transform: uppercase; }
.activity-table th, .activity-table td { border-bottom: 1px solid #e3ebf0; padding: 9px 11px; white-space: nowrap; }
.activity-table td { background: #fff; }
.activity-table tbody tr:hover td { background: #f3f9fc; }
.activity-table th:nth-child(1), .activity-table td:nth-child(1) { position: sticky; left: 0; width: 112px; min-width: 112px; max-width: 112px; z-index: 4; }
.activity-table th:nth-child(2), .activity-table td:nth-child(2) { position: sticky; left: 112px; width: 260px; min-width: 260px; max-width: 260px; z-index: 4; border-right: 1px solid var(--line); overflow: hidden; text-overflow: ellipsis; }
.activity-table th:nth-child(1), .activity-table th:nth-child(2) { z-index: 6; background: #f7fafb; }
.activity-table th:nth-child(3) { min-width: 110px; }
.activity-table th:nth-child(4) { min-width: 135px; }
.activity-table th:nth-child(5) { min-width: 90px; }
.activity-table th:nth-child(6), .activity-table th:nth-child(7) { min-width: 105px; }
.activity-table .critical td:first-child { border-left: 3px solid var(--critical); color: var(--critical); font-weight: 750; }
.table-message { height: 95px; text-align: center; color: var(--muted); }
.editable-name { display: block; max-width: 235px; overflow: hidden; text-overflow: ellipsis; border: 0; border-bottom: 1px dashed #8faebb; border-radius: 0; background: transparent; color: var(--text); text-align: left; padding: 2px 0; font-weight: 500; }
.inline-name-editor { width: 235px; border: 1px solid var(--blue); border-radius: 3px; padding: 5px; }
.row-actions { min-width: 155px; }
.constraint-flag { display: inline-grid; place-items: center; width: 16px; height: 16px; margin-left: 6px; border-radius: 50%; background: #fff0dd; color: #995b00; font-size: 10px; font-weight: 850; vertical-align: middle; }

.timeline-head, .bar-cell { padding: 0 !important; }
#ganttAxis, .timeline { position: relative; min-height: 35px; background-color: #f8fafb; background-image: linear-gradient(to right, #d9e3e955 1px, transparent 1px); background-size: var(--gantt-grid, 70px) 100%; overflow: hidden; }
#ganttAxis { height: 42px; }
.timeline { height: 34px; }
.axis-tick { position: absolute; inset: 0 auto 0 0; width: 1px; border-left: 1px solid #cbd8df; }
.axis-tick b { position: absolute; top: 5px; left: 4px; color: #617581; font-size: 10px; font-weight: 650; text-transform: none; }
.gantt-activity { position: absolute; top: 10px; height: 14px; min-width: 4px; z-index: 2; }
.gantt-segment { position: absolute; top: 0; height: 14px; min-width: 4px; border-radius: 2px; box-shadow: 0 1px 2px #0a355044; }
.gantt-segment.actual { background: #36a982; }
.gantt-segment.remaining { background: var(--blue); }
.gantt-segment.remaining.critical { background: var(--critical); }
.gantt-activity.milestone { width: 12px !important; min-width: 12px; height: 12px; top: 11px; transform: rotate(45deg); border-radius: 1px; box-shadow: 0 1px 2px #0a355044; }
.gantt-activity.milestone.actual { background: #36a982; }
.gantt-activity.milestone.remaining { background: var(--orange); }
.gantt-links { position: absolute; top: 0; left: 0; z-index: 2; overflow: visible; pointer-events: none; }
.gantt-links > path { fill: none; stroke: #5c7080; stroke-width: 1.35; marker-end: url(#ganttArrow); vector-effect: non-scaling-stroke; }
.gantt-links marker path { fill: #5c7080; }
.unscheduled { position: absolute; left: 8px; top: 8px; color: var(--muted); font-size: 11px; }
.reference-line { position: absolute; inset: 0 auto 0 0; width: 0; border-left: 2px solid; z-index: 1; pointer-events: none; }
.reference-line.data-date-line { border-color: var(--orange); }
.reference-line.today-line { border-color: var(--cyan); border-left-style: dashed; }
.reference-line em { position: absolute; left: 3px; bottom: 1px; color: var(--muted); background: #f7fafbcc; font-size: 9px; font-style: normal; text-transform: none; white-space: nowrap; }
#pagination { padding: 12px 18px; display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
#range { min-width: 130px; text-align: center; color: var(--muted); }
.log-panel { padding: 17px; }
.log-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.log-panel pre { max-height: 260px; overflow: auto; color: #425d6c; white-space: pre-wrap; }

dialog { border: 0; border-radius: 9px; padding: 0; width: min(700px, calc(100vw - 36px)); max-height: min(900px, calc(100vh - 32px)); overflow: auto; box-shadow: 0 25px 80px #0d26395c; color: var(--text); }
dialog.large { width: min(980px, calc(100vw - 36px)); }
dialog.xlarge { width: min(1440px, calc(100vw - 30px)); }
dialog::backdrop { background: #0c2032a6; backdrop-filter: blur(2px); }
dialog form { margin: 0; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 18px 22px; border-bottom: 1px solid var(--line); background: #fff; }
.dialog-head h2 { margin: 0; font-size: 18px; }
.dialog-head p { margin: 4px 0 0; color: var(--muted); }
.icon { border: 0; background: transparent; color: var(--muted); font-size: 24px; padding: 3px 6px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 20px 22px; }
.form-grid label, #wbsForm label, #calendarForm label, .form-stack label, .relation-form label, .progress-toolbar label { color: var(--muted); font-size: 12px; }
.form-grid input, .form-grid select, .form-grid textarea, #wbsForm input, #wbsForm select, #wbsForm textarea, #calendarForm input, #calendarForm select, #calendarForm textarea, .form-stack input, .relation-form input, .relation-form select, .progress-toolbar input { display: block; width: 100%; border: 1px solid var(--line); border-radius: 4px; padding: 8px; margin-top: 5px; color: var(--text); background: #fff; }
.form-grid .wide { grid-column: 1 / -1; }
.form-grid textarea, #wbsForm textarea { min-height: 72px; resize: vertical; }
.field-help { display: block; margin-top: 4px; color: var(--muted); }
.create-mode .edit-only { display: none !important; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 15px 22px; border-top: 1px solid var(--line); background: #fff; }
.form-stack { display: grid; gap: 15px; padding: 22px; }
.split { display: grid; grid-template-columns: minmax(290px, .9fr) minmax(360px, 1.1fr); min-height: 450px; }
.list-pane { border-right: 1px solid var(--line); padding: 18px; background: #f9fbfc; }
.split > form { padding: 18px; }
.split > form > label { display: block; margin-bottom: 12px; }
.dialog-empty { padding: 28px 18px; text-align: center; color: var(--muted); }
.notice { margin: 14px 0; padding: 11px 13px; border-radius: 5px; background: #eef7fc; color: #285e7c; }
.notice ul { margin-bottom: 0; }

.project-list { max-height: 500px; overflow: auto; padding: 12px; }
.project-card, .calendar-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; border: 1px solid transparent; background: #fff; color: var(--text); text-align: left; padding: 11px 12px; margin-bottom: 5px; }
.project-card:hover, .project-card.selected, .calendar-card:hover, .calendar-card.selected { border-color: #b9dbea; background: #eaf5fb; }
.project-card span, .calendar-card span { display: grid; gap: 2px; }
.project-card small, .calendar-card small { color: var(--muted); font-weight: 500; }

.wbs-node { position: relative; display: flex; align-items: center; gap: 5px; margin: 2px 0 2px calc(var(--depth) * 16px); border: 1px solid transparent; border-radius: 4px; }
.wbs-node:hover, .wbs-node.selected { background: #eaf5fb; border-color: #c8e4f3; }
.wbs-node.dragging { opacity: .45; }
.wbs-tree-toolbar { display: flex; gap: 6px; margin-bottom: 8px; }
.wbs-toggle, .wbs-toggle-spacer { flex: 0 0 22px; width: 22px; }
.wbs-toggle { align-self: stretch; border: 0; background: transparent; color: var(--blue); padding: 2px; font-size: 15px; }
.wbs-node.drop-before::before, .wbs-node.drop-after::after { content: ''; position: absolute; left: 0; right: 0; height: 2px; background: var(--blue); }
.wbs-node.drop-before::before { top: -2px; }
.wbs-node.drop-after::after { bottom: -2px; }
.wbs-select { display: grid; gap: 3px; flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); text-align: left; padding: 8px 9px; font-weight: 500; }
.wbs-identity { display: flex; align-items: center; gap: 8px; min-width: 0; }
.wbs-select small { color: var(--muted); }
.wbs-identity > span { overflow: hidden; text-overflow: ellipsis; }
.wbs-rollup-summary { overflow: hidden; color: var(--muted); font-size: 10px; font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }
.wbs-order-actions { display: flex; padding-right: 4px; }
.wbs-order-actions button { border: 0; background: transparent; color: var(--blue); padding: 4px; }
.wbs-rollups { margin: 16px 0 0; border: 1px solid var(--line); border-radius: 5px; padding: 12px; }
.wbs-rollups legend { color: var(--muted); font-size: 12px; }
.wbs-rollup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.wbs-rollup-grid label { display: grid; gap: 2px; color: var(--muted); font-size: 10px; text-transform: uppercase; }
.wbs-rollup-grid output { color: var(--text); font-size: 12px; font-weight: 700; text-transform: none; }
.wbs-rollups > small { display: block; margin-top: 10px; color: var(--muted); }

.relation-form { display: grid; grid-template-columns: minmax(220px, 2fr) 80px 125px minmax(220px, 2fr) auto; gap: 9px; align-items: end; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.activity-picker { display: grid; gap: 7px; }
.relationship-toolbar { display: flex; align-items: center; gap: 9px; padding: 11px 20px; border-bottom: 1px solid var(--line); background: #f8fafb; }
.relationship-toolbar label { color: var(--muted); font-size: 12px; }
.relationship-toolbar input { width: min(320px, 38vw); border: 1px solid var(--line); border-radius: 4px; padding: 7px 9px; }
.relationship-toolbar span { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }
.relationship-list { max-height: 430px; overflow: auto; }
.relationship { display: grid; grid-template-columns: 1fr auto 1fr auto; gap: 15px; align-items: center; padding: 10px 20px; border-bottom: 1px solid #edf1f4; }
.relationship > span { display: grid; min-width: 0; }
.relationship > span small { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.relationship strong { color: var(--blue); }
.delete-row { border: 0; background: transparent; color: var(--danger); padding: 5px; }

.milestone-toolbar { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); background: #f8fafb; }
.milestone-toolbar p { margin: 0; color: var(--muted); }
.milestone-overview { display: grid; gap: 4px; margin-right: auto; }
.milestone-summary { display: flex; flex-wrap: wrap; gap: 5px 12px; font-size: 11px; }
.milestone-summary span { white-space: nowrap; }
.milestone-summary b { color: var(--text); }
.milestone-filter { min-width: min(290px, 32vw); color: var(--muted); font-size: 10px; text-transform: uppercase; }
.milestone-filter input { display: block; width: 100%; margin-top: 3px; border: 1px solid var(--line); border-radius: 4px; padding: 7px 9px; color: var(--text); text-transform: none; }
.milestone-table-wrap { max-height: 460px; overflow: auto; }
.milestone-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.milestone-table th, .milestone-table td { padding: 9px 10px; border-bottom: 1px solid #e5edf1; text-align: left; white-space: nowrap; }
.milestone-table thead th { position: sticky; top: 0; z-index: 2; background: #f7fafb; color: var(--muted); font-size: 10px; text-transform: uppercase; }
.milestone-table tbody th { font-weight: 750; }
.milestone-table td:nth-child(2) { min-width: 220px; max-width: 330px; overflow: hidden; text-overflow: ellipsis; }
.milestone-table .milestone-actions { text-align: right; }
.milestone-status, .milestone-tag { display: inline-block; border-radius: 999px; padding: 2px 7px; font-size: 9px; font-weight: 750; text-transform: uppercase; }
.milestone-status { background: #edf2f5; color: #50636f; }
.milestone-status.achieved { background: #e4f4ed; color: var(--success); }
.milestone-status.at-risk, .milestone-status.missed { background: #ffeaeb; color: var(--danger); }
.milestone-status.forecast { background: #eaf5fb; color: var(--blue); }
.milestone-tag { margin-right: 4px; background: #fff2df; color: #87560c; }
.milestone-link { display: grid; }
.milestone-link small { color: var(--muted); }
.milestone-link.deleted { color: var(--danger); }
.milestone-link.deleted b, .milestone-link.deleted small { text-decoration: line-through; }
.deleted-badge { width: max-content; margin-top: 2px; border-radius: 999px; padding: 1px 6px; background: #ffeaeb; color: var(--danger); font-size: 9px; font-style: normal; font-weight: 800; text-decoration: none; text-transform: uppercase; }
.milestone-variance { color: var(--muted); font-weight: 750; }
.milestone-variance.late { color: var(--danger); }
.milestone-variance.early { color: var(--success); }
.milestone-variance.on-date { color: var(--text); }
.milestone-editor { border-top: 3px solid var(--blue); background: #fff; }
.editor-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 15px 22px 0; }
.editor-heading h3 { margin: 0; font-size: 16px; }
.editor-heading p { margin: 3px 0 0; color: var(--muted); }
.form-grid .check-field { display: flex; align-items: center; gap: 8px; align-self: end; min-height: 37px; color: var(--text); }
.form-grid .check-field input { display: inline; width: auto; margin: 0; padding: 0; border: 0; accent-color: var(--blue); }

.calendar-list { margin-bottom: 14px; }
.calendar-card em { color: var(--muted); font-size: 10px; font-style: normal; text-transform: uppercase; }
.calendar-split { grid-template-columns: minmax(250px, .7fr) minmax(500px, 1.3fr); }
.three-fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.weekday-fieldset, .rotation-fieldset { margin: 12px 0; border: 1px solid var(--line); border-radius: 5px; padding: 12px; }
.weekday-fieldset legend, .rotation-fieldset legend { color: var(--muted); font-size: 12px; }
.weekday-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.weekday-grid label { display: flex !important; align-items: center; gap: 4px; color: var(--text) !important; }
.weekday-grid input { display: inline !important; width: auto !important; margin: 0 !important; }
.subhead { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin-top: 18px; }
.subhead h3, .history-panel h3 { margin: 0; font-size: 15px; }
.subhead p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.exception-list { display: grid; gap: 7px; margin-top: 10px; }
.exception-row { display: grid; grid-template-columns: 135px 125px 1fr auto; gap: 7px; align-items: end; }

.progress-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 15px; padding: 14px 20px; background: #f8fafb; border-bottom: 1px solid var(--line); }
.progress-toolbar label { min-width: 190px; }
.progress-grid-wrap, .history-table-wrap { overflow: auto; }
.progress-grid-wrap { max-height: 430px; }
.progress-table, .history-table { width: 100%; border-collapse: collapse; }
.progress-table th, .progress-table td, .history-table th, .history-table td { padding: 8px; border-bottom: 1px solid #e5edf1; text-align: left; white-space: nowrap; }
.progress-table th, .history-table th { background: #f7fafb; color: var(--muted); font-size: 11px; text-transform: uppercase; }
.progress-table thead th { position: sticky; top: 0; z-index: 2; }
.progress-table tr.selected { background: #f1f9fd; }
.progress-table tr.progress-derived { background: #f5f6f7; color: var(--muted); }
.progress-table td:nth-child(2) { min-width: 200px; white-space: normal; }
.progress-table td:nth-child(2) small { display: block; color: var(--muted); }
.progress-type-note { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; font-style: normal; }
.progress-table input { width: 112px; border: 1px solid var(--line); border-radius: 3px; padding: 6px; }
.progress-table input[readonly] { background: #eef2f4; color: var(--muted); }
.progress-table input[type="checkbox"] { width: auto; }
.progress-table td:nth-child(10) input { width: 180px; }
.history-panel { padding: 16px 20px; border-top: 1px solid var(--line); }
.history-panel h4 { margin: 12px 0 7px; }
.history-table { font-size: 12px; }
.history-pagination { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding-top: 9px; color: var(--muted); font-size: 12px; }
#progressMessage { margin: 14px 20px 0; }

.run-history-split { grid-template-columns: minmax(300px, .85fr) minmax(400px, 1.15fr); min-height: 520px; }
.schedule-run-list { display: grid; gap: 7px; }
.schedule-run-card { display: grid; gap: 8px; width: 100%; border: 1px solid var(--line); background: #fff; color: var(--text); padding: 11px; text-align: left; font-weight: 500; }
.schedule-run-card:hover, .schedule-run-card.selected { border-color: #9fcfe5; background: #eaf5fb; }
.run-card-heading { display: flex; justify-content: space-between; align-items: center; }
.run-status { padding: 2px 7px; border-radius: 999px; font-size: 9px; font-style: normal; text-transform: uppercase; }
.run-status.complete { background: #e4f4ed; color: var(--success); }
.run-status.failed { background: #ffeaeb; color: var(--danger); }
.run-card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; color: var(--muted); }
.run-card-grid small { display: flex; justify-content: space-between; gap: 5px; }
.run-card-grid small:last-child { grid-column: 1 / -1; }
.run-card-grid b { color: var(--text); font-weight: 600; }
.run-log-pane { padding: 18px; min-width: 0; }
.run-log-pane h3 { margin: 0 0 12px; }
.run-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 5px; background: #f8fafb; }
.run-summary span { display: grid; gap: 2px; }
.run-summary b { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.run-log-list { margin: 14px 0 0; padding-left: 25px; }
.run-log-list li { margin-bottom: 10px; padding: 9px 11px; border-left: 3px solid var(--blue); background: #f8fafb; }
.run-log-list li.error { border-color: var(--danger); background: #fff4f4; }
.run-log-list li > div { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 11px; text-transform: uppercase; }
.run-log-list li p { margin: 5px 0; }
.run-log-list pre { max-height: 170px; overflow: auto; white-space: pre-wrap; font-size: 11px; }

#toast { position: fixed; right: 22px; bottom: 22px; max-width: min(420px, calc(100vw - 44px)); background: var(--navy); color: #fff; padding: 12px 16px; border-radius: 5px; opacity: 0; visibility: hidden; pointer-events: none; transform: translateY(8px); transition: .2s; z-index: 100; box-shadow: 0 8px 30px #0c203255; }
#toast[data-tone="error"] { background: #912f35; }
#toast.show { opacity: 1; visibility: visible; transform: translateY(0); }

.alert { background: #ffeded; color: #982d32; padding: 9px; border-radius: 4px; }
.login-page { display: grid; place-items: center; min-height: 100vh; padding: 18px; background: linear-gradient(135deg, var(--navy), #1d4965); }
.login-card { background: #fff; border-radius: 9px; width: min(360px, 100%); padding: 34px; box-shadow: 0 20px 60px #07162280; }
.login-card .brand-mark { display: inline-block; }
.login-card label { display: block; margin: 16px 0 5px; }
.login-card input { display: block; width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 4px; margin-top: 5px; }
.login-card button { width: 100%; }

@media (max-width: 1240px) {
    :root { --sidebar-width: 210px; }
    .topbar { gap: 9px; padding-inline: 16px; flex-wrap: wrap; }
    .topbar #search { flex: 1 1 190px; }
    .topbar .user { display: none; }
    .project-actions { max-width: 650px; justify-content: flex-end; }
}

@media (max-width: 900px) {
    .sidebar { position: static; display: flex; width: 100%; height: 68px; overflow: hidden; }
    .brand { flex: 0 0 auto; }
    .sidebar nav { display: flex; flex: 1; gap: 4px; padding: 8px; overflow-x: auto; }
    .nav-item { flex: 0 0 auto; width: auto; min-width: max-content; }
    .nav-item.active { box-shadow: inset 0 -3px var(--cyan); }
    .shell { margin-left: 0; }
    .topbar { top: 0; flex-wrap: wrap; }
    .topbar select { width: 260px; }
    .topbar #search { order: 10; width: 100%; margin-left: 0; }
    .metrics { grid-template-columns: repeat(2, minmax(140px, 1fr)); }
    .page-title { align-items: flex-start; flex-direction: column; }
    .project-actions { justify-content: flex-start; max-width: none; }
    .calendar-split { grid-template-columns: 1fr; }
    .run-history-split { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
    section { padding: 18px 12px; }
    .brand { width: 75px; padding: 0 12px; }
    .brand strong { display: none; }
    .topbar { position: relative; padding: 10px 12px; }
    .topbar select { width: calc(100% - 120px); flex: 1; }
    #dataDate { margin-left: 0; }
    .page-title h1 { font-size: 24px; }
    .panel-head { align-items: flex-start; flex-direction: column; }
    .metrics { grid-template-columns: 1fr 1fr; }
    .milestone-dashboard-summary { align-items: flex-start; flex-wrap: wrap; }
    .milestone-dashboard-summary em { width: 100%; margin-left: 0; }
    .form-grid { grid-template-columns: 1fr; }
    .form-grid .wide { grid-column: auto; }
    .split { grid-template-columns: 1fr; }
    .list-pane { border-right: 0; border-bottom: 1px solid var(--line); max-height: 310px; overflow: auto; }
    .relation-form { grid-template-columns: 1fr; align-items: stretch; }
    .relationship-toolbar { align-items: stretch; flex-wrap: wrap; }
    .relationship-toolbar label { width: 100%; }
    .relationship-toolbar input { flex: 1 1 210px; width: auto; }
    .relationship { grid-template-columns: 1fr auto 1fr; }
    .relationship .delete-row { grid-column: 1 / -1; justify-self: end; }
    .milestone-toolbar { align-items: stretch; flex-direction: column; }
    .milestone-overview { margin-right: 0; }
    .milestone-filter { min-width: 0; }
    .three-fields { grid-template-columns: 1fr; }
    .weekday-grid { grid-template-columns: repeat(4, 1fr); }
    .exception-row { grid-template-columns: 1fr 1fr auto; }
    .exception-row label:nth-child(3) { grid-column: 1 / 3; }
    .progress-toolbar { align-items: stretch; flex-direction: column; }
    .dialog-actions { flex-wrap: wrap; }
}

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