:root {
  /* SHAIAN DESIGNS brand kit */
  --navy: #0F2344;
  --navy-2: #1F4E8C;
  --magenta: #B98A34; /* brand gold (accent buttons) */
  --header-blue: #1F4E8C;
  --stripe: #f4f6fb;
  --border: #e2e7f0;
  --bg: #eef1f7;
  --ink: #1b2130;
  --muted: #6b7486;
  --radius: 10px;
  --shadow-sm: 0 1px 3px rgba(20, 35, 70, 0.08);
  --shadow-md: 0 6px 18px rgba(20, 35, 70, 0.10);
}

* { box-sizing: border-box; }

body {
  font-family: "Manrope", "Segoe UI Variable", "Segoe UI", "Inter", system-ui, Arial, sans-serif;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

h2 { color: var(--navy); font-size: 15px; font-weight: 700; margin: 14px 0 8px; letter-spacing: 0.01em; }

button {
  background: var(--navy);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  font-weight: 600;
  transition: background 0.15s, transform 0.08s, box-shadow 0.15s;
}
button:hover { background: #16305c; box-shadow: var(--shadow-sm); }
button:active { transform: translateY(1px); }
.addRowBtn { background: var(--magenta); margin: 8px 0 18px; }
.addRowBtn:hover { background: #96702a; }

input, select {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--navy-2);
  box-shadow: 0 0 0 3px rgba(45, 82, 150, 0.15);
}

.topbar {
  background: linear-gradient(120deg, var(--navy) 0%, var(--navy-2) 100%);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-md);
  position: relative;
  z-index: 5;
}
.brand { font-weight: 700; font-size: 16px; white-space: nowrap; letter-spacing: 0.01em; }
.job-fields, .job-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.job-fields input { width: 160px; border: none; }
.topbar button { background: #ffffff22; border-radius: 999px; font-weight: 500; }
.topbar button:hover { background: #ffffff36; }
.topbar select { border: none; border-radius: 999px; background: #ffffffea; }
.fileBtn {
  background: #ffffff22; color: #fff;
  padding: 8px 16px; border-radius: 999px; cursor: pointer; font-size: 13px;
  transition: background 0.15s;
}
.fileBtn:hover { background: #ffffff36; }
.userBox { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.userBox #userEmail { font-size: 12px; opacity: 0.85; }
.userBox .navLink {
  color: #fff; text-decoration: none; font-size: 13px; background: #ffffff22;
  padding: 8px 16px; border-radius: 999px; transition: background 0.15s;
}
.userBox .navLink:hover { background: #ffffff36; }

.tabs {
  display: flex; gap: 6px; background: transparent; padding: 14px 20px 0;
}
.tabBtn {
  background: #fff; color: var(--muted); border-radius: 999px;
  padding: 9px 22px; font-weight: 600; box-shadow: var(--shadow-sm);
}
.tabBtn:hover { background: #fff; color: var(--navy); }
.tabBtn.active { background: var(--navy); color: #fff; }

main { padding: 16px 20px 40px; }
.tabPane { display: none; }
.tabPane.active { display: block; animation: fadeIn 0.18s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.designGrid { display: grid; grid-template-columns: 390px 1fr; gap: 16px; align-items: start; }
.segmentsPanel, .canvasPanel {
  background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 16px;
  box-shadow: var(--shadow-sm);
}
/* the sections list scrolls on its own; the drawing stays pinned in view */
.segmentsPanel {
  max-height: calc(100vh - 210px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.canvasPanel {
  position: sticky;
  top: 12px;
}
.segmentsPanel::-webkit-scrollbar { width: 9px; }
.segmentsPanel::-webkit-scrollbar-thumb { background: #c6cede; border-radius: 999px; }
.segmentsPanel::-webkit-scrollbar-thumb:hover { background: #aab4c9; }
.segmentsPanel::-webkit-scrollbar-track { background: transparent; }

.areaStrip {
  display: flex; align-items: center; gap: 8px; margin-bottom: 12px; background: #fff;
  border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}
#areaChips { display: flex; gap: 6px; flex-wrap: wrap; }
.areaChip {
  padding: 7px 16px; border-radius: 999px; background: var(--stripe); color: var(--navy);
  font-size: 13px; font-weight: 600; cursor: pointer; border: 1px solid var(--border);
  transition: background 0.15s, color 0.15s;
}
.areaChip:hover { background: #e7ecf6; }
.areaChip.active { background: var(--navy); color: #fff; border-color: var(--navy); }

.sinkButtons { display: flex; gap: 8px; margin-bottom: 12px; }
.sinkButtons button { background: var(--magenta); font-size: 12px; flex: 1; }
.sinkButtons button:hover { background: #96702a; }

.counterGroup {
  border: 1px solid var(--border); border-radius: 12px; padding: 10px; margin-bottom: 12px; background: #fff;
}
.counterHead {
  display: flex; justify-content: space-between; align-items: center;
  font-weight: 700; color: var(--navy); font-size: 13px; margin-bottom: 8px;
  border-bottom: 2px solid var(--navy); padding-bottom: 6px;
}
.segCard {
  border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-bottom: 10px; background: var(--stripe);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.segCard.selected {
  border-color: var(--magenta);
  background: #fef3f7;
  box-shadow: 0 0 0 2px rgba(194, 24, 91, 0.25);
}
.segCard .segHead { display: flex; justify-content: space-between; align-items: center; font-weight: 700; color: var(--navy); cursor: pointer; }
.segCard .row { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; align-items: center; }
.segCard label { font-size: 11.5px; color: var(--muted); display: flex; flex-direction: column; gap: 3px; font-weight: 600; }
.segCard input[type=number] { width: 72px; }
.removeBtn { background: #c23a33; padding: 4px 10px; font-size: 12px; }
.removeBtn:hover { background: #9c2a24; }
.cutoutRow { display: flex; gap: 6px; align-items: center; font-size: 12px; margin-top: 5px; flex-wrap: wrap; }
.splashSidesRow { align-items: center; }
.splashSidesRow .chk { flex-direction: row !important; align-items: center; gap: 4px; font-size: 12px; font-weight: 500 !important; color: var(--ink) !important; }
.splashSidesRow input[type=checkbox] { width: auto; }
.cutoutList { margin-top: 10px; }
.xBtn { background: #c23a33; border-radius: 50%; width: 20px; height: 20px; padding: 0; line-height: 18px; font-size: 11px; }

#designSvg {
  width: 100%; height: 460px; display: block; touch-action: none; cursor: crosshair;
  background: linear-gradient(180deg, #fdfefe 0%, #f2f5fa 100%);
  border: 1px solid var(--border); border-radius: 14px;
  box-shadow: inset 0 1px 5px rgba(20, 35, 70, 0.06);
}
.hint { color: var(--muted); font-size: 12.5px; }

.canvasHeader { display: flex; align-items: center; gap: 16px; margin-bottom: 10px; flex-wrap: wrap; }
.controlsBar {
  display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px;
}
.ctrlChip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--stripe); border: 1px solid var(--border); border-radius: 999px;
  padding: 4px 11px; font-size: 11.5px; color: var(--muted); white-space: nowrap;
}
.ctrlChip kbd {
  background: #fff; border: 1px solid var(--border); border-bottom-width: 2px;
  border-radius: 5px; padding: 1px 6px; font-size: 10.5px; font-family: inherit;
  font-weight: 700; color: var(--navy);
}
.inlineField { display: flex; flex-direction: column; font-size: 11.5px; gap: 3px; color: var(--muted); font-weight: 600; }
.inlineField input, .inlineField select { width: auto; min-width: 90px; }
.canvasStage { position: relative; }
.canvasToolbar {
  position: absolute; top: 12px; right: 12px; display: flex; flex-direction: column; gap: 6px;
}
.canvasToolbar button {
  font-size: 12px; padding: 7px 15px; border-radius: 999px;
  background: #ffffffee; color: var(--navy); box-shadow: var(--shadow-sm);
  border: 1px solid var(--border); backdrop-filter: blur(4px);
}
.canvasToolbar button:hover { background: var(--navy); color: #fff; }
.canvasToolbar button.activeMode { background: var(--magenta); color: #fff; border-color: var(--magenta); }
.dimEdit {
  position: absolute; z-index: 20; width: 92px; font-size: 12px; padding: 4px 6px;
  border: 2px solid var(--magenta); border-radius: 8px; text-align: center;
  box-shadow: var(--shadow-md);
}

.areaStrip button, .slabToolRow button { border-radius: 999px; }

.sinkFormRow { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.sinkFormRow label { font-size: 12px; font-weight: 600; color: var(--muted); }
.sinkFormRow select, .sinkFormRow input { padding: 8px 10px; }
.slabDims { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 4px; font-weight: 600; }

.pickerList { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow-y: auto; }
.pickerRow {
  padding: 11px 14px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; font-size: 13px;
  display: flex; justify-content: space-between; transition: background 0.12s, border-color 0.12s;
}
.pickerRow:hover { background: var(--stripe); border-color: var(--navy-2); }

#toastHost { position: fixed; top: 16px; right: 16px; z-index: 999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--navy); color: #fff; padding: 11px 18px; border-radius: 10px; font-size: 13px;
  box-shadow: var(--shadow-md); animation: toastIn 0.16s ease-out;
}
.toast.warn { background: #c23a33; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

.modalOverlay {
  position: fixed; inset: 0; background: rgba(15, 22, 36, 0.5); display: flex; align-items: center; justify-content: center; z-index: 1000;
  backdrop-filter: blur(2px);
}
.modalBox {
  background: #fff; border-radius: 16px; padding: 24px; max-width: 380px; width: calc(100% - 40px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  animation: fadeIn 0.15s ease-out;
}
.modalBox p { margin: 0 0 16px; color: var(--ink); font-size: 14px; }
.modalBox .modalActions { display: flex; justify-content: flex-end; gap: 8px; }
.modalBox .modalActions button.secondary { background: #8a93a5; }
.modalBox .modalActions button.secondary:hover { background: #6b7486; }

.slabControls { display: flex; gap: 16px; align-items: flex-end; margin-bottom: 12px; background: #fff; padding: 14px; border-radius: 14px; border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.slabControls label { display: flex; flex-direction: column; font-size: 11.5px; gap: 4px; color: var(--muted); font-weight: 600; }
#slabAreasWrap { display: flex; flex-direction: column; gap: 24px; }
.slabSvg { background: #fff; width: 100%; display: block; touch-action: none; }
.slabStage {
  background: linear-gradient(180deg, #fdfefe 0%, #f2f5fa 100%);
  border: 1px solid var(--border); border-radius: 14px; padding: 12px;
  max-width: 820px; box-shadow: inset 0 1px 5px rgba(20, 35, 70, 0.06);
}
.slabStage svg { background: transparent; }
.slabToolRow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.slabToolRow button { font-size: 12px; padding: 6px 14px; }
.quoteSlabBlock { margin-top: 10px; }
.quoteSlabLabel { font-size: 12px; color: var(--ink); margin-bottom: 4px; }

.areaSection { margin: 18px 0 6px; background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow-sm); }
#quoteAreas .areaSection, #quoteDoc .areaSection { border: none; box-shadow: none; padding: 0; background: transparent; }
.areaSection h3 { color: var(--navy); font-size: 14px; margin: 0 0 8px; border-bottom: 2px solid var(--navy); padding-bottom: 5px; }
.areaSubtotal { text-align: right; font-weight: 700; color: var(--navy); font-size: 13px; margin-top: 6px; }
.noPriceWarn { color: #c23a33; font-style: italic; font-size: 12px; }

.quoteControls { display: flex; gap: 14px; align-items: flex-end; margin-bottom: 14px; background: #fff; padding: 14px; border-radius: 14px; border: 1px solid var(--border); flex-wrap: wrap; box-shadow: var(--shadow-sm); }
.quoteControls label { display: flex; flex-direction: column; font-size: 11.5px; gap: 4px; color: var(--muted); font-weight: 600; }

.quoteDoc { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 28px; max-width: 850px; margin: 0 auto; box-shadow: var(--shadow-md); }
.quoteHeader { display: flex; justify-content: space-between; border-bottom: 3px solid var(--navy); padding-bottom: 12px; margin-bottom: 12px; }
.companyBlock { display: flex; align-items: center; gap: 14px; }
#qLogo { max-height: 72px; max-width: 180px; object-fit: contain; }
.companyName { color: var(--navy); font-size: 20px; font-weight: 700; }
.quoteMeta { text-align: right; font-size: 13px; }
.priceSettingsBar {
  display: flex; gap: 20px; flex-wrap: wrap; background: var(--stripe); border-radius: 8px;
  padding: 9px 14px; font-size: 12px; color: var(--ink); margin-bottom: 12px;
}
.qDrawing { width: 100%; max-height: 320px; object-fit: contain; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 12px; background: #fafbfd; }
.quoteTable { width: 100%; border-collapse: collapse; font-size: 13px; }
.quoteTable th { background: var(--header-blue); color: #fff; text-align: left; padding: 7px 10px; }
.quoteTable th:first-child { border-radius: 6px 0 0 0; }
.quoteTable th:last-child { border-radius: 0 6px 0 0; }
.quoteTable td { padding: 6px 10px; border-bottom: 1px solid var(--border); }
.quoteTable tr.stripe td { background: var(--stripe); }
.quoteTable tr.sectionRow td { background: var(--navy); color: #fff; font-weight: 700; }
.quoteTotals { margin-top: 12px; margin-left: auto; width: 290px; font-size: 14px; }
.quoteTotals div { display: flex; justify-content: space-between; padding: 4px 0; }
.quoteTotals .grand { font-weight: 700; font-size: 17px; border-top: 2px solid var(--navy); color: var(--navy); }
.quoteNote { margin-top: 14px; font-size: 12px; color: var(--muted); font-style: italic; }
.quoteMadeWith {
  margin-top: 22px; padding-top: 12px; border-top: 1px solid var(--border);
  font-size: 11px; color: var(--muted); text-align: center; letter-spacing: 0.02em;
}

.editTable { width: 100%; border-collapse: collapse; background: #fff; margin-bottom: 4px; border-radius: 10px; overflow: hidden; box-shadow: var(--shadow-sm); }
.editTable th { background: var(--header-blue); color: #fff; text-align: left; padding: 8px 10px; font-size: 12px; }
.editTable td { padding: 6px 10px; border-bottom: 1px solid var(--border); }
.editTable input { width: 100%; }
.priceListActions { display: flex; gap: 10px; margin: 16px 0 40px; }

@media print {
  .no-print { display: none !important; }
  main { padding: 0; }
  body { background: #fff; }
  .tabPane { display: none !important; }
  #tab-quote.tabPane, #tab-quote.tabPane.active { display: block !important; }
  .quoteDoc { border: none; box-shadow: none; max-width: 100%; }
}
