:root {
  --bg: #0f0f0f;
  --bg-raised: #181818;
  --border: #2a2a2a;
  --orange: #ff4d00;
  --orange-dark: #d43f00;
  --paper: #f5f0e8;
  --paper-line: #ddd4c4;
  --ink: #1c1a16;
  --ink-soft: #6b6455;
  --text: #f2f0ec;
  --text-dim: #9b9890;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

[hidden] {
  display: none !important;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Header */

.site-header {
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.app-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.nav-link {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-link:hover {
  color: var(--text);
  background: var(--bg-raised);
}

.nav-link[aria-current='true'] {
  color: var(--orange);
  background: var(--bg-raised);
}

.logo {
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  font-size: 30px;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  line-height: 1;
}

.logo-trade {
  color: var(--text);
}

.logo-done {
  color: var(--orange);
}

.tagline {
  margin: 8px 0 0;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
}

/* Input panel */

.input-panel {
  padding: 24px 0 40px;
}

.input-label {
  display: block;
  font-family: 'Oswald', sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 10px;
}

textarea {
  width: 100%;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  padding: 16px;
  resize: vertical;
  min-height: 160px;
  transition: border-color 0.15s ease;
}

textarea::placeholder {
  color: var(--text-dim);
}

textarea:focus {
  outline: none;
  border-color: var(--orange);
}

.primary-btn {
  margin-top: 8px;
  background: var(--orange);
  color: #0f0f0f;
  border: none;
  border-radius: 10px;
  font-family: 'Oswald', sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 17px;
  padding: 16px 20px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background 0.15s ease, transform 0.05s ease;
}

.primary-btn.full-width {
  width: 100%;
}

.primary-btn:hover {
  background: #ff6420;
}

.primary-btn:active {
  transform: scale(0.99);
}

.primary-btn:disabled {
  background: var(--orange-dark);
  cursor: not-allowed;
  opacity: 0.75;
}

.btn-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(15, 15, 15, 0.35);
  border-top-color: #0f0f0f;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex: 0 0 auto;
}

.primary-btn.loading .btn-spinner {
  display: inline-block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.error-message,
.form-error {
  margin-top: 14px;
  background: rgba(255, 77, 0, 0.1);
  border: 1px solid rgba(255, 77, 0, 0.4);
  color: #ffb28c;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.5;
}

.form-success {
  margin-top: 14px;
  background: rgba(76, 200, 120, 0.1);
  border: 1px solid rgba(76, 200, 120, 0.4);
  color: #a7e8bd;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.5;
}

/* Screens (auth, onboarding, settings, quotes list) */

.screen {
  padding: 28px 0 48px;
}

.screen-title {
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  font-size: 26px;
  margin: 0 0 8px;
}

.screen-intro {
  color: var(--text-dim);
  font-size: 14px;
  margin: 0 0 24px;
  line-height: 1.5;
}

.auth-screen {
  max-width: 380px;
}

.screen-links {
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-dim);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.link-btn {
  background: none;
  border: none;
  color: var(--orange);
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 13px;
  padding: 0;
  cursor: pointer;
}

.link-btn:hover {
  color: #ff6420;
  text-decoration: underline;
}

/* Form fields (auth + business profile) */

.field-label {
  display: block;
  font-family: 'Oswald', sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 12px;
  color: var(--text-dim);
  margin: 18px 0 8px;
}

.field-label:first-of-type {
  margin-top: 0;
}

.field-input {
  width: 100%;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  padding: 13px 14px;
  transition: border-color 0.15s ease;
}

textarea.field-input {
  resize: vertical;
  min-height: 60px;
}

.field-input::placeholder {
  color: var(--text-dim);
}

.field-input:focus {
  outline: none;
  border-color: var(--orange);
}

.field-input[type='file'] {
  padding: 10px 12px;
  font-size: 13px;
}

.field-hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--text-dim);
}

.business-form {
  max-width: 480px;
}

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

.logo-field .field-input {
  flex: 1;
}

.logo-preview {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  object-fit: contain;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  flex: 0 0 auto;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
}

.toggle-row .field-label {
  margin: 0;
}

.toggle {
  position: relative;
  display: inline-block;
  cursor: pointer;
}

.toggle input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.toggle-track {
  display: block;
  width: 46px;
  height: 26px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.toggle-thumb {
  display: block;
  width: 18px;
  height: 18px;
  margin: 3px;
  background: var(--text-dim);
  border-radius: 50%;
  transition: transform 0.15s ease, background 0.15s ease;
}

.toggle input:checked + .toggle-track {
  background: var(--orange-dark);
  border-color: var(--orange);
}

.toggle input:checked + .toggle-track .toggle-thumb {
  transform: translateX(20px);
  background: #fff;
}

.toggle input:focus-visible + .toggle-track {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

/* Quotes list */

.empty-state {
  color: var(--text-dim);
  font-size: 14px;
  padding: 20px 0;
}

.quotes-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quote-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.quote-list-row:hover {
  border-color: var(--orange);
}

.quote-list-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.quote-list-job {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quote-list-client {
  font-size: 13px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quote-list-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex: 0 0 auto;
}

.quote-list-date {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
}

.quote-list-total {
  font-family: 'Oswald', sans-serif;
  font-weight: 600;
  font-size: 16px;
  color: var(--orange);
  white-space: nowrap;
}

/* Quote panel */

.quote-panel {
  padding: 8px 0 60px;
}

.quote-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 18px;
}

.ghost-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 13px;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.ghost-btn:hover {
  border-color: var(--orange);
  color: var(--orange);
}

/* The quote itself — off-white paper */

.quote-paper {
  background: var(--paper);
  color: var(--ink);
  border-radius: 10px;
  padding: 28px 22px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

.quote-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 3px solid var(--ink);
}

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

.quote-logo-img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 4px;
  flex: 0 0 auto;
}

.quote-business-name {
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  font-size: 22px;
  line-height: 1.15;
  color: var(--ink);
  word-break: break-word;
}

.quote-head-contact {
  text-align: right;
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.5;
  flex: 0 1 auto;
}

.quote-head-contact p {
  margin: 0;
}

.meta-label {
  display: block;
  font-family: 'Oswald', sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 11px;
  color: var(--ink-soft);
  margin-bottom: 2px;
}

.quote-refdate {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  font-size: 12.5px;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--paper-line);
}

.quote-refdate .meta-label {
  display: inline;
  margin-right: 6px;
}

.quote-parties {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  padding: 18px 0;
  border-bottom: 1px solid var(--paper-line);
}

.quote-parties > div {
  flex: 1 1 200px;
}

.quote-client-name,
.quote-job-title {
  margin: 0;
  font-weight: 600;
  font-size: 16px;
}

/* Table */

.quote-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 18px;
  font-size: 14px;
  table-layout: fixed;
}

.quote-table thead th {
  text-align: left;
  font-family: 'Oswald', sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 11px;
  color: var(--ink-soft);
  padding: 0 0 8px;
  border-bottom: 2px solid var(--ink);
}

.quote-table .col-qty,
.quote-table .col-price,
.quote-table .col-total {
  text-align: right;
  white-space: nowrap;
}

.quote-table tbody td {
  padding: 10px 0;
  border-bottom: 1px solid var(--paper-line);
  vertical-align: top;
}

.quote-table tbody tr:last-child td {
  border-bottom: none;
}

.quote-table .col-qty,
.quote-table .col-price,
.quote-table .col-total {
  font-variant-numeric: tabular-nums;
}

/* Mobile: collapse Qty + Unit into a sub-line under the description, keep
   just Description | Total as visible columns so nothing feels cramped. */
.line-meta {
  display: block;
  color: var(--ink-soft);
  font-size: 12px;
  margin-top: 3px;
}

.quote-table th.col-qty,
.quote-table th.col-price,
.quote-table td.col-qty,
.quote-table td.col-price {
  display: none;
}

.quote-table .col-desc {
  width: 62%;
}

.quote-table .col-total {
  width: 38%;
}

@media (min-width: 480px) {
  .line-meta {
    display: none;
  }

  .quote-table th.col-qty,
  .quote-table th.col-price,
  .quote-table td.col-qty,
  .quote-table td.col-price {
    display: table-cell;
  }

  .quote-table .col-desc {
    width: 46%;
  }

  .quote-table .col-qty {
    width: 14%;
  }

  .quote-table .col-price,
  .quote-table .col-total {
    width: 20%;
  }
}

/* Totals */

.quote-totals {
  margin-top: 6px;
  padding-top: 12px;
  margin-left: auto;
  max-width: 280px;
}

.totals-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.totals-final {
  border-top: 2px solid var(--ink);
  margin-top: 4px;
  padding-top: 12px;
  font-family: 'Oswald', sans-serif;
  font-weight: 600;
  font-size: 20px;
}

.totals-final span:last-child {
  color: var(--orange-dark);
}

/* Notes + footer */

.quote-notes {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--paper-line);
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-soft);
}

.quote-notes p:last-child {
  margin-bottom: 0;
}

.quote-footer {
  margin-top: 28px;
  text-align: center;
}

.quote-footer p {
  margin: 0;
  font-family: 'Oswald', sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
  color: var(--paper-line);
}

/* Responsive: tablet / desktop */

@media (min-width: 640px) {
  .logo {
    font-size: 34px;
  }

  .input-panel {
    padding: 36px 0 48px;
  }

  .quote-paper {
    padding: 44px 48px;
  }
}

/* Print styles */

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

  .site-header,
  .quote-toolbar,
  .input-panel {
    display: none !important;
  }

  .quote-panel,
  .screen {
    padding: 0;
  }

  .quote-paper {
    box-shadow: none;
    border-radius: 0;
  }
}
