:root {
  color-scheme: light;
  --ink: #31241d;
  --muted: #786555;
  --line: #ded6c2;
  --paper: #f4fbf3;
  --panel: #fffefa;
  --teal: #87a947;
  --teal-dark: #795033;
  --coral: #bf744b;
  --gold: #dee15b;
  --blue: #66a9cf;
  --sky: #c6e5f8;
  --grass: #a8c93f;
  --shadow: 0 18px 50px rgba(79, 71, 39, 0.14);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(198, 229, 248, 0.85) 0%, rgba(244, 251, 243, 0.95) 42%, rgba(168, 201, 63, 0.18) 100%),
    var(--paper);
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

a {
  color: var(--teal-dark);
}

.hidden {
  display: none !important;
}

.login-page {
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(198, 229, 248, 0.9), transparent 35%),
    radial-gradient(circle at bottom right, rgba(222, 225, 91, 0.22), transparent 28%),
    linear-gradient(180deg, rgba(255, 254, 250, 0.96) 0%, rgba(244, 251, 243, 0.98) 100%);
}

.login-shell {
  width: min(100%, 540px);
}

.login-panel,
.panel,
.stat,
.public-document,
.agreement-intro,
.agreement-copy {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-panel {
  position: relative;
  padding: 36px;
  border-top: 6px solid var(--grass);
  overflow: hidden;
}

.login-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  margin-bottom: 16px;
  color: var(--teal-dark);
  background: #f5f8dc;
  border: 1px solid #d9df8f;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}

.login-logo {
  display: block;
  width: min(260px, 72%);
  height: auto;
  margin: 0 auto 16px;
  border-radius: 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--teal);
  font-size: 0.77rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 8px;
  font-size: clamp(1.8rem, 3vw, 2.65rem);
  line-height: 1.05;
}

h2 {
  margin-bottom: 0;
  font-size: 1.25rem;
}

h3 {
  font-size: 1rem;
}

.muted,
.fine-print,
.message {
  color: var(--muted);
}

.fine-print {
  margin: 18px 0 0;
  font-size: 0.9rem;
}

.message {
  min-height: 1.25em;
  margin: 0;
}

.message.error {
  color: #b42318;
}

.message.success {
  color: var(--teal);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(300px, 1fr) auto auto;
  gap: 18px;
  align-items: center;
  padding: 16px clamp(18px, 4vw, 48px);
  background: rgba(255, 254, 250, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

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

.brand-lockup img {
  width: 156px;
  height: 76px;
  object-fit: contain;
  border-radius: 0;
}

.brand-lockup h1 {
  margin: 0;
  font-size: 1.35rem;
}

.tabs {
  display: inline-flex;
  gap: 6px;
  padding: 5px;
  background: #eff5e2;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.tab-button {
  min-height: 38px;
  padding: 0 14px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-weight: 800;
}

.tab-button.active {
  color: var(--teal-dark);
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(121, 80, 51, 0.12);
}

.dashboard-shell {
  width: min(1480px, calc(100% - 36px));
  margin: 28px auto 56px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat {
  padding: 18px;
}

.stat span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.stat strong {
  font-size: 1.6rem;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(440px, 0.9fr) minmax(480px, 1.1fr);
  gap: 18px;
  align-items: start;
}

.panel {
  padding: 22px;
  border-top: 4px solid rgba(168, 201, 63, 0.55);
}

.panel-heading {
  display: flex;
  gap: 16px;
  align-items: start;
  justify-content: space-between;
  margin-bottom: 20px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  color: var(--teal-dark);
  background: #f5f8dc;
  border: 1px solid #d9df8f;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.stacked-form {
  display: grid;
  gap: 16px;
}

label,
fieldset {
  display: grid;
  gap: 7px;
  min-width: 0;
  margin: 0;
  color: #4e3b2f;
  font-size: 0.9rem;
  font-weight: 800;
}

fieldset {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

legend {
  padding: 0 6px;
}

input,
textarea,
select {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fffffb;
  border: 1px solid #d8cfb9;
  border-radius: 7px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(135, 169, 71, 0.22);
}

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

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

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

.service-grid {
  grid-template-columns: minmax(180px, 1fr) 130px auto;
  align-items: end;
}

.suggestion-list {
  display: grid;
  gap: 6px;
  max-height: 260px;
  overflow: auto;
  padding: 8px;
  background: #fffffb;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(79, 71, 39, 0.16);
}

.suggestion-button {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  min-height: 40px;
  padding: 8px 10px;
  color: var(--ink);
  background: #f8f9e8;
  border: 1px solid #d9df8f;
  border-radius: 7px;
  text-align: left;
}

.suggestion-button span {
  color: var(--muted);
  font-size: 0.86rem;
}

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

.service-chip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  background: #fffdf3;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.service-chip span {
  min-width: 0;
  overflow: hidden;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wide {
  grid-column: 1 / -1;
}

.line-items {
  display: grid;
  gap: 10px;
}

.line-item {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 72px 110px 36px;
  gap: 8px;
  align-items: end;
}

.line-item.header-row {
  align-items: center;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.line-item button {
  width: 36px;
  height: 42px;
  padding: 0;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 7px;
  font-weight: 900;
  text-decoration: none;
}

.button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.button.primary {
  color: #ffffff;
  background: var(--teal-dark);
}

.button.secondary {
  color: var(--teal-dark);
  background: #f5f8dc;
  border-color: #d9df8f;
}

.button.ghost {
  color: var(--teal-dark);
  background: #ffffff;
  border-color: var(--line);
}

.button.danger {
  color: #9a3412;
  background: #fff5ed;
  border-color: #fed7aa;
}

.quote-preview {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding: 12px;
  background: #f8f9e8;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.quote-preview span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.quote-preview strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 1rem;
}

.record-list {
  display: grid;
  gap: 12px;
}

.record {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: #fffffb;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.record-top {
  display: flex;
  gap: 12px;
  align-items: start;
  justify-content: space-between;
}

.record h3 {
  margin: 0 0 4px;
}

.record p {
  margin: 0;
  color: var(--muted);
}

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

.status-grid {
  display: grid;
  grid-template-columns: minmax(120px, 150px) minmax(95px, 110px) auto;
  gap: 8px;
  align-items: end;
}

.small-link {
  overflow: hidden;
  color: var(--blue);
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section-divider {
  height: 1px;
  margin: 22px 0;
  background: var(--line);
}

.compact-list {
  max-height: 430px;
  overflow: auto;
  padding-right: 4px;
}

.search-box {
  margin-bottom: 16px;
}

.settings-panel {
  max-width: 980px;
}

.calendar-panel {
  display: grid;
  gap: 16px;
}

.calendar-layout {
  display: grid;
  grid-template-columns: minmax(360px, 430px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.calendar-builder,
.calendar-view {
  min-width: 0;
}

.calendar-builder {
  padding: 18px;
  background: #fffdf3;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.booking-time-grid {
  grid-template-columns: 1fr;
}

.booking-time-grid input,
.booking-time-grid select {
  min-width: 0;
}

.calendar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.calendar-frame-wrap {
  overflow: hidden;
  background: #fffffb;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.calendar-frame {
  width: 100%;
  min-height: 780px;
  border: 0;
  background: #ffffff;
}

@media (min-width: 1280px) {
  .booking-time-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.public-page {
  padding: clamp(18px, 4vw, 42px);
}

.public-document,
.agreement-shell {
  width: min(100%, 980px);
  margin: 0 auto;
}

.public-document {
  padding: clamp(22px, 4vw, 44px);
}

.quote-head {
  display: flex;
  gap: 20px;
  justify-content: space-between;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--teal-dark);
}

.quote-head img {
  width: 190px;
  height: auto;
  object-fit: contain;
  border-radius: 0;
}

.business-block {
  display: flex;
  gap: 14px;
}

.quote-meta {
  text-align: right;
}

.quote-status {
  display: inline-flex;
  padding: 5px 9px;
  background: #fbf5cc;
  border: 1px solid #d9cf62;
  border-radius: 999px;
  font-weight: 900;
  text-transform: capitalize;
}

.quote-status.paid {
  background: #edf6df;
  border-color: #b7d47e;
}

.quote-status.partial {
  background: #e9f6fd;
  border-color: #9fcfe7;
}

.quote-table {
  width: 100%;
  margin: 28px 0;
  border-collapse: collapse;
}

.quote-table th,
.quote-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.quote-table th {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
}

.quote-table td:nth-child(n + 2),
.quote-table th:nth-child(n + 2) {
  text-align: right;
}

.totals {
  display: grid;
  gap: 8px;
  width: min(100%, 360px);
  margin-left: auto;
}

.totals div {
  display: flex;
  justify-content: space-between;
}

.totals .grand-total {
  padding-top: 10px;
  border-top: 2px solid var(--teal-dark);
  font-size: 1.25rem;
  font-weight: 900;
}

.totals .payment-due {
  display: block;
  margin-top: 8px;
  padding: 12px;
  color: var(--teal-dark);
  background: #fbf5cc;
  border: 1px solid #d9cf62;
  border-radius: 8px;
  font-size: 1rem;
  line-height: 1.35;
}

.public-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
}

.agreement-shell {
  display: grid;
  gap: 18px;
}

.agreement-intro {
  display: flex;
  gap: 18px;
  align-items: center;
  padding: 22px;
}

.agreement-intro img {
  width: 190px;
  height: auto;
  object-fit: contain;
  border-radius: 0;
}

.agreement-copy {
  padding: clamp(20px, 4vw, 34px);
}

.agreement-copy h2 {
  margin-bottom: 18px;
  text-align: center;
}

.agreement-copy p {
  line-height: 1.58;
}

.agreement-form {
  display: grid;
  gap: 18px;
}

.form-section h2 {
  margin-bottom: 16px;
}

.choice {
  display: flex;
  grid-template-columns: none;
  gap: 10px;
  align-items: flex-start;
  font-weight: 700;
}

.choice input {
  width: 18px;
  min-width: 18px;
  height: 18px;
  min-height: 18px;
  margin-top: 2px;
}

.acceptance {
  padding: 12px;
  background: #f8f9e8;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.signature-pad {
  display: grid;
  gap: 10px;
}

.signature-pad canvas {
  width: 100%;
  height: 220px;
  background: #ffffff;
  border: 1px solid #b8c7c3;
  border-radius: 8px;
  touch-action: none;
}

.detail-dialog {
  width: min(920px, calc(100% - 32px));
  max-height: 88vh;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.detail-dialog::backdrop {
  background: rgba(11, 22, 20, 0.4);
}

.dialog-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  color: var(--muted);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 50%;
}

.signature-image {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.detail-grid div {
  padding: 10px;
  background: #fffdf3;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.form-subheading {
  margin: 6px 0 -4px;
  color: var(--teal-dark);
  font-size: 0.96rem;
  text-transform: uppercase;
}

.quote-details {
  margin-top: 24px;
}

.detail-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

@media (max-width: 1100px) {
  .app-header,
  .two-column,
  .calendar-layout,
  .summary-grid,
  .quote-preview {
    grid-template-columns: 1fr;
  }

  .tabs {
    justify-self: start;
  }
}

@media (max-width: 720px) {
  .app-header {
    position: static;
  }

  .dashboard-shell {
    width: min(100% - 22px, 1480px);
    margin-top: 14px;
  }

  .panel,
  .login-panel,
  .public-document,
  .agreement-intro,
  .agreement-copy {
    padding: 16px;
  }

  .form-grid,
  .form-grid.compact,
  .service-chip,
  .line-item,
  .status-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .line-item.header-row {
    display: none;
  }

  .line-item button {
    width: 100%;
  }

  .quote-head,
  .agreement-intro {
    flex-direction: column;
    align-items: flex-start;
  }

  .calendar-frame {
    min-height: 640px;
  }

  .quote-meta {
    text-align: left;
  }

  .public-actions,
  .record-top {
    flex-direction: column;
  }
}

@media print {
  body {
    background: #ffffff;
  }

  .public-actions {
    display: none;
  }

  .public-document {
    width: 100%;
    margin: 0;
    border: 0;
    box-shadow: none;
  }
}
