@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500&family=DM+Sans:wght@300;400;500&display=swap');

:root {
  --ink: #000000;
  --ink-muted: #636466;
  --ink-faint: #9a9a9c;
  --surface: #f7f7f7;
  --white: #ffffff;
  --accent: #f37021;
  --accent-light: #fff3eb;
  --accent-muted: #f9a878;
  --success: #059669;
  --success-light: #ecfdf5;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --border: #e4e4e4;
  --border-strong: #c8c8c8;
  --radius: 10px;
  --radius-sm: 6px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--surface);
  color: var(--ink);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.6;
}

/* Layout */
.shell { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: 240px; min-height: 100vh;
  background: #000000;
  display: flex; flex-direction: column;
  padding: 28px 0;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 10;
}
.sidebar-logo { padding: 0 24px 28px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.sidebar-logo span { font-family: 'Playfair Display', serif; font-size: 20px; color: #fff; }
.sidebar-logo small { display: block; font-size: 10px; color: rgba(255,255,255,0.35); letter-spacing: 1.5px; text-transform: uppercase; margin-top: 2px; }
.sidebar-nav { padding: 20px 12px; flex: 1; }
.nav-label { font-size: 9px; letter-spacing: 1.8px; text-transform: uppercase; color: rgba(255,255,255,0.3); padding: 0 12px; margin-bottom: 6px; margin-top: 16px; display: block; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius-sm); color: rgba(255,255,255,0.55); text-decoration: none; font-size: 13.5px; font-weight: 400; transition: all 0.15s; }
.nav-item:hover { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.85); }
.nav-item.active { background: rgba(243,112,33,0.2); color: #fff; font-weight: 500; border-left: 3px solid #f37021; }
.nav-item svg { opacity: 0.7; flex-shrink: 0; }
.nav-item.active svg { opacity: 1; }
.sidebar-footer { padding: 20px 24px 0; border-top: 1px solid rgba(255,255,255,0.08); color: rgba(255,255,255,0.3); font-size: 11px; }

/* Main */
.main { margin-left: 240px; flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

/* Topbar */
.topbar { background: var(--white); border-bottom: 1px solid var(--border); padding: 0 32px; height: 56px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 5; }
.topbar-title { font-size: 15px; font-weight: 500; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }

/* Content */
.content { padding: 28px 32px; flex: 1; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 16px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; cursor: pointer; border: none; font-family: 'DM Sans', sans-serif; transition: all 0.15s; text-decoration: none; white-space: nowrap; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-ghost { background: transparent; color: var(--ink-muted); border: 1px solid var(--border-strong); }
.btn-ghost:hover { background: var(--surface); color: var(--ink); }
.btn-danger { background: var(--danger-light); color: var(--danger); }
.btn-danger:hover { background: #fee2e2; }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-icon { padding: 6px; border-radius: var(--radius-sm); background: transparent; border: 1px solid var(--border); cursor: pointer; color: var(--ink-muted); display: inline-flex; align-items: center; justify-content: center; transition: all 0.15s; }
.btn-icon:hover { background: var(--danger-light); color: var(--danger); }

/* Cards */
.card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.card-header { padding: 16px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: 13px; font-weight: 500; }
.card-body { padding: 22px; }

/* Forms */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }
label { font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.7px; color: var(--ink-muted); }
input[type=text], input[type=email], input[type=number], textarea, select {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 12px; font-size: 13.5px;
  font-family: 'DM Sans', sans-serif; color: var(--ink);
  background: var(--white); outline: none; transition: border-color 0.15s, box-shadow 0.15s; width: 100%;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,0.08); }
textarea { resize: vertical; min-height: 80px; }

/* Page header */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 24px; }
.page-header h1 { font-family: 'Playfair Display', serif; font-size: 24px; font-weight: 400; }
.page-header p { color: var(--ink-muted); font-size: 13px; margin-top: 2px; }
.page-header-actions { display: flex; gap: 10px; }

/* Stats */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 28px; }
.stat-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--ink-faint); font-weight: 500; }
.stat-value { font-size: 26px; font-weight: 300; font-family: 'Playfair Display', serif; margin-top: 4px; }
.stat-sub { font-size: 11px; color: var(--ink-muted); margin-top: 2px; }

/* Table */
.table-wrap { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.table-toolbar { padding: 14px 20px; border-bottom: 1px solid var(--border); }
.search-input { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 7px 12px; font-size: 13px; font-family: 'DM Sans', sans-serif; background: var(--surface); outline: none; width: 280px; transition: border-color 0.15s; }
.search-input:focus { border-color: var(--accent-muted); background: var(--white); }
table { width: 100%; border-collapse: collapse; }
thead tr { background: var(--surface); }
th { text-align: left; padding: 11px 16px; font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.8px; color: var(--ink-muted); border-bottom: 1px solid var(--border); }
td { padding: 13px 16px; border-bottom: 1px solid var(--border); font-size: 13px; }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.1s; }
tbody tr:hover { background: var(--accent-light); }

/* Badges */
.quote-num { display: inline-flex; align-items: center; background: var(--accent-light); color: var(--accent); padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 500; }
.status-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 500; }
.status-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status-draft    { background: #f1f5f9; color: #64748b; }
.status-sent     { background: var(--accent-light); color: var(--accent); }
.status-accepted { background: var(--success-light); color: var(--success); }
.status-declined { background: var(--danger-light); color: var(--danger); }
.status-lost     { background: #fff7ed; color: #c2410c; }

/* Line items table */
.items-table { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.items-table th { font-size: 10px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--ink-faint); font-weight: 500; padding: 0 8px 8px; text-align: left; border-bottom: 1px solid var(--border); }
.items-table td { padding: 6px 8px; vertical-align: top; }
.items-table input { border-radius: var(--radius-sm); font-size: 13px; }
input.item-qty   { width: 64px; text-align: center; }
input.item-price { width: 96px; text-align: right; }
.item-total { font-size: 13px; font-weight: 500; text-align: right; padding-top: 14px; min-width: 80px; }
.add-line-btn { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-size: 12.5px; font-weight: 500; cursor: pointer; background: none; border: none; font-family: 'DM Sans', sans-serif; padding: 4px 0; }
.add-line-btn:hover { opacity: 0.75; }

/* Summary */
.summary-line { display: flex; justify-content: space-between; font-size: 13px; padding: 6px 0; }
.summary-line .s-label { color: var(--ink-muted); }
.summary-line .s-val  { font-weight: 500; font-variant-numeric: tabular-nums; }
.summary-divider { border: none; border-top: 1px solid var(--border); margin: 10px 0; }
.summary-total { display: flex; justify-content: space-between; align-items: center; padding: 8px 0 2px; }
.summary-total .t-label { font-size: 13px; font-weight: 500; }
.summary-total .t-val   { font-family: 'Playfair Display', serif; font-size: 22px; }
.discount-row { display: flex; gap: 8px; align-items: center; margin: 8px 0; font-size: 13px; color: var(--ink-muted); }
.discount-row input { width: 80px; text-align: right; }

/* Detail layout */
.detail-header { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px 28px; margin-bottom: 20px; display: flex; align-items: flex-start; justify-content: space-between; }
.detail-meta h2 { font-family: 'Playfair Display', serif; font-size: 22px; font-weight: 400; }
.detail-meta p { color: var(--ink-muted); font-size: 13px; margin-top: 4px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.info-block { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; }
.info-block h3 { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--ink-faint); margin-bottom: 12px; font-weight: 500; }
.info-row { margin-bottom: 10px; }
.info-row:last-child { margin-bottom: 0; }
.ir-label { font-size: 11px; color: var(--ink-faint); }
.ir-val   { font-size: 13.5px; font-weight: 500; }
.ip-table { width: 100%; border-collapse: collapse; }
.ip-table th { font-size: 10px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--ink-faint); font-weight: 500; padding: 10px 22px; text-align: left; background: var(--surface); border-bottom: 1px solid var(--border); }
.ip-table th:not(:first-child), .ip-table td:not(:first-child) { text-align: right; }
.ip-table td { padding: 12px 22px; border-bottom: 1px solid var(--border); font-size: 13px; }
.ip-table tr:last-child td { border-bottom: none; }
.ip-totals { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.ip-total-row { display: flex; gap: 32px; font-size: 13px; }
.ip-total-row .tl { color: var(--ink-muted); }
.ip-total-row .tv { font-weight: 500; min-width: 90px; text-align: right; font-variant-numeric: tabular-nums; }
.ip-grand { font-family: 'Playfair Display', serif; font-size: 20px; }
.notes-block { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; margin-top: 20px; }
.notes-block h3 { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--ink-faint); margin-bottom: 10px; font-weight: 500; }
.notes-block p { font-size: 13px; color: var(--ink-muted); line-height: 1.7; }

/* Alert */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px; }
.alert-error   { background: var(--danger-light);  color: var(--danger); }
.alert-success { background: var(--success-light); color: var(--success); }

/* Empty state */
.empty { text-align: center; padding: 60px 20px; color: var(--ink-muted); }
.empty svg { opacity: 0.2; margin-bottom: 16px; }

/* Builder layout */
.builder-layout { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
.builder-col { display: flex; flex-direction: column; gap: 16px; }
