:root {
  --bg-dark: #2a3142;
  --bg-darker: #1e2433;
  --text: #e8eae9;
  --text-muted: #b8bdc4;
  --accent: #c9a962;
  --accent-strong: #d4b56e;
  --border: rgba(255, 255, 255, 0.12);
  --panel: rgba(248, 247, 244, 0.96);
  --panel-solid: #f8f7f4;
  --ink: #1e2433;
  --muted: #5c6575;
  --line: rgba(30, 36, 51, 0.12);
  --danger: #9b3b2f;
  --ok: #2f6b4f;
  --rail: #1e2433;
  --shadow: 0 18px 50px rgba(18, 22, 32, 0.35);
  --radius: 14px;
  --font: "Montserrat", sans-serif;
  --display: "Montserrat", sans-serif;
  --header-height: 52px;
  /* Opaque buttons for cream/white surfaces — never use dark-chrome ghost there */
  --btn-light-bg: #ffffff;
  --btn-light-color: #1e2433;
  --btn-light-border: rgba(30, 36, 51, 0.22);
  --btn-light-hover-bg: #e8ebf0;
  --btn-primary-color: #ffffff;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg-darker);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.app-frame {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  background: var(--panel-solid);
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}
.header-inner {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.site-logo {
  display: block;
  font-family: "Montserrat", sans-serif;
  font-weight: 600;
  font-size: clamp(0.82rem, 2.1vw, 1.15rem);
  letter-spacing: 0.08em;
  line-height: 1;
  color: #1e2433;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.site-logo:hover { text-decoration: none; opacity: 0.85; }
.logo-word {
  display: inline-block;
  color: #1e2433;
  white-space: nowrap;
}
.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  align-items: center;
}
.site-nav a {
  font-family: "Montserrat", sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-decoration: none;
}
.site-nav a:hover,
.site-nav a.is-current {
  color: var(--accent);
  text-decoration: none;
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}
.header-search {
  position: relative;
  display: flex;
  align-items: center;
}
.header-search-toggle {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}
.header-search-toggle:hover,
.header-search.is-expanded .header-search-toggle {
  color: var(--accent);
  border-color: rgba(201, 169, 98, 0.55);
  background: rgba(201, 169, 98, 0.1);
}
.header-search-form {
  width: 0;
  overflow: hidden;
  opacity: 0;
  margin-left: 0;
  transition: width 220ms ease, opacity 180ms ease, margin 220ms ease;
}
.header-search.is-expanded .header-search-form {
  width: min(18rem, 46vw);
  opacity: 1;
  margin-left: 0.45rem;
}
.header-search-form input {
  width: 100%;
  font: inherit;
  font-size: 0.88rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.55rem 0.9rem;
  outline: none;
}
.header-search-form input::placeholder { color: var(--muted); }
.header-search-form input:focus {
  border-color: rgba(201, 169, 98, 0.55);
  box-shadow: 0 0 0 2px rgba(201, 169, 98, 0.16);
}

body.search-modal-open { overflow: hidden; }
.search-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: start center;
  padding: 3.75rem 1rem 2rem;
}
.search-modal[hidden] { display: none; }
.search-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(14, 17, 24, 0.72);
  backdrop-filter: blur(4px);
}
.search-modal-panel {
  position: relative;
  width: min(920px, 100%);
  max-height: min(80vh, 780px);
  overflow: auto;
  background: var(--panel-solid);
  color: var(--ink);
  border-radius: 1.1rem;
  box-shadow: var(--shadow);
  padding: 1.15rem 1.25rem 1.35rem;
}
.search-modal-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--line);
}
.search-modal-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 600;
}
.search-modal-query { margin: 0.25rem 0 0; }
.search-modal-close {
  color: var(--ink) !important;
  border-color: var(--line) !important;
  background: #fff !important;
}
.search-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.search-section h3 {
  margin: 0 0 0.45rem;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.search-section h3 span { font-weight: 600; opacity: 0.75; }
.search-section .result-list {
  margin: 0;
  padding: 0.35rem 0.55rem;
  background: rgba(30, 36, 51, 0.03);
  border-radius: 0.75rem;
}
@media (max-width: 720px) {
  .search-grid { grid-template-columns: 1fr; }
  .header-search.is-expanded .header-search-form { width: min(12rem, 42vw); }
}

.site-footer {
  margin-top: auto;
  padding: 2rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--bg-darker);
  color: var(--text-muted);
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}
.footer-nav a {
  font-size: 0.8125rem;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  text-decoration: none;
}
.footer-nav a:hover { color: var(--accent); text-decoration: none; }
.footer-copy {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.shell {
  display: grid;
  grid-template-columns: 250px 1fr;
  flex: 1;
  min-height: 0;
}

.rail {
  background: linear-gradient(180deg, #252c3d, var(--rail));
  color: var(--text);
  padding: 1.25rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  border-right: 1px solid var(--border);
}
.rail-label {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
  padding: 0 0.8rem;
}

.brand {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  color: inherit;
  text-decoration: none;
}
.brand-mark {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.85rem;
  display: grid;
  place-items: center;
  background: transparent;
  border: 1px solid var(--text);
  color: var(--text);
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: 0.04em;
  font-size: 0.75rem;
}
.brand-mark.lg { width: 3.25rem; height: 3.25rem; font-size: 0.9rem; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-family: var(--display); font-size: 1.05rem; font-weight: 700; }
.brand-text em { font-style: normal; opacity: 0.7; font-size: 0.82rem; }

.nav { display: flex; flex-direction: column; gap: 0.25rem; flex: 1; }
.nav a {
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.65rem 0.8rem;
  border-radius: 0.65rem;
  font-weight: 600;
  font-size: 0.92rem;
}
.nav a:hover { background: rgba(255,255,255,0.05); color: var(--text); text-decoration: none; }
.nav a.is-active {
  background: rgba(201, 169, 98, 0.16);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(201, 169, 98, 0.28);
}

.rail-foot {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}
.who { display: flex; flex-direction: column; padding: 0 0.35rem; }
.who small { opacity: 0.65; }

.main {
  padding: 1.5rem 1.75rem 2.5rem;
  background:
    radial-gradient(900px 500px at 100% -10%, rgba(201,169,98,0.12), transparent 55%),
    linear-gradient(165deg, #232a3a 0%, #2a3142 55%, #323a4d 100%);
}
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1.25rem;
  color: var(--text);
}
.topbar h1 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.25rem, 1.7vw, 1.5rem);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.lede { margin: 0.35rem 0 0; color: var(--text-muted); max-width: 42rem; }
.topbar-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.topbar-access-code {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
  max-width: min(100%, 22rem);
  margin: 0;
}
.topbar-access-code-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: min(100%, 14rem);
  flex: 1;
}
.topbar-access-code-field > span:first-child {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.topbar-access-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.topbar-access-controls .password-field {
  flex: 1;
  min-width: 0;
}
.topbar-access-code-field input,
.topbar-access-code .password-field > input {
  font: inherit;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 0.75rem;
  padding: 0.55rem 0.75rem;
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.topbar-access-code .password-field {
  width: auto;
}
.access-code-save {
  appearance: none;
  flex: 0 0 auto;
  width: 2.35rem;
  height: 2.35rem;
  display: inline-grid;
  place-items: center;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(201, 169, 98, 0.65);
  border-radius: 0.65rem;
  background: linear-gradient(135deg, #d4b56e, #c9a962);
  color: #1a1208;
  cursor: pointer;
}
.access-code-save[hidden] {
  display: none !important;
}
.access-code-save:hover {
  filter: brightness(1.06);
}
.access-code-save svg { display: block; }
.topbar-access-hint {
  margin: 0;
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.35;
}
.inline-action { display: inline; margin: 0; }

.estimate-panel { overflow: hidden; }
.sheet-wrap { overflow-x: auto; margin: -0.25rem -0.25rem 0; }
.sheet {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 860px;
}
.sheet th {
  position: sticky;
  top: 0;
  background: #ebe4d8;
  border-bottom: 2px solid var(--line);
  padding: 0.55rem 0.4rem;
  font-size: 0.72rem;
}
.sheet td {
  padding: 0.2rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.sheet input, .sheet select {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 0.45rem;
  padding: 0.45rem 0.4rem;
  background: #fff;
  font: inherit;
}
.sheet input:focus, .sheet select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(201,169,98,0.22);
}
.sheet .col-cat { width: 9rem; }
.sheet .col-value { width: 11rem; min-width: 11rem; }
.sheet .col-amount { width: 7rem; text-align: right; white-space: nowrap; }
.sheet .col-person { width: 2.4rem; }
.sheet .col-del { width: 2.4rem; }
.sheet .col-drag { width: 2rem; }
.sheet.sheet-simple { min-width: 640px; }
.line-metrics {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.2rem;
  align-items: center;
  min-height: 2.15rem;
  width: 100%;
}
.line-metrics.is-materials {
  grid-template-columns: minmax(2.6rem, 0.85fr) auto minmax(3.4rem, 1.15fr);
}
.line-metrics .line-metrics-sep {
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
  user-select: none;
}
.line-metrics.is-labor .line-metrics-sep,
.line-metrics.is-labor .line-unit-cost,
.line-metrics.is-lump .line-metrics-sep,
.line-metrics.is-lump .line-qty {
  display: none;
}
.line-metrics.is-labor .line-qty,
.line-metrics.is-lump .line-unit-cost {
  grid-column: 1 / -1;
}
.line-person {
  position: relative;
  display: grid;
  place-items: center;
}
.line-person.is-inactive {
  visibility: hidden;
  pointer-events: none;
}
.line-person[hidden] { display: none !important; }
.line-person-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-muted, #8a90a0);
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 0.4rem;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}
.line-person-btn:hover {
  color: var(--accent, #c9a962);
  background: rgba(201, 169, 98, 0.12);
}
.line-person.is-assigned .line-person-btn {
  color: var(--accent, #c9a962);
  background: rgba(201, 169, 98, 0.16);
}
.line-person-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.25rem);
  z-index: 40;
  min-width: 14rem;
  padding: 0.55rem 0.65rem;
  border-radius: 0.55rem;
  background: #fff;
  color: var(--ink, #1e2433);
  box-shadow: 0 14px 28px rgba(8, 14, 10, 0.22);
  border: 1px solid rgba(30, 36, 51, 0.1);
}
.line-person-menu[hidden] { display: none !important; }
.line-person-menu label {
  display: grid;
  gap: 0.25rem;
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.line-person-menu select {
  font: inherit;
  text-transform: none;
  letter-spacing: normal;
  color: var(--ink, #1e2433);
  padding: 0.4rem 0.45rem;
  border-radius: 0.4rem;
  border: 1px solid var(--line, #d7d2c8);
}
.estimate-drag-handle {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-muted, #8a90a0);
  width: 1.6rem;
  height: 1.8rem;
  display: inline-grid;
  place-items: center;
  cursor: grab;
  padding: 0;
  border-radius: 0.35rem;
}
.estimate-drag-handle:hover {
  color: var(--accent, #c9a962);
  background: rgba(201, 169, 98, 0.1);
}
.estimate-drag-handle:active { cursor: grabbing; }
.estimate-drag-handle[hidden],
.estimate-drag-handle.is-disabled {
  visibility: hidden;
  pointer-events: none;
}
.estimate-lines .estimate-line-row.is-dragging {
  opacity: 0.55;
}
.estimate-lines .estimate-line-row.is-drag-over td {
  box-shadow: inset 0 2px 0 rgba(201, 169, 98, 0.85);
}
.estimate-lines .col-drag {
  vertical-align: middle;
  padding-left: 0.15rem;
  padding-right: 0.15rem;
}
.sheet .line-value { text-align: right; font-variant-numeric: tabular-nums; }
.sheet .qty, .sheet .unit-cost, .sheet .amount { text-align: right; font-variant-numeric: tabular-nums; }
.sheet .btn-del {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.2rem;
  cursor: pointer;
  width: 100%;
  line-height: 1;
  padding: 0.35rem;
}
.sheet .btn-del:hover { color: var(--danger); }
.sheet tfoot td {
  border-bottom: 0;
  padding-top: 0.75rem;
  font-weight: 700;
}
.sheet .total-label { text-align: right; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.75rem; }
.estimate-lines tfoot .estimate-overhead-row td {
  color: var(--muted);
  font-weight: 500;
  background: rgba(30, 36, 51, 0.03);
  border-top: 1px dashed rgba(30, 36, 51, 0.12);
}
.estimate-lines tfoot .estimate-overhead-row .total-label {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.9rem;
  font-weight: 500;
}
.estimate-lines tfoot .estimate-grand-total-row td {
  font-weight: 700;
  border-top: 1px solid rgba(30, 36, 51, 0.16);
}
.estimate-lines tfoot .estimate-subtotal-row td {
  border-top: 1px solid rgba(30, 36, 51, 0.12);
}
.sheet .total-value { font-family: var(--display); font-size: 1.15rem; text-align: right; }
.estimate-meta { margin-bottom: 1rem; }
.estimate-meta-form {
  margin: 0;
  display: block;
  max-width: 100%;
}
.estimate-title-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  max-width: min(100%, 40rem);
}
.estimate-title-row {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  max-width: 100%;
}
.topbar h1 .estimate-title-input,
.estimate-title-input {
  font: inherit;
  font-family: var(--display);
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  letter-spacing: inherit;
  color: inherit;
  margin: 0;
  padding: 0.05rem 0.25rem;
  border: 1px solid transparent;
  border-radius: 0.4rem;
  background: transparent;
  min-width: 8rem;
  max-width: 100%;
  width: 100%;
}
.estimate-notes-input {
  font: inherit;
  font-size: 0.95rem;
  font-weight: 400;
  line-height: 1.35;
  color: rgba(243, 239, 230, 0.82);
  margin: 0;
  padding: 0.25rem 0.45rem;
  border: 1px solid transparent;
  border-radius: 0.4rem;
  background: transparent;
  width: 100%;
  min-height: 2.4rem;
  max-height: calc(1.35em * 4 + 0.5rem);
  resize: none;
  overflow-y: auto;
  white-space: pre-wrap;
  field-sizing: content;
}
.estimate-title-input:hover,
.estimate-notes-input:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
}
.estimate-title-input:focus,
.estimate-notes-input:focus {
  outline: none;
  border-color: rgba(201, 169, 98, 0.7);
  box-shadow: 0 0 0 2px rgba(201, 169, 98, 0.22);
  background: rgba(255, 255, 255, 0.11);
  color: #fff;
}
.estimate-lede { margin-top: 0.25rem !important; }
.estimate-lines .estimate-line-row {
  cursor: text;
  height: 3.1rem;
}
.estimate-lines {
  table-layout: fixed;
}
.estimate-lines .estimate-line-row input,
.estimate-lines .estimate-line-row select {
  width: 100%;
  font: inherit;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 0.45rem;
  padding: 0.45rem 0.4rem;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
}
.estimate-lines .estimate-line-row input:hover,
.estimate-lines .estimate-line-row select:hover {
  border-color: rgba(201, 169, 98, 0.45);
  background: #fff;
}
.estimate-lines .estimate-line-row input:focus,
.estimate-lines .estimate-line-row select:focus {
  outline: none;
  border-color: rgba(201, 169, 98, 0.65);
  background: #fff;
  color: var(--ink);
  box-shadow: 0 0 0 2px rgba(201, 169, 98, 0.18);
}
.estimate-lines .estimate-new-row td {
  background: transparent;
}
.estimate-lines .estimate-line-row.is-saving td {
  background: transparent;
}
.estimate-lines .estimate-new-row input,
.estimate-lines .estimate-new-row select {
  border-color: var(--line);
  background: #fff;
}
.estimate-title-display {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.estimate-title-edit {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  max-width: 100%;
}
.estimate-title-edit input {
  font-family: var(--font);
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: normal;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 0.55rem;
  padding: 0.4rem 0.65rem;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  min-width: 8.5rem;
  max-width: 16rem;
  height: 2.15rem;
  box-sizing: border-box;
}
.estimate-title-edit input[name="estimate_notes"] {
  min-width: 12rem;
  max-width: 22rem;
  flex: 1;
}
.estimate-title-edit input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}
.estimate-title-edit input:focus {
  outline: none;
  border-color: rgba(201, 169, 98, 0.7);
  box-shadow: 0 0 0 2px rgba(201, 169, 98, 0.22);
  background: rgba(255, 255, 255, 0.11);
}
.estimate-title-edit .btn {
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.4rem 0.85rem;
  height: 2.15rem;
  border-radius: 0.55rem;
  line-height: 1;
}
.estimate-title-edit .btn-primary {
  background: linear-gradient(135deg, #d4b56e, #c9a962);
  color: #1a1208;
  border-color: transparent;
}
.estimate-lede { margin-top: 0.25rem !important; }
.estimate-notes-preview { color: var(--text-muted); }
.icon-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 0.45rem;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  vertical-align: middle;
}
.icon-btn:hover {
  color: var(--accent);
  border-color: rgba(201,169,98,0.35);
  background: rgba(201,169,98,0.08);
}

.project-header-form {
  margin: 0;
  display: block;
  max-width: 100%;
}
.project-title-row {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  max-width: 100%;
}
.customer-open {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  margin-left: 0.15rem;
  min-width: 0;
}
.customer-open-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: rgba(243, 239, 230, 0.88);
  text-decoration: none;
  max-width: 16rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.customer-open-name:hover {
  color: var(--accent, #c9a962);
  text-decoration: underline;
}
.customer-open-icon {
  display: inline-grid;
  place-items: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 0.35rem;
  color: rgba(243, 239, 230, 0.72);
  text-decoration: none;
  flex-shrink: 0;
}
.customer-open-icon:hover {
  color: var(--accent, #c9a962);
  background: rgba(201, 169, 98, 0.14);
  text-decoration: none;
}
.estimate-lede .customer-open {
  margin-left: 0.45rem;
}
.estimate-lede .customer-open-name {
  font-size: 0.92rem;
  font-weight: 600;
}
.header-total {
  display: inline-block;
  margin-left: 0.55rem;
  color: #f3efe6;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  font-size: 1.05rem;
}
.estimate-total-cluster {
  position: relative;
  display: inline-block;
  vertical-align: baseline;
}
.estimate-total-cluster .header-total {
  margin-left: 0.55rem;
}
.estimate-save-status {
  position: absolute;
  left: calc(100% + 0.45rem);
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
  font-size: 0.82rem;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
  /* Out of flow — Saving/Saved must not reflow the lede */
}
.project-header-lede .header-total {
  margin-left: 0.65rem;
}
.topbar h1 .inplace-title,
.inplace-title {
  font: inherit;
  font-family: var(--display);
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  letter-spacing: inherit;
  color: inherit;
  margin: 0;
  padding: 0.05rem 0.2rem;
  border: 1px solid transparent;
  border-radius: 0.4rem;
  background: transparent;
  min-width: 8rem;
  max-width: min(100%, 52rem);
  width: auto;
  field-sizing: content;
}
.project-header-lede {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.45rem;
}
.project-header-sep {
  color: var(--text-muted);
  opacity: 0.8;
}
.project-header-for {
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 500;
}
.inplace-control {
  font: inherit;
  color: inherit;
  border: 1px solid transparent;
  border-radius: 0.45rem;
  background: transparent;
  padding: 0.15rem 0.35rem;
  max-width: 100%;
}
.inplace-status {
  appearance: none;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  border-color: transparent;
  cursor: default;
}
.inplace-location,
.inplace-client {
  min-width: 6rem;
  max-width: 16rem;
}
.project-header-form:not(.is-editing) .inplace-control,
.project-details-form:not(.is-editing) [data-inplace-control] {
  pointer-events: none;
  box-shadow: none;
}
.project-header-form.is-editing .inplace-control,
.project-details-form.is-editing [data-inplace-control] {
  pointer-events: auto;
  border-color: rgba(201, 169, 98, 0.55);
  background: rgba(255, 255, 255, 0.08);
  cursor: text;
}
.project-header-form.is-editing .inplace-status,
.project-header-form.is-editing .inplace-client,
.project-details-form.is-editing select[data-inplace-control] {
  cursor: pointer;
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
}
.project-header-form.is-editing .inplace-title {
  background: rgba(255, 255, 255, 0.1);
}
.inplace-save[hidden],
[data-inplace-save][hidden] {
  display: none !important;
}
.project-details-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}
.project-details-head h2 { margin: 0; }
.project-details-actions {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}
.project-details-form:not(.is-editing) [data-inplace-control] {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  padding-left: 0;
  padding-right: 0;
}
.project-details-form.is-editing [data-inplace-control] {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
  padding: 0.6rem 0.75rem;
}
.estimate-ledger { padding-top: 0.85rem; }
.estimate-ledger-topline {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin: -0.35rem 0 0.45rem;
}
.estimate-portal-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.88);
  white-space: nowrap;
}
.estimate-portal-badge.is-included {
  color: #fff;
}
.estimate-portal-badge.is-excluded {
  color: rgba(255, 255, 255, 0.78);
}
.estimate-assumptions-panel {
  margin-bottom: 0.85rem;
}
.estimate-settings-form {
  display: grid;
  gap: 0.85rem;
  margin: 0;
}
.estimate-assumptions {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 0;
}
.estimate-assumptions-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.estimate-assumptions textarea {
  font: inherit;
  font-size: 0.88rem;
  line-height: 1.45;
  width: 100%;
  min-height: 4.5rem;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  padding: 0.6rem 0.75rem;
  background: #fff;
  color: var(--ink);
  box-sizing: border-box;
}
.estimate-assumptions textarea:focus {
  outline: none;
  border-color: rgba(201, 169, 98, 0.7);
  box-shadow: 0 0 0 2px rgba(201, 169, 98, 0.2);
}
.estimate-portal-visibility {
  align-items: flex-start;
  font-size: 0.92rem;
}
.estimate-settings-actions {
  display: flex;
  justify-content: flex-start;
}
.estimate-settings-actions .btn-primary {
  background: linear-gradient(135deg, #d4b56e, #c9a962);
  border-color: transparent;
  color: #1e2433;
}
.estimate-settings-actions .btn-primary:hover {
  background: linear-gradient(135deg, #dcb872, #d0b06a);
  color: #1e2433;
  filter: none;
}
.estimate-settings-actions .btn:disabled,
.estimate-settings-actions .btn-primary:disabled:hover {
  opacity: 0.45;
  cursor: not-allowed;
  filter: none;
  background: linear-gradient(135deg, #d4b56e, #c9a962);
  color: #1e2433;
}
.estimate-lines .estimate-line-row td {
  vertical-align: middle;
}
.btn.is-disabled,
a.btn.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}
.danger-zone {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}
.danger-zone .btn {
  color: var(--danger);
  background: #fff;
  border-color: rgba(155, 59, 47, 0.45);
  box-shadow: 0 1px 2px rgba(16, 20, 28, 0.18);
}
.danger-zone .btn:hover {
  color: #7a2e24;
  background: #fff8f6;
  border-color: var(--danger);
  filter: none;
}

.inline-restore {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
  margin: 0;
  flex-wrap: wrap;
}
.inline-restore select {
  font: inherit;
  font-size: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  padding: 0.35rem 0.5rem;
  background: #fff;
}
.inline-restore .btn { padding: 0.4rem 0.75rem; font-size: 0.85rem; }

.quote-body {
  min-height: 100vh;
  background:
    radial-gradient(900px 500px at 100% 0%, rgba(201,169,98,0.14), transparent 50%),
    linear-gradient(165deg, #1e2433, #2a3142 55%, #323a4d);
  color: var(--ink);
  font-family: var(--font);
  padding: 1.25rem;
}
.quote-doc {
  max-width: 860px;
  margin: 0 auto 2rem;
  background: #f7f3ea;
  border-radius: 1.1rem;
  padding: 1.6rem 1.7rem 2rem;
  box-shadow: var(--shadow);
}
.quote-hero {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid rgba(201,169,98,0.45);
}
.quote-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}
.quote-brand {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.45rem;
  color: #1e2433;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}
.quote-customer-logo {
  height: 2.4rem;
  width: auto;
  max-width: 9rem;
  object-fit: contain;
  display: block;
}
.quote-logo {
  font-size: 1.35rem;
  letter-spacing: 0.08em;
  color: #1e2433;
}
.quote-body .app-frame { min-height: 100vh; }
.quote-body .site-footer { margin-top: auto; }
.quote-tag {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.15rem;
}
.quote-doc h1 {
  margin: 0 0 0.85rem;
  font-family: var(--display);
  font-size: clamp(1.5rem, 3vw, 2rem);
}
.quote-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.1rem;
}
.quote-meta div {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 0.75rem;
  align-items: baseline;
}
.quote-meta span {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}
.quote-from {
  margin: 0 0 1.1rem;
  padding: 0.75rem 0.9rem;
  border-left: 3px solid rgba(201, 169, 98, 0.7);
  background: rgba(30, 36, 51, 0.04);
  display: grid;
  gap: 0.15rem;
  font-size: 0.95rem;
}
.quote-from > span {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}
.quote-from-bottom {
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}
.quote-intro { color: #3d4a3f; line-height: 1.55; }
.quote-table th {
  background: #1e2433;
  color: #fff;
  border-bottom: 0;
}
.quote-table td, .quote-table th { padding: 0.7rem 0.55rem; }
.quote-pkg-row td {
  background: rgba(30, 36, 51, 0.05);
  border-top: 1px solid rgba(30, 36, 51, 0.1);
  vertical-align: top;
}
.quote-pkg-row.is-overhead td {
  background: rgba(201, 169, 98, 0.12);
}
.quote-line-row td {
  color: #3d4a3f;
  font-size: 0.92rem;
  border-top: 0;
  padding-top: 0.4rem;
  padding-bottom: 0.4rem;
}
.quote-line-indent {
  display: inline-block;
  padding-left: 1.15rem;
}
.quote-table tfoot td {
  font-weight: 700;
  font-family: var(--display);
  font-size: 1.05rem;
  border-bottom: 0;
  padding-top: 0.9rem;
}
.quote-notes h2, .quote-share h2 {
  font-family: var(--display);
  font-size: 1.05rem;
  margin: 1.25rem 0 0.4rem;
}
.quote-notes p { white-space: pre-wrap; color: #3d4a3f; }
.quote-assumptions {
  margin-top: 0.5rem;
  padding: 0.5rem 0.6rem;
  border-radius: 0.4rem;
  background: #fff6e8;
  border: 1px solid #c47a1a;
  border-left-width: 3px;
}
.quote-assumptions-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #7a3e08;
  margin-bottom: 0.2rem;
}
.quote-assumptions-body {
  white-space: pre-wrap;
  font-size: 0.88rem;
  line-height: 1.45;
  color: #1e2433;
  font-weight: 500;
}
.quote-global-assumptions .quote-assumptions {
  margin-top: 0.35rem;
}
@media print {
  .quote-assumptions {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    break-inside: avoid;
  }
}
.share-url {
  display: block;
  word-break: break-all;
  background: rgba(23,32,23,0.06);
  padding: 0.7rem 0.8rem;
  border-radius: 0.6rem;
  font-size: 0.85rem;
}
.quote-foot {
  margin-top: 1.75rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
}
.linkish {
  appearance: none;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}
.portal-admin-bar .inline-action { display: inline; }

@media print {
  .no-print,
  .portal-admin-bar,
  .site-header,
  .site-footer,
  .quote-actions {
    display: none !important;
  }
  .quote-body {
    background: #fff !important;
    padding: 0 !important;
    color: #1e2433 !important;
  }
  .quote-body .app-frame {
    min-height: 0 !important;
  }
  .quote-doc {
    box-shadow: none !important;
    border-radius: 0 !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0.5in !important;
  }
  .quote-hero {
    border-bottom-color: #ccc !important;
  }
  .quote-table th {
    background: #1e2433 !important;
    color: #fff !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .quote-pkg-row td,
  .quote-pkg-row.is-overhead td {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  a[href]::after { content: none !important; }
}

/* Detailed quotes keep a simplified table for print-only */
.quote-simple-for-print {
  display: none;
}
body.quote-print-simple .quote-table-detailed {
  display: none !important;
}
body.quote-print-simple .quote-simple-for-print {
  display: table !important;
  width: 100%;
}

@media (max-width: 720px) {
  .quote-meta { grid-template-columns: 1fr; }
}

.content { display: flex; flex-direction: column; gap: 1rem; }

/*
  Button system
  -------------
  .btn alone = translucent ghost for dark chrome (page actions, dark bg).
  .btn-secondary / .btn-on-light = ALWAYS opaque ink-on-white (safe on cream).
  Any .btn inside a light surface (:is list below) is forced opaque.
  Never put bare .btn on cream/white without .btn-secondary or a listed parent.
*/
.btn {
  appearance: none;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.08);
  color: #f4efe6;
  border-radius: 999px;
  padding: 0.55rem 1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  filter: none;
}
.btn:hover {
  background: rgba(255,255,255,0.14);
  text-decoration: none;
  color: #f4efe6;
  filter: none;
}
.btn-primary {
  background: linear-gradient(135deg, #d4b56e, #c9a962);
  border-color: transparent;
  color: var(--btn-primary-color);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #dcb978, #d0b06a);
  border-color: transparent;
  color: var(--btn-primary-color);
  filter: none;
}
.btn-ghost {
  background: transparent;
  border-color: rgba(255,255,255,0.16);
  color: #e9efe8;
}
.btn-ghost:hover {
  background: rgba(255,255,255,0.1);
  color: #f4efe6;
  filter: none;
}

/* Explicit solid secondary — use this on light UIs so contrast cannot regress */
.btn-secondary,
.btn-on-light,
a.btn-secondary,
a.btn-on-light,
button.btn-secondary,
button.btn-on-light {
  background: var(--btn-light-bg) !important;
  color: var(--btn-light-color) !important;
  border: 1px solid var(--btn-light-border) !important;
  filter: none !important;
}
.btn-secondary:hover,
.btn-on-light:hover,
a.btn-secondary:hover,
a.btn-on-light:hover,
button.btn-secondary:hover,
button.btn-on-light:hover {
  background: var(--btn-light-hover-bg) !important;
  color: var(--btn-light-color) !important;
  border-color: var(--btn-light-border) !important;
  filter: none !important;
  text-decoration: none;
}

/* All light surfaces: bare .btn must stay opaque (fixes cream-on-cream ghosts) */
:is(
  .panel,
  .quote-doc,
  .quote-actions,
  .quote-modal,
  .form-panel,
  .filters,
  .portal-card,
  .portal-task-actions,
  .banner,
  .row-actions,
  .customer-projects,
  .surface-light
) .btn:not(.btn-primary):not(.btn-ghost):not(.btn-del) {
  background: var(--btn-light-bg);
  color: var(--btn-light-color);
  border-color: var(--btn-light-border);
  filter: none;
}
:is(
  .panel,
  .quote-doc,
  .quote-actions,
  .quote-modal,
  .form-panel,
  .filters,
  .portal-card,
  .portal-task-actions,
  .banner,
  .row-actions,
  .customer-projects,
  .surface-light
) .btn:not(.btn-primary):not(.btn-ghost):not(.btn-del):hover {
  background: var(--btn-light-hover-bg);
  color: var(--btn-light-color);
  border-color: var(--btn-light-border);
  filter: none;
  text-decoration: none;
}
:is(
  .panel,
  .quote-doc,
  .quote-actions,
  .quote-modal,
  .form-panel,
  .filters,
  .portal-card,
  .portal-task-actions,
  .banner,
  .row-actions,
  .customer-projects,
  .surface-light
) .btn-primary {
  background: linear-gradient(135deg, #d4b56e, #c9a962);
  border-color: transparent;
  color: var(--btn-primary-color);
  filter: none;
}
:is(
  .panel,
  .quote-doc,
  .quote-actions,
  .quote-modal,
  .form-panel,
  .filters,
  .portal-card,
  .portal-task-actions,
  .banner,
  .row-actions,
  .customer-projects,
  .surface-light
) .btn-primary:hover {
  background: linear-gradient(135deg, #dcb978, #d0b06a);
  border-color: transparent;
  color: var(--btn-primary-color);
  filter: none;
}

.panel {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.1rem 1.15rem;
  backdrop-filter: blur(8px);
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}
.panel-head-actions {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
  margin-left: auto;
}
.panel-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.2rem;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
}
.stat-grid.compact { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat {
  background: var(--panel);
  border-radius: 1rem;
  padding: 0.95rem 1rem;
  box-shadow: var(--shadow);
}
.stat-label {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  margin-bottom: 0.35rem;
}
.stat strong {
  font-family: var(--display);
  font-size: 1.55rem;
  letter-spacing: -0.02em;
}

.split {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1rem;
}
.stack-panels { display: flex; flex-direction: column; gap: 1rem; }

.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
th, td {
  text-align: left;
  padding: 0.7rem 0.55rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
th.sortable:hover { color: var(--ink); }
th.sortable::after {
  content: " ↕";
  opacity: 0.35;
  font-size: 0.85em;
  letter-spacing: 0;
  text-transform: none;
}
th.sortable.is-sorted-asc::after {
  content: " ↑";
  opacity: 0.9;
  color: var(--accent);
}
th.sortable.is-sorted-desc::after {
  content: " ↓";
  opacity: 0.9;
  color: var(--accent);
}
.muted { color: var(--muted); font-size: 0.88rem; }
.field-hint {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.8rem;
  line-height: 1.35;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
}
.empty { color: var(--muted); padding: 0.85rem 0.2rem; }
.pos { color: var(--ok); }
.neg { color: var(--danger); }

.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  background: rgba(23,32,23,0.08);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: capitalize;
}
.status-active { background: rgba(47,107,79,0.18); color: #1e2433; }
.status-estimating {
  background: #e8a04a;
  color: #3a2208;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(90, 48, 8, 0.18);
}
.status-quoted {
  background: #c9a962;
  color: #1f1608;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(60, 42, 8, 0.22);
}
.status-lead { background: rgba(55,90,120,0.16); color: #2a4660; }
.status-on_hold { background: rgba(120,110,60,0.18); color: #5c5320; }
.status-complete, .status-done { background: rgba(47,107,79,0.12); color: #2f6b4f; }
.status-blocked, .status-archived { background: rgba(155,59,47,0.14); color: #7a2e24; }
.status-open, .status-in_progress { background: rgba(55,90,120,0.14); color: #2a4660; }

.task-list, .activity, .result-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.task-list li, .activity li, .result-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.65rem 0.2rem;
  border-bottom: 1px solid var(--line);
}
.task-list li:last-child,
.activity li:last-child,
.result-list li:last-child { border-bottom: 0; }
.task-list strong, .activity strong, .result-list strong { display: block; }
.task-list small, .activity small, .result-list small {
  display: block;
  color: var(--muted);
  margin-top: 0.15rem;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}
.filters input, .filters select,
label input, label select, label textarea,
.inline-form input, .inline-form select,
.task-list select {
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  padding: 0.6rem 0.75rem;
  background: #fff;
  color: var(--ink);
}
.filters input[type="search"] { min-width: min(100%, 18rem); flex: 1; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem 1rem;
}
.form-grid label { display: flex; flex-direction: column; gap: 0.35rem; }
.form-grid label > span {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.form-grid .span-2 { grid-column: span 2; }
.form-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.password-field {
  position: relative;
  display: block;
  width: 100%;
}
.password-field > input {
  width: 100%;
  box-sizing: border-box;
  padding-right: 2.65rem;
}
.password-toggle {
  position: absolute;
  right: 0.3rem;
  top: 50%;
  transform: translateY(-50%);
  width: 2.1rem;
  height: 2.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0.55rem;
  background: transparent;
  color: var(--muted, #6b7280);
  cursor: pointer;
  line-height: 0;
}
.password-toggle:hover,
.password-toggle:focus-visible {
  color: var(--ink, #1e2433);
  background: rgba(42, 49, 66, 0.08);
  outline: none;
}
.password-toggle svg {
  width: 1.15rem;
  height: 1.15rem;
  display: block;
}
.portal-body .password-toggle {
  color: rgba(243, 239, 230, 0.72);
}
.portal-body .password-toggle:hover,
.portal-body .password-toggle:focus-visible {
  color: #f3efe6;
  background: rgba(255, 255, 255, 0.12);
}
.form-panel .btn-primary, .filters .btn-primary {
  /* primary contrast handled by light-surface :is() rules */
  color: var(--btn-primary-color);
}

.customer-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
  gap: 1rem;
  align-items: start;
}
.customer-main { min-width: 0; }
.customer-projects {
  position: sticky;
  top: 0.75rem;
  padding: 0.9rem 0.95rem 1rem;
}
.customer-projects-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.customer-projects-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.15rem;
}
.customer-projects-add {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-bottom: 1rem;
}
.customer-add-project {
  width: 100%;
  justify-content: center;
}
.customer-add-panel {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.65rem 0.7rem;
  border: 1px solid var(--line, rgba(0,0,0,0.12));
  border-radius: 0.75rem;
  background: rgba(255,255,255,0.55);
}
.customer-add-panel[hidden] { display: none !important; }
.customer-assign-form {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.customer-assign-form label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.82rem;
}
.customer-assign-form label > span {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.customer-add-empty { margin: 0; font-size: 0.82rem; }
.customer-project-section + .customer-project-section {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line, rgba(0,0,0,0.1));
}
.customer-project-section-title {
  margin: 0 0 0.45rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.customer-project-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.customer-project-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.6rem;
  border-radius: 0.65rem;
  border: 1px solid transparent;
  background: rgba(255,255,255,0.5);
  color: inherit;
  text-decoration: none;
}
.customer-project-link:hover {
  border-color: rgba(201, 169, 98, 0.55);
  background: #fff;
  text-decoration: none;
}
.customer-project-link strong {
  font-size: 0.9rem;
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.customer-project-link .pill {
  flex: 0 0 auto;
  font-size: 0.68rem;
}
.customer-project-empty {
  margin: 0;
  font-size: 0.85rem;
}

@media (max-width: 960px) {
  .customer-layout {
    grid-template-columns: 1fr;
  }
  .customer-projects {
    position: static;
  }
}
/* customer-projects buttons: covered by light-surface :is() rules */
.check {
  flex-direction: row !important;
  align-items: center;
  gap: 0.55rem !important;
  padding-top: 1.55rem;
}
.inline-form {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.flashes { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.75rem; }
.flash {
  padding: 0.8rem 1rem;
  border-radius: 0.85rem;
  background: #fff;
  color: #1e2433;
  font-weight: 600;
  border: 1px solid rgba(201, 169, 98, 0.55);
  box-shadow: 0 1px 3px rgba(16, 20, 28, 0.22);
}
.flash-error {
  background: #fff;
  color: #7a2e24;
  border-color: rgba(155, 59, 47, 0.45);
}
.flash-ok {
  background: #fff;
  color: #1e2433;
  border-color: rgba(201, 169, 98, 0.65);
}

.auth-body { min-height: 100vh; background: var(--bg-darker); }
.auth-stage {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    linear-gradient(120deg, rgba(30,36,51,0.82), rgba(30,36,51,0.55)),
    linear-gradient(160deg, #1e2433, #2a3142 60%, #3a4256);
}
.auth-stage-framed {
  flex: 1;
  min-height: 0;
}
.auth-panel {
  width: min(420px, 100%);
  background: var(--panel-solid);
  border-radius: 1.4rem;
  padding: 1.6rem;
  box-shadow: var(--shadow);
}
.auth-brand {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}
.auth-logo {
  font-size: 1.55rem;
  letter-spacing: 0.08em;
  color: #1e2433;
}
.auth-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.auth-lede { color: var(--muted); margin: 0 0 1rem; }
.auth-back {
  margin: 1rem 0 0;
  text-align: center;
  font-size: 0.9rem;
}
.auth-back a { color: var(--accent); }
.stack { display: flex; flex-direction: column; gap: 0.85rem; }
.stack label { display: flex; flex-direction: column; gap: 0.35rem; font-weight: 600; }
.stack input {
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  padding: 0.7rem 0.8rem;
}
.stack .btn-primary { width: 100%; }

.row-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; justify-content: flex-end; }
.row-actions .btn { padding: 0.4rem 0.75rem; font-size: 0.85rem; }
.slug { font-size: 0.82rem; background: rgba(23,32,23,0.06); padding: 0.2rem 0.45rem; border-radius: 0.4rem; }
.section-label {
  margin: 0.5rem 0 0.75rem;
  font-family: var(--display);
  font-size: 1.05rem;
}
.logo-upload-hint { margin: -0.35rem 0 0.85rem; max-width: 40rem; }
.logo-dropzone {
  position: relative;
  border: 2px dashed rgba(42, 49, 66, 0.28);
  border-radius: 0.85rem;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.92), rgba(248,246,241,0.96)),
    repeating-linear-gradient(
      -12deg,
      transparent,
      transparent 10px,
      rgba(42, 49, 66, 0.03) 10px,
      rgba(42, 49, 66, 0.03) 11px
    );
  padding: 1rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
.logo-dropzone.is-active,
.logo-dropzone:focus-visible {
  border-color: #c9a962;
  box-shadow: 0 0 0 3px rgba(201, 169, 98, 0.28);
  background-color: rgba(201, 169, 98, 0.08);
}
.logo-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.logo-preview-frame {
  position: relative;
  border: 1px solid rgba(42, 49, 66, 0.16);
  border-radius: 0.65rem;
  background: #fff;
  min-height: 8.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.logo-active-label {
  position: absolute;
  top: 0.55rem;
  left: 0.65rem;
  z-index: 2;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #2a3142;
  background: rgba(201, 169, 98, 0.92);
  padding: 0.2rem 0.45rem;
  border-radius: 0.3rem;
  opacity: 0.55;
  transition: opacity 0.15s ease;
}
.logo-dropzone.is-active .logo-active-label,
.logo-dropzone:focus-visible .logo-active-label,
.logo-dropzone.has-preview .logo-active-label {
  opacity: 1;
}
.logo-preview-stage {
  position: relative;
  width: min(100%, 16rem);
  height: 6.5rem;
  margin: 1.4rem 1rem 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed rgba(201, 169, 98, 0.75);
  border-radius: 0.45rem;
  background:
    linear-gradient(90deg, rgba(42,49,66,0.04) 0 28%, transparent 28%),
    linear-gradient(#f8f6f1, #f8f6f1);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.7);
}
.logo-dropzone.is-active .logo-preview-stage {
  border-color: #c9a962;
  box-shadow: inset 0 0 0 1px rgba(201, 169, 98, 0.35);
}
.logo-preview-img {
  max-width: 88%;
  max-height: 88%;
  object-fit: contain;
  display: block;
}
.logo-preview-img[hidden] { display: none !important; }
.logo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  padding: 0.5rem;
}
.logo-placeholder[hidden] { display: none !important; }
.logo-placeholder strong {
  color: var(--ink);
  font-size: 0.95rem;
}
.logo-dropzone-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.85rem;
}
.logo-status { min-height: 1.2rem; margin: 0.55rem 0 0; font-size: 0.85rem; }
.logo-clear-check { margin-top: 0.75rem; }

body.logo-paste-open { overflow: hidden; }
.logo-paste-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}
.logo-paste-modal[hidden] { display: none !important; }
.logo-paste-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 24, 32, 0.55);
}
.logo-paste-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 28rem);
  background: #fff;
  border-radius: 1rem;
  box-shadow: 0 18px 48px rgba(16, 20, 28, 0.28);
  padding: 1.15rem 1.2rem 1.25rem;
  color: var(--ink);
}
.logo-paste-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 0.9rem;
}
.logo-paste-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.15rem;
}
.logo-paste-head p { margin: 0.3rem 0 0; font-size: 0.88rem; }
.logo-paste-target {
  position: relative;
  min-height: 9.5rem;
  border: 2px dashed rgba(42, 49, 66, 0.28);
  border-radius: 0.85rem;
  background: #f8f6f1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  text-align: center;
  color: var(--muted);
  outline: none;
  cursor: text;
  padding: 1rem;
  overflow: hidden;
}
.logo-paste-target strong {
  color: var(--ink);
  font-size: 1rem;
}
.logo-paste-target:focus,
.logo-paste-target:focus-visible {
  border-color: #c9a962;
  box-shadow: 0 0 0 3px rgba(201, 169, 98, 0.28);
  background: rgba(201, 169, 98, 0.08);
}
.logo-paste-target.has-image {
  border-style: solid;
  border-color: #c9a962;
}
.logo-paste-preview {
  max-width: 85%;
  max-height: 7.5rem;
  object-fit: contain;
  display: block;
  margin-top: 0.35rem;
}
.logo-paste-preview[hidden] { display: none !important; }
.logo-paste-hint {
  min-height: 1.25rem;
  margin: 0.7rem 0 0;
  font-size: 0.88rem;
}
.logo-paste-hint.is-error { color: var(--danger); }

.logo-variants {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border, rgba(0,0,0,0.12));
}
.logo-variants[hidden] { display: none !important; }
.logo-variants-title {
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
}
.logo-variants-hint { margin: 0 0 0.75rem; font-size: 0.85rem; }
.logo-variants-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}
.logo-variant-item {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 0.65rem;
  align-items: center;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border, rgba(0,0,0,0.12));
  border-radius: 8px;
  background: rgba(255,255,255,0.35);
}
.logo-variant-item.is-active {
  border-color: var(--accent, #c9a962);
  box-shadow: inset 0 0 0 1px rgba(201,169,98,0.35);
}
.logo-variant-thumb {
  width: 64px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  overflow: hidden;
}
.logo-variant-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.logo-variant-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.55rem;
  align-items: center;
  font-size: 0.88rem;
}
.logo-variant-badge {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
  background: rgba(201,169,98,0.25);
  color: #5a4318;
}
.logo-variant-delete { font-size: 0.82rem; }

body.logo-editor-open { overflow: hidden; }
.logo-editor-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.logo-editor-modal[hidden] { display: none !important; }
.logo-editor-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 22, 30, 0.55);
}
.logo-editor-panel {
  position: relative;
  z-index: 1;
  width: min(960px, 100%);
  max-height: min(92vh, 820px);
  overflow: auto;
  background: #f7f4ee;
  color: #1e2433;
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(0,0,0,0.28);
  padding: 1rem 1.1rem 1.15rem;
}
.logo-editor-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 0.85rem;
}
.logo-editor-head h2 {
  margin: 0;
  font-size: 1.2rem;
}
.logo-editor-head p { margin: 0.3rem 0 0; font-size: 0.88rem; }
.logo-editor-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 1rem;
}
@media (max-width: 760px) {
  .logo-editor-body { grid-template-columns: 1fr; }
}
.logo-editor-stage-wrap {
  min-width: 0;
  background:
    linear-gradient(45deg, #ddd 25%, transparent 25%) 0 0 / 16px 16px,
    linear-gradient(-45deg, #ddd 25%, transparent 25%) 0 8px / 16px 16px,
    linear-gradient(45deg, transparent 75%, #ddd 75%) 8px -8px / 16px 16px,
    linear-gradient(-45deg, transparent 75%, #ddd 75%) -8px 0 / 16px 16px,
    #eee;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.1);
  overflow: hidden;
}
.logo-editor-stage {
  position: relative;
  width: 100%;
  min-height: 280px;
}
.logo-editor-stage canvas {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: top;
}
.logo-crop-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.logo-crop-overlay[hidden] { display: none !important; }
.logo-crop-box {
  position: absolute;
  border: 2px solid #c9a962;
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.35);
  pointer-events: auto;
  cursor: move;
}
.logo-crop-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #fff;
  border: 2px solid #c9a962;
  border-radius: 2px;
}
.logo-crop-handle.nw { left: -7px; top: -7px; cursor: nwse-resize; }
.logo-crop-handle.ne { right: -7px; top: -7px; cursor: nesw-resize; }
.logo-crop-handle.sw { left: -7px; bottom: -7px; cursor: nesw-resize; }
.logo-crop-handle.se { right: -7px; bottom: -7px; cursor: nwse-resize; }
.logo-editor-tools {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.logo-tool {
  display: grid;
  gap: 0.25rem;
  font-size: 0.86rem;
}
.logo-tool.check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.logo-tool output {
  font-variant-numeric: tabular-nums;
  color: #5a6478;
}
.logo-editor-status {
  min-height: 1.2rem;
  margin: 0.2rem 0 0;
  font-size: 0.85rem;
}
.logo-editor-status.is-error { color: var(--danger); }
.logo-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.logo-editor-create-note { margin: 0; font-size: 0.82rem; }
.logo-editor-create-note[hidden] { display: none !important; }

.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0.35rem 1rem; }
.check.tight { padding-top: 0 !important; }

.portal-body {
  min-height: 100vh;
  background:
    radial-gradient(900px 500px at 0% 0%, rgba(201,169,98,0.16), transparent 55%),
    linear-gradient(165deg, #1e2433, #2a3142 55%, #323a4d);
  color: #f3efe6;
  font-family: var(--font);
}
.portal-body .app-frame { min-height: 100vh; }
.portal-admin-bar {
  background: rgba(201,169,98,0.92);
  color: #1a1208;
  padding: 0.55rem 1rem;
  font-size: 0.88rem;
  font-weight: 600;
}
.portal-admin-bar a { color: #1a1208; text-decoration: underline; }
.portal-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
}
.portal-brand {
  display: flex;
  gap: 0.85rem;
  align-items: center;
  color: inherit;
  text-decoration: none;
}
.portal-brand:hover {
  color: inherit;
  text-decoration: none;
  opacity: 0.88;
}
.portal-customer-logo {
  height: 2.75rem;
  width: auto;
  max-width: 8.5rem;
  object-fit: contain;
  display: block;
  border-radius: 0.35rem;
  background: rgba(255, 255, 255, 0.92);
  padding: 0.25rem 0.4rem;
}
.portal-brand strong { display: block; font-family: var(--display); }
.portal-brand em { font-style: normal; opacity: 0.7; font-size: 0.85rem; }
.portal-who { font-weight: 600; opacity: 0.85; }
.portal-main { padding: 0 1.5rem 2.5rem; max-width: 980px; margin: 0 auto; }
.portal-intro h1 {
  margin: 0.35rem 0 0.4rem;
  font-family: var(--display);
  font-size: clamp(1.8rem, 4vw, 2.5rem);
}
.portal-intro p { color: rgba(243,239,230,0.75); max-width: 40rem; }
.portal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.85rem;
  margin-top: 1.25rem;
}
.portal-project {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1.1rem;
  border-radius: 1rem;
  background: rgba(244,239,230,0.94);
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform 180ms ease, box-shadow 180ms ease;
}
.portal-project:hover {
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: 0 22px 40px rgba(8,14,10,0.32);
}
.portal-project strong { font-family: var(--display); font-size: 1.15rem; }
.portal-project small { color: var(--muted); }
.portal-project p { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.92rem; }
.portal-project-status {
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(30, 36, 51, 0.1);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: rgba(30, 36, 51, 0.62);
}
.portal-project-open-items {
  display: inline-flex;
  align-self: flex-start;
  margin-top: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(201, 169, 98, 0.28);
  color: #1e2433;
  font-size: 0.75rem;
  font-weight: 700;
}
.portal-open-items-home {
  margin-top: 1rem;
}
.portal-open-items-home h2 {
  margin-bottom: 0.55rem;
}
.portal-task-link {
  text-decoration: none;
  color: inherit;
}
.portal-task-link:hover {
  text-decoration: none;
  background: rgba(30, 36, 51, 0.04);
}
.portal-card {
  background: rgba(244,239,230,0.94);
  color: var(--ink);
  border-radius: 1rem;
  padding: 1.15rem 1.2rem;
  box-shadow: var(--shadow);
}
.portal-card.narrow { max-width: 420px; margin: 2rem auto; }
.portal-card h1, .portal-card h2 {
  font-family: var(--display);
  margin-top: 0;
}
.portal-detail-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}
.portal-meta { display: grid; gap: 0.55rem; margin: 1rem 0 0; }
.portal-meta > div { display: flex; justify-content: space-between; gap: 1rem; border-top: 1px solid var(--line); padding-top: 0.45rem; }
.portal-meta dt { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
.portal-meta dd { margin: 0; font-weight: 600; }
.portal-estimate {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  border-top: 1px solid var(--line);
  padding-top: 0.45rem;
}
.portal-estimate-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.portal-estimate-row dd {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.portal-estimate-toggle {
  appearance: none;
  border: 0;
  background: rgba(30, 36, 51, 0.08);
  color: var(--ink);
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease;
}
.portal-estimate-toggle:hover { background: rgba(201, 169, 98, 0.28); }
.portal-estimate.is-open .portal-estimate-toggle { transform: rotate(180deg); }
.portal-estimate-packages {
  list-style: none;
  margin: 0;
  padding: 0.15rem 0 0.2rem;
  display: grid;
  gap: 0.35rem;
}
.portal-estimate-packages[hidden] { display: none !important; }
.portal-estimate-packages li {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.92rem;
  padding: 0.35rem 0 0.35rem 0.35rem;
  border-left: 2px solid rgba(201, 169, 98, 0.55);
}
.portal-estimate-package-static,
.portal-estimate-package {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  width: 100%;
}
.portal-estimate-package-text {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}
.portal-estimate-package-name {
  font-weight: 600;
}
.portal-estimate-package-summary {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
  white-space: pre-wrap;
}
.portal-estimate-assumptions {
  margin: 0.15rem 0 0.1rem;
  padding: 0.45rem 0.55rem;
  border-radius: 0.45rem;
  background: rgba(30, 36, 51, 0.04);
}
.portal-estimate-assumptions-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.2rem;
}
.portal-estimate-assumptions p {
  margin: 0;
  white-space: pre-wrap;
  font-size: 0.86rem;
  line-height: 1.45;
  color: #3d4a3f;
}
.portal-estimate-packages strong { font-variant-numeric: tabular-nums; }
.portal-estimate-package {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  width: 100%;
  margin: 0;
  padding: 0.15rem 0.35rem 0.15rem 0;
  border: 0;
  border-radius: 0.35rem;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.portal-estimate-package:hover {
  background: rgba(201, 169, 98, 0.14);
}
.portal-estimate-package strong { font-variant-numeric: tabular-nums; }
.portal-estimate-dialog {
  border: 0;
  border-radius: 1rem;
  padding: 0;
  width: min(40rem, calc(100vw - 1.5rem));
  max-height: min(80vh, 640px);
  box-shadow: 0 24px 48px rgba(8, 14, 10, 0.28);
  background: #fff;
  color: var(--ink);
}
.portal-estimate-dialog::backdrop { background: rgba(18, 22, 30, 0.55); }
.portal-estimate-dialog-inner {
  padding: 1.1rem 1.2rem 1.25rem;
  display: grid;
  gap: 0.85rem;
  overflow: auto;
  max-height: min(80vh, 640px);
}
.portal-estimate-dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}
.portal-estimate-dialog-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.25rem;
}
.portal-estimate-dialog-close {
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 999px;
  background: rgba(30, 36, 51, 0.06);
  color: var(--ink);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}
.portal-estimate-dialog-close:hover { background: rgba(30, 36, 51, 0.12); }
.portal-estimate-lines {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.portal-estimate-lines th,
.portal-estimate-lines td {
  text-align: left;
  padding: 0.45rem 0.35rem;
  border-bottom: 1px solid rgba(30, 36, 51, 0.1);
  vertical-align: top;
}
.portal-estimate-lines th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.portal-estimate-lines tfoot td {
  font-weight: 700;
  border-bottom: 0;
  padding-top: 0.7rem;
}
.portal-quote-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.65rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--line);
}
.portal-task-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.15rem;
}
.portal-task-list > li.empty {
  padding: 0.35rem 0;
  color: var(--muted);
}
.portal-task-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35rem;
  height: 1.35rem;
  padding: 0 0.35rem;
  margin-left: 0.25rem;
  border-radius: 999px;
  background: rgba(201, 169, 98, 0.28);
  color: #1e2433;
  font-size: 0.72rem;
  font-weight: 700;
  vertical-align: middle;
}
.portal-task-item {
  border: none;
  border-radius: 0.55rem;
  background: transparent;
  padding: 0 !important;
}
.portal-task-item[open] {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(30, 36, 51, 0.1);
  margin: 0.2rem 0;
}
.portal-task-summary {
  list-style: none;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.65rem;
  cursor: pointer;
  border-radius: 0.55rem;
}
.portal-task-summary::-webkit-details-marker { display: none; }
.portal-task-summary::marker { content: ""; }
.portal-task-summary:hover {
  background: rgba(30, 36, 51, 0.04);
}
.portal-task-item[open] > .portal-task-summary:hover {
  background: transparent;
}
.portal-task-bullet {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: #c9a962;
  flex-shrink: 0;
}
.portal-task-summary-main {
  display: grid;
  gap: 0.05rem;
  min-width: 0;
}
.portal-task-summary-main strong {
  font-size: 0.95rem;
  font-weight: 600;
  color: #1e2433;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.portal-task-summary-main small {
  color: var(--muted);
  font-size: 0.78rem;
}
.portal-task-chevron {
  color: var(--muted);
  display: inline-flex;
  transition: transform 0.15s ease;
}
.portal-task-item[open] .portal-task-chevron {
  transform: rotate(180deg);
  color: #1e2433;
}
.portal-task-body {
  display: grid;
  gap: 0.55rem;
  padding: 0 0.85rem 0.85rem 1.65rem;
}
.portal-task-notes {
  margin: 0;
  color: #3d4a3f;
  font-size: 0.92rem;
  line-height: 1.45;
  white-space: pre-wrap;
}
.portal-task-prior-response {
  padding: 0.45rem 0.55rem;
  border-radius: 0.45rem;
  background: rgba(30, 36, 51, 0.04);
}
.portal-task-prior-response > span {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.2rem;
}
.portal-task-prior-response p {
  margin: 0;
  white-space: pre-wrap;
  font-size: 0.88rem;
}
.portal-task-respond {
  display: grid;
  gap: 0.45rem;
}
.portal-task-respond label {
  display: grid;
  gap: 0.25rem;
}
.portal-task-respond label > span {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
}
.portal-task-respond textarea {
  width: 100%;
  border: 1px solid rgba(30, 36, 51, 0.14);
  border-radius: 0.5rem;
  padding: 0.55rem 0.65rem;
  font: inherit;
  resize: vertical;
  min-height: 4.5rem;
  background: #fff;
}
.portal-task-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.portal-add-item {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(30, 36, 51, 0.1);
}
.portal-add-item > summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--ink);
  list-style: none;
}
.portal-add-item > summary::-webkit-details-marker { display: none; }
.portal-add-item > summary::before {
  content: "+ ";
  color: var(--accent);
  font-weight: 700;
}
.portal-add-item[open] > summary::before { content: "− "; }
.portal-add-item-form {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.65rem;
}
.portal-add-item-form label {
  display: grid;
  gap: 0.25rem;
}
.portal-add-item-form label > span {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
}
.portal-add-item-form input,
.portal-add-item-form textarea {
  width: 100%;
  border: 1px solid rgba(30, 36, 51, 0.14);
  border-radius: 0.5rem;
  padding: 0.55rem 0.65rem;
  font: inherit;
  background: #fff;
}
.portal-add-item-form textarea {
  resize: vertical;
  min-height: 5rem;
}
.task-customer-response {
  margin-top: 0.35rem;
  padding: 0.4rem 0.55rem;
  border-radius: 0.45rem;
  background: rgba(201, 169, 98, 0.12);
}
.task-customer-response p {
  margin: 0.15rem 0 0;
  white-space: pre-wrap;
  font-size: 0.9rem;
}
.project-details-form.is-editing input[type="checkbox"][data-inplace-control] {
  cursor: pointer;
  accent-color: var(--accent);
}
.project-portal-details-toggle {
  margin-top: 0.15rem;
}
.portal-notes { white-space: pre-wrap; }
/* Portal light-surface buttons: covered by shared :is(...) .btn rules above */

.banner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.95rem 1.1rem;
  border-radius: 0.75rem;
  margin: 0 0 1rem;
  background: #fff;
  color: #1e2433;
  border: 1px solid rgba(30, 36, 51, 0.16);
  box-shadow: 0 2px 10px rgba(8, 14, 10, 0.18);
}
.banner strong {
  color: #1e2433;
  display: block;
  margin-bottom: 0.2rem;
}
.banner .muted {
  color: #3d4656;
  font-weight: 500;
}
.banner-warn {
  background: #fff6e8;
  border: 1px solid #c47a1a;
  color: #1e2433;
}
.banner-warn strong {
  color: #7a3e08;
}
.banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  flex-shrink: 0;
}
/* banner .btn: covered by light-surface :is() rules */
.quote-modal {
  border: 0;
  border-radius: 1rem;
  padding: 0;
  width: min(32rem, calc(100vw - 1.5rem));
  box-shadow: 0 24px 48px rgba(8, 14, 10, 0.28);
  background: #fff;
  color: var(--ink);
}
.quote-modal::backdrop { background: rgba(18, 22, 30, 0.55); }
.quote-modal-form { padding: 1.15rem 1.25rem 1.2rem; display: grid; gap: 0.85rem; }
.quote-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}
.quote-modal-head h2 { margin: 0; font-family: var(--display); font-size: 1.35rem; }
.quote-modal-close {
  appearance: none;
  border: 0;
  background: transparent;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  width: 2rem;
  height: 2rem;
}
.quote-modal-field { display: grid; gap: 0.3rem; }
.quote-modal-field input {
  font: inherit;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
}
.quote-modal-estimates {
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  padding: 0.65rem 0.75rem;
  display: grid;
  gap: 0.45rem;
  margin: 0;
}
.quote-modal-estimates legend {
  padding: 0 0.25rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.quote-modal-estimates .check.is-disabled { opacity: 0.55; }
.quote-modal-total { margin: 0; }
.quote-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}
.form-error { color: var(--danger); margin: 0; font-size: 0.9rem; }

@media (max-width: 820px) {
  .portal-detail-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1100px) {
  .stat-grid, .stat-grid.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .site-nav { gap: 0.75rem; }
  .site-nav a { font-size: 0.7rem; letter-spacing: 0.08em; }
  .shell { grid-template-columns: 1fr; }
  .rail {
    position: sticky;
    top: 0;
    z-index: 20;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
  }
  .nav { flex-direction: row; flex-wrap: wrap; width: 100%; }
  .rail-foot { width: 100%; flex-direction: row; align-items: center; justify-content: space-between; }
  .stat-grid, .stat-grid.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid, .inline-form { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .main { padding: 1rem; }
}
