:root{
  --bg:#f6f7fb;
  --card:#ffffff;
  --text:#152033;
  --muted:#6e788b;
  --primary:#5b5bd6;
  --primary-dark:#4646bd;
  --line:#e7e9f1;
  --soft:#efefff;
  --shadow:0 18px 50px rgba(25,31,52,.08);
}
*{box-sizing:border-box}
body{
  margin:0;
  font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  background:var(--bg);
  color:var(--text);
}
button,input,textarea,select{font:inherit}
.topbar{
  max-width:1180px;
  margin:auto;
  padding:22px 24px;
  display:flex;
  align-items:center;
  justify-content:space-between;
}
.brand{display:flex;align-items:center;gap:12px}
.logo,.quote-logo{
  width:42px;height:42px;border-radius:14px;
  display:grid;place-items:center;
  background:linear-gradient(135deg,#5b5bd6,#8b5cf6);
  color:white;font-weight:900;font-size:20px;
  box-shadow:0 10px 25px rgba(91,91,214,.25);
}
.brand-name{font-size:20px;font-weight:900;letter-spacing:-.02em}
.brand-sub{font-size:12px;color:var(--muted)}
.hero{
  max-width:1180px;
  margin:12px auto 40px;
  padding:36px 24px 10px;
  display:grid;
  grid-template-columns:1.05fr .95fr;
  gap:38px;
  align-items:center;
}
.pill{
  display:inline-block;padding:8px 12px;border-radius:99px;
  background:var(--soft);color:var(--primary-dark);font-weight:800;font-size:13px;
}
.hero h1{
  font-size:clamp(42px,6vw,74px);
  line-height:.98;
  letter-spacing:-.055em;
  margin:18px 0;
}
.hero-copy p{font-size:19px;line-height:1.6;color:var(--muted);max-width:650px}
.hero-card,.panel{
  background:var(--card);border:1px solid var(--line);border-radius:24px;
  box-shadow:var(--shadow);
}
.hero-card{padding:24px}
label{font-size:13px;font-weight:800;color:#39445a;margin-bottom:8px;display:block}
textarea,input,select{
  width:100%;border:1px solid #dfe3ec;border-radius:12px;
  background:white;padding:12px 13px;outline:none;color:var(--text);
}
textarea:focus,input:focus,select:focus{border-color:var(--primary);box-shadow:0 0 0 3px rgba(91,91,214,.1)}
textarea{min-height:110px;resize:vertical}
.hero-card small{display:block;color:var(--muted);margin-top:10px}
.btn{
  border:0;border-radius:12px;padding:12px 16px;font-weight:850;cursor:pointer;
  transition:.2s transform,.2s background;
}
.btn:hover{transform:translateY(-1px)}
.btn.primary{background:var(--primary);color:white}
.btn.primary:hover{background:var(--primary-dark)}
.btn.ghost,.btn.small{background:white;border:1px solid var(--line);color:var(--text)}
.btn.full{width:100%;margin-top:12px}
.btn.small{padding:9px 12px}
.workspace{
  max-width:1180px;margin:0 auto;padding:0 24px 50px;
  display:grid;grid-template-columns:1fr .92fr;gap:24px;align-items:start;
}
.panel{padding:24px}
.panel-head h2,.section-title h3{margin:0}
.panel-head p{margin:6px 0 22px;color:var(--muted)}
.grid.two{display:grid;grid-template-columns:1fr 1fr;gap:14px}
.field{margin-bottom:14px}
.section-title{
  display:flex;justify-content:space-between;align-items:center;
  margin:12px 0 12px;
}
.item-row{
  display:grid;grid-template-columns:2.2fr .6fr .9fr auto;
  gap:10px;align-items:end;margin-bottom:10px;
}
.item-row .remove{
  width:42px;height:42px;border:1px solid #f0d7d7;border-radius:11px;
  background:#fff7f7;color:#c33;cursor:pointer;font-weight:900;
}
.actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:8px}
.preview{position:sticky;top:18px;padding:16px}
.quote-paper{
  background:white;border:1px solid var(--line);border-radius:18px;
  padding:28px;min-height:680px;
}
.quote-head{display:flex;justify-content:space-between;gap:20px}
.quote-logo{margin-bottom:14px}
.quote-head h2{margin:0 0 4px}
.quote-meta{text-align:right}
.quote-title{font-size:28px;font-weight:950;letter-spacing:.08em;color:var(--primary);margin-bottom:10px}
.quote-meta div{margin:5px 0}.quote-meta span{color:var(--muted);margin-right:7px}
.muted{color:var(--muted)}
.client-box{margin:32px 0 22px;padding:16px;background:#f8f8fd;border-radius:14px}
.client-box span{display:block;font-size:11px;font-weight:900;color:var(--muted);letter-spacing:.08em;margin-bottom:5px}
.client-box strong{font-size:18px}
table{width:100%;border-collapse:collapse}
th,td{padding:12px 8px;border-bottom:1px solid var(--line);text-align:left;font-size:13px}
th{font-size:11px;text-transform:uppercase;color:var(--muted);letter-spacing:.05em}
th:nth-child(n+2),td:nth-child(n+2){text-align:right}
.totals{width:min(320px,100%);margin:22px 0 22px auto}
.totals>div{display:flex;justify-content:space-between;padding:8px 0}
.totals .grand{font-size:20px;border-top:2px solid var(--text);margin-top:5px;padding-top:12px}
.notes{margin-top:34px}
.notes h4{margin-bottom:6px}.notes p{color:var(--muted);font-size:13px;line-height:1.6}
.footer-note{margin-top:50px;padding-top:14px;border-top:1px solid var(--line);color:#9aa1b0;font-size:11px;text-align:center}
footer{max-width:1180px;margin:auto;padding:0 24px 35px;display:flex;justify-content:space-between;color:var(--muted);font-size:13px}
@media(max-width:900px){
  .hero,.workspace{grid-template-columns:1fr}
  .hero{padding-top:10px}
  .preview{position:static}
}
@media(max-width:620px){
  .grid.two{grid-template-columns:1fr}
  .item-row{grid-template-columns:1fr 1fr}
  .item-row .desc{grid-column:1/-1}
  .hero h1{font-size:44px}
  .topbar{padding-inline:16px}.hero,.workspace{padding-inline:16px}
}
@media print{
  body{background:white}
  .topbar,.hero,.editor,footer{display:none!important}
  .workspace{display:block;padding:0;margin:0;max-width:none}
  .preview{box-shadow:none;border:0;padding:0}
  .quote-paper{border:0;border-radius:0;padding:20px;min-height:auto}
}

.pricing-section{max-width:1100px;margin:70px auto 35px;padding:0 20px}
.pricing-head{text-align:center;max-width:650px;margin:0 auto 28px}
.pricing-head h2{font-size:clamp(28px,4vw,42px);margin:12px 0 8px}
.pricing-head p{opacity:.72}
.pricing-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px;max-width:820px;margin:0 auto}
.price-card{position:relative;border:1px solid rgba(127,127,127,.22);border-radius:22px;padding:28px;background:var(--card-bg,#fff);box-shadow:0 16px 45px rgba(0,0,0,.06)}
.price-card.featured{transform:translateY(-6px);border-width:2px}
.popular{position:absolute;right:18px;top:18px;font-size:11px;font-weight:800;letter-spacing:.08em;opacity:.7}
.plan-name{font-size:21px;font-weight:800}
.plan-price{font-size:38px;font-weight:850;margin:10px 0}
.plan-price small{font-size:14px;font-weight:500;opacity:.6}
.price-card p{opacity:.7;min-height:45px}
.plan-feature{padding:7px 0;font-size:14px}
.plan-btn{width:100%;margin-top:20px}
@media(max-width:720px){.pricing-grid{grid-template-columns:1fr}.price-card.featured{transform:none}}

.modal-backdrop{position:fixed;inset:0;background:rgba(0,0,0,.48);z-index:1000;display:grid;place-items:center;padding:20px}
.modal-backdrop[hidden]{display:none}
.modal-card{width:min(760px,100%);max-height:82vh;overflow:auto;background:var(--card-bg,#fff);border-radius:22px;padding:24px;box-shadow:0 24px 80px rgba(0,0,0,.24)}
.modal-head{display:flex;justify-content:space-between;gap:18px;align-items:flex-start;border-bottom:1px solid rgba(127,127,127,.18);padding-bottom:16px;margin-bottom:12px}
.modal-head h2{margin:0 0 5px}
.modal-head p{margin:0;opacity:.65}
.saved-quote{display:grid;grid-template-columns:1fr auto;gap:16px;align-items:center;padding:16px 4px;border-bottom:1px solid rgba(127,127,127,.16)}
.saved-quote:last-child{border-bottom:0}
.saved-quote-title{font-weight:800}
.saved-quote-meta{font-size:13px;opacity:.65;margin-top:4px}
.saved-quote-actions{display:flex;gap:8px;flex-wrap:wrap}
.empty-quotes{text-align:center;padding:38px 10px;opacity:.65}
@media(max-width:650px){.saved-quote{grid-template-columns:1fr}.saved-quote-actions{justify-content:flex-start}}

.logo-upload-box{display:flex;justify-content:space-between;align-items:center;gap:18px;padding:16px;border:1px dashed rgba(127,127,127,.28);border-radius:16px;margin:14px 0 20px}
.logo-upload-box label{display:block;font-weight:700;margin-bottom:7px}
.logo-upload-box small{display:block;margin-top:6px;opacity:.62}
.logo-thumb-wrap{display:flex;align-items:center;gap:10px}
.logo-thumb-wrap img{width:82px;height:58px;object-fit:contain;border:1px solid rgba(127,127,127,.2);border-radius:10px;background:#fff}
.quote-brand-row{display:flex;align-items:center;justify-content:space-between;gap:20px}
.quote-company-logo{max-width:150px;max-height:70px;object-fit:contain}
@media(max-width:620px){.logo-upload-box{align-items:flex-start;flex-direction:column}}
@media print{
  .quote-company-logo{max-width:145px;max-height:65px}
}

.pdf-hint{display:block;width:100%;margin-top:8px;opacity:.58;font-size:12px}
@page{size:A4;margin:12mm}
@media print{
  body{background:#fff!important}
  header,.hero,.editor-panel,.pricing-section,footer,.modal-backdrop,.pdf-hint{display:none!important}
  main{display:block!important;margin:0!important;padding:0!important}
  .app-shell,.workspace,.quote-preview-wrap{display:block!important;width:100%!important;max-width:none!important;margin:0!important;padding:0!important}
  .quote-preview{display:block!important;width:100%!important;max-width:none!important;min-height:auto!important;margin:0!important;padding:14mm!important;box-shadow:none!important;border:0!important;border-radius:0!important;background:#fff!important;color:#111!important}
  .quote-preview table{width:100%!important;border-collapse:collapse!important}
  .quote-preview th{font-size:11px!important;text-transform:uppercase!important;letter-spacing:.04em!important;padding:10px 8px!important;border-bottom:2px solid #222!important}
  .quote-preview td{padding:10px 8px!important;border-bottom:1px solid #ddd!important}
  .quote-preview .grand{font-size:18px!important;font-weight:800!important}
  .quote-company-logo{max-width:150px!important;max-height:65px!important}
  *{-webkit-print-color-adjust:exact!important;print-color-adjust:exact!important}
}

/* QuoteAI V17 — authentication gate */
.auth-gate{
  min-height:100vh;
  padding:42px 20px;
  display:grid;
  place-items:center;
  background:
    radial-gradient(circle at 15% 15%,rgba(139,92,246,.14),transparent 34%),
    radial-gradient(circle at 85% 80%,rgba(91,91,214,.12),transparent 34%),
    #f7f8fc;
}
.auth-gate[hidden],#quoteaiApp[hidden]{display:none!important}
.auth-shell{
  width:min(980px,100%);
  display:grid;
  grid-template-columns:1fr 460px;
  gap:56px;
  align-items:center;
}
.auth-brand{padding:20px}
.auth-logo{
  width:58px;height:58px;border-radius:18px;display:grid;place-items:center;
  background:linear-gradient(135deg,#5b5bd6,#8b5cf6);color:#fff;
  font-weight:950;font-size:28px;box-shadow:0 18px 36px rgba(91,91,214,.22)
}
.auth-brand-name{font-size:22px;font-weight:950;margin-top:15px}
.auth-brand h1{font-size:clamp(40px,5.5vw,67px);line-height:1;letter-spacing:-.05em;margin:22px 0 16px}
.auth-brand p{font-size:18px;line-height:1.6;color:var(--muted);max-width:520px}
.auth-card{
  min-height:590px;background:#fff;border:1px solid var(--line);border-radius:28px;
  padding:18px;box-shadow:0 24px 70px rgba(25,31,52,.12)
}
.auth-tabs{display:grid;grid-template-columns:1fr 1fr;gap:6px;background:#f3f4f8;padding:5px;border-radius:14px;margin-bottom:16px}
.auth-tab{border:0;background:transparent;padding:11px 12px;border-radius:10px;font-weight:850;color:#6e788b;cursor:pointer}
.auth-tab.active{background:#fff;color:var(--text);box-shadow:0 3px 12px rgba(25,31,52,.08)}
.clerk-auth-mount{min-height:500px;display:grid;place-items:start center}
.auth-loading{padding:48px 20px;color:var(--muted);text-align:center}
.auth-error{margin:12px;padding:12px 14px;border-radius:12px;background:#fff3f3;color:#a63232;font-size:13px}
.topbar-actions{display:flex;align-items:center;gap:9px;flex-wrap:wrap;justify-content:flex-end}
.clerk-user-button{display:flex;align-items:center;margin-left:3px;min-width:32px;min-height:32px}
@media(max-width:900px){
  .auth-shell{grid-template-columns:1fr;gap:20px;max-width:520px}
  .auth-brand{text-align:center;padding:0 14px}
  .auth-logo{margin:auto}.auth-brand p{margin-left:auto;margin-right:auto}
  .auth-brand h1{font-size:43px}
}
@media(max-width:620px){
  .auth-gate{padding:18px 12px;align-items:start}
  .auth-shell{gap:12px}
  .auth-brand h1{font-size:34px;margin:14px 0 10px}
  .auth-brand p{font-size:15px;margin-top:0}
  .auth-card{min-height:560px;padding:10px;border-radius:20px}
  .topbar{align-items:flex-start;gap:12px}.topbar-actions{gap:6px}
  .topbar-actions .btn{padding:9px 10px;font-size:12px}
}
