:root {
  color-scheme: light;
  --ink: #1e2428;
  --muted: #69757d;
  --line: #dce3e1;
  --paper: #fbfbf8;
  --panel: #ffffff;
  --sage: #6f8d79;
  --moss: #435f4d;
  --rose: #b66b73;
  --gold: #b78a3b;
  --blue: #42657c;
  --shadow: 0 18px 45px rgba(35, 44, 42, 0.09);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

textarea {
  resize: none;
  overflow: hidden;
  min-height: 44px;
  max-height: none;
}

button {
  cursor: pointer;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(120deg, rgba(238, 243, 239, 0.96), rgba(251, 251, 248, 0.94)),
    url("https://images.unsplash.com/photo-1464366400600-7168b8af9bc3?auto=format&fit=crop&w=1600&q=80");
  background-size: cover;
  background-position: center;
}

.auth-card {
  width: min(460px, 100%);
  padding: 28px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 18px;
}

.auth-brand {
  margin-bottom: 4px;
}

.auth-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.auth-actions button {
  flex: 1 1 150px;
}

.auth-message,
.auth-warning,
.auth-help {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.auth-help {
  padding: 10px 12px;
  border: 1px solid #dce7e0;
  border-radius: 8px;
  background: #f7faf7;
  color: #3d5c49;
  font-size: 0.9rem;
}

.auth-warning {
  padding: 12px;
  border: 1px solid #ead1d4;
  border-radius: 8px;
  background: #fff7f7;
  color: #8b3740;
}

.auth-shell.is-hidden,
.onboarding-shell.is-hidden,
.password-update-shell.is-hidden,
.billing-shell.is-hidden,
.app-shell.is-locked {
  display: none;
}

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

.billing-card {
  width: min(520px, 100%);
}

.billing-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.plan-option {
  min-height: 88px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  display: grid;
  gap: 6px;
  text-align: left;
}

.plan-option strong {
  font-size: 1.55rem;
  color: var(--moss);
}

.plan-option.is-selected {
  border-color: var(--moss);
  background: #eef3ef;
}

.payment-instructions {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf7;
  color: var(--muted);
  line-height: 1.45;
}

.paypal-buttons {
  min-height: 46px;
}

.upgrade-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(30, 36, 40, 0.42);
}

.upgrade-modal-dialog {
  width: min(620px, 100%);
  max-height: min(760px, 92vh);
  overflow: auto;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
  display: grid;
  gap: 16px;
}

.upgrade-modal-dialog > p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.upgrade-comparison {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.upgrade-plan-card,
.upgrade-ai-examples > div {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfa;
}

.upgrade-plan-card.is-pro {
  border-color: rgba(67, 95, 77, 0.45);
  background: #eef5ef;
}

.upgrade-plan-card h4,
.upgrade-ai-examples h4 {
  margin: 4px 0 10px;
  font-size: 1rem;
}

.upgrade-plan-card ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.45;
}

.upgrade-ai-examples {
  display: grid;
  gap: 12px;
}

.upgrade-ai-examples p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.upgrade-plan-options .plan-option {
  min-height: 76px;
}

.onboarding-grid {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
}

.app-shell {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 180ms ease;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 76px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
  background: #eef3ef;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
  min-width: 0;
  transition: padding 180ms ease, gap 180ms ease;
}

.sidebar-toggle {
  position: fixed;
  top: 188px;
  left: 247px;
  z-index: 5;
  width: 44px;
  min-width: 44px;
  height: 44px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 2px solid #111;
  border-radius: 999px;
  background: #fff;
  color: #111;
  box-shadow: 0 12px 26px rgba(46, 57, 50, 0.2);
  cursor: pointer;
  transition: left 180ms ease, top 180ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.sidebar-toggle-arrow {
  display: block;
  font-size: 1.45rem;
  font-weight: 900;
  line-height: 1;
  transform: translateX(-1px) rotate(180deg);
}

.sidebar-toggle:hover,
.sidebar-toggle:focus-visible {
  background: #fff;
  color: #111;
  transform: scale(1.04);
  box-shadow: 0 16px 32px rgba(46, 57, 50, 0.24);
  outline: none;
}

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

.sidebar-brand {
  display: grid;
  gap: 6px;
  align-items: start;
}

.brand-banner {
  display: block;
  width: min(100%, 225px);
  height: auto;
  border-radius: 8px;
  object-fit: contain;
  box-shadow: 0 10px 24px rgba(33, 39, 34, 0.1);
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: block;
  object-fit: contain;
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--line);
  box-shadow: 0 8px 18px rgba(33, 39, 34, 0.12);
}

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

h1 {
  font-size: 1.1rem;
}

.brand p,
.build-label,
.summary-panel small,
.eyebrow,
label,
th,
.total-card span,
.section-heading span {
  color: var(--muted);
}

.build-label {
  display: block;
  margin-top: 3px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.nav-list {
  display: grid;
  gap: 6px;
  flex: 1 1 auto;
}

.tenant-switcher {
  display: grid;
  gap: 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  min-width: 0;
}

.tenant-switcher label,
.tenant-switcher .shop-tabs,
.tenant-switcher #addShop {
  display: none !important;
}

.tenant-switcher [hidden],
.tenant-switcher label[hidden] {
  display: none !important;
}

.undo-button {
  width: 100%;
  margin-top: auto;
}

.sort-header-button {
  background: transparent;
  border: 0;
  font: inherit;
  font-weight: 800;
  color: inherit;
  padding: 0;
  cursor: pointer;
}

.sort-header-button.is-active {
  color: var(--moss);
}

.micro-icon {
  font-size: 0.82em;
  opacity: 0.85;
  margin-right: 4px;
}

.micro-icon-img {
  width: 14px;
  height: 14px;
  object-fit: cover;
  border-radius: 3px;
  opacity: 0.82;
  vertical-align: -2px;
  margin-right: 5px;
}

.micro-brand-icon {
  width: 16px;
  height: 16px;
  object-fit: cover;
  border-radius: 4px;
  opacity: 0.72;
  margin-top: 6px;
}

.tenant-switcher .secondary-button {
  width: 100%;
}

.shop-tabs {
  display: grid;
  gap: 6px;
}

.shop-tab {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf7;
  color: var(--ink);
  text-align: left;
  font-weight: 700;
}

.shop-tab[aria-current="true"] {
  background: var(--moss);
  color: #fff;
  border-color: var(--moss);
}

.nav-list a {
  color: var(--ink);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quick-admin-create {
  margin: 10px 0 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf7;
}

.quick-admin-create h4 {
  margin: 0 0 10px;
}

.center-action-panel {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 96px;
  padding: 18px;
}

.center-action-panel .primary-button,
.center-action-panel .secondary-button {
  width: min(320px, 100%);
}

.nav-list a:hover,
.nav-list a:focus-visible,
.nav-list a.is-active {
  background: #dde8df;
  outline: none;
}

.nav-list a.is-active {
  color: var(--moss);
  font-weight: 850;
}

.summary-panel {
  padding: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 6px;
}

.summary-panel strong {
  font-size: 1.8rem;
}

.topbar-title {
  min-width: 0;
}

.topbar-title-row {
  display: flex;
  align-items: center;
  gap: 20px;
  min-width: 0;
}

.topbar-title-row h2 {
  min-width: 0;
}

.topbar-balance {
  min-width: 190px;
  padding: 10px 14px;
  gap: 2px;
  box-shadow: 0 10px 24px rgba(46, 57, 50, 0.08);
}

.topbar-balance strong {
  font-size: 1.25rem;
  line-height: 1.1;
}

.topbar-balance small {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-shell.event-list-view .topbar-balance,
.app-shell.admin-overview .topbar-balance,
.app-shell.profile-view .topbar-balance,
.app-shell.template-view .topbar-balance,
.app-shell.add-event-view .topbar-balance,
.app-shell.add-user-view .topbar-balance,
.app-shell.import-pdf-view .topbar-balance {
  display: none;
}

.app-shell.sidebar-collapsed .sidebar {
  padding: 18px 12px;
  gap: 18px;
  align-items: center;
}

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

.app-shell.sidebar-collapsed .brand-banner {
  width: 46px;
  height: 46px;
  object-fit: cover;
  object-position: left center;
  border-radius: 12px;
}

.app-shell.sidebar-collapsed .brand > div:last-child,
.app-shell.sidebar-collapsed .tenant-switcher {
  display: none;
}

.dashboard-admin-table {
  display: none;
}

.app-shell.profile-view #dashboard,
.app-shell.profile-view #admin,
.app-shell.profile-view #proposalForm,
.app-shell.profile-view #preview,
.app-shell.profile-view .topbar .actions {
  display: none;
}

.app-shell.profile-view #account {
  display: block;
}

.app-shell.template-view #account {
  display: none;
}

.app-shell.template-view #template {
  display: block;
}

.app-shell.sidebar-collapsed .nav-list {
  width: 100%;
}

.app-shell.sidebar-collapsed .nav-list a {
  display: grid;
  place-items: center;
  min-height: 42px;
  padding: 10px 6px;
  font-size: 0;
}

.app-shell.sidebar-collapsed .nav-list a::before {
  content: attr(data-short);
  font-family: "Segoe UI Symbol", "Apple Symbols", "Noto Sans Symbols", system-ui, sans-serif;
  font-size: 1.18rem;
  font-weight: 900;
  line-height: 1;
}

.app-shell.sidebar-collapsed .sidebar-toggle {
  left: 55px;
}

.app-shell.sidebar-collapsed .sidebar-toggle-arrow {
  transform: translateX(1px);
}

main {
  min-width: 0;
}

.app-footer {
  padding: 18px 28px 24px;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
  border-top: 1px solid rgba(220, 227, 225, 0.76);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  min-height: 78px;
  padding: 18px 28px;
  background: rgba(251, 251, 248, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
}

.eyebrow {
  font-size: 0.72rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

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

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

.action-status {
  min-height: 22px;
  margin: -6px 0 14px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.action-status.is-success {
  color: #2f6b45;
}

.action-status.is-error {
  color: #9c414b;
}

.primary-button,
.secondary-button,
.icon-button {
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 700;
}

.primary-button {
  padding: 0 16px;
  background: var(--moss);
  color: #fff;
}

.secondary-button {
  padding: 0 14px;
  background: #fff;
  color: var(--moss);
  border-color: var(--line);
}

.icon-button {
  width: 42px;
  background: #fff;
  color: var(--moss);
  border-color: var(--line);
}

.import-review-overlay,
.email-review-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(18, 29, 24, 0.46);
}

.import-review-overlay[hidden],
.email-review-overlay[hidden] {
  display: none;
}

.import-review-dialog,
.email-review-dialog {
  width: min(980px, 100%);
  max-height: min(820px, calc(100vh - 44px));
  overflow: auto;
  padding: 24px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fffefb;
  box-shadow: 0 24px 80px rgba(21, 31, 25, 0.28);
}

.email-review-dialog {
  width: min(1120px, 100%);
}

.email-review-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.email-review-meta label {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf7;
}

.email-review-meta span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.email-review-meta strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 0.98rem;
}

.email-review-meta input,
.email-review-meta textarea {
  width: 100%;
  border: 1px solid #cfd9d3;
  border-radius: 8px;
  background: #fffefb;
  color: var(--ink);
  font: inherit;
  font-size: 0.98rem;
}

.email-review-meta textarea {
  min-height: 92px;
  resize: vertical;
}

.email-review-document {
  max-height: 520px;
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f3f0ea;
}

.email-review-document .proposal-document {
  max-width: 920px;
  margin: 0 auto;
}

.email-review-actions {
  justify-content: flex-end;
  margin-top: 18px;
}

@media (max-width: 760px) {
  .email-review-meta {
    grid-template-columns: 1fr;
  }

  .email-review-document {
    padding: 10px;
  }
}

.import-review-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.import-review-stat {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf7;
}

.import-review-stat span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.import-review-stat strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 1rem;
}

.import-review-warning {
  margin: 12px 0;
  padding: 12px 14px;
  border: 1px solid #e8c6a9;
  border-radius: 8px;
  background: #fff8ee;
  color: #7b4a19;
  font-weight: 800;
}

.import-review-preview {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.import-review-section {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.import-review-section h4 {
  margin: 0 0 8px;
}

.import-review-section ul {
  margin: 0;
  padding-left: 20px;
}

.import-review-section li {
  margin: 5px 0;
}

.import-review-actions {
  justify-content: flex-end;
  margin-top: 18px;
}

.workspace {
  min-width: 0;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 22px 28px 32px;
  display: grid;
  gap: 18px;
}

form {
  display: grid;
  gap: 22px;
}

.panel {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px 22px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  min-width: 0;
  flex-wrap: wrap;
}

.section-heading > .secondary-button,
.section-heading > .primary-button,
.section-heading > .actions,
.section-heading > .preview-actions,
.section-heading > .toolbar-actions {
  margin-left: clamp(24px, 24vw, 430px);
  margin-right: auto;
}

.section-heading > div {
  min-width: 0;
}

.section-heading h3 {
  font-size: 1.22rem;
}

.section-heading-with-add {
  justify-content: flex-start;
  column-gap: 30px;
}

.section-heading-with-add > .secondary-button,
.section-heading-with-add > .primary-button,
.section-heading-with-add .toolbar-actions {
  margin-left: 30px;
  margin-right: auto;
}

.section-heading-with-add > div {
  flex: 0 0 auto;
  width: max-content;
}

.section-heading-with-add .toolbar-actions {
  margin-left: 30px;
}

.section-heading-with-add > .secondary-button,
.section-heading-with-add .toolbar-actions {
  flex: 0 0 auto;
}

.form-grid,
.totals-grid,
.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 16px;
}

.metric-grid {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  margin-bottom: 18px;
}

.import-status-banner {
  display: none !important;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin: 0 0 18px;
  padding: 14px 16px;
  border: 1px solid #d7e2d9;
  border-left: 8px solid var(--moss);
  border-radius: 8px;
  background: #f7fbf7;
}

.import-status-banner[hidden] {
  display: none !important;
}

.import-status-banner p {
  margin: 4px 0 0;
  color: var(--muted);
}

.dashboard-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
  margin-bottom: 14px;
}

.dashboard-toolbar h4 {
  margin: 0;
  font-size: 1.08rem;
}

.dashboard-toolbar label {
  width: min(240px, 100%);
}

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

.toolbar-actions select {
  min-width: 180px;
}

.toolbar-actions input[type="date"] {
  min-width: 170px;
}

.empty-table-cell {
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-weight: 700;
}

label {
  display: grid;
  gap: 7px;
  font-size: 0.86rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cfd9d5;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 10px 11px;
  min-width: 0;
}

textarea {
  resize: none;
  overflow: hidden;
  line-height: 1.45;
}

textarea.auto-grow-textarea {
  overflow: hidden;
  resize: none;
  field-sizing: content;
}

.proposal-settings-card {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfdf9;
}

.checkbox-line {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  max-width: 100%;
  color: var(--ink);
  font-weight: 800;
}

.checkbox-line input {
  width: 18px;
  height: 18px;
  min-width: 18px;
  accent-color: var(--moss);
}

.predictive-suggestions {
  position: absolute;
  z-index: 1000;
  display: grid;
  gap: 2px;
  max-height: 220px;
  overflow-y: auto;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(37, 50, 41, 0.16);
}

.predictive-suggestions[hidden] {
  display: none !important;
}

.predictive-suggestion-button {
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.25;
  text-align: left;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
}

.predictive-suggestion-button:hover,
.predictive-suggestion-button:focus {
  background: var(--soft-mint);
  outline: none;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  outline: 3px solid rgba(111, 141, 121, 0.28);
  border-color: var(--sage);
}

.full-width {
  margin-top: 16px;
}

#account:not(:target),
#template:not(:target) {
  display: none;
}

.form-grid .full-width {
  grid-column: 1 / -1;
  margin-top: 0;
}

.team-table,
.contacts-table {
  margin-top: 18px;
}

.payment-log {
  margin-top: 18px;
  display: grid;
  gap: 12px;
}

.template-editor {
  min-width: 0;
}

.template-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 20px;
  align-items: start;
}

.template-sample {
  --proposal-primary: var(--moss);
  --proposal-primary-text: #fff;
  --proposal-secondary: var(--rose);
  --proposal-secondary-text: var(--ink);
  position: sticky;
  top: 96px;
  display: grid;
  gap: 12px;
}

.template-sample-cover,
.template-sample-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.template-sample-cover {
  min-height: 320px;
  padding: 24px;
  background:
    linear-gradient(110deg, color-mix(in srgb, var(--proposal-primary) 90%, #000 10%), color-mix(in srgb, var(--proposal-secondary) 82%, #000 18%)),
    url("https://images.unsplash.com/photo-1464366400600-7168b8af9bc3?auto=format&fit=crop&w=900&q=80");
  background-size: cover;
  background-position: center;
  color: var(--proposal-primary-text);
  display: grid;
  align-content: end;
  gap: 10px;
}

.template-sample-cover h4,
.template-sample-cover p,
.template-sample-cover strong,
.template-sample-cover .eyebrow {
  margin: 0;
  color: var(--proposal-primary-text);
}

.template-sample-cover h4 {
  font-family: "Iowan Old Style", Georgia, "Times New Roman", serif;
  font-size: 2.2rem;
  line-height: 1;
}

.template-sample-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid color-mix(in srgb, var(--proposal-primary-text) 42%, transparent);
  color: var(--proposal-primary-text);
}

.template-sample-card {
  padding: 18px;
  background: #fff;
  color: var(--proposal-secondary-text);
  border-left: 8px solid var(--proposal-secondary);
}

.template-sample-card p {
  color: var(--muted);
}

.sub-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
}

.sub-heading h4 {
  margin: 0;
  font-size: 1rem;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}

td,
th {
  overflow-wrap: anywhere;
}

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

.admin-table table,
.contacts-table table,
.attachments-table table,
.payments-table table {
  min-width: 900px;
}

.attachment-file-input {
  margin-top: 8px;
  font-size: 13px;
}

.events-table table {
  table-layout: fixed;
  min-width: 1040px;
}

.events-table th,
.events-table td {
  overflow-wrap: normal;
  word-break: normal;
}

.events-table th:nth-child(1),
.events-table td:nth-child(1) {
  width: 23%;
}

.events-table th:nth-child(2),
.events-table td:nth-child(2) {
  width: 118px;
  min-width: 118px;
}

.events-table th:nth-child(3),
.events-table td:nth-child(3) {
  width: 106px;
}

.events-table th:nth-child(4),
.events-table td:nth-child(4) {
  width: 25%;
}

.events-table th:nth-child(5),
.events-table td:nth-child(5) {
  width: 76px;
}

.events-table th:nth-child(6),
.events-table td:nth-child(6),
.events-table th:nth-child(7),
.events-table td:nth-child(7),
.events-table th:nth-child(8),
.events-table td:nth-child(8) {
  width: 106px;
}

.events-table th:nth-child(9),
.events-table td:nth-child(9) {
  width: 54px;
  text-align: center;
}

.events-table td:nth-child(1),
.events-table td:nth-child(4) {
  overflow-wrap: anywhere;
}

.events-table tbody tr:nth-child(even) td {
  background: #f8fbf7;
}

.events-table tbody tr:nth-child(odd) td:nth-child(even) {
  background: #fbfcfa;
}

.events-table tbody tr:nth-child(even) td:nth-child(even) {
  background: #f3f7f1;
}

.events-table th:nth-child(even) {
  background: #eef4ed;
}

.events-table td + td,
.events-table th + th {
  border-left: 1px solid rgba(207, 219, 210, 0.72);
}

.locations-table table {
  min-width: 940px;
}

.items-table table {
  table-layout: fixed;
  min-width: 1080px;
}

.items-table th:nth-child(1),
.items-table td:nth-child(1) {
  width: 118px;
}

.items-table th:nth-child(2),
.items-table td:nth-child(2) {
  width: 140px;
}

.items-table td:nth-child(2) textarea,
.items-table .item-name-textarea {
  min-width: 0;
  width: 100%;
  min-height: 44px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.items-table textarea {
  display: block;
  min-width: 0;
  max-width: 100%;
  height: auto;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: normal;
}

.items-table .item-name-textarea,
.items-table .item-description-textarea,
.items-table .item-location-textarea {
  min-height: 48px;
}

.items-table th:nth-child(3),
.items-table td:nth-child(3) {
  width: 31%;
}

.items-table th:nth-child(4),
.items-table td:nth-child(4) {
  width: 140px;
}

.items-table th:nth-child(5),
.items-table td:nth-child(5) {
  width: 82px;
}

.items-table th:nth-child(6),
.items-table td:nth-child(6) {
  width: 100px;
}

.items-table th:nth-child(7),
.items-table td:nth-child(7) {
  width: 68px;
  text-align: center;
}

.items-table th:nth-child(8),
.items-table td:nth-child(8) {
  width: 110px;
}

.items-table th:nth-child(9),
.items-table td:nth-child(9) {
  width: 82px;
}

.items-table .item-delete-button.is-confirming {
  min-width: 62px;
  white-space: nowrap;
}

.app-shell.shop-mode:not(.admin-data-access) .admin-only,
.app-shell.shop-mode:not(.admin-data-access) #addShop,
.app-shell.shop-mode:not(.admin-data-access) .nav-list a[href="#admin"],
.app-shell.shop-mode:not(.admin-data-access) .nav-list a[href="#shop-access"] {
  display: none;
}

.app-shell.staff-mode .nav-list a[href="#add-user"] {
  display: none;
}

.app-shell.staff-mode .owner-only {
  display: none;
}

.app-shell.shop-mode:not(.admin-data-access) .shop-admin-control,
.app-shell.shop-mode:not(.admin-data-access) #shopTabs {
  display: none;
}

.app-shell:not(.profile-view) #account,
.app-shell:not(.template-view) #template {
  display: none;
}

.app-shell:not(.contact-directory-view) #contact-directory,
.app-shell:not(.location-directory-view) #location-directory {
  display: none;
}

.app-shell.event-list-view #proposalForm,
.app-shell.import-pdf-view #proposalForm,
.app-shell.add-event-view #proposalForm,
.app-shell.add-user-view #proposalForm,
.app-shell.crm-view #proposalForm,
.app-shell.event-list-view #labels,
.app-shell.event-list-view #delivery-list,
.app-shell.import-pdf-view #labels,
.app-shell.import-pdf-view #delivery-list,
.app-shell.add-event-view #labels,
.app-shell.add-event-view #delivery-list,
.app-shell.add-user-view #labels,
.app-shell.add-user-view #delivery-list,
.app-shell.crm-view #labels,
.app-shell.crm-view #delivery-list,
.app-shell.profile-view #labels,
.app-shell.profile-view #delivery-list,
.app-shell.template-view #labels,
.app-shell.template-view #delivery-list,
.app-shell.shop-access-view #labels,
.app-shell.shop-access-view #delivery-list,
.app-shell.contact-directory-view #labels,
.app-shell.contact-directory-view #delivery-list,
.app-shell.location-directory-view #labels,
.app-shell.location-directory-view #delivery-list,
.app-shell.import-pdf-view #preview,
.app-shell.add-event-view #preview,
.app-shell.add-user-view #preview,
.app-shell.crm-view #preview,
.app-shell.import-pdf-view #admin,
.app-shell.add-event-view #admin,
.app-shell.add-user-view #admin,
.app-shell.crm-view #admin,
.app-shell.import-pdf-view #shop-access,
.app-shell.add-event-view #shop-access,
.app-shell.add-user-view #shop-access,
.app-shell.crm-view #shop-access,
.app-shell.event-list-view #preview,
.app-shell.import-pdf-view .topbar .actions,
.app-shell.add-event-view .topbar .actions,
.app-shell.add-user-view .topbar .actions,
.app-shell.crm-view .topbar .actions,
.app-shell.event-list-view .topbar .actions {
  display: none;
}

.app-shell.proposal-detail-view #dashboard,
.app-shell.profile-view #dashboard,
.app-shell.template-view #dashboard,
.app-shell.import-pdf-view #dashboard,
.app-shell.add-event-view #dashboard,
.app-shell.add-user-view #dashboard,
.app-shell.crm-view #dashboard,
.app-shell.shop-access-view #dashboard,
.app-shell.contact-directory-view #dashboard,
.app-shell.location-directory-view #dashboard {
  display: none;
}

.app-shell:not(.add-event-view) #add-event-view,
.app-shell:not(.add-user-view) #add-user-view {
  display: none;
}

.app-shell:not(.import-pdf-view) #import-pdf {
  display: none;
}

.app-shell:not(.crm-view) #crm {
  display: none;
}

.crm-metrics {
  margin: 18px 0;
}

.crm-controls {
  align-items: end;
}

.crm-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 18px 0;
  flex-wrap: wrap;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.inline-check input {
  width: auto;
}

.deposit-preview-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  padding: 18px;
  margin: 16px 0;
  line-height: 1.55;
}

.reminder-table td,
.reminder-table th {
  vertical-align: top;
}

.reminder-table small {
  color: var(--muted);
}

#import-pdf .section-heading {
  justify-content: flex-start;
  gap: 30px;
  flex-wrap: wrap;
}

#import-pdf .section-heading > div {
  flex: 0 1 auto;
}

#importPdfProposal {
  flex: 0 0 auto;
}

.app-shell:not(.shop-access-view) #shop-access {
  display: none;
}

.app-shell.shop-access-view #admin {
  display: none;
}

.app-shell.shop-access-view #proposalForm,
.app-shell.shop-access-view #preview,
.app-shell.shop-access-view #labels,
.app-shell.shop-access-view #delivery-list {
  display: none;
}

.app-shell.admin-overview .shop-dashboard,
.app-shell.admin-overview #proposalForm,
.app-shell.admin-overview #preview,
.app-shell.admin-overview #labels,
.app-shell.admin-overview #delivery-list,
.app-shell.admin-overview #add-event-view,
.app-shell.admin-overview .topbar .actions,
.app-shell.admin-overview .nav-list a[href="#add-event"],
.app-shell.admin-overview .nav-list a[href="#proposal"],
.app-shell.admin-overview .nav-list a[href="#contact"],
.app-shell.admin-overview .nav-list a[href="#locations"],
.app-shell.admin-overview .nav-list a[href="#items"],
.app-shell.admin-overview .nav-list a[href="#labels"],
.app-shell.admin-overview .nav-list a[href="#delivery-list"],
.app-shell.admin-overview .nav-list a[href="#payments"],
.app-shell.admin-overview .nav-list a[href="#attachments"],
.app-shell.admin-overview .nav-list a[href="#preview"] {
  display: none;
}

.app-shell.admin-overview #account {
  display: none;
}

.access-warning {
  color: var(--danger);
  font-weight: 800;
}

.shop-access-table {
  overflow-x: auto;
}

.shop-access-table table {
  min-width: 1320px;
  table-layout: fixed;
}

.shop-access-table th,
.shop-access-table td {
  vertical-align: top;
}

.shop-access-table th:nth-child(1),
.shop-access-table td:nth-child(1) {
  width: 230px;
  min-width: 230px;
  overflow-wrap: anywhere;
}

.shop-access-table th:nth-child(2),
.shop-access-table td:nth-child(2) {
  width: 250px;
  min-width: 250px;
  overflow-wrap: anywhere;
}

.shop-access-table th:nth-child(3),
.shop-access-table td:nth-child(3) {
  width: 700px;
  min-width: 700px;
}

.shop-access-table th:nth-child(4),
.shop-access-table td:nth-child(4) {
  width: 140px;
  min-width: 140px;
}

.shop-access-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.shop-access-editor {
  min-width: 680px;
  display: grid;
  grid-template-columns: repeat(4, minmax(145px, 1fr));
  gap: 12px;
  align-items: end;
}

.shop-access-status-line {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.shop-access-editor label {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.78rem;
  font-weight: 900;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.shop-access-editor input,
.shop-access-editor select,
.shop-access-editor textarea {
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
}

.shop-access-editor textarea {
  resize: vertical;
}

.shop-access-notes {
  grid-column: span 2;
}

.pause-button,
.reactivate-button {
  min-width: 104px;
}

.pause-button {
  border-color: #e9b8b8;
  color: #9a3434;
  background: #fff7f7;
}

.reactivate-button {
  border-color: #bed9c6;
  color: var(--moss);
  background: #f5fbf6;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.82rem;
  font-weight: 900;
  color: var(--moss);
  background: #f7faf6;
}

.status-pill.is-paused {
  border-color: #e9b8b8;
  color: #9a3434;
  background: #fff7f7;
}

.danger-text {
  color: var(--danger);
  font-weight: 900;
}

.app-shell.event-details-hidden.event-list-view #proposalForm,
.app-shell.event-details-hidden.event-list-view #preview,
.app-shell.event-details-hidden.event-list-view .topbar .actions,
.app-shell.event-details-hidden .nav-list a[href="#proposal"],
.app-shell.event-details-hidden .nav-list a[href="#contact"],
.app-shell.event-details-hidden .nav-list a[href="#locations"],
.app-shell.event-details-hidden .nav-list a[href="#items"],
.app-shell.event-details-hidden .nav-list a[href="#labels"],
.app-shell.event-details-hidden .nav-list a[href="#delivery-list"],
.app-shell.event-details-hidden .nav-list a[href="#payments"],
.app-shell.event-details-hidden .nav-list a[href="#attachments"],
.app-shell.event-details-hidden .nav-list a[href="#preview"] {
  display: none;
}

.app-shell.event-details-hidden #dashboard::after {
  content: "Click Name of Event for details.";
  display: block;
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf7;
  color: var(--muted);
  font-weight: 700;
}

.app-shell.admin-overview #dashboard::after {
  content: "Platform Admin Overview hides shop proposals by default. Use Access Shop Data or Access User Data above to inspect a selected shop or user.";
}

.access-note {
  padding: 10px 12px;
  background: #f8faf7;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

th,
td {
  padding: 10px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

th {
  background: #f5f7f4;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.drag-cell {
  width: 118px;
}

.move-tools {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  min-width: 0;
}

.drag-handle,
.move-button {
  width: 28px;
  min-width: 28px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--moss);
  font-weight: 900;
  font-size: 0;
  line-height: 1;
  padding: 0;
}

.move-button span {
  display: block;
  font-size: 0.92rem;
  line-height: 1;
}

.drag-handle span {
  display: block;
  font-size: 0.76rem;
  line-height: 1;
  transform: translateY(0);
}

.drag-handle {
  cursor: grab;
}

.drag-handle:hover,
.drag-handle:focus-visible {
  color: var(--gold);
}

.move-button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.dragging-row {
  opacity: 0.45;
}

.drop-target td {
  background: #eef6ef;
}

tbody tr:last-child td {
  border-bottom: 0;
}

td input,
td select,
td textarea {
  min-width: 120px;
}

td textarea {
  min-width: 0;
  min-height: 72px;
}

.money-cell {
  width: 128px;
}

.qty-cell {
  width: 92px;
}

.tax-cell {
  width: 74px;
  text-align: center;
}

.remove-button {
  width: 34px;
  height: 34px;
  border: 1px solid #ead1d4;
  border-radius: 8px;
  background: #fff7f7;
  color: #9c414b;
  font-weight: 900;
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--moss);
  padding: 0;
  text-align: left;
  font-weight: 800;
}

.event-name-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.event-name-actions .link-button {
  min-width: 0;
  overflow-wrap: anywhere;
}

.selected-row td {
  background: #eaf3e8 !important;
}

.delete-confirm-row td {
  background: #fff4f0 !important;
}

.event-delete-cell {
  width: 54px;
  text-align: center;
}

.event-delete-button {
  width: 34px;
  min-width: 34px;
  min-height: 32px;
  border: 1px solid #e3c7ca;
  border-radius: 7px;
  background: #fff7f7;
  color: #9c414b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px;
  font-weight: 800;
}

.event-delete-button:hover {
  background: #ffecee;
}

.event-delete-button.is-confirming {
  background: #9c414b;
  border-color: #9c414b;
  color: #fff;
  box-shadow: 0 8px 18px rgba(156, 65, 75, 0.18);
}

.event-delete-button.is-confirming {
  width: auto;
}

.event-delete-icon {
  width: 14px;
  height: 14px;
}

.total-card {
  min-height: 76px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  align-content: center;
  gap: 5px;
  background: #f8faf7;
}

.total-card strong {
  font-size: 1.35rem;
}

.preview-panel {
  margin-bottom: 28px;
}

.proposal-document {
  min-height: 340px;
  overflow: hidden;
  border: 1px solid #e2dccc;
  border-radius: 14px;
  background: #fffdf8;
  color: #2c2923;
  font-family: "Iowan Old Style", Georgia, "Times New Roman", serif;
  max-width: 100%;
}

.pdf-render-document {
  position: absolute;
  left: -12000px;
  top: 0;
  z-index: 1;
  width: 7.5in;
  min-height: 10in;
  border: 0;
  border-radius: 0;
  overflow: visible;
  pointer-events: none;
}

.proposal-cover {
  padding: 34px;
  border-radius: 12px 12px 0 0;
  color: var(--proposal-primary-text, #fff);
  background:
    linear-gradient(110deg, color-mix(in srgb, var(--proposal-primary, #435f4d) 94%, #000 6%), color-mix(in srgb, var(--proposal-secondary, #b66b73) 82%, #000 18%)),
    url("https://images.unsplash.com/photo-1464366400600-7168b8af9bc3?auto=format&fit=crop&w=1600&q=80");
  background-size: cover;
  background-position: center;
}

.proposal-cover .eyebrow,
.proposal-cover p {
  color: color-mix(in srgb, var(--proposal-primary-text, #fff) 86%, transparent);
}

.proposal-cover .template-title {
  margin: 8px 0 0;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--proposal-primary-text, #fff);
  font-size: clamp(1.05rem, 2vw, 1.65rem);
}

.proposal-cover h4 {
  max-width: 820px;
  margin: 10px 0;
  font-size: clamp(1.85rem, 3.2vw, 3.35rem);
  line-height: 1.03;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.proposal-cover dl {
  display: grid;
  grid-template-columns: 0.9fr 1fr 1.35fr 1.7fr 1fr;
  gap: 14px 20px;
  margin: 26px 0 0;
  align-items: start;
}

.proposal-cover dt,
.proposal-cover dd {
  margin: 0;
}

.proposal-cover dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: color-mix(in srgb, var(--proposal-primary-text, #fff) 76%, transparent);
}

.proposal-cover dd {
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.proposal-content {
  display: grid;
  gap: 26px;
  padding: 30px;
}

.proposal-section h5 {
  margin: 0 0 10px;
  font-size: 1.2rem;
}

.labels-document {
  min-height: 560px;
  padding: 36px;
  border: 1px solid #e3ddce;
  border-radius: 8px;
  background: #fffef9;
  color: #25231f;
}

.labels-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 12px;
}

.labels-list span {
  display: grid;
  min-height: 72px;
  align-items: center;
  justify-items: center;
  break-inside: avoid;
  padding: 6px 10px;
  border: 1px dashed #d6cec0;
  border-radius: 4px;
  font-family: "Times New Roman", Times, serif;
  font-size: 18px;
  font-style: italic;
  line-height: 1.12;
  text-align: center;
}

.labels-empty {
  margin: 0;
  font-size: 1rem;
  color: var(--muted);
  font-weight: 700;
}

.delivery-list-document {
  display: grid;
  gap: 26px;
  min-height: 560px;
  padding: 34px;
  border: 1px solid #dce3dd;
  border-radius: 8px;
  background: #fffefb;
  color: #172019;
}

.delivery-list-head {
  display: grid;
  gap: 8px;
  border-bottom: 2px solid #dce3dd;
  padding-bottom: 18px;
}

.delivery-list-head strong {
  font-size: 1.35rem;
}

.delivery-list-group {
  display: grid;
  gap: 14px;
}

.delivery-list-location {
  display: grid;
  gap: 5px;
  padding: 14px 16px;
  border-radius: 8px;
  background: #edf4ee;
  border: 1px solid #d5e2d8;
}

.delivery-list-location strong {
  font-size: 1.15rem;
}

.delivery-list-location span,
.delivery-list-location small {
  font-size: 1rem;
  color: var(--muted);
}

.delivery-list-items {
  display: grid;
  gap: 18px;
  margin: 0;
  padding-left: 28px;
}

.delivery-list-items li {
  font-size: 18px;
  line-height: 1.45;
  font-weight: 700;
}

.delivery-list-items small {
  display: block;
  margin-top: 4px;
  font-size: 0.95rem;
  line-height: 1.4;
  color: var(--muted);
  font-weight: 700;
}

@media (max-width: 920px) {
  .labels-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .labels-document {
    padding: 24px;
  }

  .delivery-list-document {
    padding: 24px;
  }

  .labels-list {
    grid-template-columns: 1fr;
  }
}

.proposal-section p {
  line-height: 1.6;
}

.contact-chips,
.proposal-item-grid,
.location-list,
.proposal-totals,
.ai-recommendation-grid {
  display: grid;
  gap: 12px;
}

.proposal-location-group {
  display: grid;
  gap: 10px;
}

.proposal-location-header {
  padding: 12px 14px;
  border-radius: 14px;
  background: #eef3ef;
  border: 1px solid #d9e4dc;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
}

.proposal-location-header strong {
  display: block;
  color: var(--moss);
}

.proposal-location-header span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.88rem;
}

.proposal-location-header small {
  display: block;
  margin-top: 2px;
  color: #7d7468;
  font-size: 0.78rem;
  line-height: 1.35;
}

.contact-chip,
.proposal-item-card,
.ai-recommendation-card,
.location-card,
.proposal-total-row {
  border: 1px solid #eadfce;
  border-radius: 14px;
  background: #fff;
  padding: 14px;
}

.contact-chip strong,
.proposal-item-card strong,
.ai-recommendation-card strong,
.location-card strong {
  display: block;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
}

.ai-recommendations-section {
  padding: 18px;
  border: 1px solid #e4dac9;
  border-radius: 16px;
  background: linear-gradient(135deg, #fffdf8, #f4efe5);
}

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

.ai-recommendation-card {
  background: #fffefb;
}

.proposal-item-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

.proposal-gallery {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 600px));
  gap: 20px;
  justify-content: center;
  align-items: start;
}

.proposal-gallery-image {
  margin: 0;
  text-align: center;
}

.proposal-gallery-image img {
  width: min(600px, 100%);
  border-radius: 12px;
  display: inline-block;
}

.proposal-gallery-file {
  grid-column: 1 / -1;
  padding: 8px 0;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 760px) {
  .proposal-gallery {
    grid-template-columns: minmax(0, 600px);
  }
}

.proposal-item-card p,
.ai-recommendation-card p,
.contact-chip p,
.location-card p {
  margin-top: 6px;
  color: #655f55;
}

.proposal-price {
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-weight: 800;
  color: var(--moss);
}

.proposal-total-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
}

.proposal-total-row.final {
  background: #f4f7f2;
  border-radius: 16px;
  font-weight: 900;
  font-size: 1.1rem;
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-shell.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .sidebar-toggle {
    top: 132px;
    left: auto;
    right: 18px;
  }

  .app-shell.sidebar-collapsed .sidebar {
    padding: 18px;
    align-items: stretch;
  }

  .app-shell.sidebar-collapsed .sidebar-toggle {
    left: auto;
    right: 18px;
  }

  .app-shell.sidebar-collapsed .brand {
    justify-content: flex-start;
  }

  .app-shell.sidebar-collapsed .brand > div:last-child {
    display: block;
  }

  .app-shell.sidebar-collapsed .tenant-switcher {
    display: none;
  }

  .app-shell.sidebar-collapsed .nav-list {
    display: none;
  }

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

  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-title-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

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

  .topbar .actions {
    width: 100%;
  }

  .topbar .actions .secondary-button,
  .topbar .actions .primary-button {
    flex: 1 1 180px;
  }

  .form-grid,
  .totals-grid,
  .metric-grid,
  .template-layout {
    grid-template-columns: 1fr;
  }

  .template-sample {
    position: static;
  }

  .dashboard-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar-actions,
  .sub-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .section-heading > .secondary-button,
  .section-heading > .primary-button,
  .section-heading > .actions,
  .section-heading > .preview-actions,
  .section-heading > .toolbar-actions,
  .section-heading-with-add > .secondary-button,
  .section-heading-with-add > .primary-button,
  .section-heading-with-add .toolbar-actions {
    margin-left: 0;
    margin-right: 0;
  }

  .toolbar-actions > *,
  .sub-heading > *,
  .section-heading .actions,
  .preview-actions > * {
    width: 100%;
  }
}

@media (max-width: 700px) {
  body {
    font-size: 15px;
  }

  .auth-shell,
  .onboarding-shell,
  .password-update-shell,
  .billing-shell {
    padding: 12px;
    align-items: start;
  }

  .auth-card {
    padding: 18px;
  }

  .billing-options,
  .onboarding-grid {
    grid-template-columns: 1fr;
  }

  .workspace {
    padding: 10px;
    gap: 12px;
    max-width: 100%;
  }

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

  .total-card {
    min-height: 62px;
    padding: 10px 12px;
  }

  .total-card strong {
    font-size: 1.2rem;
  }

  .dashboard-toolbar {
    gap: 10px;
    margin-bottom: 10px;
  }

  .dashboard-toolbar h4 {
    font-size: 1rem;
  }

  .app-footer {
    padding: 14px 12px 20px;
    font-size: 0.82rem;
    text-align: center;
  }

  .panel {
    padding: 12px;
    border-radius: 10px;
  }

  .sidebar {
    padding: 12px 14px;
    gap: 12px;
  }

  .brand {
    gap: 10px;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 10px;
  }

  .brand h1 {
    font-size: 1rem;
  }

  .brand p {
    font-size: 0.88rem;
    line-height: 1.15;
  }

  .build-label {
    font-size: 0.72rem;
  }

  .sidebar-toggle {
    top: 118px;
    right: 14px;
    width: 42px;
    height: 42px;
  }

  .nav-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .nav-list a {
    min-height: 40px;
    padding: 9px 10px;
    border-radius: 8px;
  }

  .tenant-switcher {
    padding: 10px;
    gap: 8px;
  }

  .tenant-switcher label {
    gap: 5px;
  }

  .undo-button {
    min-height: 38px;
  }

  .topbar {
    padding: 12px;
    gap: 12px;
    min-height: 0;
  }

  .topbar-title-row {
    gap: 8px;
  }

  .topbar h2 {
    font-size: 1.35rem;
    overflow-wrap: anywhere;
  }

  .topbar-balance {
    width: 100%;
    min-width: 0;
    padding: 9px 11px;
  }

  .topbar-balance strong {
    font-size: 1.15rem;
  }

  .topbar .actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    gap: 8px;
  }

  .topbar .actions .secondary-button,
  .topbar .actions .primary-button {
    width: auto;
    min-height: 38px;
    padding: 0 8px;
    font-size: 0.88rem;
    white-space: normal;
  }

  .preview-actions,
  .auth-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .icon-button {
    width: 100%;
  }

  .primary-button,
  .secondary-button {
    width: 100%;
    min-width: 0;
  }

  .section-heading {
    gap: 10px;
    align-items: flex-start;
  }

  .section-heading h3 {
    font-size: 1.16rem;
  }

  .section-heading .actions,
  .preview-actions {
    gap: 8px;
  }

  .section-heading-with-add {
    column-gap: 12px;
    row-gap: 8px;
  }

  .section-heading-with-add > .secondary-button {
    width: auto;
    min-width: 126px;
  }

  .toolbar-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    align-items: stretch;
  }

  .toolbar-actions label {
    grid-column: 1 / -1;
    width: 100%;
  }

  .toolbar-actions input[type="date"] {
    width: 100%;
    min-width: 0;
  }

  .table-wrap {
    overflow-x: visible;
    border: 0;
  }

  table,
  .team-table table,
  .admin-table table,
  .events-table table,
  .contacts-table table,
  .locations-table table,
  .items-table table,
  .payments-table table {
    min-width: 0;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
  }

  thead {
    display: none;
  }

  tbody {
    display: grid;
    gap: 10px;
  }

  tr {
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    min-width: 0;
  }

  .events-table tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 12px;
  }

  td {
    display: grid;
    gap: 3px;
    padding: 0;
    border: 0;
    min-width: 0;
  }

  .events-table th,
  .events-table td,
  .contacts-table th,
  .contacts-table td,
  .locations-table th,
  .locations-table td,
  .items-table th,
  .items-table td,
  .payments-table th,
  .payments-table td {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  .events-table td {
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
  }

  .events-table td:nth-child(1),
  .events-table td:nth-child(4) {
    grid-column: 1 / -1;
    overflow-wrap: anywhere;
  }

  .events-table td:nth-child(6),
  .events-table td:nth-child(7),
  .events-table td:nth-child(8) {
    padding: 7px 8px;
    border-radius: 8px;
    background: #f7faf7;
  }

  .events-table td:nth-child(9) {
    grid-column: 1 / -1;
    justify-items: end;
  }

  .contacts-table tr,
  .locations-table tr,
  .items-table tr,
  .payments-table tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 12px;
  }

  .contacts-table td:nth-child(2),
  .contacts-table td:nth-child(4),
  .contacts-table td:nth-child(5),
  .locations-table td:nth-child(1),
  .locations-table td:nth-child(2),
  .locations-table td:nth-child(4),
  .payments-table td:nth-child(4) {
    grid-column: 1 / -1;
  }

  .contacts-table td:last-child,
  .locations-table td:last-child,
  .payments-table td:last-child {
    grid-column: 1 / -1;
    justify-items: end;
  }

  .items-table td:nth-child(1),
  .items-table td:nth-child(2),
  .items-table td:nth-child(3),
  .items-table td:nth-child(4) {
    grid-column: 1 / -1;
  }

  .items-table td:nth-child(5),
  .items-table td:nth-child(6),
  .items-table td:nth-child(7),
  .items-table td:nth-child(8),
  .payments-table td:nth-child(2),
  .payments-table td:nth-child(3) {
    padding: 7px 8px;
    border-radius: 8px;
    background: #f7faf7;
  }

  .items-table td:nth-child(9) {
    grid-column: 1 / -1;
    justify-items: end;
  }

  .events-table .event-open-button {
    width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    text-align: left;
  }

  .events-table td small {
    font-size: 0.78rem;
    line-height: 1.3;
  }

  .drag-cell,
  .money-cell,
  .qty-cell,
  .tax-cell {
    width: auto;
  }

  td::before {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

  td input,
  td select,
  td textarea {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  td textarea {
    min-width: 0;
    max-width: 100%;
  }

  .events-table td:nth-child(1)::before { content: "Event"; }
  .events-table td:nth-child(2)::before { content: "Type"; }
  .events-table td:nth-child(3)::before { content: "Date"; }
  .events-table td:nth-child(4)::before { content: "Location"; }
  .events-table td:nth-child(5)::before { content: "Status"; }
  .events-table td:nth-child(6)::before { content: "Total"; }
  .events-table td:nth-child(7)::before { content: "Deposit"; }
  .events-table td:nth-child(8)::before { content: "Balance"; }
  .events-table td:nth-child(9)::before { content: "Delete"; }

  .contacts-table td:nth-child(1)::before { content: "Role"; }
  .contacts-table td:nth-child(2)::before { content: "Name"; }
  .contacts-table td:nth-child(3)::before { content: "Phone"; }
  .contacts-table td:nth-child(4)::before { content: "Email"; }
  .contacts-table td:nth-child(5)::before { content: "Notes"; }

  .locations-table td:nth-child(1)::before { content: "Place"; }
  .locations-table td:nth-child(2)::before { content: "Address"; }
  .locations-table td:nth-child(3)::before { content: "Delivery Time"; }
  .locations-table td:nth-child(4)::before { content: "Notes"; }

  .items-table td:nth-child(1)::before { content: "Move"; }
  .items-table td:nth-child(2)::before { content: "Item"; }
  .items-table td:nth-child(3)::before { content: "Description"; }
  .items-table td:nth-child(4)::before { content: "Location"; }
  .items-table td:nth-child(5)::before { content: "Qty"; }
  .items-table td:nth-child(6)::before { content: "Unit"; }
  .items-table td:nth-child(7)::before { content: "Tax"; }
  .items-table td:nth-child(8)::before { content: "Total"; }

  .payments-table td:nth-child(1)::before { content: "Date"; }
  .payments-table td:nth-child(2)::before { content: "Amount"; }
  .payments-table td:nth-child(3)::before { content: "Form"; }
  .payments-table td:nth-child(4)::before { content: "Notes"; }

  .team-table td:nth-child(1)::before { content: "User"; }
  .team-table td:nth-child(2)::before { content: "Email"; }
  .team-table td:nth-child(3)::before { content: "Role"; }
  .team-table td:nth-child(4)::before { content: "Status"; }

  .move-tools {
    justify-content: flex-start;
    gap: 6px;
  }

  .move-tools button {
    flex: 0 0 32px;
  }

  .proposal-document {
    border-radius: 10px;
  }

  .proposal-cover {
    min-height: 0;
    padding: 18px 14px;
    border-radius: 10px 10px 0 0;
  }

  .proposal-cover h4 {
    font-size: 1.75rem;
    line-height: 1.04;
  }

  .proposal-cover dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .proposal-content {
    padding: 14px;
    gap: 14px;
  }

  .proposal-item-card {
    grid-template-columns: 1fr;
  }

  .ai-recommendation-grid {
    grid-template-columns: 1fr;
  }

  .labels-document,
  .delivery-list-document {
    padding: 14px;
  }

  .labels-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px 14px;
  }

  .label-item {
    font-size: 1.2rem;
    min-height: 64px;
  }
}

@media (max-width: 420px) {
  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .brand h1 {
    font-size: 1rem;
  }

  .brand p,
  .summary-panel small {
    font-size: 0.78rem;
  }

  .sidebar {
    padding: 14px;
  }

  .nav-list {
    grid-template-columns: 1fr;
  }

  .contacts-table tr,
  .locations-table tr,
  .items-table tr,
  .payments-table tr,
  .proposal-cover dl,
  .labels-list {
    grid-template-columns: 1fr;
  }

  .workspace {
    padding: 10px;
  }

  .panel {
    padding: 14px;
  }

  .proposal-cover h4 {
    font-size: 1.55rem;
  }

  .topbar .actions .secondary-button,
  .topbar .actions .primary-button {
    min-height: 40px;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .toolbar-actions {
    grid-template-columns: 1fr;
  }
}

@media print {
  @page {
    margin: 0.45in;
  }

  html,
  body {
    background: #fff;
  }

  .sidebar,
  .topbar,
  form,
  #account,
  #admin,
  .preview-panel > .section-heading {
    display: none;
  }

  .app-shell {
    display: block;
  }

  .workspace {
    max-width: none;
    display: block;
  }

  .panel {
    padding: 0;
    margin: 0;
    box-shadow: none;
    border: 0;
  }

  .proposal-document {
    border: 0;
    background: #fff;
    color-adjust: exact;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .proposal-cover {
    min-height: 3.4in;
    break-inside: avoid;
  }

  .proposal-item-card,
  .location-card,
  .contact-chip,
  .proposal-total-row {
    break-inside: avoid;
  }
}
