/* =============================================
   SiteSheetOS — Design System
   ============================================= */

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

:root {
  --blue-600: #1a56db;
  --blue-700: #1341b3;
  --blue-50:  #eff6ff;
  --blue-100: #dbeafe;
  --gray-50:  #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-700: #334155;
  --gray-900: #0f172a;
  --green-50:  #f0fdf4;
  --green-600: #16a34a;
  --red-50:   #fef2f2;
  --red-600:  #dc2626;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.05);
  --shadow:    0 1px 3px rgb(0 0 0 / 0.1), 0 1px 2px rgb(0 0 0 / 0.06);
  --shadow-md: 0 4px 6px rgb(0 0 0 / 0.07), 0 2px 4px rgb(0 0 0 / 0.06);
  --shadow-lg: 0 10px 15px rgb(0 0 0 / 0.1), 0 4px 6px rgb(0 0 0 / 0.05);
  --radius:    10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--gray-900);
  background: var(--gray-50);
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---- Header ---- */
.header {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 700;
  color: var(--gray-900);
  text-decoration: none;
}
.nav { display: flex; gap: 4px; }
.nav-link {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-500);
  text-decoration: none;
  transition: all 0.15s;
}
.nav-link:hover, .nav-link.active {
  color: var(--blue-600);
  background: var(--blue-50);
}

/* ---- Hero ---- */
.hero {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
  color: white;
  padding: 56px 0 52px;
  text-align: center;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgb(255 255 255 / 0.12);
  border: 1px solid rgb(255 255 255 / 0.2);
  border-radius: 100px;
  padding: 5px 16px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 20px;
  color: rgb(255 255 255 / 0.9);
}
.hero h1 {
  font-size: clamp(28px, 5vw, 46px);
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 16px;
  letter-spacing: -0.02em;
}
.hero-sub {
  font-size: 18px;
  color: rgb(255 255 255 / 0.75);
  margin: 0;
  max-width: 560px;
  margin-inline: auto;
}

/* ---- Cards & layout ---- */
.main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  padding-top: 32px;
  padding-bottom: 32px;
  align-items: start;
}
@media (max-width: 720px) {
  .main-grid { grid-template-columns: 1fr; }
}

.card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}
.card h2 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-900);
}
.hint {
  font-size: 13px;
  color: var(--gray-400);
  margin: 0 0 20px;
}

/* ---- Examples ---- */
.examples {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
  align-items: center;
}
.examples-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.example-btn {
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: 100px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-700);
  cursor: pointer;
  transition: all 0.15s;
}
.example-btn:hover {
  background: var(--blue-50);
  border-color: var(--blue-100);
  color: var(--blue-600);
}

/* ---- Form ---- */
.form-group { position: relative; margin-bottom: 16px; }
.textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
  color: var(--gray-900);
  background: white;
  resize: vertical;
  min-height: 100px;
  transition: border-color 0.15s;
  outline: none;
}
.textarea:focus {
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px rgb(26 86 219 / 0.1);
}
.char-count {
  text-align: right;
  font-size: 12px;
  color: var(--gray-400);
  margin-top: 4px;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}
.btn-primary {
  background: var(--blue-600);
  color: white;
}
.btn-primary:hover:not(:disabled) { background: var(--blue-700); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-outline {
  background: white;
  border: 1.5px solid var(--gray-200);
  color: var(--gray-700);
}
.btn-outline:hover { background: var(--gray-50); border-color: var(--gray-300); }
.btn-lg { padding: 12px 24px; font-size: 15px; width: 100%; }
.btn-sm { padding: 6px 14px; font-size: 13px; }

/* ---- Loading ---- */
.loading-state, .error-state {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: var(--radius);
}
.loading-state {
  background: var(--blue-50);
  color: var(--blue-600);
  font-size: 14px;
  font-weight: 500;
}
.error-state {
  background: var(--red-50);
  color: var(--red-600);
  font-size: 14px;
  font-weight: 500;
}
.spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid rgb(26 86 219 / 0.2);
  border-top-color: var(--blue-600);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
.dots::after {
  content: '';
  animation: dots 1.5s steps(4, end) infinite;
}
@keyframes dots {
  0%  { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75% { content: '...'; }
}
.hidden { display: none !important; }

/* ---- Empty state ---- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 48px 24px;
  color: var(--gray-400);
}
.empty-state h3 {
  margin: 16px 0 6px;
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-500);
}
.empty-state p { margin: 0; font-size: 14px; }

/* ---- Quote output ---- */
.quote-output { font-size: 14px; }
.quote-header {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--gray-100);
}
.quote-header h3 {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 700;
  color: var(--gray-900);
}
.quote-meta {
  font-size: 12px;
  color: var(--gray-400);
}
.quote-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--gray-400);
  margin: 20px 0 8px;
}
.line-items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.line-items-table th {
  text-align: left;
  font-weight: 600;
  color: var(--gray-500);
  padding: 6px 8px;
  border-bottom: 1.5px solid var(--gray-100);
}
.line-items-table th.num, .line-items-table td.num {
  text-align: right;
}
.line-items-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
  vertical-align: top;
}
.line-items-table tr:last-child td { border-bottom: none; }
.line-items-table tr:hover td { background: var(--gray-50); }

.totals-block {
  margin-top: 20px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
}
.totals-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 16px;
  font-size: 13px;
  color: var(--gray-700);
  border-bottom: 1px solid var(--gray-100);
}
.totals-row:last-child { border-bottom: none; }
.totals-row.total-final {
  background: var(--gray-900);
  color: white;
  font-size: 16px;
  font-weight: 700;
}
.totals-row .label { font-weight: 500; }
.totals-row .amount { font-weight: 600; font-variant-numeric: tabular-nums; }

.payment-terms {
  margin-top: 16px;
  background: var(--green-50);
  border: 1px solid #bbf7d0;
  border-radius: var(--radius);
  padding: 14px 16px;
}
.payment-terms-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--green-600);
  margin-bottom: 8px;
}
.payment-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--gray-700);
  padding: 3px 0;
}
.payment-row .payment-amount { font-weight: 600; color: var(--green-600); }

.notes-block {
  margin-top: 14px;
  padding: 12px 14px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: #92400e;
}
.notes-label { font-weight: 700; margin-bottom: 4px; }

.quote-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--gray-100);
}
.quote-actions .btn { flex: 1; }

/* ---- History ---- */
.history-section {
  padding: 0 0 48px;
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}
.history-list {
  display: grid;
  gap: 10px;
}
.history-item {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  transition: all 0.15s;
}
.history-item:hover {
  border-color: var(--blue-600);
  box-shadow: var(--shadow);
}
.history-item-desc {
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-900);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-item-meta {
  font-size: 12px;
  color: var(--gray-400);
}
.history-item-total {
  font-size: 16px;
  font-weight: 700;
  color: var(--green-600);
  white-space: nowrap;
}
.muted { color: var(--gray-400); font-size: 14px; }

/* ---- Footer ---- */
.footer {
  background: var(--gray-900);
  color: rgb(255 255 255 / 0.5);
  text-align: center;
  padding: 24px;
  font-size: 13px;
}
