:root {
    color-scheme: light;
    --ink: #173441;
    --muted: #718187;
    --line: #dce5e4;
    --navy: #102e3b;
    --navy-soft: #1e4652;
    --green: #277052;
    --green-pale: #edf6ef;
    --red: #a74b50;
    --red-pale: #fbefef;
    --canvas: #f5f7f5;
    --focus: #e4a941;
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    font-synthesis: none;
    text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; color: var(--ink); background: var(--canvas); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.topbar { position: relative; min-height: 74px; padding: 0 34px; display: flex; align-items: center; justify-content: space-between; gap: 20px; color: #fff; background: var(--navy); box-shadow: 0 3px 14px #102e3b20; }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark { width: 39px; height: 39px; display: grid; place-items: center; border: 1px solid #ffffff53; color: #d8c178; font-weight: 800; font-size: 13px; letter-spacing: 0; }
.brand-copy { display: grid; gap: 3px; }
.brand-copy strong { font-size: 12px; letter-spacing: 1.3px; }
.brand-copy small { color: #a9bdc1; font-size: 10px; letter-spacing: 1.8px; }
.toolbar { display: flex; align-items: center; gap: 18px; }
.year-control { display: flex; align-items: center; gap: 10px; color: #a9bdc1; font-size: 10px; font-weight: 700; letter-spacing: 1.1px; }
.year-control select { min-width: 90px; padding: 9px 28px 9px 10px; border: 1px solid #ffffff46; border-radius: 2px; color: #fff; background: var(--navy-soft); font-weight: 700; }
.year-control option { color: var(--ink); background: #fff; }
.year-drop-panel { position: absolute; z-index: 15; top: calc(100% + 5px); right: 20px; width: min(650px, calc(100vw - 40px)); padding: 10px; display: grid; gap: 7px; border: 1px solid #cbd9d7; border-radius: 3px; color: var(--ink); background: #fff; box-shadow: 0 8px 26px #102e3b29; }
.year-drop-panel[hidden] { display: none; }
.year-drop-row { display: grid; grid-template-columns: 44px repeat(12, minmax(0, 1fr)); align-items: center; gap: 4px; }
.year-drop-label { color: #718187; font-size: 10px; text-align: center; }
.year-drop-target { min-width: 0; min-height: 30px; padding: 2px; border: 1px dashed #cbd9d7; border-radius: 2px; color: #52676e; background: #f7f9f8; font-size: 10px; }
.year-drop-target:hover, .year-drop-target.is-over { border-color: #287c79; color: #fff; background: #287c79; }
.button { min-height: 38px; padding: 0 15px; border: 1px solid transparent; border-radius: 3px; font-size: 12px; font-weight: 700; transition: background-color .15s, border-color .15s; }
.button-primary { color: #172f36; background: #e4c66e; }
.button-primary:hover { background: #f0d783; }
.button-primary > span { margin-right: 5px; font-size: 17px; vertical-align: -1px; }
.button-quiet { color: var(--ink); border-color: var(--line); background: #fff; }
.button-quiet:hover { background: #f4f7f6; }
.button-danger { color: #9c3e45; border-color: #e5c4c4; background: #fff; }
.button-danger:hover { background: #fbefef; }
.planner-shell { width: 100%; padding: 28px 30px 20px; }
.intro-row { min-height: 84px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.eyebrow { margin: 0 0 6px; color: #778a8b; font-size: 9px; font-weight: 800; letter-spacing: 1.8px; }
h1 { margin: 0; color: var(--navy); font-size: 25px; line-height: 1.2; font-weight: 650; letter-spacing: 0; }
.intro-note { display: flex; align-items: center; gap: 9px; margin: 15px 2px 0 0; color: #728181; font-size: 9px; font-weight: 750; letter-spacing: 1.3px; }
.live-dot { width: 6px; height: 6px; display: inline-block; border-radius: 50%; background: #3c9870; }
.notice { position: fixed; z-index: 20; right: 24px; bottom: 22px; max-width: min(390px, calc(100vw - 32px)); padding: 12px 17px; border-left: 3px solid #44926e; color: #fff; background: var(--navy); box-shadow: 0 5px 25px #102e3b25; opacity: 0; pointer-events: none; transform: translateY(8px); transition: opacity .2s, transform .2s; }
.notice.is-visible { opacity: 1; transform: translateY(0); }
.notice.is-error { border-color: #de7774; }
.timeline-viewport { width: 100%; overflow: visible; border: 1px solid #d5dfdd; background: #fff; box-shadow: 0 4px 20px #1734410a; }
.timeline { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.quarter { min-width: 0; border-right: 5px solid var(--navy); }
.quarter:last-child { border-right: 0; }
.quarter-header { height: 56px; padding: 0; display: grid; place-items: center; color: var(--navy); background: transparent; font-size: 30px; font-weight: 800; letter-spacing: 0; }
.quarter-dash { display: none; }
.quarter-months { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.month-column { min-width: 0; min-height: calc(100vh - 260px); border-right: 1px solid #dce5e4; }
.month-column:last-child { border-right: 0; }
.month-header { position: sticky; z-index: 2; top: 0; min-height: 46px; padding: 0 7px 0 10px; display: flex; align-items: center; justify-content: space-between; gap: 2px; color: #fff; }
.is-suitable .month-header { background: var(--green); }
.is-unsuitable .month-header { background: var(--red); }
.month-name { overflow: hidden; font-size: clamp(9px, .75vw, 12px); font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.suitability-toggle { width: 25px; height: 25px; flex: 0 0 25px; padding: 0; border: 0; border-radius: 50%; color: inherit; background: #ffffff20; font-size: 16px; font-weight: 700; }
.suitability-toggle:hover { background: #ffffff3a; }
.is-suitable { background: var(--green-pale); }
.is-unsuitable { background: var(--red-pale); }
.month-activities { min-height: 170px; padding: 8px 6px 12px; display: flex; flex-direction: column; align-items: stretch; gap: 7px; transition: background-color .15s, box-shadow .15s; }
.month-activities.drop-target { background: #e7f1f0; box-shadow: inset 0 0 0 2px #4c8584; }
.activity-card { position: relative; width: 100%; min-width: 0; padding: 7px 7px 6px; display: grid; gap: 4px; border: 0; border-left: 3px solid var(--activity-color, #2e7180); border-radius: 2px; color: #19333b; text-align: left; background: color-mix(in srgb, var(--activity-color, #2e7180) 8%, white); box-shadow: 0 1px 4px #17344116; cursor: grab; user-select: none; -webkit-user-select: none; touch-action: manipulation; transition: box-shadow .15s, transform .15s, opacity .15s; }
.activity-card:hover { z-index: 1; box-shadow: 0 3px 9px #17344124; transform: translateY(-1px); }
.activity-card:active { cursor: grabbing; }
.activity-card.is-dragging { opacity: .35; cursor: grabbing; user-select: none; }
.activity-card.drop-before::before, .activity-card.drop-after::after { position: absolute; right: 2px; left: 2px; height: 2px; content: ""; background: #1d7272; }
.activity-card.drop-before::before { top: -5px; }
.activity-card.drop-after::after { bottom: -5px; }
.duplicate-activity { position: absolute; z-index: 1; top: 3px; right: 4px; width: 21px; height: 21px; padding: 3px; display: grid; place-items: center; border: 0; border-radius: 0; color: #64748b; background: transparent; cursor: pointer; }
.duplicate-activity svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.duplicate-activity:hover { color: #334155; background: transparent; }
.duplicate-activity:focus-visible { outline: 2px solid #64748b; outline-offset: 1px; }
.duplicate-activity:disabled { cursor: wait; opacity: .55; }
.duplicate-activity.is-loading svg { opacity: .45; }
.activity-range { min-height: 17px; padding-right: 25px; color: var(--activity-color); font-size: 9px; font-weight: 750; }
.activity-title { overflow-wrap: anywhere; unicode-bidi: plaintext; font-size: 11px; line-height: 1.4; font-weight: 700; }
.activity-subtitle { overflow-wrap: anywhere; unicode-bidi: plaintext; color: #52676e; font-size: 10px; line-height: 1.4; font-weight: 600; }
.activity-description { overflow-wrap: anywhere; unicode-bidi: plaintext; color: #63747a; font-size: 9px; line-height: 1.45; font-weight: 400; }
.activity-meta { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 5px; color: #748184; font-size: 9px; }
.activity-meta > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-dot { width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: #d0a33f; }
.status-under_review { background: #be7c43; }
.status-approved { background: #3284a0; }
.status-in_progress { background: #5086be; }
.status-completed { background: #438565; }
.status-cancelled { background: #b95e61; }
.board-footer { min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #778486; font-size: 10px; }
.legend-dot { width: 8px; height: 8px; margin: 0 5px 0 12px; display: inline-block; border-radius: 50%; vertical-align: 0; }
.legend-dot:first-child { margin-left: 0; }
.legend-dot.suitable { background: var(--green); }
.legend-dot.unsuitable { background: var(--red); }
.activity-dialog { width: min(570px, calc(100vw - 28px)); max-height: min(90vh, 760px); padding: 0; overflow: auto; border: 1px solid #dce5e4; border-radius: 4px; color: var(--ink); background: #fff; box-shadow: 0 18px 70px #102e3b35; }
.activity-dialog::backdrop { background: #102e3b88; backdrop-filter: blur(2px); }
.activity-dialog form { padding: 23px 25px 20px; }
.dialog-heading { margin-bottom: 20px; display: flex; align-items: flex-start; justify-content: space-between; }
.dialog-heading h2 { margin: 0; color: var(--navy); font-size: 20px; letter-spacing: 0; }
.icon-button { width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 3px; color: #53676c; background: white; font-size: 23px; line-height: 1; }
.field { min-width: 0; display: grid; gap: 6px; color: #42575c; font-size: 11px; font-weight: 700; }
.field-wide { margin-bottom: 14px; }
.required { color: #a74b50; }
.field input, .field select, .field textarea { width: 100%; min-width: 0; min-height: 38px; padding: 8px 10px; border: 1px solid #d7e0df; border-radius: 2px; outline: none; color: var(--ink); background: #fff; font-size: 13px; font-weight: 400; }
.field textarea { min-height: 66px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, button:focus-visible, select:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.field-grid { margin-bottom: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 13px 15px; }
.field-color { gap: 9px; }
.color-palette { display: flex; flex-wrap: wrap; gap: 7px; }
.color-swatch { position: relative; width: 30px; height: 30px; flex: 0 0 30px; padding: 0; display: grid; place-items: center; border: 1px solid #ffffff; border-radius: 3px; color: #fff; background: var(--swatch-color); box-shadow: 0 0 0 1px #cbd5d3; }
.color-swatch.is-selected { box-shadow: 0 0 0 2px #173441; }
.color-swatch.is-selected::after { content: "✓"; color: #fff; font-size: 16px; font-weight: 800; text-shadow: 0 1px 3px #000, 1px 0 2px #000; }
.color-swatch-custom { border: 1px dashed #829192; color: #42575c; background: #fff; font-size: 20px; font-weight: 400; }
.color-swatch-custom.is-selected::after { content: none; }
.color-swatch-custom.has-custom-color { border-style: solid; color: white; background: var(--swatch-color); }
.color-swatch-custom span { line-height: 1; }
.native-color-input { position: absolute; width: 1px; height: 1px; padding: 0 !important; overflow: hidden; opacity: 0; pointer-events: none; }
.dialog-actions { margin-top: 21px; display: flex; align-items: center; gap: 9px; }
.action-spacer { flex: 1; }
[hidden] { display: none !important; }

@media (min-width: 1500px) {
    .planner-shell { padding-right: 42px; padding-left: 42px; }
    .month-header { padding-right: 11px; padding-left: 13px; }
    .month-activities { padding-right: 9px; padding-left: 9px; }
    .activity-card { padding: 9px; }
    .activity-title { font-size: 12px; }
}

@media (max-width: 900px) {
    .topbar { padding-right: 18px; padding-left: 18px; }
    .planner-shell { padding: 20px 16px; }
    .timeline-viewport { overflow-x: auto; overscroll-behavior-x: contain; }
    .timeline { min-width: 980px; }
    .month-column { min-height: calc(100vh - 220px); }
    .month-name { font-size: 11px; }
}

@media (max-width: 520px) {
    .topbar { min-height: 65px; padding: 0 12px; gap: 8px; }
    .brand { gap: 8px; }
    .brand-mark { width: 33px; height: 33px; }
    .brand-copy strong { font-size: 10px; letter-spacing: .8px; }
    .brand-copy small { font-size: 8px; letter-spacing: 1.2px; }
    .toolbar { gap: 8px; }
    .year-control { gap: 0; font-size: 0; }
    .year-control select { min-width: 68px; padding: 8px 7px; font-size: 12px; }
    .button { min-height: 35px; padding: 0 9px; font-size: 11px; }
    .planner-shell { padding: 17px 10px; }
    .intro-row { align-items: flex-start; flex-direction: column; gap: 3px; }
    h1 { font-size: 22px; }
    .intro-note { margin: 4px 0 13px; }
    .timeline { min-width: 940px; }
    .quarter { border-right-width: 4px; }
    .activity-dialog form { padding: 19px 16px 16px; }
    .field-grid { gap: 11px; }
}

@media print {
    @page { size: landscape; margin: 8mm; }
    body { background: #fff; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
    .topbar, .intro-note, .notice, .board-footer, .suitability-toggle { display: none !important; }
    .planner-shell { padding: 0; }
    .intro-row { min-height: 48px; }
    h1 { font-size: 18px; }
    .timeline-viewport { overflow: visible; border: 1px solid #9cadad; box-shadow: none; }
    .timeline { min-width: 0; }
    .quarter { break-inside: avoid; }
    .month-column { min-height: 0; }
    .month-header { position: static; }
    .month-activities { min-height: 110px; }
    .activity-card { break-inside: avoid; box-shadow: none; }
    .activity-dialog { display: none; }
}