:root {
  color-scheme: dark;
  --ink: #0e0d0b;
  --ink-2: #161410;
  --paper: #ede6d3;
  --paper-2: #c9c1ad;
  --ember: #e8541c;
  --ember-deep: #b53a0e;
  --steel: #595550;
  --rule: rgba(237, 230, 211, 0.13);
  --rule-strong: rgba(237, 230, 211, 0.28);
  --rule-hover: rgba(237, 230, 211, 0.42);
  --surface: rgba(22, 20, 16, 0.75);
  --surface-strong: rgba(22, 20, 16, 0.86);
  --surface-soft: rgba(22, 20, 16, 0.7);
  --surface-tint: rgba(237, 230, 211, 0.04);
  --nav-bg: rgba(14, 13, 11, 0.82);
  --input-bg: rgba(14, 13, 11, 0.55);
  --input-bg-focus: rgba(14, 13, 11, 0.78);
  --ember-haze: rgba(232, 84, 28, 0.12);
  --on-accent: #0e0d0b;
  --display: 'Newsreader', 'Times New Roman', serif;
  --body: 'Instrument Sans', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

[data-theme="light"] {
  color-scheme: light;
  --ink: #f3ecda;
  --ink-2: #fbf6e8;
  --paper: #1c1814;
  --paper-2: #5a534b;
  --ember: rgb(255, 165, 0);
  --ember-deep: rgb(204, 122, 0);
  --steel: #877f76;
  --rule: rgba(28, 24, 20, 0.16);
  --rule-strong: rgba(28, 24, 20, 0.32);
  --rule-hover: rgba(28, 24, 20, 0.48);
  --surface: rgba(255, 251, 240, 0.78);
  --surface-strong: rgba(255, 251, 240, 0.92);
  --surface-soft: rgba(255, 251, 240, 0.66);
  --surface-tint: rgba(28, 24, 20, 0.05);
  --nav-bg: rgba(243, 236, 218, 0.86);
  --input-bg: rgba(255, 253, 245, 0.7);
  --input-bg-focus: rgba(255, 255, 252, 0.95);
  --ember-haze: rgba(255, 165, 0, 0.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--ink);
  color: var(--paper);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-image:
    linear-gradient(var(--rule) 1px, transparent 1px),
    linear-gradient(90deg, var(--rule) 1px, transparent 1px),
    radial-gradient(circle at 80% -10%, var(--ember-haze), transparent 55%);
  background-size: 64px 64px, 64px 64px, 100% 100%;
  background-position: -1px -1px, -1px -1px, 0 0;
  min-height: 100vh;
}

::selection { background: var(--ember); color: var(--on-accent); }

a { color: inherit; text-decoration: none; }
img, svg { max-width: 100%; display: block; }

/* ---------- NAV ---------- */
.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 48px;
  border-bottom: 1px solid var(--rule);
  position: sticky;
  top: 0;
  background: var(--nav-bg);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 14px; }

.brand-mark {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--ember);
  box-shadow:
    0 0 0 4px rgba(232, 84, 28, 0.16),
    0 0 22px rgba(232, 84, 28, 0.55);
  position: relative;
}
.brand-mark::after {
  content: '';
  position: absolute;
  inset: -8px;
  border: 1px solid var(--ember);
  border-radius: 50%;
  opacity: 0.6;
  animation: pulse 2.6s cubic-bezier(.4,0,.2,1) infinite;
}
@keyframes pulse {
  0%   { transform: scale(0.8); opacity: 0.55; }
  100% { transform: scale(1.9); opacity: 0; }
}

.brand-name {
  font-family: var(--display);
  font-weight: 500;
  font-size: 19px;
  letter-spacing: -0.012em;
  font-variation-settings: 'opsz' 24;
}

.nav nav { display: flex; gap: 32px; align-items: center; }
.nav nav a {
  font-family: var(--mono);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  opacity: 0.7;
  transition: opacity .2s ease, color .2s ease;
}
.nav nav a:hover { opacity: 1; }
.nav nav .cta-link { color: var(--ember); opacity: 1; }
.nav nav .nav-signin {
  padding: 6px 12px;
  border: 1px solid var(--rule-strong);
  opacity: 0.85;
  transition: border-color .2s, color .2s, opacity .2s;
}
.nav nav .nav-signin:hover {
  border-color: var(--paper);
  opacity: 1;
}

/* ---------- HERO ---------- */
.hero {
  position: relative;
  padding: 96px 48px 88px;
  border-bottom: 1px solid var(--rule);
  overflow: hidden;
}

.hero-meta {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  opacity: 0.55;
  margin-bottom: 64px;
}
.hero-meta .tag::before { content: '— '; opacity: 0.6; }

.hero-title {
  font-family: var(--display);
  font-weight: 300;
  font-size: clamp(48px, 9.4vw, 152px);
  line-height: 0.94;
  letter-spacing: -0.038em;
  font-variation-settings: 'opsz' 72;
  max-width: 14ch;
  position: relative;
  z-index: 2;
}
.hero-title .line { display: block; overflow: hidden; padding-bottom: 0.06em; }
.hero-title .line > span,
.hero-title .line > em {
  display: inline-block;
  transform: translateY(110%);
  animation: rise 1s cubic-bezier(.2,.7,.2,1) both;
}
.hero-title .line:nth-child(1) > * { animation-delay: 0.05s; }
.hero-title .line:nth-child(2) > * { animation-delay: 0.20s; }
.hero-title .line:nth-child(3) > * { animation-delay: 0.34s; }
.hero-title .line:nth-child(4) > * { animation-delay: 0.46s; }
.hero-title em {
  font-style: italic;
  color: var(--ember);
  font-weight: 400;
}
@keyframes rise {
  to { transform: translateY(0); }
}

.hero-foot {
  margin-top: 80px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 48px;
  align-items: end;
  border-top: 1px solid var(--rule);
  padding-top: 32px;
  position: relative;
  z-index: 2;
  opacity: 0;
  animation: fadeUp 1s cubic-bezier(.2,.7,.2,1) 0.7s forwards;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.hero-lede {
  max-width: 58ch;
  font-size: 18px;
  line-height: 1.5;
  color: var(--paper);
  opacity: 0.78;
}

.primary-cta {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 16px 22px;
  background: var(--ember);
  color: var(--on-accent);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  white-space: nowrap;
  transition: background .25s ease, transform .25s ease, box-shadow .25s ease;
}
.primary-cta:hover {
  background: var(--paper);
  color: var(--ink);
  transform: translateX(4px);
  box-shadow: 0 0 0 2px var(--rule-strong);
}
.primary-cta svg { width: 18px; height: 18px; }

/* deflector graphic — concentric sprinkler-spray pattern */
.deflector {
  position: absolute;
  top: 24%;
  right: -180px;
  width: 560px;
  height: 560px;
  color: var(--ember);
  pointer-events: none;
  opacity: 0.55;
  animation: spin 80s linear infinite;
  filter: drop-shadow(0 0 30px rgba(232, 84, 28, 0.25));
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- SECTION HEAD ---------- */
.section-head {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 48px;
  margin-bottom: 80px;
}
.section-no {
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  opacity: 0.6;
  padding-top: 12px;
}
.section-head h2 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(36px, 5.4vw, 72px);
  line-height: 1.02;
  letter-spacing: -0.026em;
  max-width: 22ch;
  font-variation-settings: 'opsz' 72;
}
.section-sub {
  margin-top: 24px;
  max-width: 56ch;
  opacity: 0.72;
  font-size: 17px;
  line-height: 1.5;
}

/* ---------- SERVICES ---------- */
.services {
  padding: 120px 48px;
  border-bottom: 1px solid var(--rule);
}
.service-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--rule-strong);
}
.service-grid li {
  padding: 40px 32px 44px;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  transition: background .35s ease;
  position: relative;
}
.service-grid li:nth-child(3n) { border-right: none; }
.service-grid li:hover { background: rgba(232, 84, 28, 0.05); }
.service-grid li::before {
  content: '';
  position: absolute;
  left: 0; top: 0;
  width: 0; height: 1px;
  background: var(--ember);
  transition: width .4s cubic-bezier(.2,.7,.2,1);
}
.service-grid li:hover::before { width: 100%; }
.service-grid .num {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ember);
  display: block;
  margin-bottom: 28px;
}
.service-grid h3 {
  font-family: var(--display);
  font-weight: 500;
  font-size: 22px;
  line-height: 1.15;
  letter-spacing: -0.012em;
  margin-bottom: 12px;
  font-variation-settings: 'opsz' 24;
}
.service-grid p { opacity: 0.74; font-size: 15px; line-height: 1.55; }

/* ---------- PROCESS ---------- */
.process {
  padding: 120px 48px;
  border-bottom: 1px solid var(--rule);
}
.steps { list-style: none; }
.steps li {
  display: grid;
  grid-template-columns: 100px 1.1fr 2fr;
  gap: 48px;
  padding: 40px 0;
  border-top: 1px solid var(--rule);
  align-items: baseline;
  transition: padding-left .35s ease, background .35s ease;
}
.steps li:hover {
  padding-left: 20px;
  background: rgba(232, 84, 28, 0.04);
}
.steps li:last-child { border-bottom: 1px solid var(--rule); }
.step-no {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ember);
}
.steps h3 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(26px, 3.2vw, 40px);
  line-height: 1.05;
  letter-spacing: -0.022em;
  font-variation-settings: 'opsz' 48;
}
.steps p {
  opacity: 0.74;
  max-width: 58ch;
  line-height: 1.55;
  font-size: 16px;
}

/* ---------- STANDARDS ---------- */
.standards {
  padding: 120px 48px;
  background: var(--ink-2);
  border-bottom: 1px solid var(--rule);
  position: relative;
}
.standards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 80px;
}
.standards figcaption {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  opacity: 0.6;
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--rule-strong);
}
.standards ul { list-style: none; }
.standards li {
  padding: 16px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 16px;
  line-height: 1.4;
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 24px;
  align-items: baseline;
}
.standards li span:first-child {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.14em;
  color: var(--ember);
  text-transform: uppercase;
}

/* ---------- CONTACT ---------- */
.contact {
  padding: 140px 48px 120px;
}
.contact-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 80px;
}
.contact-lead .section-no { display: inline-block; padding-top: 0; margin-bottom: 24px; }
.contact h2 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(40px, 6.4vw, 88px);
  line-height: 1.0;
  letter-spacing: -0.028em;
  margin: 0 0 28px;
  max-width: 14ch;
  font-variation-settings: 'opsz' 72;
}
.contact-lead p {
  opacity: 0.78;
  max-width: 44ch;
  font-size: 18px;
  line-height: 1.5;
}
.contact-list { list-style: none; align-self: end; }
.contact-list li {
  padding: 22px 0;
  border-top: 1px solid var(--rule);
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 24px;
  align-items: baseline;
}
.contact-list li:last-child { border-bottom: 1px solid var(--rule); }
.contact-list .label {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  opacity: 0.6;
}
.contact-list a, .contact-list > li > span:not(.label) {
  font-family: var(--display);
  font-size: 22px;
  letter-spacing: -0.012em;
  font-variation-settings: 'opsz' 24;
}
.contact-list a { transition: color .2s ease; }
.contact-list a:hover { color: var(--ember); }
.contact-card {
  margin-top: 64px;
  position: relative;
  padding: 48px 52px 44px;
  background:
    linear-gradient(180deg, var(--surface-tint), transparent 38%),
    var(--surface-strong);
  border: 1px solid var(--rule-strong);
  box-shadow:
    0 1px 0 var(--surface-tint) inset,
    0 24px 60px -28px rgba(0, 0, 0, 0.65),
    0 2px 0 rgba(232, 84, 28, 0.0);
  backdrop-filter: blur(14px) saturate(110%);
  -webkit-backdrop-filter: blur(14px) saturate(110%);
}
.contact-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 64px;
  height: 2px;
  background: var(--ember);
}
.contact-card::after {
  content: "";
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 28px;
  height: 28px;
  border-right: 1px solid var(--ember);
  border-bottom: 1px solid var(--ember);
  pointer-events: none;
}
.contact-card-head {
  display: grid;
  gap: 10px;
  padding-bottom: 28px;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--rule-strong);
}
.contact-card-no {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ember);
}
.contact-card-head h3 {
  font-family: var(--display);
  font-weight: 400;
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: -0.018em;
  font-variation-settings: 'opsz' 36;
}
.contact-card-meta {
  font-size: 14px;
  opacity: 0.65;
  max-width: 56ch;
}
.contact-banner {
  margin-bottom: 28px;
  padding: 14px 18px;
  border: 1px solid var(--rule-strong);
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.04em;
}
.contact-banner-ok { border-color: rgba(120, 200, 130, 0.55); background: rgba(120, 200, 130, 0.08); }
.contact-banner-err { border-color: rgba(232, 84, 28, 0.6); background: rgba(232, 84, 28, 0.1); }
.contact-form {
  display: grid;
  gap: 22px;
}
.contact-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 22px;
}
.contact-field { display: grid; gap: 10px; }
.contact-field label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.72;
}
.contact-optional {
  text-transform: none;
  letter-spacing: 0.04em;
  opacity: 0.55;
}
.contact-field input,
.contact-field textarea {
  font: inherit;
  font-family: var(--display);
  font-size: 18px;
  color: var(--paper);
  background: var(--input-bg);
  border: 1px solid var(--rule-strong);
  padding: 14px 16px;
  border-radius: 0;
  transition: border-color .2s ease, background-color .2s ease, box-shadow .2s ease;
}
.contact-field input::placeholder,
.contact-field textarea::placeholder {
  color: var(--paper);
  opacity: 0.32;
}
.contact-field input:hover,
.contact-field textarea:hover {
  border-color: var(--rule-hover);
}
.contact-field input:focus,
.contact-field textarea:focus {
  outline: none;
  border-color: var(--ember);
  background: var(--input-bg-focus);
  box-shadow: 0 0 0 3px rgba(232, 84, 28, 0.14);
}
.contact-field textarea { resize: vertical; min-height: 160px; line-height: 1.55; }
.contact-form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  margin-top: 8px;
  padding-top: 28px;
  border-top: 1px solid var(--rule);
}
.contact-form-note {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.5;
  max-width: 42ch;
}
.contact-submit {
  background: var(--ember);
  color: var(--on-accent);
  border: 1px solid var(--ember);
  padding: 14px 22px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: background-color .2s ease, color .2s ease, transform .2s ease;
}
.contact-submit:hover {
  background: var(--ember-deep);
  border-color: var(--ember-deep);
  transform: translateY(-1px);
}
.contact-submit svg { width: 18px; height: 18px; }
.contact-honeypot {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
@media (max-width: 800px) {
  .contact-card { padding: 36px 24px 32px; }
  .contact-form-row { grid-template-columns: 1fr; }
  .contact-form-actions { justify-content: flex-start; }
  .contact-submit { width: 100%; justify-content: center; }
}
.placeholder {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ember);
  opacity: 0.7;
  margin-left: 8px;
  vertical-align: 3px;
}

/* ---------- FOOTER ---------- */
footer {
  padding: 32px 48px;
  border-top: 1px solid var(--rule);
}
.footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  opacity: 0.55;
}
.footer-row .brand-name {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* ---------- MOTION PREFERENCE ---------- */
@media (prefers-reduced-motion: reduce) {
  .hero-title .line > *,
  .hero-foot,
  .deflector,
  .brand-mark::after {
    animation: none !important;
    transform: none !important;
    opacity: 1 !important;
  }
}

/* ============================================================
   APP / AUTHENTICATED VIEWS
   ============================================================ */

.app-body, .auth-body { min-height: 100vh; }

/* ---------- APP NAV ---------- */
.appnav {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 32px;
  align-items: center;
  padding: 18px 36px;
  border-bottom: 1px solid var(--rule);
  background: var(--nav-bg);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  position: sticky; top: 0; z-index: 20;
}
.brand-sub {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.45;
  margin-left: 4px;
}
.appnav nav { display: flex; gap: 28px; justify-content: center; }
.appnav nav a {
  font-family: var(--mono);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  opacity: 0.6;
  padding: 6px 0;
  border-bottom: 1px solid transparent;
  transition: opacity .2s, border-color .2s, color .2s;
}
.appnav nav a:hover { opacity: 1; }
.appnav nav a.active {
  opacity: 1;
  color: var(--ember);
  border-bottom-color: var(--ember);
}

/* Marketing links, tucked into a disclosure for signed-in users. Structured
   as a simple dropdown now; can grow into a mega menu without markup changes. */
.nav-dropdown { position: relative; }
.nav-dropdown > summary {
  list-style: none;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  opacity: 0.6;
  padding: 6px 0;
  transition: opacity .2s;
}
.nav-dropdown > summary::-webkit-details-marker { display: none; }
.nav-dropdown > summary::after { content: " \25BE"; opacity: 0.7; }
.nav-dropdown[open] > summary,
.nav-dropdown > summary:hover { opacity: 1; }
.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 190px;
  padding: 10px;
  background: var(--nav-bg);
  border: 1px solid var(--rule);
  border-radius: 10px;
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  z-index: 30;
}
.nav-dropdown-menu a {
  font-family: var(--mono);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  opacity: 0.7;
  padding: 7px 9px;
  white-space: nowrap;
  border-radius: 6px;
  transition: opacity .2s, background .2s;
}
.nav-dropdown-menu a:hover {
  opacity: 1;
  background: color-mix(in srgb, var(--ember) 12%, transparent);
}

.appnav-user { display: flex; align-items: center; gap: 20px; }
.user-meta {
  display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2;
}
.user-name {
  font-family: var(--display);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: -0.01em;
}
.user-role {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ember);
  opacity: 0.85;
}
.inline-form { display: inline; }

/* ---------- APP MAIN ---------- */
.app-main {
  max-width: 1240px;
  margin: 0 auto;
  padding: 56px 36px 96px;
}
.app-main.app-main-wide {
  max-width: min(1920px, calc(100vw - 32px));
  padding-left: 24px;
  padding-right: 24px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 32px;
  margin-bottom: 48px;
  flex-wrap: wrap;
}
.page-head h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(36px, 4.6vw, 56px);
  line-height: 1.04;
  letter-spacing: -0.024em;
  margin: 8px 0 12px;
  font-variation-settings: 'opsz' 72;
  max-width: 24ch;
}
.page-sub { opacity: 0.72; font-size: 16px; max-width: 60ch; }

/* ---------- BLOCKS ---------- */
.block {
  border: 1px solid var(--rule);
  background: var(--surface);
  margin-bottom: 32px;
  position: relative;
}
.block.narrow { max-width: 720px; }
.block-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 24px 28px;
  border-bottom: 1px solid var(--rule);
  gap: 24px;
}
.block-head h2 {
  font-family: var(--display);
  font-weight: 500;
  font-size: 18px;
  letter-spacing: -0.01em;
  font-variation-settings: 'opsz' 24;
}
.block .data-table,
.block .form,
.block .kv-list,
.block .empty,
.block .notes,
.block .spec-list,
.block .people-list,
.block .prose {
  margin: 0;
}
.block .empty {
  padding: 40px 28px;
  text-align: center;
  opacity: 0.55;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.06em;
}
.block .prose { padding: 24px 28px; line-height: 1.55; opacity: 0.85; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 32px;
}
.grid-2 .block { margin-bottom: 0; }

/* ---------- STATS ---------- */
.stat-row {
  display: grid;
  /* Tighter min so the added status fits more per row before wrapping. */
  grid-template-columns: repeat(auto-fit, minmax(108px, 1fr));
  gap: 0;
  border: 1px solid var(--rule);
  margin-bottom: 32px;
  background: var(--surface);
}
.stat {
  padding: 20px 24px;
  border-right: 1px solid var(--rule);
  display: flex; flex-direction: column; gap: 6px;
}
.stat:last-child { border-right: none; }
.stat-label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.55;
}
.stat-value {
  font-family: var(--display);
  font-size: 32px;
  font-weight: 400;
  letter-spacing: -0.025em;
  line-height: 1;
  font-variation-settings: 'opsz' 48;
}

/* ---------- KV LISTS ---------- */
.kv-list { list-style: none; padding: 8px 0; }
.kv-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 12px 28px;
  border-bottom: 1px solid var(--rule);
}
.kv-list li:last-child { border-bottom: none; }
.kv-label {
  font-family: var(--mono);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  opacity: 0.65;
}
.kv-value {
  font-family: var(--display);
  font-size: 22px;
  letter-spacing: -0.012em;
  font-variation-settings: 'opsz' 24;
}

/* ---------- TABLES ---------- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
}
.data-table thead th {
  text-align: left;
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  opacity: 0.55;
  padding: 14px 28px;
  border-bottom: 1px solid var(--rule-strong);
}
.data-table tbody td {
  padding: 14px 28px;
  border-bottom: 1px solid var(--rule);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background .2s; }
.data-table tbody tr:hover { background: rgba(232, 84, 28, 0.04); }
.data-table-rowlink tbody tr { cursor: pointer; }
.data-table-rowlink tbody tr:focus { outline: 1px solid var(--ember); outline-offset: -1px; }
.data-table a { color: var(--paper); border-bottom: 1px dashed transparent; transition: border-color .2s, color .2s; }
.data-table a:hover { color: var(--ember); border-bottom-color: var(--ember); }

.mono { font-family: var(--mono); font-size: 13px; letter-spacing: 0.02em; }
.dim { opacity: 0.55; }

/* ---------- BADGES ---------- */
.badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  padding: 4px 8px 3px;
  border: 1px solid currentColor;
  border-radius: 2px;
  color: var(--paper-2);
}
.badge-intake        { color: var(--paper-2); }
.badge-design        { color: #f4a261; }
.badge-calculations  { color: #e9c46a; }
.badge-submittal     { color: #98c1d9; }
.badge-revisions     { color: var(--ember); }
.badge-complete      { color: #6db28a; }
.badge-on-hold       { color: #b6a89a; opacity: 0.7; }

/* Status badges (project status machine) */
.badge-status-not-assigned            { color: var(--paper-2); opacity: 0.75; }
.badge-status-pre-design              { color: var(--paper-2); }
.badge-status-head-pipe-layout        { color: #f4a261; }
.badge-status-hydraulic-calculations  { color: #e9c46a; }
.badge-status-submit-plan             { color: #98c1d9; }
.badge-status-fabrication             { color: var(--ember); }
.badge-status-resubmittal             { color: #c98ed4; }
.badge-status-approved                { color: #8bbf7d; }
.badge-status-complete                { color: #6db28a; }
.badge-status-bim-coordination        { color: #5fa3c7; }

/* Priority badges — red = most critical, blue = least critical */
.badge-priority-low    { color: #5fa3c7; }
.badge-priority-medium { color: #e9c46a; }
.badge-priority-high   { color: #f4a261; }
.badge-priority-urgent { color: #f4511e; }
.badge-priority-911    { color: #e53935; font-weight: 700; letter-spacing: 0.12em; }

/* State badges (operational state — orthogonal to workflow status) */
.badge-state-not-assigned       { color: var(--paper-2); opacity: 0.75; }
.badge-state-in-progress        { color: #8bbf7d; }
.badge-state-on-hold            { color: #b6a89a; }
.badge-state-delayed            { color: #f4511e; }
.badge-state-waiting-plans      { color: #98c1d9; }
.badge-state-waiting-flow-test  { color: #c98ed4; }
.badge-state-waiting-client     { color: #e9c46a; }

/* Calendar bar priority accent (left border) */
.cal-bar-priority-low    { box-shadow: inset 3px 0 0 #5fa3c7; }
.cal-bar-priority-medium { box-shadow: inset 3px 0 0 #e9c46a; }
.cal-bar-priority-high   { box-shadow: inset 3px 0 0 #f4a261; }
.cal-bar-priority-urgent { box-shadow: inset 3px 0 0 #f4511e; }
.cal-bar-priority-911    { box-shadow: inset 4px 0 0 #e53935, 0 0 0 1px #e53935; }

/* Engineer filter chips (multi-select) */
.engineer-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 4px;
  padding: 12px 14px;
  border: 1px solid var(--rule);
  background: var(--surface);
}
.engineer-chips-label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.55;
  align-self: center;
  margin-right: 4px;
}
.engineer-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid var(--rule-strong);
  background: var(--ink);
  color: var(--paper-2);
  cursor: pointer;
  user-select: none;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.engineer-chip input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.engineer-chip:hover { color: var(--paper); border-color: var(--paper-2); }
.engineer-chip.selected {
  background: var(--ember);
  color: var(--on-accent);
  border-color: var(--ember);
}
.project-search {
  display: flex;
  align-items: center;
  gap: 8px;
}
.project-search input[type="search"] {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--rule-strong);
  padding: 8px 12px;
  min-width: 240px;
  letter-spacing: 0.04em;
}
.project-search input[type="search"]:focus {
  outline: none;
  border-color: var(--ember);
}
.project-search input[type="search"]::placeholder {
  color: var(--paper-2);
  opacity: 0.6;
}

.engineer-chip-clear {
  margin-left: auto;
  align-self: center;
  font-size: 11px;
  opacity: 0.55;
}
.engineer-chip-clear:hover { opacity: 1; }

/* Priority chip accents — colored dot left of label (unselected) or full fill (selected) */
.engineer-chip-priority-low      { border-left: 3px solid #5fa3c7; }
.engineer-chip-priority-medium   { border-left: 3px solid #e9c46a; }
.engineer-chip-priority-high     { border-left: 3px solid #f4a261; }
.engineer-chip-priority-urgent   { border-left: 3px solid #f4511e; }
.engineer-chip-priority-911      { border-left: 3px solid #e53935; }
.engineer-chip-priority-low.selected    { background: #5fa3c7; border-color: #5fa3c7; }
.engineer-chip-priority-medium.selected { background: #e9c46a; border-color: #e9c46a; color: var(--ink); }
.engineer-chip-priority-high.selected   { background: #f4a261; border-color: #f4a261; color: var(--ink); }
.engineer-chip-priority-urgent.selected { background: #f4511e; border-color: #f4511e; }
.engineer-chip-priority-911.selected    { background: #e53935; border-color: #e53935; }

/* State chip accents — match badge-state-* palette */
.engineer-chip-state-not-assigned       { border-left: 3px solid var(--paper-2); }
.engineer-chip-state-in-progress        { border-left: 3px solid #8bbf7d; }
.engineer-chip-state-on-hold            { border-left: 3px solid #b6a89a; }
.engineer-chip-state-delayed            { border-left: 3px solid #f4511e; }
.engineer-chip-state-waiting-plans      { border-left: 3px solid #98c1d9; }
.engineer-chip-state-waiting-flow-test  { border-left: 3px solid #c98ed4; }
.engineer-chip-state-waiting-client     { border-left: 3px solid #e9c46a; }
.engineer-chip-state-not-assigned.selected      { background: var(--paper-2); border-color: var(--paper-2); color: var(--ink); }
.engineer-chip-state-in-progress.selected       { background: #8bbf7d; border-color: #8bbf7d; color: var(--ink); }
.engineer-chip-state-on-hold.selected           { background: #b6a89a; border-color: #b6a89a; color: var(--ink); }
.engineer-chip-state-delayed.selected           { background: #f4511e; border-color: #f4511e; }
.engineer-chip-state-waiting-plans.selected     { background: #98c1d9; border-color: #98c1d9; color: var(--ink); }
.engineer-chip-state-waiting-flow-test.selected { background: #c98ed4; border-color: #c98ed4; color: var(--ink); }
.engineer-chip-state-waiting-client.selected    { background: #e9c46a; border-color: #e9c46a; color: var(--ink); }

/* CSV export popover */
.csv-export { position: relative; display: inline-block; }
.csv-export > summary { cursor: pointer; list-style: none; }
.csv-export > summary::-webkit-details-marker { display: none; }
.csv-export[open] > summary.ghost-btn { background: var(--ink-2); color: var(--paper); border-color: var(--rule-strong); }
.csv-export[open] > summary.ghost-btn:hover { color: var(--ember); border-color: var(--ember); background: var(--ink-2); }
.csv-export-form {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 20;
  min-width: 260px;
  padding: 14px;
  background: var(--ink-2);
  color: var(--paper);
  border: 1px solid var(--rule-strong);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.csv-export-tz { border: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; color: var(--paper); }
.csv-export-tz legend { padding: 0 0 2px; font-size: 11px; opacity: 0.65; text-transform: uppercase; letter-spacing: 0.08em; color: var(--paper); }
.csv-export-tz label { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; color: var(--paper); }
.csv-export-tz input[type="radio"] { accent-color: var(--ember); }
.csv-export-form .form-actions { margin: 0; padding-top: 10px; justify-content: flex-end; border-top: 1px solid var(--rule-strong); }

.badge-role-admin    { color: var(--ember); }
.badge-role-engineer { color: #98c1d9; }
.badge-role-client   { color: #e9c46a; }
.badge-company       { color: var(--paper-2); }

/* ---------- FORMS ---------- */
.form { padding: 28px; display: flex; flex-direction: column; gap: 20px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field label {
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  opacity: 0.7;
}
.field input,
.field select,
.field textarea {
  font-family: var(--body);
  font-size: 16px;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--rule-strong);
  padding: 12px 14px;
  border-radius: 0;
  transition: border-color .2s, background .2s;
  width: 100%;
  font-feature-settings: 'tnum';
}
.field textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--ember);
  background: rgba(232, 84, 28, 0.04);
}
select option,
select optgroup {
  background: var(--ink);
  color: var(--paper);
}
.field-hint {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  opacity: 0.55;
}
.field .checkbox-label {
  font-family: var(--body);
  font-size: 14px;
  text-transform: none;
  letter-spacing: normal;
  opacity: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.field .checkbox-label input[type="checkbox"] {
  width: auto;
  margin: 0;
  padding: 0;
  accent-color: var(--ember);
}
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}
.palette {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.palette-swatch {
  position: relative;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 80ms ease, border-color 80ms ease;
}
.palette-swatch:hover { transform: scale(1.08); }
.palette-swatch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.palette-swatch:has(input:checked) { border-color: #fff; box-shadow: 0 0 0 2px rgba(0,0,0,0.5); }
.palette-swatch-none {
  background:
    linear-gradient(45deg, transparent 47%, rgba(255,255,255,0.4) 47%, rgba(255,255,255,0.4) 53%, transparent 53%),
    rgba(255,255,255,0.06);
}

/* Calendar swimlane grid */
.cal-grid { width: 100%; }
.cal-grid-inner {
  display: grid;
  grid-template-columns: 200px repeat(var(--cal-cols, 7), 1fr);
  gap: 1px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  overflow: hidden;
}
.cal-grid-inner[data-zoom="month"] .cal-bar { padding: 2px 4px; }
.cal-grid-inner[data-zoom="month"] .cal-bar-title { font-size: 10px; }
.cal-grid-inner[data-zoom="month"] .cal-bar-proj  { font-size: 9px; }

.cal-dot {
  position: absolute;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.4), 0 1px 3px rgba(0,0,0,0.45);
  cursor: pointer;
}
.cal-dot:hover { transform: scale(1.15); }
.cal-dot-admin {
  background-image: repeating-linear-gradient(45deg, rgba(0,0,0,0.25) 0 2px, transparent 2px 4px);
}
.cal-corner { background: rgba(0,0,0,0.25); }
.cal-day-head {
  padding: 10px 12px;
  background: rgba(0,0,0,0.25);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.7;
}
.cal-day-head-today {
  background: var(--ember-haze);
  color: var(--ember);
  opacity: 1;
  font-weight: 700;
}
.cal-today-stripe {
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--ember-haze);
  pointer-events: none;
  z-index: 0;
}
.cal-lane-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  background: rgba(0,0,0,0.15);
}
.cal-lane-dot {
  width: 10px; height: 10px; border-radius: 50%;
  flex: 0 0 auto;
}
.cal-lane-role {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.5;
}
.cal-lane-name {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted transparent;
  transition: border-color .15s ease, color .15s ease;
}
.cal-lane-name:hover { color: var(--ember); border-bottom-color: var(--ember); }
.cal-lane-track {
  position: relative;
  background: rgba(0,0,0,0.1);
  min-height: 96px;
  padding: 8px 0;
  background-image: repeating-linear-gradient(
    to right,
    transparent 0,
    transparent calc(100% / var(--cal-cols, 7) - 1px),
    rgba(255,255,255,0.05) calc(100% / var(--cal-cols, 7) - 1px),
    rgba(255,255,255,0.05) calc(100% / var(--cal-cols, 7))
  );
}
.cal-bar {
  position: absolute;
  top: 8px;
  height: 36px;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 12px;
  line-height: 1.25;
  color: #0b0b0b;
  font-weight: 600;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,0.4);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  box-sizing: border-box;
}
.cal-bar-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-bar-proj {
  font-size: 10px;
  font-weight: 500;
  opacity: 0.78;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-bar:hover { filter: brightness(1.1); }
.cal-bar-admin {
  /* admin items get a hatched overlay so they're distinguishable at a glance */
  background-image: repeating-linear-gradient(45deg, rgba(255,255,255,0.18) 0 4px, transparent 4px 8px);
}
.cal-bar-dragging {
  opacity: 0.85;
  cursor: grabbing !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.45);
  z-index: 5;
}
.cal-bar-ghost {
  pointer-events: none;
  opacity: 0.55;
  outline: 1px dashed rgba(255,255,255,0.6);
  outline-offset: -2px;
}
.cal-bar-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 6px;
  cursor: ew-resize;
  opacity: 0;
  background: rgba(0,0,0,0.45);
  transition: opacity 80ms ease;
}
.cal-bar:hover .cal-bar-handle { opacity: 0.6; }
.cal-bar-handle-l { left: 0; border-radius: 4px 0 0 4px; }
.cal-bar-handle-r { right: 0; border-radius: 0 4px 4px 0; }
.cal-milestone {
  position: absolute;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.03em;
  color: var(--ember, #e8541c);
  padding: 2px 4px;
  border: 1px solid currentColor;
  border-radius: 3px;
  background: rgba(0,0,0,0.65);
  width: calc(100% / var(--cal-cols, 7) - 4px);
  box-sizing: border-box;
  text-align: center;
  overflow: hidden;
  cursor: pointer;
  text-decoration: none;
}
.cal-milestone:hover { background: rgba(0,0,0,0.85); }
.cal-milestone-state {
  text-transform: uppercase;
  font-weight: 600;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-milestone-proj {
  font-size: 8px;
  opacity: 0.75;
  text-transform: none;
  letter-spacing: 0.02em;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-grid-inner[data-zoom="month"] .cal-milestone { font-size: 7px; padding: 1px 2px; }
.cal-grid-inner[data-zoom="month"] .cal-milestone-proj { font-size: 6px; }
.cal-grid-inner[data-zoom="day"] .cal-milestone {
  width: auto;
  min-width: 140px;
  max-width: 260px;
  font-size: 11px;
  padding: 4px 8px;
}
.cal-grid-inner[data-zoom="day"] .cal-milestone-proj { font-size: 10px; }

.cal-milestone-star {
  position: absolute;
  transform: translateX(-50%);
  font-size: 14px;
  line-height: 1;
  color: var(--ember, #e8541c);
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
  cursor: pointer;
  user-select: none;
  text-decoration: none;
}
.cal-milestone-star:hover { transform: translateX(-50%) scale(1.25); }

.cal-milestone-done { opacity: 0.4; }
.cal-empty {
  text-align: center;
  font-family: var(--mono);
  font-size: 12px;
  opacity: 0.5;
}

.cal-zoom {
  display: inline-flex;
  border: 1px solid var(--rule-strong);
  border-radius: 6px;
  overflow: hidden;
}
.cal-zoom-btn {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--paper);
  padding: 6px 14px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  border-right: 1px solid var(--rule);
}
.cal-zoom-btn:last-child { border-right: 0; }
.cal-zoom-btn:hover { background: var(--surface-tint); }
.cal-zoom-btn.active {
  background: var(--ember);
  color: var(--on-accent);
}

.cal-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cal-modal[hidden] { display: none; }
.cal-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(2px);
}
.cal-modal-panel {
  position: relative;
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  overflow: auto;
  background: var(--ink-2);
  color: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: 12px;
  box-shadow: 0 24px 48px rgba(0,0,0,0.5);
  padding: 20px 24px;
}
.cal-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.cal-modal-head h2 {
  margin: 0;
  font-size: 18px;
  font-family: var(--mono);
  letter-spacing: 0.04em;
}
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.form-actions {
  display: flex; justify-content: flex-end; gap: 12px; align-items: center;
  padding-top: 8px;
  border-top: 1px solid var(--rule);
  margin-top: 4px;
  padding-top: 20px;
}

/* ---------- BUTTONS ---------- */
.primary-cta.full {
  width: 100%;
  justify-content: center;
}
.ghost-btn, .ghost-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: transparent;
  border: 1px solid var(--rule-strong);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  cursor: pointer;
  transition: border-color .2s, color .2s, background .2s;
}
.ghost-btn:hover, .ghost-link:hover {
  border-color: var(--ember);
  color: var(--ember);
}
.ghost-link { padding: 6px 0; border: none; opacity: 0.7; letter-spacing: 0.14em; }
.ghost-link:hover { opacity: 1; color: var(--ember); }

.danger-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: transparent;
  border: 1px solid #e53935;
  color: #e53935;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  cursor: pointer;
  transition: background .2s, color .2s;
}
.danger-btn:hover {
  background: #e53935;
  color: var(--ink);
}
.danger-zone {
  border: 1px solid rgba(229, 57, 53, 0.4);
  margin-top: 32px;
}
.alert-error {
  border: 1px solid #e53935;
  background: rgba(229, 57, 53, 0.08);
  color: var(--paper);
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 13px;
}

/* ---------- FLASH ---------- */
.flash-stack { display: flex; flex-direction: column; gap: 12px; margin-bottom: 32px; }
.flash {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 14px 18px;
  border: 1px solid currentColor;
  font-size: 14.5px;
  line-height: 1.4;
}
.flash-error   { color: var(--ember); }
.flash-success { color: #6db28a; }
.flash-tag {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  background: currentColor;
  color: var(--on-accent);
  padding: 3px 7px 2px;
}

/* ---------- AUTH SHELL ---------- */
.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}
.auth-shell {
  width: 100%;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}
.auth-brand { justify-content: center; }
.auth-card {
  border: 1px solid var(--rule-strong);
  background: var(--surface-soft);
  padding: 40px 36px;
}
.auth-head { margin-bottom: 28px; }
.auth-head h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: 40px;
  line-height: 1;
  letter-spacing: -0.025em;
  margin: 12px 0 8px;
  font-variation-settings: 'opsz' 48;
}
.auth-head p { opacity: 0.7; font-size: 15px; }
.auth-foot {
  text-align: center;
  font-size: 13px;
  opacity: 0.55;
  margin-top: 8px;
}
.auth-card .form { padding: 0; }

/* ---------- PROJECT DETAIL ---------- */
.project-head { align-items: flex-start; }
.project-status { display: flex; gap: 12px; align-items: center; }
.project-status select {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--rule-strong);
  padding: 8px 10px;
  cursor: pointer;
}

.project-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 32px;
  align-items: start;
}
.project-main, .project-side { display: flex; flex-direction: column; gap: 24px; }
.project-main .block, .project-side .block { margin-bottom: 0; }

.spec-list, .people-list { list-style: none; padding: 8px 0; }
.spec-list li, .people-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 12px 28px;
  border-bottom: 1px solid var(--rule);
}
.spec-list li:last-child, .people-list li:last-child { border-bottom: none; }
.spec-label, .people-label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.55;
}
.people-list li {
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.team-sub { list-style: none; padding-left: 0; margin-top: 4px; display: flex; flex-direction: column; gap: 4px; }

/* ---------- NOTES ---------- */
.notes { list-style: none; padding: 0; }
.notes .note {
  padding: 20px 28px;
  border-bottom: 1px solid var(--rule);
}
.notes .note:last-child { border-bottom: none; }
.notes .note header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
  gap: 12px;
}
.note-author {
  font-family: var(--display);
  font-weight: 500;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.note-meta { font-size: 11px; }
.notes .note p { line-height: 1.55; opacity: 0.88; white-space: pre-wrap; }
.note-form { border-top: 1px solid var(--rule); margin-top: 0; padding-top: 24px; }

/* ---------- STATUS MACHINE ---------- */
.status-machine {
  border: 1px solid var(--rule);
  background: var(--surface);
  margin-bottom: 32px;
  padding: 24px 20px;
}
.status-rail {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(var(--status-count, 6), 1fr);
  gap: 0;
  position: relative;
  padding: 0;
  margin: 0 0 24px;
}
.status-rail::before {
  content: '';
  position: absolute;
  top: 12px;
  left: calc(50% / var(--status-count, 6));
  right: calc(50% / var(--status-count, 6));
  height: 1px;
  background: var(--rule-strong);
  z-index: 0;
}
.status-step {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 0 2px;
  min-width: 0;
}
.status-num {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--ink);
  border: 1px solid var(--rule-strong);
  color: var(--paper-2);
  position: relative;
  z-index: 1;
  transition: all .25s ease;
}
.status-label {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.55;
  line-height: 1.3;
  max-width: 14ch;
  overflow-wrap: break-word;
}
.status-step.done .status-num {
  background: var(--ember);
  border-color: var(--ember);
  color: var(--on-accent);
}
.status-step.done .status-label { opacity: 0.85; color: var(--paper); }
.status-step.current .status-num {
  background: var(--ink);
  border-color: var(--ember);
  color: var(--ember);
  box-shadow: 0 0 0 4px rgba(232, 84, 28, 0.15), 0 0 18px rgba(232, 84, 28, 0.5);
}
.status-step.current .status-label { opacity: 1; color: var(--ember); }
.status-eta {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  opacity: 0.55;
  margin-top: 2px;
  display: block;
}
.status-step.current .status-eta { opacity: 0.9; color: var(--ember); }

.status-actions {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
}
.status-final {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.55;
}
.status-admin-form { display: flex; align-items: center; gap: 10px; }
.status-admin-form select {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--rule-strong);
  padding: 8px 10px;
  cursor: pointer;
}
.status-admin-label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.55;
}

@media (max-width: 1100px) {
  .status-machine { padding: 20px 14px; }
  .status-label { font-size: 8.5px; max-width: 12ch; letter-spacing: 0.06em; }
  .status-num { width: 24px; height: 24px; font-size: 9px; }
  .status-rail::before { top: 11px; }
}

@media (max-width: 820px) {
  .status-rail {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .status-rail::before { display: none; }
  .status-step {
    flex-direction: row;
    text-align: left;
    gap: 14px;
    padding: 6px 0;
    border-bottom: 1px solid var(--rule);
  }
  .status-step:last-child { border-bottom: none; }
  .status-label { max-width: none; font-size: 11px; }
  .status-eta { margin-top: 0; margin-left: auto; }
}

/* ---------- LINK LIST ---------- */
.link-list { list-style: none; padding: 0; }
.link-list li {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--rule);
  flex-wrap: wrap;
}
.link-list li:last-child { border-bottom: none; }
.link-list li.empty { display: block; padding: 40px 28px; text-align: center; opacity: 0.55; font-family: var(--mono); font-size: 13px; letter-spacing: 0.06em; border-bottom: none; }
.link-list a {
  font-family: var(--display);
  font-weight: 500;
  font-size: 16px;
  letter-spacing: -0.01em;
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
  border-bottom: 1px dashed transparent;
  transition: color .2s, border-color .2s;
}
.link-list a:hover { color: var(--ember); border-bottom-color: var(--ember); }
.link-meta {
  font-size: 11px;
  flex: 0 0 auto;
}
.link-form {
  border-top: 1px solid var(--rule);
  margin-top: 0;
  padding-top: 24px;
}
.field-hint.padded { padding: 0 28px 20px; margin: 0; }

/* ---------- FILE FOLDERS (project files) ---------- */
.files-block .folder-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 16px 20px 0;
  border-bottom: 1px solid var(--rule);
}
.folder-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: transparent;
  color: var(--paper-2);
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  position: relative;
  top: 1px;
}
.folder-tab:hover { color: var(--paper); background: rgba(232, 84, 28, 0.06); }
.folder-tab .folder-icon {
  width: 16px;
  height: 16px;
  color: var(--ember);
  flex: 0 0 auto;
}
.folder-tab .folder-name {
  white-space: nowrap;
  text-transform: none;
  letter-spacing: normal;
  font-family: var(--body);
  font-size: 13px;
}
.folder-tab .folder-count {
  font-size: 10px;
  opacity: 0.6;
  padding: 1px 6px;
  border: 1px solid var(--rule);
  border-radius: 999px;
}
.folder-tab.active {
  color: var(--paper);
  background: var(--ink);
  border-color: var(--rule-strong);
}
.folder-tab.active .folder-icon { color: var(--ember); }
.folder-tab.active .folder-count { border-color: var(--ember); color: var(--ember); opacity: 1; }

.folder-panel { padding: 20px 28px 8px; }
.folder-panel[hidden] { display: none; }
.folder-panel .invoice-list li,
.folder-panel .invoice-list li.empty { padding-left: 0; padding-right: 0; }
.folder-panel .invoice-upload-fallback .link-form { padding-left: 0; padding-right: 0; }

.subfolder-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--rule);
}
.subfolder-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: transparent;
  color: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.subfolder-tab:hover { color: var(--paper); background: rgba(232, 84, 28, 0.06); }
.subfolder-tab .subfolder-name {
  font-family: var(--body);
  font-size: 13px;
  letter-spacing: normal;
  text-transform: none;
}
.subfolder-tab .subfolder-count {
  font-size: 10px;
  opacity: 0.6;
}
.subfolder-tab.active {
  color: var(--paper);
  background: var(--ink);
  border-color: var(--ember);
}
.subfolder-tab.active .subfolder-count { color: var(--ember); opacity: 1; }
.subfolder-panel[hidden] { display: none; }
.folder-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}
.folder-panel-head h3 {
  font-family: var(--display);
  font-weight: 500;
  font-size: 18px;
  letter-spacing: -0.01em;
  margin: 0;
}
.folder-panel-count {
  font-size: 11px;
  letter-spacing: 0.08em;
}

.file-list { list-style: none; padding: 0; margin: 0 0 8px; }
.file-list .file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--rule);
}
.file-list .file-row:last-child { border-bottom: none; }
.file-list .empty {
  padding: 24px 0;
  text-align: center;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  opacity: 0.55;
}
.file-list .file-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.01em;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-bottom: 1px dashed transparent;
  transition: color .15s, border-color .15s;
}
.file-list a.file-name:hover { color: var(--ember); border-bottom-color: var(--ember); }
.file-list .file-icon {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  opacity: 0.7;
}
.file-list .file-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-list .file-meta {
  font-size: 10.5px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

/* ---------- DESIGN CHECK CARD (project sidebar) ---------- */
.design-check-card .design-check-body { padding: 16px 24px 24px; }
.design-check-card .progress-rail {
  display: block;
  width: 100%;
  height: 6px;
  background: var(--rule);
  margin: 8px 0 16px;
  position: relative;
}
.design-check-card .progress-fill {
  display: block;
  height: 100%;
  background: var(--ember);
  transition: width .3s ease;
}
.design-check-card .design-check-link { width: 100%; justify-content: center; }

/* ---------- CHECKLIST PAGE ---------- */
.checklist-block .checklist-panel { padding: 24px 28px 8px; }
.checklist-group-name {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.7;
  margin: 24px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule-strong);
}
.checklist-group-name:first-child { margin-top: 0; }
.checklist-list { list-style: none; padding: 0; margin: 0; }
.checklist-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--rule);
}
.checklist-item:last-child { border-bottom: none; }
.checklist-item.status-X { background: rgba(46, 138, 80, 0.05); }
.checklist-item.status-I { background: rgba(232, 180, 28, 0.05); }
.checklist-item.status-N { background: rgba(255, 255, 255, 0.02); opacity: 0.7; }
.checklist-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: start;
  gap: 14px;
}
.checklist-num {
  font-size: 11px;
  letter-spacing: 0.06em;
  opacity: 0.5;
  padding-top: 4px;
}
.checklist-text {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.5;
}
.checklist-status-group {
  display: inline-flex;
  gap: 4px;
  flex: 0 0 auto;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  padding: 4px 8px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  border: 1px solid var(--rule-strong);
  background: transparent;
  color: var(--paper-2);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.status-pill input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.status-pill:hover { background: rgba(232, 84, 28, 0.06); }
.status-pill.status-pill-pending.selected { background: var(--ink); border-color: var(--rule-strong); color: var(--paper-2); }
.status-pill.status-pill-X.selected { background: rgba(46, 138, 80, 0.85); border-color: rgba(46, 138, 80, 1); color: var(--on-accent); }
.status-pill.status-pill-I.selected { background: rgba(232, 180, 28, 0.85); border-color: rgba(232, 180, 28, 1); color: var(--on-accent); }
.status-pill.status-pill-N.selected { background: rgba(160, 160, 160, 0.55); border-color: rgba(160, 160, 160, 0.85); color: var(--on-accent); }

.checklist-notes {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin: 10px 0 0 42px;
}
.checklist-notes input[type="text"] {
  font-family: var(--body);
  font-size: 12.5px;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--rule);
  padding: 8px 10px;
  width: 100%;
}
.checklist-notes input[type="text"]:focus { outline: none; border-color: var(--ember); }
.checklist-notes-readonly {
  margin: 8px 0 0 42px;
  padding: 6px 10px;
  font-family: var(--mono);
  font-size: 12px;
  background: rgba(255, 255, 255, 0.03);
  border-left: 2px solid var(--rule-strong);
}
.checklist-meta {
  margin: 6px 0 0 42px;
  font-size: 10.5px;
  letter-spacing: 0.04em;
}

.ghost-btn.small {
  padding: 6px 10px;
  font-size: 10px;
  letter-spacing: 0.12em;
}

/* ---------- TAB BAR (timecard sub-views) ---------- */
.tab-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--rule-strong);
}
.list-controls {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.map-link {
  color: var(--ember);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}
.map-link:hover { color: var(--ember-deep); }
.list-controls .tab-bar { margin-bottom: 0; flex: 1 1 auto; }
.list-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 6px;
}
.list-filter select {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  padding: 6px 10px;
  background: transparent;
  color: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: 4px;
}
.tab-bar .tab {
  font-family: var(--mono);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  padding: 12px 20px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  opacity: 0.65;
  transition: opacity .2s, color .2s, border-color .2s;
}
.tab-bar .tab:hover { opacity: 1; }
.tab-bar .tab.active {
  opacity: 1;
  color: var(--ember);
  border-bottom-color: var(--ember);
}

/* ---------- STATUS DOT ---------- */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
}
.status-open {
  background: var(--ember);
  box-shadow: 0 0 0 3px rgba(232, 84, 28, 0.18), 0 0 12px rgba(232, 84, 28, 0.6);
}
.status-closed {
  background: var(--paper-2);
  opacity: 0.45;
}

/* ---------- PAGER ---------- */
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 18px 28px;
  border-top: 1px solid var(--rule);
}
.ghost-btn.small.disabled,
.pager .ghost-btn.small.disabled {
  opacity: 0.3;
  pointer-events: none;
}

/* ---------- CALENDAR GRID ---------- */
.calendar-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border: 1px solid var(--rule-strong);
  background: var(--surface);
  margin-bottom: 32px;
}
.calendar-day {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--rule);
  min-height: 360px;
}
.calendar-day:last-child { border-right: none; }
.calendar-day-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.calendar-day-body {
  flex: 1;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 540px;
  overflow-y: auto;
}
.calendar-empty {
  font-family: var(--mono);
  font-size: 11px;
  opacity: 0.3;
  text-align: center;
  padding: 24px 0;
  letter-spacing: 0.18em;
}
.cal-segment {
  display: block;
  padding: 10px 12px;
  border-left: 3px solid var(--ember);
  background: rgba(232, 84, 28, 0.08);
  color: var(--paper);
  text-decoration: none;
  transition: transform .15s ease, background .2s;
}
.cal-segment:hover {
  transform: translateX(2px);
  filter: brightness(1.18);
}
.cal-segment .cal-project {
  font-family: var(--display);
  font-weight: 500;
  font-size: 14.5px;
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin-bottom: 2px;
}
.cal-segment .cal-engineer {
  font-size: 12px;
  opacity: 0.82;
  margin-bottom: 4px;
}
.cal-segment .cal-time {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  opacity: 0.9;
}
.cal-segment .cal-segments {
  font-size: 10px;
  letter-spacing: 0.04em;
  opacity: 0.62;
  margin-top: 2px;
}
.cal-segment.cal-open {
  border-left-style: dashed;
}

/* ---------- PROJECT ROLLUP BAR ---------- */
.project-bar {
  height: 4px;
  background: rgba(232, 84, 28, 0.08);
  margin: 0 28px 16px;
  border-radius: 2px;
  overflow: hidden;
}
.project-bar-fill {
  height: 100%;
  background: var(--ember);
  border-radius: 2px;
}

/* ---------- TIME CARD ---------- */
.timecard-block .timecard-status {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  padding: 8px 0;
}
.timecard-status-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 12px 28px;
  border-bottom: 1px solid var(--rule);
}
.timecard-status-line:last-child { border-bottom: none; }
.timecard-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 20px 28px;
  border-top: 1px solid var(--rule);
}

/* ---------- THEME PICKER ---------- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.block .theme-form { margin: 0; padding: 28px; display: grid; gap: 24px; }
.theme-options {
  border: 0;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.theme-option {
  position: relative;
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 16px;
  align-items: center;
  padding: 16px 40px 16px 18px;
  border: 1px solid var(--rule-strong);
  cursor: pointer;
  transition: border-color .2s ease, background-color .2s ease, box-shadow .2s ease;
}
.theme-option:hover {
  border-color: var(--rule-hover);
}
.theme-option:has(input[type="radio"]:checked) {
  border-color: var(--paper);
  background: var(--paper);
  color: var(--ink);
  box-shadow: inset 4px 0 0 var(--ember);
}
.theme-option:has(input[type="radio"]:checked) .theme-desc {
  opacity: 0.7;
  color: var(--ink);
}
.theme-option::after {
  content: "";
  position: absolute;
  top: 14px;
  right: 14px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid var(--rule-hover);
  background: transparent;
  transition: background-color .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.theme-option:has(input[type="radio"]:checked)::after {
  border-color: var(--ember);
  background: var(--ember);
  box-shadow: inset 0 0 0 3px var(--paper);
}
.theme-option > * { pointer-events: none; }
.theme-option input[type="radio"] {
  pointer-events: auto;
  position: absolute;
  opacity: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
  z-index: 1;
}
.theme-option:has(input[type="radio"]:focus-visible) {
  box-shadow: 0 0 0 3px var(--ember-haze);
}
.theme-swatch {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--rule);
  height: 56px;
}
.theme-swatch-bar {
  height: 4px;
  border-radius: 2px;
  background: currentColor;
  opacity: 0.85;
}
.theme-swatch-bar:nth-child(1) { width: 80%; opacity: 1; }
.theme-swatch-bar:nth-child(2) { width: 60%; opacity: 0.55; }
.theme-swatch-bar:nth-child(3) { width: 40%; background: var(--ember); opacity: 1; }
.theme-swatch-dark {
  background: #161410;
  color: #ede6d3;
  border-color: rgba(237, 230, 211, 0.18);
}
.theme-swatch-light {
  background: #fbf6e8;
  color: #1c1814;
  border-color: rgba(28, 24, 20, 0.18);
}
.theme-meta { display: grid; gap: 4px; }
.theme-name {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.theme-desc {
  font-size: 13px;
  opacity: 0.65;
}
.block .theme-form .form-actions {
  border-top: 1px solid var(--rule);
  padding-top: 20px;
}
@media (max-width: 700px) {
  .theme-options { grid-template-columns: 1fr; }
}

/* ============================================================
   END APP STYLES
   ============================================================ */

/* ---------- RESPONSIVE ---------- */
@media (max-width: 1080px) {
  .service-grid { grid-template-columns: repeat(2, 1fr); }
  .service-grid li:nth-child(3n) { border-right: 1px solid var(--rule); }
  .service-grid li:nth-child(2n) { border-right: none; }
  .steps li { grid-template-columns: 80px 1fr; }
  .steps li > p { grid-column: 2; }
}

@media (max-width: 960px) {
  .project-grid { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
  .calendar-week { grid-template-columns: 1fr; }
  .calendar-day { border-right: none; border-bottom: 1px solid var(--rule); min-height: auto; }
  .calendar-day:last-child { border-bottom: none; }
  .calendar-day-body { max-height: none; }
}

@media (max-width: 760px) {
  .nav { padding: 18px 22px; }
  .nav nav { display: none; }
  .hero { padding: 64px 22px 64px; }
  .services, .process, .standards, .contact { padding-left: 22px; padding-right: 22px; padding-top: 80px; padding-bottom: 80px; }
  footer { padding: 24px 22px; }
  .hero-meta { gap: 18px; margin-bottom: 40px; font-size: 10.5px; }
  .hero-foot { grid-template-columns: 1fr; gap: 28px; margin-top: 56px; padding-top: 24px; }
  .section-head { grid-template-columns: 60px 1fr; gap: 16px; margin-bottom: 56px; }
  .section-no { padding-top: 8px; font-size: 11px; }
  .service-grid { grid-template-columns: 1fr; }
  .service-grid li { border-right: none; padding: 32px 0; }
  .service-grid li:nth-child(2n) { border-right: none; }
  .standards-grid { grid-template-columns: 1fr; gap: 56px; }
  .contact-grid { grid-template-columns: 1fr; gap: 48px; }
  .footer-row { flex-direction: column; gap: 8px; align-items: flex-start; }
  .deflector { right: -240px; top: auto; bottom: -160px; opacity: 0.3; width: 460px; height: 460px; }

  /* App responsive */
  .appnav {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    padding: 14px 20px;
    gap: 12px;
  }
  .appnav nav {
    grid-column: 1 / -1;
    justify-content: flex-start;
    gap: 18px;
    padding-top: 8px;
    border-top: 1px solid var(--rule);
  }
  .appnav-user { gap: 12px; }
  .user-meta { display: none; }
  .app-main { padding: 32px 20px 64px; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 20px; }
  .page-head .primary-cta { align-self: stretch; justify-content: center; }
  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table tr {
    padding: 16px 20px;
    border-bottom: 1px solid var(--rule);
  }
  .data-table tbody td { padding: 4px 0; border: none; }
  .data-table tbody tr:hover { background: transparent; }
  .stat-row { grid-template-columns: 1fr 1fr; }
  .stat:nth-child(2n) { border-right: none; }
  .stat { border-bottom: 1px solid var(--rule); }
}

/* ---------- COMPANY: USER PICKER + CONTACTS ---------- */
.user-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 6px 16px;
  margin-top: 6px;
}
.contacts-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 6px;
}
.contact-row {
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(0, 0, 0, 0.02);
}
.contact-row-actions {
  display: flex;
  justify-content: flex-end;
}
.contact-add-actions {
  margin-top: 12px;
}

/* ---------- INVOICE BUILDER ---------- */
.invoice-builder {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 28px;
  align-items: start;
}
@media (max-width: 1100px) {
  .invoice-builder { grid-template-columns: 1fr; }
}

.invoice-builder-form { margin: 0; }
.invoice-builder-form .block-head { padding-bottom: 16px; }

.invoice-party {
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 18px 18px 6px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: rgba(0, 0, 0, 0.02);
}
[data-theme="dark"] .invoice-party { background: rgba(255, 255, 255, 0.015); }
.invoice-party legend {
  padding: 0 8px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ember);
}

.invoice-builder-preview {
  position: sticky;
  top: 24px;
}
.invoice-preview-frame {
  background: linear-gradient(180deg, rgba(232, 84, 28, 0.06), rgba(232, 84, 28, 0));
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 28px;
  display: flex;
  justify-content: center;
}
.invoice-preview-paper {
  width: 100%;
  max-width: 520px;
  aspect-ratio: 8.5 / 11;
  background: #ffffff;
  color: #111;
  border-radius: 4px;
  box-shadow:
    0 1px 0 rgba(0, 0, 0, 0.04),
    0 12px 36px rgba(0, 0, 0, 0.18);
  padding: 32px 32px 28px;
  font-family: 'Helvetica', 'Arial', sans-serif;
  font-size: 11px;
  line-height: 1.45;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ip-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}
.ip-head-left { flex: 1 1 auto; min-width: 0; }
.ip-title {
  margin: 0 0 10px 0;
  font-family: 'Helvetica', 'Arial', sans-serif;
  font-weight: 400;
  font-size: 22px;
  letter-spacing: -0.01em;
  color: #111;
  line-height: 1.15;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  min-height: 1.15em;
}
.ip-meta {
  margin: 0;
  font-size: 9.5px;
  color: #555;
}
.ip-brand {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex: 0 0 auto;
}
.ip-brand-name {
  font-weight: 700;
  color: #d83a1a;
  font-size: 14px;
  letter-spacing: 0.04em;
}
.ip-brand-sub {
  font-size: 7.5px;
  letter-spacing: 0.18em;
  color: #7a1c0b;
  margin-top: 1px;
}
.ip-rule {
  border: none;
  border-top: 1px solid #ddd;
  margin: 18px 0 16px;
}
.ip-parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 28px;
}
.ip-parties > div { min-width: 0; }
.ip-party-label {
  font-size: 8.5px;
  color: #888;
  margin: 0 0 6px 0;
  letter-spacing: 0.04em;
}
.ip-party-name {
  font-size: 12.5px;
  font-weight: 500;
  color: #111;
  margin: 0;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  min-height: 1.4em;
}
.ip-party-addr {
  margin: 4px 0 0 0;
  font-size: 9.5px;
  color: #444;
  white-space: pre-line;
}
.ip-invoice-no {
  margin: 14px 0 0 0;
  font-size: 10px;
  color: #111;
  letter-spacing: 0.02em;
  min-height: 1em;
}

.ip-line-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
  margin-bottom: auto;
}
.ip-line-table thead th {
  text-align: left;
  font-weight: 400;
  font-size: 8.5px;
  color: #888;
  letter-spacing: 0.04em;
  border-bottom: 1px solid #ddd;
  padding: 0 0 8px 0;
}
.ip-line-table tbody td {
  padding: 14px 0 0 0;
  font-size: 10.5px;
  color: #222;
  vertical-align: top;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.ip-col-num { text-align: right; white-space: nowrap; }
.ip-col-desc { width: 50%; }

.ip-totals {
  margin-top: 32px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}
.ip-total-row {
  display: grid;
  grid-template-columns: auto auto;
  gap: 36px;
  font-size: 9.5px;
  color: #666;
  letter-spacing: 0.04em;
  width: 60%;
  justify-content: end;
}
.ip-total-row .ip-total-value {
  text-align: right;
  font-size: 10.5px;
  color: #222;
  font-weight: 400;
  letter-spacing: 0;
}
.ip-total-row-strong {
  color: #111;
  font-weight: 700;
}
.ip-total-row-strong .ip-total-value {
  font-weight: 700;
  color: #111;
}

/* ---------- SETTINGS PAGE ---------- */
.settings-row { gap: 14px; }
.settings-counter {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  font-family: var(--mono);
  background: rgba(232, 84, 28, 0.06);
}
.settings-counter strong { color: var(--ember); font-size: 14px; }

/* ---------- WORK SPEC BLOCK ---------- */
.work-spec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 28px 36px;
  padding: 4px 28px 8px;
}
.work-spec-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.work-spec-h {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ember);
  margin: 0 0 4px 0;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 6px;
}
.work-spec-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.work-spec-block .prose { margin: 0; white-space: pre-wrap; }
.work-spec-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--paper-2);
  opacity: 0.7;
}
.work-spec-dl {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 6px 14px;
  margin: 0;
}
.work-spec-dl dt {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--paper-2);
  opacity: 0.75;
  align-self: baseline;
}
.work-spec-dl dd {
  margin: 0;
  font-size: 14px;
  color: var(--paper);
  overflow-wrap: anywhere;
}
.work-spec-flags {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.work-spec-flags li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-size: 12px;
  background: rgba(232, 84, 28, 0.05);
}
.work-spec-flag-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ember);
  box-shadow: 0 0 0 2px rgba(232, 84, 28, 0.18);
}

