@charset "UTF-8";

:root {
  color-scheme: light;
  font-family: "Segoe UI", Arial, sans-serif;
  font-synthesis: none;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.45;
  color: #203541;
  background: #f7f8f6;
  --ink: #203541;
  --muted: #748086;
  --line: #e3e7e4;
  --line-strong: #cdd5d0;
  --paper: #fff;
  --surface: #f7f8f6;
  --accent: #176d60;
  --accent-hover: #11594f;
  --focus: #4c9b8d;
  --planned: #64748b;
  --active: #3579bc;
  --done: #348666;
  --late: #c46443;
  --label-width: 290px;
  --row-height: 50px;
}
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; }
body { overflow: hidden; -webkit-font-smoothing: antialiased; }
#root { height: 100%; min-height: 0; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { color: inherit; cursor: pointer; }
button:disabled, button[aria-disabled="true"] { cursor: not-allowed; opacity: .5; }
button[aria-busy="true"] { cursor: wait; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button:focus-visible, a:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid var(--focus); outline-offset: 3px;
}
[hidden] { display: none !important; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { color: var(--ink); }
h1 { font-size: 27px; line-height: 1.25; letter-spacing: -.7px; }
h2 { font-size: 20px; line-height: 1.3; letter-spacing: -.4px; }
h3 { font-size: 15px; line-height: 1.4; }
p { line-height: 1.55; }
small { font-size: 14px; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.full { grid-column: 1 / -1; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Quiet, consistent controls. */
.btn, .icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 38px; padding: 8px 13px; border: 1px solid var(--line-strong);
  border-radius: 7px; background: var(--paper); color: var(--ink);
  font-size: 14px; font-weight: 600; line-height: 1.25; white-space: nowrap;
  transition: background-color .14s, border-color .14s;
}
.btn:hover, .icon-btn:hover { background: #f0f4f1; text-decoration: none; border-color: #b5c3ba; }
.btn.primary { color: #fff; background: var(--accent); border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: #edf2ee; border-color: transparent; }
.btn.small { min-height: 32px; padding: 6px 10px; font-size: 14px; }
.btn.danger { color: #ad4138; border-color: #e9cbc7; }
.btn.danger:hover { background: #fff3f1; border-color: #dca69e; }
.icon-btn { flex: 0 0 auto; width: 34px; min-height: 34px; padding: 7px; border-color: transparent; background: transparent; }
.icon-btn:hover { border-color: transparent; }
.text-btn { display: inline-flex; align-items: center; justify-content: flex-start; min-height: 28px; padding: 2px 0; border: 0; border-radius: 3px; background: transparent; color: var(--accent); text-align: left; font-size: inherit; font-weight: 500; line-height: 1.45; }
.text-btn:hover { color: var(--accent-hover); text-decoration: underline; }
.icon { display: inline-block; flex: 0 0 auto; width: 18px; height: 18px; }
.icon svg { display: block; width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* The calendar and inspector keep their own scroll position on wide screens. */
.app-shell { display: flex; flex-direction: column; height: 100vh; height: 100dvh; min-width: 0; overflow: hidden; }
.app-header { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 18px; min-height: 66px; padding: 12px 26px; background: var(--paper); border-bottom: 1px solid var(--line); z-index: 20; }
.brand { display: inline-flex; align-items: center; gap: 10px; min-width: 0; color: var(--ink); }
a.brand:hover { text-decoration: none; }
.brand-mark { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 33px; height: 35px; border: 1.5px solid var(--accent); border-radius: 7px; color: var(--accent); font-size: 20px; font-weight: 700; line-height: 1; }
.brand-text { min-width: 0; font-size: 16px; line-height: 1.2; font-weight: 700; letter-spacing: -.35px; }
.brand-text strong { font-weight: 700; }
.brand-text small, .brand small { display: block; margin-top: 4px; font-size: 12px; font-weight: 400; line-height: 1.2; letter-spacing: .3px; color: var(--muted); }
.header-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; }
.account-menu { position: relative; margin-left: 4px; }
.account-menu > summary { display: flex; align-items: center; gap: 8px; padding: 2px; border-radius: 8px; cursor: pointer; list-style: none; }
.account-menu > summary .secondary-label { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.account-menu > summary::-webkit-details-marker { display: none; }
.avatar { display: grid; place-items: center; flex: 0 0 auto; width: 34px; height: 34px; border: 1px solid #d6e2dc; border-radius: 50%; background: #eef4f0; color: #3e6556; font-size: 14px; font-weight: 600; }
.account-menu[open] .avatar { border-color: var(--accent); }
.account-popover { position: absolute; right: 0; top: calc(100% + 12px); z-index: 30; width: 245px; max-width: calc(100vw - 24px); padding: 15px; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: 0 12px 36px #172d3b16; }
.account-popover strong { display: block; font-size: 14px; overflow-wrap: anywhere; }
.account-popover small { display: block; margin: 5px 0 13px; color: var(--muted); }
.account-popover .btn { width: 100%; justify-content: flex-start; }
.account-popover hr { margin: 10px 0; border: 0; border-top: 1px solid var(--line); }
.workspace { display: flex; flex: 1 1 auto; flex-direction: column; gap: 12px; min-height: 0; min-width: 0; padding: 22px 26px 12px; }
/* Pick one object and paint its work periods directly on real month calendars. */
.planner-shell { display: grid; grid-template-columns: 200px minmax(0, 1fr) 280px; grid-template-rows: minmax(0, 1fr); grid-template-areas: "objects calendar details"; gap: 16px; flex: 1 1 auto; min-width: 0; min-height: 0; }
.project-sidebar { grid-area: objects; display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.project-list-head { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 12px 9px; }
.project-list-head h2 { margin: 0; color: #5b6c62; font-size: 14px; font-weight: 600; letter-spacing: 0; }
.project-list-head .icon-btn { width: 32px; min-height: 32px; }
.project-search { flex: 0 0 auto; min-width: 0; padding: 0 12px 12px; }
.project-search input { width: 100%; }
.project-list { display: flex; flex: 1 1 auto; flex-direction: column; gap: 3px; min-width: 0; min-height: 0; overflow-y: auto; padding: 0 7px 10px; scrollbar-width: thin; scrollbar-color: #ccd5cf transparent; }
.object-item { display: block; flex: 0 0 auto; width: 100%; min-width: 0; padding: 11px 10px; border: 1px solid transparent; border-left-width: 3px; border-radius: 6px; background: transparent; color: var(--ink); text-align: left; }
.object-item:hover { background: #f5f8f4; }
.object-item.active { border-color: #d3e3da; border-left-color: var(--accent); background: #edf5f0; }
.object-item strong { display: block; overflow: hidden; margin-bottom: 4px; color: #3c5244; font-size: 14px; font-weight: 600; line-height: 1.45; overflow-wrap: anywhere; }
.object-item small { display: block; overflow: hidden; color: #69776d; font-size: 12px; font-weight: 400; line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }
.project-sidebar .empty { min-height: 130px; padding: 20px 12px; font-size: 13px; }
.project-sidebar .empty h3 { font-size: 14px; }
.planner-main { grid-area: calendar; display: flex; flex-direction: column; gap: 11px; min-width: 0; min-height: 0; }
.planner-toolbar { display: flex; flex: 0 0 auto; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; min-width: 0; }
.planner-toolbar > div:first-child { min-width: 0; }
.planner-project-title { display: block; min-width: 0; overflow: hidden; margin: 0; color: #263d31; font-size: 19px; font-weight: 600; line-height: 1.3; letter-spacing: -.4px; text-overflow: ellipsis; white-space: nowrap; }
.planner-project-title h1 { margin: 0; overflow: hidden; color: inherit; font-size: inherit; font-weight: inherit; line-height: inherit; letter-spacing: inherit; text-overflow: ellipsis; white-space: nowrap; }
.planner-toolbar small { display: block; margin-top: 4px; color: #6b7a70; font-size: 13px; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.range-nav { display: flex; flex: 0 0 auto; align-items: center; gap: 5px; margin-left: auto; }
.planner-toolbar .range-nav input.month-picker { flex: 0 0 150px; width: 150px; min-width: 0; min-height: 34px; padding: 6px 8px; border-color: transparent; background: transparent; color: #6b796f; font-size: 14px; font-weight: 500; }
.planner-toolbar .range-nav input.month-picker:hover { border-color: var(--line-strong); background: #fff; }
.period-label { min-width: 145px; color: #6b796f; font-size: 14px; font-weight: 500; text-align: center; white-space: nowrap; }
.range-nav .btn.small { margin-left: 7px; }
.stage-palette { display: flex; flex: 0 0 auto; flex-wrap: wrap; align-items: stretch; gap: 7px; padding: 3px 1px; }
.stage-tool { --stage-color: #3674b8; position: relative; display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: flex-start; gap: 7px; min-height: 43px; min-width: 0; padding: 8px 11px; border: 1px solid #dbe2dc; border-radius: 6px; background: #fff; color: #4b5d50; text-align: left; font-size: 14px; line-height: 1.35; white-space: nowrap; transition: border-color .12s, background-color .12s; }
.stage-tool:hover { border-color: var(--stage-color); background: #fafcfa; }
.stage-tool.active { border-color: var(--stage-color); background: #fff; box-shadow: 0 0 0 1px var(--stage-color); color: #263c2d; }
.stage-tool > .dot, .stage-tool > i { display: inline-block; flex: 0 0 auto; width: 8px; height: 8px; margin: 0; border-radius: 3px; background: var(--stage-color); }
.stage-tool strong { display: block; font-size: 14px; font-weight: 500; line-height: 1.3; }
.stage-tool small { display: block; margin-top: 2px; color: #6e7a71; font-size: 11px; font-weight: 400; line-height: 1.35; }
.stage-tool.active strong { font-weight: 600; }
.palette-add { display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; gap: 6px; min-height: 43px; padding: 8px 11px; border: 1px dashed #c9d4cb; border-radius: 6px; background: transparent; color: #68796b; font-size: 13px; white-space: nowrap; }
.palette-add:hover { border-color: var(--accent); background: #f0f6f0; color: var(--accent); }
.other-stage-tools { flex: 0 0 auto; min-width: 0; color: #68796c; font-size: 13px; }
.other-stage-tools > summary { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 43px; padding: 8px 11px; border: 1px solid #dbe2dc; border-radius: 6px; background: transparent; list-style: none; cursor: pointer; white-space: nowrap; }
.other-stage-tools > summary::-webkit-details-marker { display: none; }
.other-stage-tools > summary::after { content: "⌄"; font-size: 15px; line-height: 1; }
.other-stage-tools > summary:hover { background: #edf3ed; border-color: #bfcfc2; }
.other-stage-tools[open] { flex-basis: 100%; width: 100%; }
.other-stage-tools[open] > summary::after { content: "⌃"; }
.other-stage-list { display: flex; flex-wrap: wrap; gap: 7px; padding-top: 9px; }
.palette-hint { flex: 0 0 auto; margin: 0; color: #66766c; font-size: 13px; line-height: 1.55; }
.selected-stage-tools { display: flex; flex: 0 0 auto; flex-wrap: wrap; align-items: center; gap: 7px 11px; min-width: 0; min-height: 30px; color: #6d7e70; font-size: 13px; line-height: 1.4; }
.selected-stage-tools > strong { color: #435d4a; font-weight: 600; }
.selected-stage-tools > span { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 5px 8px; min-width: 0; }
.selected-stage-tools > span > .dot { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 3px; }
.selected-stage-tools > span > strong { color: #435d4a; font-weight: 600; }
.selected-stage-tools > span > small { color: #6b7a70; font-size: 12px; }
.selected-stage-tools > .actions { margin-left: auto; }
.selected-stage-tools .btn.small { min-height: 30px; font-size: 13px; padding: 5px 9px; }
.selected-stage-tools .text-btn { font-size: 13px; }
.selected-stage-tools .stage-check { flex: 0 0 auto; }
.paint-status { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin: 0; color: #4e8263; font-size: 13px; font-weight: 400; line-height: 1.5; }
.paint-status:empty { display: none; }
.paint-status.error { color: #ac513c; }
.paint-status .text-error { color: #a43e2e; }
.read-only { margin: 0; color: #6b7a70; font-size: 13px; line-height: 1.5; }
.calendar-scroll { flex: 1 1 auto; min-width: 0; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 2px 2px 7px; scrollbar-width: thin; scrollbar-color: #c6cfca transparent; }
.calendar-scroll:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.months-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 16px; min-width: 0; user-select: none; -webkit-user-select: none; }
.month-card { min-width: 0; overflow: hidden; padding: 13px; border: 1px solid #dfe5df; border-radius: 9px; background: #fff; }
.month-headline { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 25px; margin-bottom: 8px; }
.month-card h3 { margin: 0; padding: 0 3px; color: #465e4c; font-size: 15px; font-weight: 600; line-height: 1.4; letter-spacing: -.1px; text-transform: capitalize; }
.month-card > h3 { margin-bottom: 11px; }
.weekdays { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); min-width: 0; min-height: 25px; border-bottom: 1px solid #e3e8e2; color: #65786b; font-size: 12px; line-height: 1.2; text-align: center; }
.weekdays > * { display: flex; align-items: center; justify-content: center; min-width: 0; }
.weekdays > :nth-child(6), .weekdays > :nth-child(7), .weekdays .weekend { color: #876e5e; }
.week-row { --lanes: 0; position: relative; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-template-rows: minmax(0, 1fr); align-items: stretch; min-width: 0; min-height: max(48px, calc(26px + var(--lanes) * 23px)); border-left: 1px solid #e6ebe5; }
.date-cell { position: relative; display: block; min-width: 0; width: 100%; height: 100%; min-height: 100%; margin: 0; padding: 0; border: 0; border-right: 1px solid #e6ebe5; border-bottom: 1px solid #e6ebe5; border-radius: 0; background: #fff; color: #5f7465; text-align: left; font-size: 13px; font-weight: 400; line-height: 1; touch-action: manipulation; }
.date-cell.weekend { background: #fbfaf7; color: #846d5e; }
.date-cell.other-month { background: #f7f9f6; pointer-events: none; }
button.date-cell:not(:disabled):hover { background: #eff5f1; }
.date-cell.selected { background: #e6eff8; box-shadow: inset 0 0 0 2px var(--stage-color, #2465bd); }
.date-cell:focus-visible { z-index: 1; outline: 2px solid var(--accent); outline-offset: -2px; }
.date-cell .date-number { position: absolute; top: 5px; left: 8px; display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; line-height: 18px; }
.date-cell.today .date-number { top: 3px; left: 6px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 600; }
.week-bars { position: absolute; top: 24px; left: 0; right: 0; z-index: 2; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-auto-rows: 20px; align-content: start; row-gap: 3px; min-width: 0; pointer-events: none; }
.work-band { position: relative; display: flex; align-items: center; gap: 3px; min-width: 0; min-height: 20px; margin: 0 2px; padding: 1px 5px; overflow: hidden; border: 1px solid #00000014; border-radius: 4px; background: var(--stage-color, #3674b8); color: var(--stage-ink, #fff); text-align: left; font-size: 11px; font-weight: 500; line-height: 16px; white-space: nowrap; text-overflow: ellipsis; pointer-events: auto; cursor: pointer; appearance: none; touch-action: manipulation; }
.work-band:hover { border-color: #00000070; box-shadow: 0 1px 4px #20354126; }
.work-band:focus-visible { z-index: 5; outline: 2px solid #172f3d; outline-offset: 1px; }
.calendar-scroll.is-painting .work-band { pointer-events: none; }
.work-band > span { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.work-band .icon { flex: 0 0 auto; width: 11px; height: 11px; }
.work-band small { flex: 0 0 auto; font-size: 11px; line-height: 1; }
.work-band.is-done { opacity: 1; }
.work-band.selected-work { z-index: 2; border-color: #00000045; box-shadow: 0 0 0 1px #00000025; font-weight: 700; }
.work-band.continues-before { margin-left: 0; border-left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.work-band.continues-after { margin-right: 0; border-right: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.selection-layer { position: absolute; top: 24px; left: 0; right: 0; bottom: 0; z-index: 4; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-auto-rows: 20px; align-content: start; row-gap: 3px; pointer-events: none; }
.selection-band { min-width: 0; min-height: 20px; margin: 0 1px; border: 2px dashed var(--stage-color, #3674b8); border-radius: 4px; background: #ffffffd9; color: var(--stage-color, #3674b8); font-size: 11px; font-weight: 600; line-height: 16px; text-align: center; overflow: hidden; white-space: nowrap; pointer-events: none; }
.selection-band.continues-before { margin-left: 0; border-left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.selection-band.continues-after { margin-right: 0; border-right: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.selection-summary { position: sticky; bottom: 0; z-index: 5; display: flex; flex: 0 0 auto; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 9px 15px; min-width: 0; padding: 12px 14px; border: 1px solid #d2e0d5; border-radius: 7px; background: #f3f8f2; color: #536c58; font-size: 14px; line-height: 1.5; box-shadow: 0 -3px 16px #20354105; }
.selection-summary:empty { display: none; }
.selection-summary strong { font-weight: 600; }
.selection-summary .actions { margin-left: auto; }
.stage-check { position: relative; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 28px; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 5px; background: transparent; color: #fff; }
.stage-check::before { content: ""; position: absolute; width: 16px; height: 16px; border: 1px solid #c8d2ca; border-radius: 4px; background: #fff; }
.stage-check .icon { position: relative; z-index: 1; width: 13px; height: 13px; }
.stage-check:not(.checked) .icon { visibility: hidden; }
.stage-check.checked::before { border-color: var(--done); background: var(--done); }
.stage-check.disabled { opacity: .5; cursor: not-allowed; }
.stage-check:not(.disabled):not(:disabled):hover::before { border-color: var(--accent); box-shadow: 0 0 0 3px #e4eee7; }
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 180px; padding: 35px 24px; color: var(--muted); text-align: center; }
.empty > .icon { width: 27px; height: 27px; color: #a4b4a7; }
.empty h2, .empty h3, .empty strong { margin: 0; color: #586c5d; font-size: 15px; font-weight: 500; }
.empty p { max-width: 360px; margin: 0; font-size: 14px; }
.empty .btn { margin-top: 4px; }

/* Selected work stays beside the calendar; the object context follows beneath it. */
.details-panel { grid-area: details; display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.details-panel-head { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 10px; min-height: 49px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.details-panel-head h2, .details-panel-head h3, .details-panel-head strong { margin: 0; color: #526759; font-size: 14px; font-weight: 600; line-height: 1.4; }
.details-panel-head [data-action="details-toggle"] { display: none; }
.details-content { flex: 1 1 auto; min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #c6cfca transparent; }
.details-section { min-width: 0; padding: 18px 16px; border-bottom: 1px solid var(--line); }
.details-section:last-child { border-bottom: 0; }
.details-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; color: #334d3d; font-size: 15px; font-weight: 600; line-height: 1.4; }
.details-heading h2, .details-heading h3, .details-heading strong { margin: 0; color: inherit; font-size: inherit; font-weight: inherit; line-height: inherit; }
.detail-stage-title { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 10px; color: #263f30; font-size: 17px; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.detail-stage-title .dot { display: block; flex: 0 0 9px; width: 9px; height: 9px; margin-top: 8px; border-radius: 3px; background: var(--stage-color, var(--accent)); }
.details-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 10px; margin: 0 0 12px; color: #667b6c; font-size: 13px; line-height: 1.55; overflow-wrap: anywhere; }
.details-meta > span, .details-meta > small { font-size: inherit; }
.detail-label { display: block; margin: 16px 0 5px; color: #66786c; font-size: 12px; font-weight: 600; line-height: 1.5; }
.detail-label:first-child { margin-top: 0; }
.details-text { margin: 0 0 12px; color: #44594c; font-size: 14px; font-weight: 400; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.details-text:last-child { margin-bottom: 0; }
.details-empty { margin: 0; color: #6c7c71; font-size: 13px; line-height: 1.6; }
.details-empty .icon { margin-bottom: 9px; }
.details-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 13px; }
.details-actions .btn { min-height: 34px; padding: 7px 9px; font-size: 12px; white-space: normal; text-align: center; }
.details-actions .text-btn { font-size: 12px; }
.details-actions .btn.danger { color: #9a554b; border-color: #e6d4ce; }
.details-actions .danger-text { color: #a14d3e; }
.details-actions .danger-text:hover { color: #8b3b2f; background: #fbefeb; }
.details-panel .text-error { color: #a43e2e; }
.details-photos + .btn { margin-top: 12px; }
.details-photos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 12px; }
.detail-photo { display: flex; flex-direction: column; gap: 5px; min-width: 0; margin: 0; padding: 0; border: 0; border-radius: 6px; background: transparent; color: #617267; text-align: left; text-decoration: none; }
button.detail-photo, a.detail-photo { cursor: pointer; }
.detail-photo img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; border: 1px solid #e0e7e1; border-radius: 6px; background: #f1f4f0; }
.detail-photo:hover img { border-color: #8da995; }
.detail-photo figcaption, .detail-photo .caption, .detail-photo > span, .detail-photo small { display: block; max-width: 100%; overflow: hidden; color: #637568; font-size: 11px; font-weight: 400; line-height: 1.45; text-overflow: ellipsis; white-space: nowrap; }
.detail-photo-large { display: block; max-width: 100%; width: auto; height: auto; max-height: calc(100dvh - 175px); margin: 0 auto; object-fit: contain; border-radius: 4px; background: #f5f7f3; }
.details-progress { margin-top: 8px; color: #5a7162; font-size: 13px; line-height: 1.5; }
.details-progress > span, .details-progress > strong { display: block; margin-bottom: 7px; font-size: inherit; font-weight: 500; }
.details-progress progress, progress.details-progress { display: block; width: 100%; height: 6px; overflow: hidden; border: 0; border-radius: 5px; background: #e9eee8; accent-color: var(--accent); }
.details-progress progress::-webkit-progress-bar, progress.details-progress::-webkit-progress-bar { border-radius: 5px; background: #e9eee8; }
.details-progress progress::-webkit-progress-value, progress.details-progress::-webkit-progress-value { border-radius: 5px; background: var(--accent); }
.details-progress progress::-moz-progress-bar, progress.details-progress::-moz-progress-bar { border-radius: 5px; background: var(--accent); }
.details-progress .progress-track { height: 6px; overflow: hidden; border-radius: 5px; background: #e9eee8; }
.details-progress .progress-fill { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.details-panel .detail-list { margin-bottom: 0; grid-template-columns: minmax(70px, .75fr) minmax(0, 1.25fr); gap: 9px 12px; font-size: 13px; }
.details-panel .agreement-item { padding: 11px 0; }
.details-panel .agreement-item strong { font-size: 13px; }
.details-panel .agreement-item > span, .details-panel .agreement-item > small, .details-panel .agreement-item p { font-size: 12px; }

/* Editors open beside the calendar and keep the save action in view. */
dialog.drawer { position: fixed; inset: 0 0 0 auto; width: 470px; max-width: 100%; height: 100vh; height: 100dvh; max-height: none; margin: 0; padding: 0; overflow: hidden; border: 0; border-left: 1px solid var(--line); border-radius: 0; background: #fff; color: var(--ink); box-shadow: -12px 0 45px #20354118; }
dialog.drawer[open] { display: flex; flex-direction: column; }
dialog.drawer::backdrop { background: #1d33412e; }
.drawer > form, .drawer > .drawer-content { display: flex; flex: 1 1 auto; flex-direction: column; min-height: 0; overflow: hidden; }
.modal-head { display: flex; flex: 0 0 auto; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 24px 24px 19px; border-bottom: 1px solid var(--line); }
.modal-head > div { min-width: 0; }
.modal-head h2, .modal-head h3 { margin: 0; overflow-wrap: anywhere; }
.modal-head p { margin: 7px 0 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.modal-head .icon-btn { margin: -5px -8px 0 0; }
.modal-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 23px 24px; scrollbar-width: thin; }
.modal-body > h3 { margin: 23px 0 11px; }
.modal-body > h3:first-child { margin-top: 0; }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px 14px; }
label { display: flex; flex-direction: column; gap: 7px; min-width: 0; color: #536458; font-size: 14px; font-weight: 500; }
label > span { line-height: 1.4; }
label > small, .field-hint { color: #6c7b71; font-size: 12px; font-weight: 400; line-height: 1.5; }
input:not([type="checkbox"]):not([type="radio"]), select, textarea { display: block; width: 100%; min-height: 40px; padding: 9px 11px; border: 1px solid #d6ddd7; border-radius: 6px; background: #fff; color: var(--ink); font-size: 14px; line-height: 1.4; font-weight: 400; transition: border-color .14s, background-color .14s; }
input:not([type="checkbox"]):not([type="radio"]):hover, select:hover, textarea:hover { border-color: #acbdb0; }
input::placeholder, textarea::placeholder { color: #758177; opacity: 1; }
input:disabled, select:disabled, textarea:disabled { background: #f5f7f4; color: #89938b; cursor: not-allowed; }
input[readonly] { background: #f8faf7; }
select { padding-right: 27px; }
textarea { min-height: 96px; resize: vertical; line-height: 1.6; }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; accent-color: var(--accent); }
.more-fields { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 14px; margin-top: 1px; }
.more-fields > summary { width: fit-content; padding: 3px 0; color: #6b7d70; font-size: 14px; font-weight: 500; cursor: pointer; }
.more-fields[open] > summary { margin-bottom: 17px; }
.more-fields > .form-grid { margin-bottom: 2px; }
.more-fields > label { margin-top: 15px; }
.status-choice { display: flex; flex-direction: column; gap: 7px; }
.status-choice select { font-weight: 500; }
.modal-actions { position: sticky; bottom: 0; z-index: 3; display: flex; flex: 0 0 auto; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 9px; min-height: 76px; margin-top: auto; padding: 16px 24px; border-top: 1px solid var(--line); background: #fff; }
.modal-actions .btn { min-height: 40px; }
.modal-actions .btn.danger { margin-right: auto; }
.modal-error, .error-box { padding: 12px 14px; border: 1px solid #e8c5bd; border-radius: 6px; background: #fff5f1; color: #a34b36; font-size: 14px; line-height: 1.55; overflow-wrap: anywhere; }
.modal-error { flex: 0 0 auto; margin: 15px 24px 0; }
.modal-error:empty, .error-box:empty { display: none; }
.notice { padding: 12px 14px; margin-bottom: 18px; border: 1px solid #dde7dc; border-radius: 6px; background: #f4f8f1; color: #66765d; font-size: 13px; line-height: 1.6; }
.notice p:last-child { margin-bottom: 0; }
.project-description { margin: 0 0 23px; color: #65746b; font-size: 14px; line-height: 1.65; overflow-wrap: anywhere; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 8px 0 12px; }
.section-heading h3 { margin: 0; font-size: 15px; font-weight: 600; }
.list-toolbar { display: flex; align-items: center; gap: 9px; margin-bottom: 13px; }
.list-toolbar > input { flex: 1 1 auto; min-width: 0; }
.list-toolbar > .btn { flex: 0 0 auto; }
.drawer-list, .agreement-list { display: flex; flex-direction: column; min-width: 0; }
.drawer-list .search-wrap { max-width: none; flex-basis: auto; margin-bottom: 14px; }
.drawer-list .btn.primary { align-self: flex-start; }
.client-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 15px 0; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); text-align: left; }
.client-row:hover { background: #fafcf8; }
.client-copy { flex: 1 1 auto; min-width: 0; min-height: 40px; padding: 0; border: 0; border-radius: 3px; background: transparent; color: inherit; text-align: left; }
.client-copy strong { display: block; margin-bottom: 5px; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.client-copy > span { display: block; color: var(--muted); font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.client-copy small, .client-copy p { display: block; margin: 3px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.contact-due { display: block; margin-top: 6px; color: #ae6945; font-size: 12px; line-height: 1.5; }
.client-copy .contact-due { color: #ae6945; }
.agreement-item { display: block; width: 100%; padding: 16px 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 3px; background: transparent; color: inherit; text-align: left; }
.agreement-item:hover { background: #fafcf8; }
.agreement-item:first-child { padding-top: 3px; }
.agreement-item h3, .agreement-item strong { display: block; margin: 0 0 5px; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.agreement-item p { margin: 5px 0 0; color: #65766a; font-size: 13px; }
.agreement-item > span:not(.agreement-meta) { display: block; font-size: 14px; line-height: 1.5; color: #697b6d; overflow-wrap: anywhere; }
.agreement-item > small { display: block; margin-top: 8px; color: #687a6d; font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.agreement-item > .actions { margin-top: 10px; }
.agreement-meta { display: flex; flex-wrap: wrap; gap: 5px 12px; margin-top: 7px; color: #68786d; font-size: 13px; line-height: 1.5; }
.agreement-meta a { overflow-wrap: anywhere; }
.detail-list { display: grid; grid-template-columns: minmax(90px, .8fr) minmax(0, 1.5fr); gap: 11px 16px; margin: 0 0 24px; font-size: 14px; line-height: 1.5; }
.detail-list dt { color: #6a796f; }
.detail-list dd { margin: 0; color: #425748; overflow-wrap: anywhere; }
.badge { display: inline-flex; align-items: center; min-height: 22px; padding: 3px 7px; border-radius: 4px; background: #eef1ed; color: #778371; font-size: 12px; font-weight: 500; line-height: 1.3; }
.badge.completed, .badge.done, .badge.won { background: #e1f0e5; color: #42764f; }
.badge.in_progress, .badge.ordered, .badge.negotiation { background: #e3eef9; color: #4b729e; }
.badge.overdue, .badge.late { background: #fae8df; color: #a36340; }
.badge.cancelled, .badge.lost { background: #f1e9e7; color: #9c726a; }

/* Login and feedback. */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100%; height: 100%; overflow-y: auto; padding: 38px 22px; background: #f7f8f6; }
.login-box { width: 100%; max-width: 350px; margin: auto; }
.login-box > .brand { margin-bottom: 39px; }
.login-box h1, .login-box h2 { margin: 0 0 10px; font-size: 25px; font-weight: 600; }
.login-box > p { margin: 0 0 25px; color: #66766c; font-size: 14px; }
.login-box form, .login-form { display: flex; flex-direction: column; gap: 18px; }
.login-box form .btn.primary { width: 100%; min-height: 43px; margin-top: 6px; }
.login-error:not(:empty) { margin-bottom: 20px; }
.login-hint { margin-top: 22px; color: #6c7a70; font-size: 12px; line-height: 1.65; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 43px !important; }
.password-toggle { position: absolute; inset: 0 1px 0 auto; display: grid; place-items: center; width: 40px; padding: 0; border: 0; border-radius: 5px; background: transparent; color: #8f9b91; }
.password-toggle:hover { color: var(--accent); }
.loading, .boot { display: flex; flex: 1 1 auto; align-items: center; justify-content: center; gap: 11px; min-height: 150px; padding: 36px 22px; color: var(--muted); font-size: 14px; }
.boot { min-height: 100%; }
.spinner { display: inline-block; width: 20px; height: 20px; flex: 0 0 auto; border: 2px solid #dce6de; border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#notifications { position: fixed; right: 22px; bottom: 22px; z-index: 100; max-width: calc(100vw - 44px); pointer-events: none; }
.notification { padding: 13px 17px; max-width: 420px; border: 1px solid #c1d7c9; border-radius: 8px; background: #f4fbf5; color: #386448; box-shadow: 0 5px 22px #20354115; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; pointer-events: auto; }
.notification.error { border-color: #dfb7aa; background: #fff4ee; color: #a05439; }

@media (min-width: 1600px) {
  .app-header { padding-left: 30px; padding-right: 30px; }
  .workspace { padding: 18px 30px 14px; }
  .planner-shell { grid-template-columns: 212px minmax(0, 1fr) 300px; gap: 20px; }
  .months-grid { gap: 18px; }
  .month-card { padding: 14px 17px; }
}
@media (max-width: 1279px) {
  .planner-shell { grid-template-columns: 200px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; grid-template-areas: "objects calendar" "objects details"; }
  .details-panel { max-height: min(360px, 40dvh); }
  .details-panel-head { min-height: 44px; padding: 6px 14px; border-bottom: 0; }
  .details-panel-head [data-action="details-toggle"] { display: inline-flex; }
  .details-content { display: none; }
  .details-panel.is-open .details-panel-head { border-bottom: 1px solid var(--line); }
  .details-panel.is-open .details-content { display: block; }
  .details-photos { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
}
@media (max-width: 1150px) {
  .app-header { padding-left: 18px; padding-right: 18px; }
  .workspace { padding: 17px 18px 10px; }
  .planner-shell { grid-template-columns: 190px minmax(0, 1fr); gap: 14px; }
  .planner-toolbar { flex-wrap: wrap; gap: 10px; }
  .range-nav { margin-left: auto; }
  .stage-palette { gap: 6px; }
  .stage-tool { padding: 7px 9px; min-height: 40px; font-size: 13px; }
  .stage-tool strong { font-size: 13px; }
  .month-card { padding: 11px; }
  .months-grid { gap: 12px; }
}
@media (max-width: 850px) {
  .planner-shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; grid-template-areas: "objects" "calendar" "details"; gap: 12px; }
  .project-sidebar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(120px, 190px); grid-template-rows: auto auto; grid-template-areas: "heading search" "objects objects"; gap: 6px 12px; padding: 8px; }
  .project-list-head { grid-area: heading; padding: 0 3px; min-width: 0; justify-content: flex-start; }
  .project-search { grid-area: search; padding: 0; }
  .project-list { grid-area: objects; flex-direction: row; gap: 5px; padding: 0 0 2px; overflow-x: auto; overflow-y: hidden; }
  .object-item { flex: 0 0 160px; width: 160px; padding: 8px 10px; }
  .object-item strong { margin-bottom: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .project-sidebar .empty { min-height: 52px; padding: 10px; }
  .project-sidebar .empty h3 { font-size: 14px; }
  .planner-toolbar { flex-wrap: wrap; }
  .planner-project-title { font-size: 17px; }
  .range-nav { gap: 3px; }
  .period-label { min-width: 140px; font-size: 13px; }
}
@media (max-width: 600px) {
  /* Let the document grow: the controls must never squeeze the calendar to zero. */
  html, body { height: auto; min-height: 100%; }
  body { min-height: 100dvh; overflow-x: hidden; overflow-y: auto; }
  #root { height: auto; min-height: 100dvh; }
  .app-shell { height: auto; min-height: 100dvh; overflow: visible; }
  .app-header { min-height: 62px; padding: 9px 12px; gap: 10px; }
  .brand { gap: 8px; }
  .brand-mark { width: 29px; height: 32px; font-size: 18px; }
  .brand-text { font-size: 15px; letter-spacing: -.35px; }
  .brand-text small { display: none; }
  .header-actions { gap: 3px; }
  .header-actions .secondary-label, .header-actions .btn .label { display: none; }
  .header-actions .btn { min-width: 44px; padding: 9px; font-size: 13px; }
  .account-menu { margin-left: 2px; }
  .account-menu > summary { min-width: 44px; min-height: 44px; justify-content: center; }
  .account-popover { top: calc(100% + 6px); }
  .workspace { flex: 0 0 auto; padding: 10px 10px calc(88px + env(safe-area-inset-bottom)); gap: 8px; }
  .planner-shell { display: flex; flex: 0 0 auto; flex-direction: column; height: auto; gap: 10px; }
  .project-sidebar { grid-template-columns: minmax(0, 1fr) minmax(120px, 155px); gap: 5px 9px; padding: 6px 7px; border-radius: 7px; }
  .project-list-head h2 { font-size: 14px; }
  .project-list-head .icon-btn { width: 44px; min-height: 44px; }
  .object-item { flex-basis: 145px; width: 145px; min-height: 49px; padding: 7px 9px; }
  .object-item strong { font-size: 13px; }
  .object-item small { font-size: 11px; }
  .planner-main { flex: 0 0 auto; height: auto; gap: 8px; }
  .planner-toolbar { flex-wrap: wrap; gap: 4px 8px; }
  .planner-toolbar > div:first-child { flex: 1 1 100%; }
  .planner-project-title { font-size: 16px; }
  .planner-toolbar small { margin-top: 3px; font-size: 12px; }
  .range-nav { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; grid-template-rows: 44px 44px; width: 100%; gap: 2px 6px; margin-left: 0; }
  .planner-toolbar .range-nav input.month-picker { grid-column: 2; grid-row: 1; width: 100%; min-width: 0; min-height: 44px; font-size: 15px; text-align: center; }
  .range-nav [data-action="paint-prev"] { grid-column: 1; grid-row: 1; }
  .range-nav [data-action="paint-next"] { grid-column: 3; grid-row: 1; }
  .range-nav [data-action="paint-today"] { grid-column: 2; grid-row: 2; justify-self: center; }
  .range-nav [data-action="project-open"] { grid-column: 1; grid-row: 2; }
  .range-nav [data-action="refresh"] { grid-column: 3; grid-row: 2; }
  .period-label { min-width: 0; flex: 1 1 auto; font-size: 13px; }
  .range-nav .btn.small { margin-left: 0; padding-left: 13px; padding-right: 13px; font-size: 13px; }
  .stage-palette { position: sticky; top: 0; z-index: 12; flex-wrap: nowrap; gap: 7px; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; padding: 7px 2px; background: var(--surface); scrollbar-width: thin; }
  .stage-tool { min-height: 44px; padding: 7px 10px; font-size: 13px; }
  .stage-tool strong { font-size: 13px; }
  .stage-tool small { font-size: 11px; }
  .palette-add { min-height: 44px; }
  .other-stage-tools > summary { min-height: 44px; }
  .stage-palette:has(.other-stage-tools[open]) { flex-wrap: wrap; overflow: visible; }
  .palette-hint { font-size: 12px; }
  .selected-stage-tools { gap: 5px 8px; font-size: 12px; }
  .selected-stage-tools [data-action="stage-edit"], .selected-stage-tools [data-action="stage-toggle"] { display: none; }
  .selected-stage-tools .btn.small { min-height: 44px; padding: 7px 9px; font-size: 12px; }
  .paint-status, .read-only { font-size: 12px; }
  .calendar-scroll { flex: 0 0 auto; height: auto; min-height: 0; overflow: visible; overscroll-behavior: auto; padding: 1px 1px 5px; }
  .months-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .month-card { padding: 12px; border-radius: 8px; }
  .month-headline { margin-bottom: 9px; }
  .month-card h3 { font-size: 15px; }
  .weekdays { min-height: 27px; font-size: 12px; }
  .week-row { min-height: max(56px, calc(26px + var(--lanes) * 23px)); }
  .date-cell { font-size: 14px; }
  .date-cell .date-number { top: 5px; left: 7px; }
  .date-cell.today .date-number { top: 3px; left: 5px; }
  .work-band { font-size: 11px; padding-left: 4px; padding-right: 4px; }
  .details-panel { position: fixed; left: 10px; right: 10px; bottom: max(10px, env(safe-area-inset-bottom)); z-index: 25; width: auto; max-height: none; border-radius: 8px; box-shadow: 0 -3px 16px #20354112; }
  .details-panel.is-open { position: fixed; left: 10px; right: 10px; bottom: max(10px, env(safe-area-inset-bottom)); z-index: 25; width: auto; max-height: min(500px, 65dvh); border-color: #c6d5cb; box-shadow: 0 -8px 32px #20354124; }
  .details-panel-head { padding: 4px 12px; }
  .details-panel-head h2, .details-panel-head h3, .details-panel-head strong { font-size: 13px; }
  .details-section { padding: 16px 14px; }
  .details-actions .btn, .details-actions .text-btn { min-height: 44px; font-size: 13px; }
  .details-photos { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .detail-photo figcaption, .detail-photo .caption, .detail-photo > span, .detail-photo small { font-size: 11px; }
  .selection-summary { padding: 9px 11px; font-size: 13px; }
  .selection-summary .actions { width: 100%; justify-content: flex-end; }
  .btn, .btn.small, .icon-btn, .text-btn, .client-copy { min-height: 44px; }
  .icon-btn { width: 44px; }
  .stage-check { flex-basis: 44px; width: 44px; height: 44px; }
  dialog.drawer { width: 100%; max-width: 100%; border-left: 0; }
  .modal-head { padding: 20px 18px 16px; }
  .modal-head h2 { font-size: 20px; }
  .modal-head .icon-btn { margin-top: -10px; margin-right: -9px; }
  .modal-body { padding: 20px 18px; }
  .modal-actions { padding: 13px 18px max(13px, env(safe-area-inset-bottom)); gap: 8px; }
  .modal-actions .btn { min-height: 44px; }
  .modal-actions .btn.primary { flex: 1 1 auto; }
  .modal-error { margin: 13px 18px 0; }
  input:not([type="checkbox"]):not([type="radio"]), select, textarea { min-height: 44px; font-size: 16px; }
  .form-grid { gap: 17px 12px; }
  .form-grid label { font-size: 14px; }
  .login-page { height: auto; min-height: 100dvh; }
  .login-box { max-width: 350px; }
  .login-box form .btn.primary { min-height: 46px; }
  #notifications { left: 12px; right: 12px; bottom: calc(80px + env(safe-area-inset-bottom)); max-width: none; }
  .notification { max-width: none; }
}
@media (max-width: 400px) {
  .brand-text { font-size: 14px; }
  .brand-mark { width: 27px; }
  .header-actions .btn { padding: 9px 6px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .detail-list { grid-template-columns: minmax(70px, .7fr) minmax(0, 1.3fr); gap: 10px; }
  .month-card { padding: 9px; }
  .project-sidebar { grid-template-columns: minmax(0, 1fr) minmax(110px, 140px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
