:root {
  --bg: #f7f5ef;
  --panel: #ffffff;
  --panel-soft: #fbfaf6;
  --ink: #171716;
  --muted: #716d64;
  --line: #ded9cf;
  --brand: #897b66;
  --brand-dark: #2b2925;
  --green: #687160;
  --amber: #9d7f4f;
  --red: #9a4639;
  --blue: #566d76;
  --nav: #111111;
  --shadow: none;
}

body[data-theme="dark"] {
  --bg: #151512;
  --panel: #1d1d19;
  --panel-soft: #24231f;
  --ink: #f5f2ea;
  --muted: #b7afa2;
  --line: #3a3730;
  --brand: #b6a78e;
  --brand-dark: #f5f2ea;
  --green: #9aa88f;
  --amber: #c2a268;
  --red: #d17a68;
  --blue: #8faab4;
  --nav: #050505;
}

* {
  box-sizing: border-box;
}

*,
*::before,
*::after {
  border-radius: 0 !important;
  box-shadow: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 400;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(120deg, rgba(17, 17, 17, 0.94), rgba(43, 41, 37, 0.82)),
    radial-gradient(circle at top left, rgba(137, 123, 102, 0.38), transparent 34%),
    var(--nav);
}

.auth-screen[hidden] {
  display: none;
}

.auth-card {
  width: min(480px, 100%);
  padding: 28px;
  overflow: hidden;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 0;
  box-shadow: none;
}

.auth-brand {
  display: block;
  min-height: 0;
  margin-bottom: 34px;
  color: var(--ink);
}

.auth-logo-image {
  display: block;
  width: min(300px, 100%);
  height: auto;
  max-width: none;
  max-height: none;
}

.auth-card h1 {
  margin-bottom: 18px;
  font-size: clamp(21px, 2.4vw, 26px);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.auth-link {
  justify-self: start;
  padding: 0;
  color: var(--brand);
  background: transparent;
  border: 0;
  font-size: 13px;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.auth-link:hover {
  color: var(--ink);
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  width: 252px;
  padding: 22px 16px;
  color: #f7f5ef;
  background: var(--nav);
  transition: width 160ms ease;
}

.sidebar-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 10px;
  align-items: start;
  margin-bottom: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  margin-bottom: 0;
  min-width: 0;
}

.brand-logo-wrap {
  display: grid;
  place-items: center;
  flex: 0 0 52px;
  height: 52px;
  padding: 8px;
  background: #f7f5ef;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 0;
}

.brand-logo-wrap img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.sidebar .brand-logo-wrap {
  background: transparent;
  border-color: transparent;
}

.brand-logo-compact {
  display: none;
}

.sidebar .brand-logo-full {
  display: none;
}

.sidebar .brand-logo-compact {
  display: block;
}

.brand strong,
.brand small {
  display: block;
}

.brand-text {
  min-width: 0;
}

.brand strong {
  font-size: 18px;
  font-weight: 500;
}

.brand small {
  color: #bbb4a8;
  font-size: 12px;
}

nav {
  display: grid;
  gap: 6px;
}

nav a {
  position: relative;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 42px;
  padding: 10px 12px;
  color: #d7d1c6;
  border-radius: 0;
  font-weight: 400;
  font-size: 14px;
}

.nav-icon {
  display: block;
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: square;
  stroke-linejoin: miter;
}

.nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

nav a.active,
nav a:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.11);
}

.nav-projects {
  position: relative;
  display: grid;
}

.nav-projects::after {
  content: "";
  position: absolute;
  top: 0;
  left: 100%;
  display: none;
  width: 14px;
  height: 100%;
}

.project-flyout {
  position: absolute;
  left: 100%;
  top: 0;
  z-index: 40;
  display: none;
  width: 360px;
  max-height: min(520px, calc(100vh - 40px));
  overflow-y: auto;
  padding: 8px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
}

.nav-projects:hover .project-flyout,
.nav-projects:hover::after,
.nav-projects:focus-within .project-flyout {
  display: grid;
  gap: 4px;
}

.project-flyout button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  color: var(--ink);
  background: transparent;
  border: 1px solid transparent;
  text-align: left;
  font-weight: 400;
}

.project-flyout button:hover,
.project-flyout button.active {
  background: var(--panel-soft);
  border-color: var(--line);
}

body[data-theme="dark"] .project-flyout {
  background: var(--panel);
  border-color: var(--line);
}

.sidebar-meta {
  display: grid;
  gap: 8px;
  margin-top: auto;
  color: #bbb4a8;
  font-size: 13px;
}

.sidebar-button {
  justify-self: start;
  min-height: 32px;
  padding: 6px 10px;
  color: #f7f5ef;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 0;
  font-weight: 500;
}

.sidebar-toggle {
  width: 42px;
  min-height: 42px;
  color: #f7f5ef;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-weight: 500;
}

.sidebar-tools {
  display: grid;
  gap: 8px;
  margin-bottom: 22px;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  justify-content: center;
}

.theme-icon {
  font-size: 14px;
  line-height: 1;
}

body.sidebar-collapsed .sidebar {
  width: 84px;
  padding-inline: 12px;
}

body.sidebar-collapsed main {
  margin-left: 84px;
}

body.sidebar-collapsed .sidebar-head {
  grid-template-columns: 1fr;
}

body.sidebar-collapsed .brand {
  justify-content: center;
}

body.sidebar-collapsed .brand-logo-wrap {
  flex-basis: 54px;
  width: 54px;
}

body.sidebar-collapsed .brand-logo-full {
  display: none;
}

body.sidebar-collapsed .brand-logo-compact {
  display: block;
}

body.sidebar-collapsed .brand-text,
body.sidebar-collapsed #themeLabel,
body.sidebar-collapsed .sidebar-meta span,
body.sidebar-collapsed .sidebar-meta .sidebar-button {
  display: none;
}

body.sidebar-collapsed .sidebar-toggle {
  width: 100%;
}

body.sidebar-collapsed nav a {
  display: grid;
  grid-template-columns: 1fr;
  place-items: center;
  padding: 10px 4px;
}

body.sidebar-collapsed .nav-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

body.sidebar-collapsed .nav-icon {
  width: 20px;
  height: 20px;
}

body.sidebar-collapsed .nav-projects {
  gap: 0;
}

body.sidebar-collapsed .project-flyout {
  left: calc(100% + 12px);
  top: 0;
}

body.sidebar-collapsed .sidebar-meta {
  display: none;
}

main {
  min-height: 100vh;
  margin-left: 252px;
  padding: 24px;
  transition: margin-left 160ms ease;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

body[data-page="overview"] #addProjectBtn {
  display: none;
}

body[data-page="overview"] .page-title {
  display: none;
}

body[data-page="overview"] .topbar {
  margin-bottom: 12px;
}

body[data-page="subs"] .topbar,
body[data-page="subs"] .metrics,
body[data-page="subs"] .overview-command,
body[data-page="subs"] .overview-grid,
body[data-page="subs"] #generalTasks {
  display: none;
}

body[data-page="inbox"] .topbar,
body[data-page="inbox"] .metrics,
body[data-page="inbox"] .overview-command,
body[data-page="inbox"] .overview-grid,
body[data-page="inbox"] #generalTasks {
  display: none;
}

body[data-page="users"] .topbar,
body[data-page="users"] .metrics,
body[data-page="users"] .overview-command,
body[data-page="users"] .overview-grid,
body[data-page="users"] #generalTasks {
  display: none;
}

body[data-page="admin"] .topbar,
body[data-page="admin"] .metrics,
body[data-page="admin"] .overview-command,
body[data-page="admin"] .overview-grid,
body[data-page="admin"] #generalTasks {
  display: none;
}

body[data-page="schedule"] .topbar,
body[data-page="schedule"] .metrics,
body[data-page="schedule"] .overview-command,
body[data-page="schedule"] .overview-grid,
body[data-page="schedule"] #generalTasks {
  display: none;
}

body[data-page="workflow"] .topbar,
body[data-page="workflow"] .metrics,
body[data-page="workflow"] .overview-command,
body[data-page="workflow"] .overview-grid,
body[data-page="workflow"] #generalTasks,
body[data-page="workflow"] .project-context {
  display: none;
}

body[data-page="project"] .topbar,
body[data-page="project"] .metrics,
body[data-page="project"] .overview-command,
body[data-page="project"] .overview-grid,
body[data-page="project"] #generalTasks,
body[data-page="project"] .project-context {
  display: none;
}

body[data-page="selections"] .topbar,
body[data-page="selections"] .metrics,
body[data-page="selections"] .overview-command,
body[data-page="selections"] .overview-grid,
body[data-page="selections"] #generalTasks {
  display: none;
}

body[data-page="sub-intake"] {
  background: var(--bg);
}

body[data-page="sub-intake"] .sidebar,
body[data-page="sub-intake"] main,
body[data-page="sub-intake"] .auth-screen {
  display: none;
}

.intake-page {
  min-height: 100vh;
  padding: 28px;
}

.intake-page[hidden] {
  display: none;
}

.intake-card {
  width: min(860px, 100%);
  margin: 0 auto;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
}

.intake-brand {
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.intake-card > .eyebrow,
.intake-card > h1 {
  padding: 0 18px;
}

.intake-card > .eyebrow {
  margin-top: 18px;
}

.intake-card > h1 {
  margin-bottom: 4px;
  font-size: clamp(26px, 4vw, 38px);
}

.eyebrow {
  margin: 0 0 5px;
  color: #7d705d;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: 0;
}

#projectTitle {
  max-width: 760px;
  font-size: clamp(20px, 2vw, 26px);
  line-height: 1.18;
}

.topbar-logo {
  display: flex;
  align-items: center;
  min-height: 132px;
}

.topbar-logo-image {
  display: block;
  width: min(300px, 48vw);
  height: auto;
  max-width: none;
  max-height: none;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 4px;
  font-size: 15px;
  font-weight: 500;
}

.header-actions {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.header-search-row,
.header-project-row {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 10px;
}

.header-search-row {
  width: 100%;
}

.sync-status {
  align-self: end;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  padding: 9px 12px;
  color: #46513f;
  background: #eef1e9;
  border: 1px solid #cfd8c8;
  border-radius: 0;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

body[data-theme="dark"] .sync-status {
  color: #d5ddca;
  background: #22291f;
  border-color: #3b4935;
}

.project-switcher {
  display: none;
  gap: 6px;
  min-width: 240px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.global-search {
  position: relative;
  width: min(420px, 42vw);
  min-width: 300px;
}

.global-search input {
  padding-left: 12px;
}

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 60;
  display: grid;
  width: min(430px, 88vw);
  max-height: 420px;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
}

.search-results[hidden] {
  display: none;
}

.search-result {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 11px 12px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.search-result:last-child {
  border-bottom: 0;
}

.search-result:hover {
  background: var(--panel-soft);
}

.search-result span,
.search-result small,
.search-empty {
  color: var(--muted);
  font-size: 12px;
}

.search-result span {
  font-weight: 500;
  text-transform: uppercase;
}

.search-result strong {
  font-weight: 500;
}

.search-empty {
  padding: 14px;
}

select,
input,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0;
}

select {
  line-height: 1.65;
}

select option {
  min-height: 34px;
  padding: 9px 11px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent);
  line-height: 1.65;
}

body[data-theme="dark"] select,
body[data-theme="dark"] input,
body[data-theme="dark"] textarea,
body[data-theme="dark"] .icon-button,
body[data-theme="dark"] .text-button {
  color: var(--ink);
  background: #171716;
}

.icon-button,
.text-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--panel);
  color: var(--ink);
  font-weight: 500;
}

.icon-button {
  width: 44px;
  font-size: 20px;
}

.small-icon {
  width: 36px;
  min-height: 36px;
  font-size: 20px;
  line-height: 1;
}

.text-button {
  padding: 9px 13px;
}

.primary-action {
  color: #ffffff;
  background: var(--ink);
  border-color: var(--ink);
}

.danger-action {
  color: var(--red);
}

.accent-action {
  color: #ffffff;
  background: var(--green);
  border-color: var(--green);
}

.text-button:hover,
.icon-button:hover {
  border-color: var(--brand);
  color: var(--brand-dark);
}

.accent-action:hover {
  color: #ffffff;
  background: var(--brand);
  border-color: var(--brand);
}

.download-toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 80;
  display: grid;
  gap: 6px;
  width: min(360px, calc(100vw - 44px));
  padding: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
}

.download-toast-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  min-height: 24px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

.download-toast-close:hover {
  color: var(--ink);
}

.download-toast strong {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
}

.download-toast span {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.download-toast small {
  color: var(--muted);
  font-size: 12px;
}

.download-toast-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.download-toast-link {
  color: var(--green);
  font-size: 13px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.download-toast-link.primary {
  color: var(--ink);
}

.inbox-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 13px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  font-weight: 500;
}

.inbox-button:hover {
  border-color: var(--brand);
}

.inbox-button span {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding-inline: 5px;
  color: #ffffff;
  background: var(--red);
  font-size: 12px;
}

.inbox-button span[hidden] {
  display: none;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metrics article,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0;
  box-shadow: var(--shadow);
}

.metrics article {
  min-height: 126px;
  padding: 18px;
}

.metrics span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
}

.metrics strong {
  display: block;
  margin: 12px 0 5px;
  font-size: 28px;
  font-weight: 400;
  line-height: 1;
}

.metrics small,
.muted {
  color: var(--muted);
}

.page-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding: 2px 0 0;
}

.page-title[hidden] {
  display: none;
}

.page-title h1 {
  margin-bottom: 7px;
  font-size: 24px;
  font-weight: 400;
  line-height: 1.12;
  letter-spacing: 0;
}

.page-title span {
  max-width: 420px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  text-align: right;
}

.overview-command {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(0, 1.6fr);
  gap: 0;
  align-items: stretch;
  margin-bottom: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.overview-command-main {
  min-height: 112px;
  padding: 18px;
  border-right: 1px solid var(--line);
}

.overview-command-main h2 {
  margin-bottom: 7px;
  font-size: 24px;
  font-weight: 400;
}

.overview-command-main span {
  color: var(--muted);
  font-size: 13px;
}

.weather-line {
  margin: 0 0 7px;
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 500;
}

.overview-command-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.overview-command-stats article {
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 18px;
  border-right: 1px solid var(--line);
}

.overview-command-stats span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
}

.overview-command-stats strong {
  display: block;
  font-size: 25px;
  font-weight: 400;
}

.overview-command-stats .text-button {
  justify-self: start;
  min-height: 34px;
  padding: 6px 10px;
  font-size: 12px;
}

.todays-agenda-page {
  margin-bottom: 18px;
}

.agenda-heading-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.todays-agenda-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  padding: 18px;
}

.agenda-day {
  display: grid;
  align-content: start;
  min-height: 168px;
  color: var(--ink);
  background: var(--panel-soft);
  border: 1px solid var(--line);
}

.agenda-day.current {
  border-color: var(--amber);
  border-width: 2px;
}

.agenda-day header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 11px;
  border-bottom: 1px solid var(--line);
}

.agenda-day header span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
}

.agenda-day header strong {
  font-size: 13px;
  font-weight: 500;
}

.agenda-day-events {
  display: grid;
  gap: 0;
}

.agenda-event {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  column-gap: 8px;
  row-gap: 1px;
  align-items: center;
  padding: 9px 11px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.agenda-event:last-child {
  border-bottom: 0;
}

.agenda-event:hover {
  background: var(--panel);
}

.agenda-event .project-color-dot {
  grid-row: 1 / span 2;
  width: 8px;
  height: 8px;
}

.agenda-event small,
.agenda-empty {
  color: var(--muted);
  font-size: 11px;
}

.agenda-event strong {
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agenda-empty {
  padding: 10px 11px;
}

.project-context {
  display: grid;
  gap: 0;
  margin-bottom: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.project-context[hidden] {
  display: none;
}

.project-context-main {
  display: grid;
  grid-template-columns: minmax(240px, 0.9fr) minmax(0, 1.4fr);
  gap: 18px;
  align-items: stretch;
  min-height: 104px;
  border-bottom: 1px solid var(--line);
}

.project-context-main > div:first-child {
  padding: 18px;
}

.project-context-main h2 {
  font-size: 22px;
  font-weight: 400;
}

.project-context-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-left: 1px solid var(--line);
}

.project-context-stats article {
  padding: 16px 18px;
  border-right: 1px solid var(--line);
}

.project-context-stats article:last-child {
  border-right: 0;
}

.project-context-stats span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
}

.project-context-stats strong {
  display: block;
  margin-top: 9px;
  font-size: 17px;
  font-weight: 400;
}

.project-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  padding: 0 10px;
}

.project-tabs a {
  min-height: 44px;
  padding: 13px 11px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  font-size: 13px;
  font-weight: 500;
}

.project-tabs a:hover,
.project-tabs a.active {
  color: var(--ink);
  border-color: var(--brand);
}

.master-schedule-page {
  margin-bottom: 18px;
}

.master-schedule-board {
  padding: 18px;
}

.master-schedule-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(150px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.master-schedule-grid.day {
  grid-template-columns: minmax(0, 1fr);
}

.master-schedule-grid.day .master-day {
  min-width: 0;
}

.master-schedule-grid.day .master-day-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 16px;
}

.master-schedule-grid.month {
  grid-template-columns: repeat(7, minmax(0, 1fr));
  overflow-x: visible;
}

.master-schedule-grid.month .master-day {
  min-width: 0;
  min-height: 190px;
}

.master-schedule-grid.month .master-day header {
  min-height: 54px;
  padding: 10px;
}

.master-schedule-grid.month .master-day-list {
  padding: 0 10px 10px;
}

.master-schedule-grid.month .master-schedule-item {
  min-height: 42px;
  padding: 8px 10px;
  gap: 3px;
}

.master-schedule-grid.month .master-day-list .master-schedule-item {
  width: calc(100% + 20px);
  margin-left: -10px;
  margin-right: -10px;
}

.master-schedule-grid.month .master-schedule-item span:not(.project-color-dot),
.master-schedule-grid.month .master-schedule-item small {
  font-size: 11px;
}

.master-day {
  min-width: 150px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
}

.master-day:nth-child(even) {
  background: color-mix(in srgb, var(--panel-soft) 94%, var(--brand) 6%);
}

body[data-theme="dark"] .master-day:nth-child(even) {
  background: color-mix(in srgb, var(--panel-soft) 96%, var(--brand) 4%);
}

.master-day header {
  min-height: 66px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
}

.master-day header span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
}

.master-day header strong {
  display: block;
  margin-top: 5px;
  font-size: 18px;
  font-weight: 400;
}

.master-day-list {
  display: grid;
  gap: 0;
  padding: 0 12px 12px;
}

.master-schedule-item {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  width: 100%;
  min-height: 54px;
  padding: 12px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.master-day-list .master-schedule-item {
  width: calc(100% + 24px);
  margin-left: -12px;
  margin-right: -12px;
}

.master-schedule-item:last-child {
  border-bottom: 0;
}

.master-schedule-item:hover {
  background: var(--panel);
}

.master-day:nth-child(even) .master-schedule-item:hover {
  background: color-mix(in srgb, var(--panel-soft) 92%, var(--brand) 8%);
}

body[data-theme="dark"] .master-day:nth-child(even) .master-schedule-item:hover {
  background: color-mix(in srgb, var(--panel-soft) 95%, var(--brand) 5%);
}

.master-schedule-item span:not(.project-color-dot),
.master-schedule-item small {
  color: var(--muted);
  font-size: 12px;
}

.master-schedule-item span:not(.project-color-dot) {
  font-weight: 500;
  text-transform: uppercase;
}

.master-schedule-item strong {
  font-size: 13px;
  font-weight: 500;
}

.project-color-dot {
  display: inline-block;
  width: 11px;
  height: 11px;
  flex: 0 0 11px;
  background: var(--project-color, var(--brand));
  border: 1px solid rgba(0, 0, 0, 0.18);
}

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
  margin-bottom: 18px;
  align-items: start;
}

.portfolio-list,
.attention-list {
  display: grid;
  gap: 0;
  padding: 0 18px 18px;
}

.portfolio-list {
  overflow-x: auto;
}

.portfolio-table {
  min-width: 760px;
}

.portfolio-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  width: 100%;
  min-height: 72px;
  padding: 13px 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.portfolio-row:last-child {
  border-bottom: 0;
}

.portfolio-row:hover,
.portfolio-row.active {
  background: var(--panel-soft);
}

.portfolio-row strong,
.attention-row strong {
  display: block;
  font-weight: 500;
}

.portfolio-row small,
.attention-row small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.portfolio-status {
  display: grid;
  gap: 6px;
  justify-items: end;
}

.attention-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  min-height: 82px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.attention-row:last-child {
  border-bottom: 0;
}

.attention-row span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
}

.inbox-page {
  margin-bottom: 18px;
}

.inbox-list {
  display: grid;
  padding: 18px;
}

.inbox-workspace {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.inbox-sidebar {
  display: grid;
  gap: 0;
  border: 1px solid var(--line);
  background: var(--panel-soft);
}

.inbox-sidebar button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  padding: 11px 12px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.inbox-sidebar button:last-child {
  border-bottom: 0;
}

.inbox-sidebar button:hover,
.inbox-sidebar button.active {
  background: var(--panel);
}

.inbox-sidebar span {
  color: var(--muted);
  font-size: 13px;
}

.inbox-sidebar strong {
  font-weight: 500;
}

.inbox-message-list {
  display: grid;
  gap: 10px;
}

.inbox-message-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  min-height: 44px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.inbox-message-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
}

.inbox-message-head strong {
  font-weight: 500;
}

.inbox-message {
  display: grid;
  gap: 9px;
  width: 100%;
  min-height: 132px;
  padding: 14px;
  color: var(--ink);
  background: var(--panel-soft);
  border: 1px solid var(--line);
  text-align: left;
}

.inbox-message:hover {
  border-color: var(--brand);
  background: var(--panel);
}

.inbox-message-top,
.inbox-message-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.inbox-message-top span,
.inbox-message-meta span,
.inbox-message p {
  color: var(--muted);
  font-size: 12px;
}

.inbox-message strong {
  font-size: 15px;
  font-weight: 500;
}

.inbox-message p {
  margin-bottom: 0;
  font-size: 13px;
}

.inbox-message-meta b {
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 500;
}

.empty-state {
  display: grid;
  gap: 5px;
  min-height: 96px;
  padding: 18px 0;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.empty-state strong {
  color: var(--ink);
  font-weight: 500;
}

.project-home-page {
  margin-bottom: 18px;
}

.project-detail-page {
  margin-top: 18px;
}

.project-section-panel {
  margin-top: 18px;
}

.project-table-wrap {
  overflow-x: auto;
}

.project-list-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 52px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
}

.user-table-wrap {
  overflow-x: auto;
}

.project-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
}

.user-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.project-table th,
.project-table td,
.user-table th,
.user-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.project-table th,
.user-table th {
  color: var(--muted);
  background: var(--panel-soft);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
}

.project-table tr {
  cursor: pointer;
}

.project-table tbody tr:hover,
.project-table tbody tr.active {
  background: var(--panel-soft);
}

.project-table tbody tr.active {
  box-shadow: inset 4px 0 0 var(--green);
}

.project-table tbody tr.active strong {
  color: var(--text);
}

.selected-action {
  color: var(--green);
  border-color: var(--green);
}

.user-table tbody tr:hover {
  background: var(--panel-soft);
}

.selection-sections {
  display: grid;
}

.selection-section {
  border-bottom: 1px solid var(--line);
}

.selection-section:last-child {
  border-bottom: 0;
}

.selection-section summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 54px;
  padding: 15px 18px;
  cursor: pointer;
  list-style: none;
}

.selection-section summary::-webkit-details-marker {
  display: none;
}

.selection-section summary::before {
  content: "+";
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin-right: 8px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
}

.selection-section[open] summary::before {
  content: "-";
}

.selection-section summary span {
  flex: 1;
  font-weight: 500;
}

.selection-section summary small {
  color: var(--muted);
  font-size: 12px;
}

.selection-section summary:hover {
  background: var(--panel-soft);
}

.selection-section-body {
  display: grid;
  padding: 0 18px 16px 46px;
}

.selection-section-actions {
  display: flex;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 0 10px;
}

.selection-section-actions .text-button {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 12px;
}

.selection-row,
.selection-empty {
  display: grid;
  grid-template-columns: 44px 72px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.selection-row {
  cursor: grab;
}

.selection-row.dragging {
  opacity: 0.55;
  background: var(--panel-soft);
}

.selection-row.drop-before,
.trade-row.drop-before {
  border-top: 3px solid var(--green);
}

.selection-row.drop-after,
.trade-row.drop-after {
  border-bottom: 3px solid var(--green);
}

.selection-empty {
  grid-template-columns: minmax(0, 1fr);
}

.selection-thumb {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  object-fit: cover;
  color: var(--muted);
  background: var(--panel-soft);
  border: 1px solid var(--line);
  font-size: 11px;
  text-align: center;
}

.selection-thumb.empty {
  padding: 8px;
}

.selection-row strong,
.selection-empty strong {
  display: block;
  font-weight: 500;
}

.selection-row-main span,
.selection-empty span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.selection-row-main p {
  margin: 7px 0 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
}

.selection-row-main a {
  display: inline-block;
  margin-top: 7px;
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 500;
}

.selection-row-actions {
  display: flex;
  align-items: center;
  justify-items: end;
  gap: 8px;
}

.selection-row-actions .text-button {
  min-height: 32px;
  padding: 6px 9px;
  font-size: 12px;
}

.user-profile-cell {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  overflow: hidden;
  color: #ffffff;
  background: var(--brand-dark);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-cell {
  display: grid;
  gap: 4px;
}

.user-cell strong {
  font-weight: 500;
}

.user-cell small {
  color: var(--muted);
  font-size: 12px;
}

.table-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.project-name-cell {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.project-name-cell strong {
  font-weight: 500;
}

.project-detail {
  display: grid;
  gap: 0;
  margin-top: 0;
}

.project-detail-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.project-detail-heading h3 {
  margin: 4px 0 0;
  color: var(--amber);
  font-size: 22px;
  font-weight: 400;
  letter-spacing: 0;
}

.project-detail-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.project-detail-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.project-detail-summary article {
  min-height: 88px;
  padding: 15px 18px;
  border-right: 1px solid var(--line);
}

.project-detail-summary article:last-child {
  border-right: 0;
}

.project-detail-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
}

.project-detail-summary strong {
  display: block;
  margin-top: 9px;
  font-size: 22px;
  font-weight: 400;
}

.project-detail-summary small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.project-trade-panel {
  min-height: 0;
}

.project-file-vault-panel {
  min-height: 0;
}

.project-task-panel {
  min-height: 0;
}

.project-schedule-panel {
  min-height: 0;
}

.project-section-panel > :not(.mini-heading) {
  padding: 16px;
}

.mini-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  margin-bottom: 0;
  padding: 12px 16px;
  background: var(--panel-soft);
  border-bottom: 1px solid var(--line);
}

.mini-heading span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
}

.mini-heading small {
  color: var(--muted);
  font-size: 12px;
}

.mini-heading > div:not(.trade-assignment-heading-actions):not(.project-schedule-heading-actions) {
  display: grid;
  gap: 3px;
}

.trade-assignment-heading-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.mini-list {
  display: grid;
}

.mini-list article {
  display: grid;
  gap: 4px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.mini-list article:last-child {
  border-bottom: 0;
}

.mini-list strong {
  font-weight: 500;
}

.mini-list span {
  color: var(--muted);
  font-size: 13px;
}

.trade-assignment-list {
  display: grid;
  gap: 8px;
}

.trade-assignment-list[hidden] {
  display: none;
}

.cost-breakdown-wrap[hidden] {
  display: none;
}

.cost-breakdown-wrap {
  overflow-x: auto;
}

.cost-breakdown-table {
  display: grid;
  min-width: 1060px;
  border: 1px solid var(--line);
  font-size: 13px;
}

.cost-breakdown-head,
.cost-breakdown-row,
.cost-breakdown-total-row {
  display: grid;
  grid-template-columns: 36px 132px 44px minmax(150px, 1fr) minmax(190px, 1.15fr) 118px 148px 128px 72px;
  align-items: center;
}

.cost-breakdown-head {
  min-height: 36px;
  color: var(--muted);
  background: var(--panel-soft);
  border-bottom: 1px solid var(--line);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
}

.cost-breakdown-head span,
.cost-breakdown-row > *,
.cost-breakdown-total-row > * {
  min-width: 0;
  padding: 6px;
  border-right: 1px solid var(--line);
}

.cost-breakdown-head span:last-child,
.cost-breakdown-row > *:last-child,
.cost-breakdown-total-row > *:last-child {
  border-right: 0;
}

.cost-breakdown-head span:nth-child(3),
.cost-breakdown-total-row > *:nth-child(3) {
  text-align: center;
}

.cost-breakdown-row > *:last-child {
  display: flex;
  align-items: center;
  justify-content: center;
}

.cost-breakdown-row {
  min-height: 40px;
  border-bottom: 1px solid var(--line);
}

.cost-breakdown-row:last-child {
  border-bottom: 0;
}

.cost-breakdown-total-row {
  min-height: 40px;
  background: var(--panel-soft);
  border-top: 1px solid var(--line);
  font-size: 14px;
}

.cost-breakdown-total-row strong {
  font-weight: 600;
}

.cost-breakdown-row.dragging {
  opacity: 0.52;
  background: var(--panel-soft);
}

.cost-breakdown-row.drop-before,
.drop-before {
  border-top: 3px solid var(--green);
}

.cost-breakdown-row.drop-after,
.drop-after {
  border-bottom: 3px solid var(--green);
}

.cost-breakdown-row input,
.cost-breakdown-row select {
  width: 100%;
  min-height: 30px;
  padding: 4px 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  font-size: 13px;
}

.cost-delete-link {
  width: auto;
  min-height: 0;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: var(--red);
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cost-delete-link:hover {
  color: var(--brand-dark);
}

.cost-line-number {
  color: var(--muted);
  text-align: center;
}

.drag-handle {
  display: grid;
  place-items: center;
  min-height: 34px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  cursor: grab;
  user-select: none;
}

.drag-handle:active {
  cursor: grabbing;
}

.trade-assignment-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
}

.trade-assignment-row.unassigned {
  background: transparent;
}

.trade-assignment-row span,
.trade-assignment-row small,
.assignment-preview span,
.assignment-preview small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.trade-assignment-row strong,
.assignment-preview strong {
  display: block;
  font-weight: 500;
}

.trade-assignment-meta,
.trade-assignment-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.assignment-preview {
  display: grid;
  gap: 5px;
  padding: 12px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
}

.compact-empty {
  padding: 12px;
}

.project-file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(176px, 1fr));
  gap: 8px;
}

.file-card.compact {
  grid-template-rows: auto auto auto;
  gap: 8px;
  min-height: 0;
  padding: 10px;
}

.file-card.compact p {
  min-height: 0;
  margin-top: 5px;
  font-size: 11px;
  line-height: 1.35;
}

.file-card.compact span {
  font-size: 10px;
}

.file-card.compact strong {
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.25;
}

.file-card.compact .file-status {
  align-items: start;
}

.file-card.compact .file-status small,
.file-card.compact .file-meta span {
  font-size: 10px;
}

.file-card.compact .file-meta {
  align-self: auto;
  padding-top: 6px;
}

.file-card.compact .file-upload {
  min-height: 34px;
  font-size: 12px;
}

.project-task-entry {
  display: grid;
  grid-template-columns: minmax(220px, 1.3fr) minmax(180px, 0.9fr) 150px 128px 116px auto;
  gap: 8px;
  align-items: center;
  padding: 0 0 14px;
  border-bottom: 1px solid var(--line);
}

.project-task-entry input,
.project-task-entry select {
  width: 100%;
  min-height: 40px;
}

.project-task-list {
  margin-top: 12px;
}

.project-schedule-board {
  display: grid;
}

.project-schedule-heading-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.project-schedule-heading-actions .text-button {
  flex: 0 0 auto;
}

.project-schedule-grid {
  display: grid;
  gap: 8px;
}

.project-schedule-grid.week {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.project-schedule-grid.month {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.project-schedule-grid.day {
  grid-template-columns: minmax(0, 1fr);
}

.project-schedule-card {
  min-height: 118px;
  padding: 12px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
}

.project-schedule-card.current {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--panel-soft) 78%, var(--brand) 22%);
}

.project-schedule-card span,
.project-gantt-row span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
}

.project-schedule-card strong {
  display: block;
  margin: 7px 0 4px;
  font-weight: 500;
}

.project-schedule-card p {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
}

.project-schedule-activities {
  display: grid;
  gap: 6px;
  margin: 8px 0 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.project-schedule-activities article {
  display: grid;
  gap: 3px;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.project-schedule-activities strong {
  margin: 0;
  font-size: 12px;
}

.project-schedule-activities span {
  font-size: 10px;
}

.project-schedule-card.manual {
  border-color: var(--brand);
}

.project-gantt {
  display: grid;
  gap: 8px;
}

.project-gantt-row {
  display: grid;
  grid-template-columns: minmax(160px, 0.32fr) minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  min-height: 58px;
  padding: 10px 12px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
}

.project-gantt-row.current {
  border-color: var(--brand);
}

.project-gantt-row strong {
  display: block;
  margin-bottom: 4px;
  font-weight: 500;
}

.project-gantt-track {
  height: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.project-gantt-track i {
  display: block;
  width: var(--width);
  height: 100%;
  margin-left: var(--offset);
  background: var(--brand);
}

.project-home-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.project-home-summary article {
  min-height: 102px;
  padding: 16px 18px;
  border-right: 1px solid var(--line);
}

.project-home-summary article:last-child {
  border-right: 0;
}

.project-home-summary span,
.project-page-link span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
}

.project-home-summary strong {
  display: block;
  margin-top: 10px;
  font-size: 24px;
  font-weight: 400;
}

.project-page-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 18px;
}

.project-page-link {
  display: grid;
  gap: 8px;
  min-height: 132px;
  padding: 14px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
}

.project-page-link:hover {
  border-color: var(--brand);
}

.project-page-link strong {
  font-weight: 500;
}

.project-page-link small {
  color: var(--muted);
}

.general-tasks-panel {
  grid-column: 1 / -1;
}

.general-task-entry {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 150px 130px 130px auto;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
}

.general-task-entry .text-button {
  white-space: nowrap;
}

.general-task-list {
  padding-bottom: 16px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(340px, 0.8fr);
  gap: 18px;
  align-items: start;
}

.primary-column,
.secondary-column {
  display: grid;
  gap: 18px;
}

.primary-column[hidden],
.secondary-column[hidden] {
  display: none;
}

.workspace:has(.primary-column[hidden]),
.workspace:has(.secondary-column[hidden]) {
  grid-template-columns: minmax(0, 1fr);
}

.workspace:has(#subs:not([hidden])) .secondary-column {
  grid-column: 1 / -1;
}

.panel {
  overflow: hidden;
}

.schedule-page,
.workflow-page,
.files-page,
.admin-page {
  margin-bottom: 18px;
}

.admin-page {
  display: grid;
  gap: 18px;
}

.admin-page[hidden] {
  display: none;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  min-height: 72px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
}

.panel-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.range-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.schedule-filter-row {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
}

.schedule-filter-row .panel-actions {
  justify-content: flex-start;
}

.schedule-filter {
  min-width: 230px;
}

.schedule-filter select {
  width: 100%;
}

.range-controls .muted {
  min-width: 210px;
  text-align: center;
  font-size: 13px;
}

.schedule-heading {
  align-items: stretch;
}

.schedule-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(88px, auto));
  gap: 6px;
  align-items: stretch;
}

.compact-controls {
  grid-template-columns: repeat(3, minmax(68px, auto));
}

.project-schedule-panel .compact-controls {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  overflow-x: auto;
}

.project-schedule-panel .compact-controls .view-toggle {
  flex: 0 0 auto;
  min-width: 68px;
}

.view-toggle {
  min-height: 42px;
  padding: 8px 11px;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--line);
  font-weight: 400;
}

.view-toggle:hover,
.view-toggle.active {
  color: var(--ink);
  border-color: var(--brand);
  background: var(--panel-soft);
}

.schedule-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.schedule-summary article {
  min-height: 94px;
  padding: 16px 18px;
  border-right: 1px solid var(--line);
}

.schedule-summary article:last-child {
  border-right: 0;
}

.schedule-summary span,
.schedule-card span,
.schedule-day span,
.critical-node span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
}

.schedule-summary strong {
  display: block;
  margin-top: 10px;
  font-size: 22px;
  font-weight: 400;
}

.schedule-board {
  padding: 18px;
}

.schedule-grid {
  display: grid;
  gap: 12px;
}

.schedule-grid.month {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.schedule-grid.week {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.schedule-grid.day {
  grid-template-columns: minmax(0, 1fr);
}

.schedule-card,
.schedule-day,
.critical-node {
  min-height: 128px;
  padding: 14px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
}

.schedule-card strong,
.schedule-day strong,
.critical-node strong {
  display: block;
  margin: 8px 0 4px;
  font-weight: 500;
}

.schedule-card p,
.schedule-day p,
.critical-node p {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
}

.schedule-card.current,
.schedule-day.current,
.critical-node.current {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--panel-soft) 72%, var(--brand) 28%);
}

.schedule-progress {
  height: 8px;
  background: #ebe6df;
  overflow: hidden;
}

body[data-theme="dark"] .schedule-progress {
  background: #34322d;
}

.schedule-progress i {
  display: block;
  width: var(--progress);
  height: 100%;
  background: var(--green);
}

.schedule-critical {
  display: grid;
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.critical-node {
  position: relative;
  min-width: 150px;
}

.critical-node::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -11px;
  width: 10px;
  height: 1px;
  background: var(--line);
}

.critical-node:last-child::after {
  display: none;
}

.workflow-heading {
  align-items: center;
}

.workflow-filter-panel {
  margin-bottom: 18px;
}

.workflow-filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
}

.workflow-filter-row h2 {
  margin: 3px 0 0;
  font-size: 22px;
  font-weight: 400;
}

.workflow-filter-select {
  width: min(440px, 100%);
}

.workflow-note {
  max-width: 420px;
  text-align: right;
  font-size: 13px;
}

.workflow-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.workflow-summary article {
  min-height: 86px;
  padding: 16px 18px;
  border-right: 1px solid var(--line);
}

.workflow-summary article:last-child {
  border-right: 0;
}

.workflow-summary span,
.workflow-stage span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
}

.workflow-summary strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
  font-weight: 400;
}

.workflow-board {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.workflow-project-board {
  border: 1px solid var(--line);
  background: var(--panel-soft);
}

.workflow-project-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.workflow-project-title > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.workflow-project-title h3 {
  margin: 0;
  color: var(--accent);
  font-size: 22px;
  font-weight: 400;
}

.workflow-project-title p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.workflow-trade-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
}

.workflow-trade-card {
  display: grid;
  gap: 10px;
  align-content: start;
  min-height: 258px;
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.workflow-trade-card.assigned {
  border-color: color-mix(in srgb, var(--muted) 42%, var(--line));
}

.workflow-trade-card.ready,
.workflow-trade-card.invoice {
  border-color: var(--amber);
}

.workflow-trade-card.correction {
  border-color: var(--red);
}

.workflow-trade-card.approved,
.workflow-trade-card.paid {
  border-color: var(--green);
}

.workflow-trade-card.is-upcoming {
  background: color-mix(in srgb, var(--panel) 82%, var(--panel-soft));
}

.workflow-trade-card.is-past {
  opacity: 0.82;
}

.workflow-trade-card.is-current {
  border-width: 2px;
}

.workflow-trade-card.needs-review {
  border-width: 2px;
  border-color: var(--amber);
  background: color-mix(in srgb, var(--panel) 88%, var(--amber));
}

.workflow-trade-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.workflow-card-badges {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 5px;
  flex-wrap: wrap;
}

.workflow-trade-card-head span,
.workflow-trade-meta span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
}

.workflow-trade-card-head strong {
  display: block;
  margin-top: 4px;
  font-size: 17px;
  font-weight: 400;
  line-height: 1.25;
}

.workflow-trade-meta {
  display: grid;
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.workflow-trade-meta strong {
  display: block;
  margin-top: 3px;
  font-size: 14px;
  font-weight: 500;
}

.workflow-trade-meta small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.workflow-date-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.workflow-date-controls label {
  display: grid;
  gap: 4px;
}

.workflow-date-controls input {
  min-height: 36px;
  padding: 7px 8px;
  font-size: 12px;
}

.workflow-trade-card p {
  min-height: 48px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.workflow-trade-actions {
  display: flex;
  align-items: center;
  align-self: end;
  gap: 8px;
  flex-wrap: wrap;
}

.workflow-trade-actions .text-button {
  padding: 7px 9px;
  font-size: 12px;
}

.workflow-trade-actions .text-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.workflow-row {
  display: grid;
  grid-template-columns: minmax(230px, 1.25fr) minmax(220px, 1.25fr) minmax(120px, 0.55fr) minmax(180px, 0.95fr) minmax(150px, 0.75fr) minmax(240px, auto);
  gap: 12px;
  align-items: center;
  min-height: 78px;
  padding: 11px 12px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
}

.workflow-row.ready,
.workflow-row.invoice {
  border-color: var(--amber);
}

.workflow-row.correction {
  border-color: var(--red);
}

.workflow-row.approved,
.workflow-row.paid {
  border-color: var(--green);
}

.workflow-project {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  min-width: 0;
}

.workflow-project strong,
.workflow-stage strong,
.workflow-contact strong {
  display: block;
  font-weight: 500;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workflow-project small,
.workflow-stage small,
.workflow-status-cell small,
.workflow-proof small,
.workflow-contact small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workflow-stage,
.workflow-status-cell,
.workflow-contact,
.workflow-proof {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.workflow-stage span,
.workflow-proof span,
.workflow-contact span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
}

.workflow-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.workflow-actions .text-button {
  min-height: 32px;
  padding: 5px 8px;
  font-size: 12px;
}

.workflow-actions .text-button:disabled {
  cursor: default;
  opacity: 0.55;
}

.file-note {
  max-width: 360px;
  text-align: right;
  font-size: 13px;
}

.file-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 18px;
}

.file-card {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 14px;
  min-height: 248px;
  padding: 14px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
}

.file-card.has-file {
  border-color: var(--green);
}

.file-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
}

.file-card strong {
  display: block;
  margin-top: 8px;
  font-weight: 500;
}

.file-card p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.file-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.file-status small,
.file-meta span {
  color: var(--muted);
  font-size: 12px;
}

.file-meta {
  align-self: end;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.file-meta strong {
  overflow-wrap: anywhere;
  font-weight: 400;
}

.file-upload {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 42px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  font-weight: 500;
  cursor: pointer;
}

.file-upload:hover {
  border-color: var(--brand);
  color: var(--brand-dark);
}

.file-upload input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.admin-heading {
  align-items: center;
}

.admin-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-section-body {
  padding: 18px;
}

.brand-settings-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.brand-settings-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
}

.brand-settings-grid label:not(.brand-color-field) {
  grid-column: span 2;
}

.brand-color-field {
  grid-template-columns: 1fr 52px;
  align-items: center;
  min-height: 42px;
  padding: 8px 10px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
}

.brand-settings-grid input[type="color"] {
  width: 48px;
  min-height: 30px;
  height: 30px;
  padding: 2px;
}

.brand-upload-field,
.user-photo-field,
.selection-image-field {
  cursor: pointer;
}

.brand-upload-field input[type="file"],
.user-photo-field input[type="file"],
.selection-image-field input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.brand-upload-control {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  min-height: 42px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.upload-button-text {
  display: inline-flex;
  align-items: center;
  padding: 9px 11px;
  color: var(--ink);
  background: var(--panel-soft);
  border-right: 1px solid var(--line);
  font-size: 12px;
  font-weight: 500;
  text-transform: none;
  white-space: nowrap;
}

.upload-file-name {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  padding: 9px 11px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.3;
  text-transform: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-layout {
  padding: 18px;
}

.trade-duration-table {
  max-height: min(68vh, 720px);
  overflow: auto;
  background: var(--panel-soft);
  border: 1px solid var(--line);
}

.trade-row {
  display: grid;
  grid-template-columns: 48px 42px minmax(180px, 1.2fr) minmax(150px, 0.9fr) 120px 82px minmax(170px, 1fr) 130px 70px 92px 128px 92px;
  gap: 8px;
  align-items: center;
  min-height: 54px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  min-width: 1308px;
}

.trade-row:last-child {
  border-bottom: 0;
}

.trade-row.dragging {
  opacity: 0.48;
  background: var(--panel);
}

.trade-row-head {
  position: sticky;
  top: 0;
  z-index: 5;
  min-height: 42px;
  color: var(--muted);
  background: var(--panel-soft);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
}

.help-label {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: help;
}

.help-label::after {
  content: "i";
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  color: var(--panel);
  background: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: none;
}

.help-label:hover::before,
.help-label:focus-visible::before {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  left: 0;
  width: 260px;
  padding: 10px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: none;
  content: attr(data-help);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  text-transform: none;
}

.trade-row strong {
  font-weight: 400;
}

.trade-sequence,
.trade-sequence-head {
  justify-self: center;
  width: 100%;
  color: var(--muted);
  text-align: center;
}

.trade-sequence {
  font-size: 13px;
}

.drag-handle {
  display: grid;
  place-items: center;
  width: 32px;
  min-height: 32px;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0;
  font-size: 15px;
  cursor: grab;
}

.drag-handle:active {
  cursor: grabbing;
}

.trade-row input {
  min-height: 36px;
}

.trade-row input[type="number"] {
  text-align: right;
}

.trade-row input[type="checkbox"] {
  width: 20px;
  min-height: 20px;
  justify-self: center;
}

.trade-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: auto;
  height: 24px;
  justify-self: center;
  cursor: pointer;
}

.trade-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.trade-toggle span {
  position: relative;
  display: block;
  width: 42px;
  height: 22px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.trade-toggle span::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  background: var(--muted);
  content: "";
  transition: transform 140ms ease, background 140ms ease;
}

.trade-toggle input:checked + span {
  border-color: var(--brand);
  background: var(--panel-soft);
}

.trade-toggle input:checked + span::after {
  transform: translateX(18px);
  background: var(--brand-dark);
}

.trade-toggle small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  min-width: 20px;
  text-transform: uppercase;
}

.trade-toggle input:checked ~ small {
  color: var(--brand-dark);
}

.trade-row select,
.trade-row input {
  font-size: 12px;
}

.preview-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.preview-heading span,
.template-row span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
}

.preview-heading strong {
  font-weight: 400;
}

.template-row {
  display: grid;
  gap: 4px;
  min-height: 66px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.template-row:last-child {
  border-bottom: 0;
}

.template-row.overlap {
  border-left: 3px solid var(--green);
}

.template-row strong {
  font-weight: 500;
}

.template-row small {
  color: var(--muted);
}

.timeline {
  display: grid;
  gap: 0;
  padding: 0 18px 18px;
}

.phase {
  display: grid;
  grid-template-columns: 140px 1fr 112px;
  gap: 14px;
  align-items: center;
  min-height: 72px;
  border-bottom: 1px solid var(--line);
}

.phase:last-child {
  border-bottom: 0;
}

.phase-date,
.phase-state {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.phase-bar {
  height: 10px;
  overflow: hidden;
  background: #ebe6df;
  border-radius: 0;
}

body[data-theme="dark"] .phase-bar {
  background: #34322d;
}

.phase-bar span {
  display: block;
  width: var(--progress);
  height: 100%;
  background: var(--green);
}

.phase.current .phase-bar span {
  background: var(--brand);
}

.phase.delayed .phase-bar span {
  background: var(--amber);
}

.task-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.task-summary article {
  min-height: 84px;
  padding: 14px 18px;
  border-right: 1px solid var(--line);
}

.task-summary article:last-child {
  border-right: 0;
}

.task-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
}

.task-summary strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
  font-weight: 400;
}

.task-entry {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(180px, 0.5fr) 150px 130px 130px auto;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
}

.task-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0 18px 18px;
  list-style: none;
}

.task {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  min-height: 64px;
  border-bottom: 1px solid var(--line);
}

.task-group-title {
  min-height: 42px;
  padding-top: 16px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
}

.task-group-title.completed {
  margin-top: 8px;
}

.task-empty {
  min-height: 56px;
  padding: 12px 0;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.task:last-child {
  border-bottom: 0;
}

.task-check {
  display: grid;
  place-items: center;
  width: 24px;
  min-height: 24px;
}

.task-check input {
  position: absolute;
  opacity: 0;
}

.task-check span {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.task-check input:checked + span {
  background: var(--green);
  border-color: var(--green);
}

.task-check input:checked + span::after {
  content: "";
  width: 9px;
  height: 5px;
  border-left: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
  transform: rotate(-45deg) translateY(-1px);
}

.task.done .task-title {
  color: var(--muted);
  text-decoration: line-through;
}

.task-title {
  display: block;
  font-weight: 500;
}

.task-meta,
.task-due {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.task-due {
  margin-top: 2px;
  color: var(--brand-dark);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 5px 9px;
  color: var(--badge-fg, var(--ink));
  background: var(--badge-bg, #eee8df);
  border-radius: 0;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

body[data-theme="dark"] .badge {
  filter: saturate(0.85) brightness(0.9);
}

.budget-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.budget-summary article {
  min-height: 92px;
  padding: 16px 18px;
  border-right: 1px solid var(--line);
}

.budget-summary article:last-child {
  border-right: 0;
}

.budget-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
}

.budget-summary strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
  font-weight: 400;
}

.budget-table {
  display: grid;
  padding: 0 18px 18px;
}

.budget-row {
  display: grid;
  grid-template-columns: 1fr 110px 110px 92px;
  gap: 12px;
  align-items: center;
  min-height: 62px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.budget-row:last-child {
  border-bottom: 0;
}

.budget-row strong {
  display: block;
}

.budget-row span {
  color: var(--muted);
}

.budget-row.over .variance {
  color: var(--red);
  font-weight: 500;
}

.budget-row.under .variance {
  color: var(--green);
  font-weight: 500;
}

#budgetHealth {
  color: var(--brand-dark);
  font-weight: 500;
}

.data-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 18px;
}

.data-grid article {
  min-height: 148px;
  padding: 16px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 0;
}

.data-grid span {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
}

.data-grid strong {
  display: block;
  margin-bottom: 8px;
  font-size: 19px;
  font-weight: 400;
}

.data-grid p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.stack {
  display: grid;
  gap: 12px;
  padding: 14px 18px 18px;
}

#changes .panel-heading {
  min-height: 58px;
  padding: 11px 18px;
}

#changes .stack {
  gap: 7px;
  padding: 10px 18px 14px;
}

.stack-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 0;
}

.stack-card.clickable {
  cursor: pointer;
}

.stack-card.clickable:hover,
.stack-card.clickable:focus {
  border-color: var(--brand);
  background: var(--panel);
  outline: none;
}

.stack-card header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.stack-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.stack-card small {
  color: var(--muted);
  font-size: 12px;
}

.change-order-row {
  display: grid;
  grid-template-columns: minmax(260px, 1.5fr) minmax(170px, 0.7fr) minmax(260px, 1fr);
  gap: 14px;
  align-items: center;
  min-height: 58px;
  padding: 11px 12px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
}

.change-order-row.clickable {
  cursor: pointer;
}

.change-order-row.clickable:hover,
.change-order-row.clickable:focus {
  border-color: var(--brand);
  background: var(--panel);
  outline: none;
}

.change-order-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.change-order-number {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.change-order-main strong {
  min-width: 0;
  overflow: hidden;
  font-size: 14px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.change-order-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  white-space: nowrap;
}

.change-order-meta > span {
  color: var(--ink);
  font-weight: 500;
}

.change-order-support {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.change-order-support small {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.change-order-detail-actions {
  padding: 0 18px 18px;
}

.homeowner-review-box {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 0 18px 14px;
}

.homeowner-review-box[hidden] {
  display: none;
}

.homeowner-review-column,
.homeowner-review-box label {
  display: grid;
  gap: 7px;
}

.homeowner-review-column {
  align-content: start;
}

.homeowner-review-box label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
}

.homeowner-review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.homeowner-review-column > .text-button,
.homeowner-review-actions .text-button {
  width: fit-content;
}

.change-order-uploads {
  display: grid;
  gap: 10px;
}

.upload-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
}

.change-order-upload-list {
  display: grid;
  gap: 8px;
}

.change-order-upload-row {
  margin: 0;
}

.contact-row {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 13px;
}

.contact-header-actions {
  display: grid;
  grid-template-columns: minmax(220px, 320px) auto auto;
  gap: 10px;
  align-items: center;
}

.contact-tools {
  display: grid;
  grid-template-columns: minmax(150px, 0.45fr) minmax(150px, 0.45fr);
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.contact-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.contact-summary article {
  min-height: 86px;
  padding: 15px 18px;
  border-right: 1px solid var(--line);
}

.contact-summary article:last-child {
  border-right: 0;
}

.contact-summary span,
.contact-docs span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
}

.contact-summary strong {
  display: block;
  margin-top: 9px;
  font-size: 25px;
  font-weight: 400;
}

.contact-directory {
  display: grid;
  gap: 0;
  padding: 0 18px 18px;
}

.contact-card {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(140px, 0.55fr) minmax(190px, 0.85fr) minmax(150px, 0.55fr) auto;
  gap: 14px;
  align-items: center;
  min-height: 78px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.contact-card:hover,
.contact-card:focus-visible {
  background: var(--panel-soft);
  outline: 1px solid var(--line);
  outline-offset: -1px;
}

.contact-main {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.contact-avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: var(--panel);
  background: var(--brand-dark);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
}

.contact-main h3 {
  overflow: hidden;
  margin-bottom: 4px;
  font-size: 15px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-main p,
.contact-phone span,
.contact-meta span {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.contact-phone {
  display: grid;
  gap: 4px;
}

.contact-phone span {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
}

.contact-phone strong {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}

.contact-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.contact-docs {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.contact-docs span {
  padding: 6px 8px;
  border: 1px solid var(--line);
}

.contact-docs span.complete {
  color: var(--brand-dark);
  background: var(--panel-soft);
  border-color: var(--brand);
}

.contact-actions {
  display: flex;
  justify-content: end;
}

.contact-actions .text-button {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 12px;
}

.email-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.48);
}

.email-modal[hidden] {
  display: none;
}

.email-card {
  width: min(620px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
}

.email-form {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.email-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
}

.email-form textarea {
  resize: vertical;
}

.contact-form-card {
  width: min(760px, 100%);
}

.project-preview-card {
  width: min(980px, 100%);
}

.project-preview-body {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.project-preview-section,
.project-preview-list {
  display: grid;
  gap: 10px;
}

.project-preview-section h3,
.project-preview-list h3 {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
}

.project-preview-band {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
}

.project-preview-band article {
  min-height: 78px;
  padding: 13px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.project-preview-band article:nth-child(4n) {
  border-right: 0;
}

.project-preview-band article:nth-last-child(-n + 4) {
  border-bottom: 0;
}

.project-preview-band span,
.project-preview-list span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.project-preview-band strong,
.project-preview-list strong {
  display: block;
  margin-top: 6px;
  font-weight: 500;
  line-height: 1.35;
}

.project-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.project-preview-list {
  border: 1px solid var(--line);
  padding: 14px;
}

.project-preview-list article {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.project-preview-list article:last-child {
  border-bottom: 0;
}

.form-grid {
  display: grid;
  gap: 14px;
}

.form-grid.two-column {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.contact-document-checks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 4px 0;
}

.contact-document-checks label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
}

.contact-document-checks input {
  width: 100%;
  min-height: 42px;
  padding: 9px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.email-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@media print {
  .sidebar,
  .header-actions,
  .email-modal,
  .text-button,
  .icon-button {
    display: none;
  }

  main {
    margin: 0;
    padding: 0;
  }

  .panel,
  .metrics article {
    box-shadow: none;
  }
}

@media (max-width: 1120px) {
  .sidebar {
    position: static;
    width: auto;
    min-height: auto;
  }

  body.sidebar-collapsed .sidebar {
    width: auto;
  }

  body.sidebar-collapsed main {
    margin-left: 0;
  }

  nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .sidebar-meta {
    display: none;
  }

  main {
    margin-left: 0;
  }

  .workspace,
  .metrics,
  .overview-command,
  .todays-agenda-list,
  .overview-grid,
  .project-page-grid,
  .project-home-summary,
  .project-context-main,
  .project-context-stats,
  .master-schedule-grid,
  .budget-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .file-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .project-file-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .project-schedule-grid.week,
  .project-schedule-grid.month {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .project-task-entry {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workflow-trade-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .primary-column,
  .secondary-column {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .sidebar {
    padding: 16px;
  }

  nav {
    display: flex;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  body.sidebar-collapsed nav a {
    min-width: 44px;
  }

  nav a {
    white-space: nowrap;
  }

  main {
    padding: 16px;
  }

  .topbar,
  .page-title,
  .header-actions,
  .header-search-row,
  .header-project-row,
  .workflow-filter-row,
  .panel-heading,
  .panel-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .project-switcher,
  .global-search,
  .workspace,
  .overview-command,
  .overview-command-stats,
  .todays-agenda-list,
  .overview-grid,
  .project-page-grid,
  .project-home-summary,
  .project-detail-summary,
  .project-context-main,
  .project-context-stats,
  .inbox-workspace,
  .master-schedule-grid,
  .budget-summary,
  .task-summary,
  .task-entry,
  .general-task-entry,
  .contact-header-actions,
  .contact-tools,
  .contact-document-checks,
  .contact-summary,
  .contact-card,
  .form-grid.two-column,
  .admin-layout,
  .brand-settings-grid,
  .metrics,
  .schedule-summary,
  .workflow-summary,
  .workflow-board,
  .file-grid,
  .project-file-grid,
  .project-schedule-grid.week,
  .project-schedule-grid.month,
  .project-task-entry,
  .homeowner-review-box,
  .project-preview-band,
  .project-preview-grid,
  .data-grid {
    grid-template-columns: 1fr;
  }

  .project-gantt-row {
    grid-template-columns: 1fr;
  }

  .project-schedule-heading-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
    white-space: normal;
  }

  .trade-assignment-heading-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
    white-space: normal;
  }

  .file-note,
  .workflow-note {
    max-width: none;
    text-align: left;
  }

  .workflow-trade-grid {
    grid-template-columns: 1fr;
  }

  .page-title {
    align-items: stretch;
    min-height: auto;
  }

  .page-title span {
    max-width: none;
    text-align: left;
  }

  .topbar-logo {
    min-height: 96px;
  }

  .topbar-logo-image {
    width: min(320px, 100%);
  }

  .schedule-controls,
  .schedule-grid.month,
  .schedule-grid.week {
    grid-template-columns: 1fr 1fr;
  }

  .project-schedule-panel .compact-controls {
    display: flex;
    grid-template-columns: none;
  }

  .schedule-summary article {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .project-home-summary article {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .project-detail-heading {
    flex-direction: column;
  }

  .project-detail-summary article {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .overview-command-main,
  .overview-command-stats article {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .overview-command-stats article:last-child {
    border-bottom: 0;
  }

  .project-context-stats {
    border-left: 0;
  }

  .project-context-stats article,
  .budget-summary article,
  .contact-summary article {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .task-summary article {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .schedule-summary article:last-child {
    border-bottom: 0;
  }

  .project-home-summary article:last-child {
    border-bottom: 0;
  }

  .project-detail-summary article:last-child {
    border-bottom: 0;
  }

  .project-context-stats article:last-child,
  .budget-summary article:last-child,
  .contact-summary article:last-child {
    border-bottom: 0;
  }

  .contact-directory {
    padding-top: 0;
  }

  .contact-card {
    align-items: start;
    gap: 10px;
  }

  .contact-header-actions {
    width: 100%;
  }

  .contact-actions {
    justify-content: start;
  }

  .task-summary article:last-child {
    border-bottom: 0;
  }

  .project-preview-band article,
  .project-preview-band article:nth-child(4n),
  .project-preview-band article:nth-last-child(-n + 4) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .project-preview-band article:last-child {
    border-bottom: 0;
  }

  .brand-settings-grid label:not(.brand-color-field) {
    grid-column: auto;
  }

  .workflow-summary article {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .workflow-summary article:last-child {
    border-bottom: 0;
  }

  .phase,
  .budget-row {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 14px 0;
  }

  .task {
    grid-template-columns: auto 1fr;
  }

  .selection-row {
    grid-template-columns: 1fr;
  }

  .selection-row-actions {
    justify-items: start;
  }

  .task .badge {
    grid-column: 2;
    justify-self: start;
  }
}
