:root {
  color-scheme: light;
  --ink: #16332a;
  --muted: #4e675d;
  --paper: #f6f8f1;
  --white: #fff;
  --line: #d4e1d6;
  --forest: #10382a;
  --forest-deep: #09271e;
  --green: #236848;
  --light: #d9efda;
  --mist: #e9f3e6;
  --lime: #c6ee9d;
  --gold: #ffeed3;
  --gold-ink: #764d10;
  --red: #fae4df;
  --red-ink: #862c28;
  --amber-line: #b97726;
  --shadow: 0 12px 35px #14332712;
  --radius: 16px;
  --gap: 18px;
  --limit: 1340px;
  --pad: clamp(16px, 3vw, 44px);
  --rail-width: 218px;
  font-family: "Aptos", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .64; }
button:active:not(:disabled) { transform: translateY(1px); }
:focus-visible { outline: 3px solid var(--green); outline-offset: 3px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(28px, 4.3vw, 49px); line-height: 1.05; letter-spacing: -.038em; overflow-wrap: anywhere; }
h2 { font-size: 17px; line-height: 1.25; }
p { line-height: 1.55; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; min-width: 0; }
input:not([type=checkbox]), select, textarea {
  width: 100%; min-width: 0; color: var(--ink); background: var(--white);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 11px;
}
input::placeholder { color: var(--muted); }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--green); margin: 0; }
textarea { resize: vertical; }
input[type=file] { padding-inline: 8px; }
.initial-status { padding: var(--pad); }

.button {
  flex-shrink: 0; padding: 8px 12px; min-height: 38px; border: 1px solid transparent;
  border-radius: 8px; background: transparent; color: var(--ink); font-size: 13px; line-height: 1.2;
  font-weight: 650; text-align: center;
}
.primary { background: var(--green); color: var(--white); }
.primary:hover { background: var(--forest); }
.secondary { border-color: var(--line); background: var(--white); }
.secondary:hover, .quiet:hover { background: var(--mist); }
.light { background: var(--lime); color: var(--forest-deep); }
.light:hover { background: var(--white); }
.pill {
  display: inline-flex; align-items: center; min-height: 24px; padding: 3px 9px; border-radius: 25px;
  background: var(--paper); color: var(--muted); font-size: 12px; font-weight: 600;
}
.pill.good { background: var(--mist); color: var(--green); }
.pill.amber { background: var(--gold); color: var(--gold-ink); }
.pill.danger { background: var(--red); color: var(--red-ink); }

.brand { display: inline-flex; align-items: center; gap: 10px; width: fit-content; text-decoration: none; }
.brand-title { font-size: 20px; font-weight: 750; letter-spacing: -.035em; }
.brand-mark { display: flex; gap: 3px; align-items: end; justify-content: center; width: 34px; height: 34px; padding: 7px 5px; border-radius: 8px; background: var(--lime); }
.brand-mark i { width: 5px; background: var(--forest); display: block; border-radius: 1px; }
.brand-mark i:nth-child(1) { height: 8px; }
.brand-mark i:nth-child(2) { height: 13px; }
.brand-mark i:nth-child(3) { height: 19px; }
.app-header { border-bottom: 1px solid var(--line); background: var(--white); }
.header-inner, .workspace { width: 100%; max-width: var(--limit); padding-inline: var(--pad); margin: 0 auto; }
.header-inner { min-height: 69px; display: flex; align-items: center; justify-content: flex-end; padding-block: 10px; }
.account { display: flex; align-items: center; gap: 12px; }
.account div { text-align: right; overflow-wrap: anywhere; }
.account small { display: block; color: var(--muted); }
.offline-link { margin-right: auto; flex-shrink: 0; }
.offline-link[aria-current] { border-color: var(--green); }
.offline-notice { margin: 0 0 16px; padding: 12px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--white); }
.offline-panels { display: grid; gap: 12px; }
.offline-draft { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: start; gap: 8px;
  padding-block: 10px; overflow-wrap: anywhere; }
.offline-draft + .offline-draft { border-top: 1px solid var(--line); }
.offline-draft summary { cursor: pointer; }
.offline-draft p { margin: 6px 0 0; }
.page-shell { display: grid; grid-template: auto 1fr / var(--rail-width) minmax(0, 1fr); min-height: 100dvh; }
.section-rail { grid-row: 1 / 3; align-self: start; position: sticky; top: 0; height: 100dvh; overflow: auto; padding: 20px 14px; background: var(--forest); color: var(--white); }
.section-rail .brand { margin: 0 8px 24px; }
.section-rail :focus-visible { outline-color: var(--lime); outline-offset: -2px; }
.primary-nav { display: grid; gap: 4px; }
.primary-nav a { display: block; padding: 10px 12px; min-height: 40px; border-radius: 8px; white-space: nowrap; color: var(--light); font-size: 14px; font-weight: 650; }
.primary-nav a:hover { color: var(--white); background: var(--forest-deep); text-decoration: none; }
.primary-nav a[aria-current] { background: var(--lime); color: var(--forest-deep); }
.primary-nav a:focus-visible[aria-current] { outline-color: var(--forest); }
.workspace { min-width: 0; padding-block: 30px 60px; }
.inbox-grid { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(0, 2fr); align-items: start; gap: var(--gap); }
.inbox-grid a[aria-current], .inbox-grid a:hover, .panel-head a { color: var(--green); text-decoration: underline; }
.inbox-grid .filter-switch { margin: 0 0 12px; }
.permissions-matrix { display: grid; gap: var(--gap); }
.permissions-matrix .table-scroll { margin: 0; }
.permissions-matrix th:not(:first-child), .permissions-matrix td:not(:first-child) {
  text-align: center;
}
.permissions-matrix th:first-child, .permissions-matrix td:first-child { min-width: 170px; }
.permissions-matrix input[disabled] { cursor: default; }
.permissions-actions { position: sticky; bottom: 0; padding: 12px; display: flex;
  justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 10px;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); }
.profile-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.page-title { display: flex; align-items: end; justify-content: space-between; gap: var(--gap); margin-bottom: 20px; }
.page-title p { color: var(--muted); margin-top: 9px; }
.page-title.title-band {
  padding: clamp(22px, 4vw, 42px); color: var(--white); background-color: var(--forest);
  background-image: linear-gradient(90deg, var(--forest), transparent 72%),
    repeating-linear-gradient(115deg, transparent 0 28px, #36936f25 29px 30px);
  border-radius: var(--radius);
}
.title-band p { color: var(--light); }
.title-band :focus-visible { outline-color: var(--lime); }
.plain h1 { font-size: clamp(26px, 4vw, 40px); }
.back-link { color: var(--green); display: inline-block; margin-bottom: 14px; font-size: 14px; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0 0 24px; }
.metric {
  display: grid; gap: 6px; align-content: start; min-width: 0;
  padding: 15px 17px; border: 1px solid var(--line); border-radius: 11px; background: var(--white);
}
.metric span, .metric small { color: var(--muted); font-size: 13px; }
.metric strong { font-size: clamp(20px, 3vw, 32px); letter-spacing: -.04em; overflow-wrap: anywhere; }
.filter-bar { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin-bottom: 17px; }
.filter-bar label { min-width: min(148px, 100%); }
.filter-bar .search { flex: 1 1 210px; max-width: 430px; }
.switch { display: flex; flex-wrap: wrap; gap: 4px; padding: 3px; border-radius: 9px; border: 1px solid var(--line); background: var(--white); width: fit-content; }
.switch button { border: 0; border-radius: 6px; padding: 7px 9px; min-height: 32px; background: transparent; color: var(--muted); font-size: 13px; }
.switch button:hover { background: var(--paper); color: var(--ink); }
.switch button[aria-pressed=true] { background: var(--light); color: var(--forest); font-weight: 700; }
.filter-switch { margin-bottom: 15px; }
.project-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
.project-card {
  position: relative; display: flex; align-items: start; justify-content: space-between; gap: 14px; min-width: 0;
  padding: 21px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
}
.project-card:hover { border-color: var(--green); box-shadow: var(--shadow); }
.project-card-main { min-width: 0; flex: 1; }
.project-class { display: flex; gap: 6px; flex-wrap: wrap; }
.project-class .pill { background: var(--mist); color: var(--green); }
.project-card h2 { margin: 10px 0 5px; font-size: 21px; overflow-wrap: anywhere; }
.project-card p, .project-meta, .meter-label { color: var(--muted); font-size: 13px; }
.meter-label, .project-meta { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; }
.meter-label { margin-top: 22px; }
.project-meta { margin-top: 8px; }
.project-arrow {
  flex: none; width: 37px; height: 37px; display: grid; place-items: center;
  font-size: 21px; border-radius: 18px; background: var(--mist); color: var(--green);
}
.project-arrow:hover { text-decoration: none; background: var(--light); }
progress { width: 100%; height: 7px; border: none; border-radius: 10px; background: var(--mist); color: var(--green); }
progress::-webkit-progress-bar { background: var(--mist); border-radius: 10px; }
progress::-webkit-progress-value { background: var(--green); border-radius: 10px; }

.subnav { display: flex; gap: 4px; overflow-x: auto; padding: 3px 3px 9px; margin: 0 0 19px; border-bottom: 1px solid var(--line); }
.subnav a { border-radius: 7px; padding: 9px 11px; white-space: nowrap; font-size: 13px; color: var(--muted); }
.subnav a:hover { background: var(--mist); color: var(--green); text-decoration: none; }
.subnav a[aria-current] { background: var(--forest); color: var(--white); }
.overview-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: var(--gap); align-items: start; }
.sidebar-stack, .stage-stack { display: grid; gap: var(--gap); min-width: 0; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); min-width: 0; }
.panel-head {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px;
  min-height: 55px; padding: 11px 17px; border-bottom: 1px solid var(--line);
}
.panel-body { padding: 14px 17px; min-width: 0; }
.panel-note { font-size: 14px; color: var(--muted); margin-bottom: 12px; }
.empty { padding: 18px 3px; color: var(--muted); }
.empty strong { color: var(--ink); }
.empty p { margin-top: 5px; font-size: 14px; }
.stage-stack { gap: 10px; }
.stage-item { display: grid; gap: 7px; border: 1px solid var(--line); padding: 13px; border-radius: 9px; }
.stage-item button { justify-self: start; margin-left: -8px; }
.stage-top, .stage-timing { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 7px; align-items: center; }
.stage-timing { color: var(--muted); font-size: 13px; }
.item-row { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 12px; padding-block: 9px; }
.item-row > div { flex: 1 1 180px; min-width: 0; overflow-wrap: anywhere; }
.item-row small { display: block; margin-top: 3px; }
.item-row + .item-row, .archive-item + .archive-item, .message + .message { border-top: 1px solid var(--line); }
.archive-item { padding-block: 8px; }
.record-note { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; margin-bottom: 8px; }
small { color: var(--muted); font-size: 12px; }
.feed-item { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: 12px; margin-bottom: 16px; }
.feed-item strong, .feed-item small { display: block; margin-bottom: 3px; }
.feed-item p { color: var(--muted); font-size: 14px; }
.feed-dot { display: inline-block; margin-top: 5px; align-self: start; aspect-ratio: 1; border: 3px solid var(--light); background: var(--green); border-radius: 50%; }
.message { padding: 12px 0; }
.message small { margin-left: 7px; }
.message p { margin-top: 5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.attachments { display: flex; flex-wrap: wrap; gap: 10px; padding-block: 6px; }
.attachments a { display: grid; gap: 6px; min-width: 65px; max-width: 170px; padding: 7px; color: var(--green); border: 1px solid var(--line); border-radius: 8px; font-size: 13px; overflow-wrap: anywhere; }
.attachments img { display: block; width: 100%; height: 86px; object-fit: cover; border-radius: 5px; }

.chart-scroll, .table-scroll { overflow: auto; }
.chart { min-width: 650px; padding: 6px 5px; }
.chart-line { display: grid; grid-template-columns: 180px minmax(0, 1fr); align-items: center; gap: 10px; min-height: 53px; }
.chart-line + .chart-line { border-top: 1px solid var(--line); }
.chart-scale { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
.chart-label button { text-align: left; display: block; max-width: 100%; min-height: 26px; padding: 4px; overflow-wrap: anywhere; }
.chart-label small { display: block; padding: 0 4px 4px; }
.chart-track { position: relative; min-height: 34px; background: repeating-linear-gradient(to right, transparent 0 calc(25% - 1px), var(--line) calc(25% - 1px) 25%); }
.bar, .day-marker { position: absolute; left: var(--from); }
.bar { width: var(--width); top: 11px; height: 12px; border-radius: 3px; background: var(--green); }
.bar.plan { top: 6px; height: 8px; background: var(--light); border: 1px solid var(--green); }
.bar.actual { top: 18px; }
.bar.overdue { background: var(--red-ink); }
.bar.milestone { width: 9px; height: 9px; transform: translateX(-50%) rotate(45deg); }
.day-marker { border-left: 2px solid var(--amber-line); top: 0; bottom: 0; }
.legend { display: flex; flex-wrap: wrap; gap: 7px 17px; margin-top: 12px; color: var(--muted); font-size: 12px; }
.legend i { display: inline-block; width: 12px; height: 6px; margin-right: 5px; background: var(--green); border-radius: 3px; }
.legend .legend-plan { background: var(--light); border: 1px solid var(--green); }
.legend .legend-delay { background: var(--red-ink); }
.legend .legend-today { background: var(--amber-line); }
table { width: 100%; border-collapse: collapse; font-size: 14px; text-align: left; }
th, td { border-bottom: 1px solid var(--line); padding: 10px; white-space: nowrap; }
th { font-size: 12px; color: var(--muted); background: var(--mist); }
td:first-child, td:last-child { white-space: normal; }
td:first-child { min-width: 130px; }
td small { display: block; margin-top: 3px; }
tfoot { font-weight: 700; }
.team-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.person-card { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 15px; background: var(--white); border: 1px solid var(--line); border-radius: 9px; }
.person-card div { flex: 1; }
.person-card p, .person-card > span:not(.avatar) { color: var(--muted); font-size: 13px; }
.avatar { display: grid; place-items: center; background: var(--mist); color: var(--green); width: 38px; height: 38px; border-radius: 50%; font-weight: 750; }

.welcome { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1fr); }
.welcome-stripe { background: repeating-linear-gradient(120deg, var(--forest), var(--forest) 35px, var(--forest-deep) 36px, var(--forest) 38px); }
.welcome-card { align-self: center; max-width: 560px; padding: clamp(20px, 6vw, 80px); }
.welcome-card h1 { margin-top: 24px; }
.welcome-card p { color: var(--muted); margin-top: 9px; }
.welcome-card form { display: grid; gap: 10px; margin: 16px 0 10px; }
.welcome-card form .button { justify-self: start; }
dialog { width: min(590px, calc(100% - 24px)); max-height: calc(100dvh - 26px); padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); box-shadow: var(--shadow); }
dialog::backdrop { background: #102d22a0; }
.dialog-heading { display: flex; justify-content: space-between; align-items: start; gap: 12px; margin-bottom: 12px; }
.dialog-heading h2 { font-size: 22px; overflow-wrap: anywhere; }
.form-fields, .record-detail { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.wide { grid-column: 1 / -1; }
.form-project { color: var(--muted); font-size: 13px; padding-bottom: 8px; }
.check { display: flex; flex-direction: row; align-items: center; }
.form-error { color: var(--red-ink) !important; font-size: 14px; margin-top: 8px; }
.form-error:empty { display: none; }
dialog footer { display: flex; justify-content: end; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.record-detail dt { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.record-detail dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
#toast { position: fixed; z-index: 2; right: 15px; bottom: 15px; max-width: calc(100vw - 30px); padding: 12px 15px; background: var(--forest-deep); color: var(--white); border-radius: 9px; }

@media (max-width: 800px) {
  .page-shell { display: block; }
  .section-rail { position: static; height: auto; padding: 13px var(--pad) 10px; }
  .section-rail .brand { margin: 0 0 8px; }
  .primary-nav { display: flex; overflow: auto; padding-bottom: 4px; }
  .primary-nav a { padding-inline: 10px; }
  .header-inner { min-height: 52px; }
  .inbox-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .workspace { padding-top: 18px; }
  .project-grid, .overview-grid, .team-grid { grid-template-columns: minmax(0, 1fr); }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-title { align-items: start; flex-direction: column; }
  .welcome { display: block; }
  .welcome-stripe { height: 14px; }
}
@media (max-width: 430px) {
  .brand-title { font-size: 16px; }
  .account { gap: 5px; }
  .account strong { font-size: 12px; }
  .account .pill { display: none; }
  .form-fields { grid-template-columns: minmax(0, 1fr); }
  .panel-body, .panel-head { padding-inline: 11px; }
}

.document-files, .pending-files { padding: 0; margin: 0; list-style: none; }
.document-files li, .pending-files li {
  display: flex; align-items: center; justify-content: space-between; gap: var(--gap);
  padding: 8px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere;
}
.document-files small { display: block; color: var(--muted); }
.document-files a, .project-customers a { color: var(--green); text-decoration: underline; }
.file-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.file-actions button, .pending-files button { flex-shrink: 0; }
.file-picker, .group-members { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.file-picker input { max-width: 100%; display: block; margin-bottom: 6px; }
.file-picker small { color: var(--muted); }
.project-customers { margin: -6px 0 var(--gap); overflow-wrap: anywhere; }
.project-customers strong { margin-inline-end: 8px; }
.payroll-progress label { display: block; margin-bottom: 8px; }
.payroll-progress progress { width: 100%; }
.chat-scrollback { max-height: min(50vh, 36rem); overflow: auto; margin-block: 8px; }
.chat-scrollback p { white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-scrollback .own-message { background: var(--mist); }
#chat-compose:not([hidden]) { display: grid; gap: 8px; margin-top: var(--gap); }
#chat-compose button { justify-self: end; }
.group-members { max-height: 45vh; overflow: auto; }
.group-members .check { padding: 7px 0; }
@media (max-width: 480px) {
  .document-files li { align-items: start; flex-direction: column; gap: 5px; }
}
