:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #2e2e2e;
  background: #f7f7f5;
  font-size: 16px;
  line-height: 1.55;
  color-scheme: light;
  --orange: #d35400;
  --orange-dark: #7f3200;
  --anthracite: #2e2e2e;
  --paper: #f7f7f5;
  --white: #fff;
  --line: #deded9;
  --muted: #65635f;
  --success: #28633d;
  --danger: #a1251c;
  --shadow: 0 10px 30px rgb(46 46 46 / 7%);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; }
a { color: var(--orange-dark); text-underline-offset: 4px; }
a:hover { color: var(--orange); }
header {
  background: var(--anthracite); color: white; display: flex; justify-content: space-between;
  gap: 24px; align-items: center; padding: 18px clamp(18px, 4vw, 64px); flex-wrap: wrap;
}
header a { color: white; }
.brand { font-size: 22px; font-weight: 800; letter-spacing: -.02em; text-decoration: none; }
.brand span { color: #f08a48; }
.brand:hover { color: white; }
nav, .actions { display: flex; align-items: center; flex-wrap: wrap; gap: 18px; }
nav form { margin: 0; }
.context {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  background: white; padding: 14px clamp(18px, 4vw, 64px); border-bottom: 1px solid var(--line);
}
.context span, .muted { color: var(--muted); }
.subnav {
  padding: 0 clamp(18px, 4vw, 64px); gap: 0; background: white; border-bottom: 1px solid var(--line);
  overflow-x: auto; flex-wrap: nowrap;
}
.subnav a { padding: 13px 14px; color: #4b4946; text-decoration: none; white-space: nowrap; border-bottom: 3px solid transparent; }
.subnav a:hover, .subnav a[aria-current="page"] { color: var(--orange-dark); border-color: var(--orange); }
main { max-width: 1440px; padding: 36px clamp(16px, 3.5vw, 52px) 70px; margin: auto; min-height: 65vh; }
h1 { font-size: clamp(28px, 4vw, 38px); line-height: 1.14; margin: 6px 0 18px; font-weight: 800; letter-spacing: -.035em; }
h2 { font-size: 21px; line-height: 1.25; margin: 0 0 16px; }
h3 { font-size: 17px; margin: 0 0 10px; }
p { max-width: 75ch; overflow-wrap: anywhere; }
.context strong, td, dd, .notice { overflow-wrap: anywhere; }
.eyebrow { font-weight: 800; text-transform: uppercase; letter-spacing: .09em; font-size: 12px; color: var(--orange-dark); margin: 0; }
.panel { background: white; border: 1px solid var(--line); border-radius: 10px; padding: 24px; margin-top: 22px; box-shadow: var(--shadow); }
.narrow { max-width: 620px; margin: 30px auto; }
.notice, .flash { padding: 13px 16px; background: #fff1e6; border-left: 4px solid var(--orange); border-radius: 3px; }
.flash { margin: 0 0 22px; }
.flash.success { background: #edf7f0; border-color: var(--success); color: #174b2b; }
.flash.error { background: #fff0ee; border-color: var(--danger); color: #761a14; }
label { display: block; font-weight: 700; margin-bottom: 6px; }
input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  width: 100%; min-height: 44px; font: inherit; padding: 9px 11px; border: 1px solid #85827e;
  border-radius: 5px; background: white; color: var(--anthracite);
}
textarea { min-height: 105px; resize: vertical; }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; accent-color: var(--orange); }
.check { display: flex; align-items: flex-start; gap: 9px; font-weight: 500; }
.field { min-width: 0; }
.booking-code-form > .actions { margin-top: 24px; }
.field small { margin-top: 4px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.field-label { display: block; font-size: .84rem; font-weight: 700; margin-bottom: .4rem; }
.day-choices { display: flex; gap: .5rem; flex-wrap: wrap; min-height: 2.35rem; align-items: center; }
.day-choice[aria-pressed="true"] { background: var(--anthracite); border-color: var(--anthracite); color: white; }
button, .button {
  display: inline-flex; justify-content: center; align-items: center; gap: 8px; min-height: 42px;
  font: inherit; font-weight: 750; padding: 9px 16px; background: var(--orange); color: white;
  border: 1px solid #a33f00; border-radius: 5px; cursor: pointer; text-decoration: none;
}
button:hover, .button:hover { background: var(--orange-dark); color: white; }
button:disabled { opacity: .55; cursor: not-allowed; }
.button.secondary, button.secondary { background: white; color: var(--orange-dark); border-color: #bb784e; }
.button.secondary:hover, button.secondary:hover { background: #fff5ef; }
.button.danger, button.danger { background: white; color: var(--danger); border-color: #c8837e; }
.quiet { background: transparent; border-color: #888; color: white; }
small, .helptext { display: block; font-size: 13px; color: var(--muted); }
.errorlist { color: var(--danger); padding-left: 20px; }
.table-wrap { overflow-x: auto; background: white; border: 1px solid var(--line); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; text-align: left; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: #55524f; background: var(--paper); }
th, td { padding: 13px 15px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fffaf7; }
code { font-size: 12px; white-space: pre-wrap; word-break: break-word; }
.tenant-list { list-style: none; margin: 0; padding: 0; }
.tenant-list li { padding: 18px 0; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.tenant-list li:last-child { border-bottom: 0; }
.tenant-list span { display: block; color: var(--muted); font-size: 14px; }
footer { padding: 24px; text-align: center; color: var(--muted); border-top: 1px solid var(--line); }
:focus-visible { outline: 3px solid var(--orange-dark); outline-offset: 3px; }
header :focus-visible { outline-color: #ffc18f; }
.skip { position: absolute; top: -80px; left: 12px; background: white; padding: 12px; z-index: 20; }
.skip:focus { top: 10px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.workspace-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.loading-state { min-height: 260px; display: grid; place-content: center; justify-items: center; color: var(--muted); }
.spinner { width: 34px; height: 34px; border: 3px solid #e2d8d1; border-top-color: var(--orange); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; border-top-color: #e2d8d1; } }
.metric-grid { display: grid; grid-template-columns: repeat(5, minmax(150px, 1fr)); gap: 14px; margin: 22px 0; }
.metric { background: white; border: 1px solid var(--line); border-radius: 8px; padding: 18px; min-height: 118px; }
.metric strong { display: block; font-size: 30px; line-height: 1; margin: 14px 0 7px; }
.metric span { color: var(--muted); font-size: 13px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.card { background: white; border: 1px solid var(--line); border-radius: 8px; padding: 20px; box-shadow: var(--shadow); overflow-wrap: anywhere; }
.card .meta { color: var(--muted); font-size: 14px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin: 18px 0; }
.toolbar .field { flex: 1 1 180px; }
.toolbar .compact { flex: 0 1 170px; }
.empty-state { text-align: center; padding: 56px 20px; border: 1px dashed #aaa6a0; border-radius: 8px; background: white; }
.status { display: inline-block; font-size: 12px; font-weight: 800; padding: 3px 8px; border-radius: 999px; background: #eceae6; }
.status.active { color: #1d5c34; background: #e5f3e9; }
.status.cancelled { color: #81221b; background: #fae8e6; }
.detail-list { display: grid; grid-template-columns: minmax(120px, .35fr) 1fr; gap: 8px 18px; margin: 0; }
.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; overflow-wrap: anywhere; }
.calendar-toolbar { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: end; margin: 20px 0; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(150px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); overflow-x: auto; }
.calendar-grid.day-view { grid-template-columns: minmax(280px, 1fr); }
.calendar-day { min-height: 260px; background: white; padding: 12px; }
.calendar-day h3 { position: sticky; top: 0; background: white; padding-bottom: 8px; }
.calendar-event { display: block; margin: 7px 0; padding: 9px; border-left: 4px solid var(--orange); background: #fff3eb; color: var(--anthracite); text-decoration: none; border-radius: 3px; font-size: 13px; }
.calendar-event.cancelled { border-color: #8a8783; background: #f1f0ee; opacity: .75; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { border-left: 3px solid #d8d5d0; padding: 0 0 20px 18px; margin-left: 7px; }
.schedule-row { display: grid; grid-template-columns: 105px 1fr 1fr auto; gap: 10px; align-items: end; padding: 12px 0; border-bottom: 1px solid var(--line); }
.booking-page { max-width: 820px; }
.booking-shell { display: grid; grid-template-columns: .8fr 1.2fr; gap: 24px; align-items: start; }
.booking-summary { position: sticky; top: 20px; }
.step { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; color: var(--muted); }
.step span { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #e9e6e2; font-weight: 800; }
.step.active { color: var(--anthracite); font-weight: 700; }
.step.active span { background: var(--orange); color: white; }
@media (max-width: 1050px) { .metric-grid { grid-template-columns: repeat(3, 1fr); } .calendar-grid { grid-template-columns: repeat(7, minmax(190px, 1fr)); } }
@media (max-width: 760px) {
  main { padding: 26px 16px 55px; }
  header { padding: 16px 18px; }
  header nav { width: 100%; justify-content: space-between; }
  .context { padding: 12px 18px; }
  .subnav { padding: 0 8px; }
  .panel { padding: 18px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .form-grid, .booking-shell { grid-template-columns: 1fr; }
  .booking-summary { position: static; }
  .schedule-row { grid-template-columns: 1fr 1fr; }
  .schedule-row strong { grid-column: 1 / -1; }
  .table-wrap table { min-width: 680px; }
  h1 { font-size: 29px; }
}
@media (max-width: 420px) { .metric-grid { grid-template-columns: 1fr; } button, .button { width: 100%; } .actions { width: 100%; } }

/* Daily work and configuration have separate, consistent navigation. */
.app-header { padding: 10px 28px; min-height: 80px; flex-wrap: nowrap; }
.brand { display: inline-flex; align-items: center; flex: 0 0 auto; }
.brand img { width: 170px; height: 66px; object-fit: contain; }
.header-actions { display: flex; align-items: center; gap: 26px; font-size: 14px; }
.header-actions > a { text-decoration: none; }
.account-menu { position: relative; }
.account-menu summary { cursor: pointer; border: 1px solid #636363; border-radius: 7px; padding: 8px 14px; }
.account-menu nav { position: absolute; z-index: 20; right: 0; top: calc(100% + 8px); min-width: 210px; padding: 12px; display: grid; gap: 4px; background: var(--anthracite); border: 1px solid #666; border-radius: 9px; box-shadow: var(--shadow); }
.account-menu nav a { padding: 8px; text-decoration: none; }
.account-menu .menu-label { color: #ccc; font-size: 12px; padding: 4px 8px; }
.app-frame { display: grid; grid-template-columns: 218px minmax(0, 1fr); min-height: calc(100vh - 86px); }
.app-frame.no-sidebar { grid-template-columns: minmax(0, 1fr); }
.sidebar { background: white; border-right: 1px solid var(--line); padding: 26px 14px; }
.sidebar nav { display: flex; flex-direction: column; align-items: stretch; gap: 5px; position: sticky; top: 24px; }
.nav-label { color: var(--muted); padding: 0 12px 12px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; }
.sidebar a, .settings-nav summary { display: block; padding: 10px 12px; text-decoration: none; color: var(--anthracite); border-radius: 6px; font-size: 14px; cursor: pointer; }
.sidebar a:hover { background: var(--paper); }
.sidebar a[aria-current=page] { color: var(--orange-dark); background: #fcf0e7; font-weight: 700; box-shadow: inset 3px 0 var(--orange); }
.settings-nav { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 12px; }
.settings-nav summary { list-style: revert; font-weight: 700; }
.settings-nav a { font-size: 13px; padding-left: 20px; }
.content-shell { min-width: 0; }
.context { justify-content: flex-start; align-items: center; gap: 36px; padding: 15px 32px; min-height: 77px; }
.context > div { display: grid; gap: 2px; min-width: 0; }
.context-label { font-size: 10px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.context strong { font-size: 14px; }
.context-switch { margin-left: auto; font-size: 13px; }
.content-shell main { width: 100%; padding: 30px 32px 48px; }
h1 { font-size: clamp(25px, 3vw, 32px); letter-spacing: -.025em; }
.eyebrow { font-size: 11px; letter-spacing: .09em; margin-bottom: 8px; }
.panel, .card { box-shadow: none; border: 1px solid var(--line); border-radius: 9px; }
.metric { box-shadow: none; border: 1px solid var(--line); }
.metric-grid { gap: 14px; }
.workspace-heading { margin-bottom: 20px; }
.toolbar, .calendar-toolbar { background: white; border: 1px solid var(--line); border-radius: 9px; padding: 16px; }
button, .button { border-radius: 6px; font-weight: 600; font-size: 14px; padding: 10px 16px; }
input, select, textarea { border-radius: 6px; }
.cards { gap: 18px; }
.card h2 { font-size: 20px; }
.calendar-event { border-radius: 5px; font-size: 13px; }
.content-shell footer { padding: 22px 32px; display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 12px; }
.content-shell footer img { width: 24px; height: 24px; object-fit: contain; }
.booking-page { max-width: 1050px; }
.booking-shell { grid-template-columns: .85fr 1.4fr; gap: 22px; }
.booking-page .day-choices { display: flex; gap: 7px; flex-wrap: wrap; }
.booking-page .day-choice { width: auto; padding: 9px 12px; }
.booking-page .step { font-size: 13px; margin-bottom: 12px; }
.booking-page h1 { max-width: 30ch; }
@media (max-width: 900px) {
  .app-frame { grid-template-columns: 180px minmax(0,1fr); }
  .sidebar { padding: 20px 8px; }
  .content-shell main { padding: 24px 20px 40px; }
  .context { padding: 14px 20px; gap: 20px; }
  .booking-shell { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .app-header { padding: 8px 16px; min-height: 68px; gap: 12px; }
  .brand img { width: 132px; height: 51px; }
  .header-actions { gap: 12px; font-size: 12px; }
  .app-frame { display: block; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); padding: 10px; }
  .sidebar nav { position: static; flex-direction: row; flex-wrap: wrap; gap: 3px; }
  .nav-label { display: none; }
  .sidebar a { padding: 8px 10px; font-size: 13px; }
  .settings-nav { margin: 0; padding: 0; border: 0; width: 100%; }
  .settings-nav[open] { padding-bottom: 6px; }
  .settings-nav a { display: inline-block; }
  .context { gap: 14px; padding: 12px 16px; }
  .context strong { font-size: 13px; }
  .context-switch { margin-left: 0; }
  .content-shell main { padding: 22px 16px 36px; }
  .header-actions button { width: auto; }
  .booking-page header { padding: 12px; }
}
.preserve-lines { white-space: pre-line; overflow-wrap: anywhere; }
.advanced-settings { margin: 20px 0; padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.advanced-settings summary { cursor: pointer; font-weight: 600; }
.advanced-settings[open] summary { margin-bottom: 20px; }
.project-setup { grid-template-columns: minmax(0, 2fr) minmax(240px, 1fr); align-items: start; }
.project-setup #id_crews label { display: flex; align-items: center; gap: 10px; font-weight: 400; }
.time-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.time-pair .field { margin: 0; }
.schedule-row { grid-template-columns: 1fr; }
@media (max-width: 800px) { .project-setup { grid-template-columns: 1fr; } }

.calendar-navigation { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.calendar-navigation h3 { margin:0; text-align:center; }
.calendar-navigation button { width:44px; min-height:44px; padding:6px; font-size:24px; }
.calendar-weekdays, .calendar-days { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); gap:5px; }
.calendar-weekdays { margin:16px 0 6px; text-align:center; font-size:13px; color:var(--muted); }
.calendar-days button { min-width:0; min-height:44px; padding:8px 2px; width:100%; }
.booking-times { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:24px; }
.booking-times button { width:auto; min-width:72px; min-height:44px; }
.calendar-days button:disabled, .booking-times button:disabled { background:#eee; color:#888; border-color:#e3e3e3; cursor:not-allowed; opacity:1; }
.calendar-days button[aria-pressed="true"], .booking-times button[aria-pressed="true"] { background:#D35400; border-color:#D35400; color:white; }
.calendar-days button[aria-current="date"] { text-decoration:underline; text-underline-offset:4px; }

.readonly-calendar { table-layout: fixed; min-width: 900px; }
.readonly-calendar td { vertical-align: top; }
.calendar-item { padding: 12px; margin-bottom: 12px; border-left: 3px solid var(--orange); background: #fff1e6; overflow-wrap: anywhere; }

.project-readonly-table { min-width: 1250px; }
.project-readonly-table th { white-space: nowrap; }
.project-readonly-table td { min-width: 95px; }
.project-readonly-table td:nth-child(7) { min-width: 180px; }
.readonly-calendar.day-view { min-width: 0; }

.legal-editor, .legal-document { max-width: 900px; margin-inline: auto; overflow-wrap: anywhere; }
.legal-editor textarea { width: 100%; margin-bottom: 24px; }
.legal-editor .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
