:root{
  --bg:#ffffff;
  --card:#ffffff;
  --muted:#667085;
  --text:#101828;
  --line:#eaecf0;
  --accent:#3c3bd1;
  --accent2:#0f9d58;
  --shadow: 0 10px 28px rgba(16,24,40,.08);
  --radius:16px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  background: var(--bg);
  color:var(--text);
}

.app{max-width:1180px; margin:28px auto; padding:0 18px 26px;}
.header{
  display:flex; align-items:flex-start; justify-content:space-between;
  gap:16px; margin-bottom:18px;
}
h1{margin:0; font-size:26px; letter-spacing:.2px}
.sub{margin:6px 0 0; color:var(--muted); max-width:720px}

.pill{
  display:flex; align-items:center; gap:10px;
  padding:10px 12px;
  border:1px solid var(--line);
  border-radius:999px;
  background: #f9fafb;
}
.pill span{color:var(--muted); font-size:13px}

.grid{
  display:grid;
  grid-template-columns: 1.2fr .8fr;
  gap:18px;
}
@media (max-width: 980px){
  .grid{grid-template-columns:1fr}
}

.card{
  background: var(--card);
  border:1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding:18px;
}
.card h2{
  margin:0 0 10px;
  font-size:16px;
  letter-spacing:.2px;
}
.hint{
  margin:0 0 12px;
  color:var(--muted);
  font-size:13px;
  line-height:1.35;
}

.channels{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap:10px;
}
@media (max-width: 640px){
  .channels{grid-template-columns: repeat(2, minmax(0, 1fr));}
}

.check{
  display:flex; align-items:center; gap:10px;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--line);
  background: #f9fafb;
  cursor:pointer;
  user-select:none;
}
.check input{accent-color: var(--accent); transform: scale(1.05);}

.divider{
  height:1px; background:var(--line);
  margin:14px 0;
}

.row{
  display:flex; flex-wrap:wrap; gap:12px;
  align-items:flex-end;
  margin:10px 0;
}
.field{flex:1; min-width:180px}
.field label{display:block; font-size:13px; color:var(--muted); margin:0 0 6px}
.meta{font-size:12px; color:var(--muted)}

input[type="number"], select{
  width:100%;
  padding:10px 11px;
  border-radius:12px;
  border:1px solid var(--line);
  background: #ffffff;
  color:var(--text);
  outline:none;
}
input[type="number"]:focus, select:focus{border-color: rgba(60,59,209,.45)}

.switch{
  display:flex; align-items:center; gap:10px;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--line);
  background: #f9fafb;
  user-select:none;
  margin:0;
}
.switch input{accent-color: var(--accent2); transform:scale(1.05)}
.switch span{color: #111827; font-weight: 700; font-size: 13px}

.adsBlock{margin-top:6px}
.hidden{display:none}
.table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  overflow:hidden;
  border-radius:12px;
  border:1px solid var(--line);
}
.table th, .table td{
  padding:10px 10px;
  border-bottom:1px solid var(--line);
  font-size:13px;
}
.table th{color:var(--muted); text-align:left; background: #f9fafb}
.table tr:last-child td{border-bottom:none}
.adsTableWrap{overflow:auto}

.actions{
  display:flex; gap:10px; justify-content:flex-end; margin-top:10px; flex-wrap:wrap;
}
.btn{
  padding:10px 12px;
  border-radius:12px;
  border:1px solid rgba(60,59,209,.45);
  background: rgba(60,59,209,.08);
  color: #2f2ea8;
  cursor:pointer;
  font-weight:800;
}
.btn:hover{filter:brightness(1.03)}
.btn.secondary{
  border-color:var(--line);
  background: #ffffff;
  color:var(--muted);
}
.btn.primary{
  background: var(--accent);
  color:#fff;
  border-color: var(--accent);
}
.btn.wide{
  width:100%;
  margin-top:12px;
}

.sticky{position: sticky; top:14px; align-self:start;}
.kpis{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:10px;
}
.kpi{
  border:1px solid var(--line);
  border-radius:14px;
  padding:12px;
  background: #f9fafb;
}
.kpiLabel{color:var(--muted); font-size:12px}
.kpiValue{font-size:20px; font-weight:900; margin-top:6px}

.summary{display:flex; flex-direction:column; gap:10px}
.lineItem{
  border:1px solid var(--line);
  border-radius:14px;
  padding:12px;
  background: #ffffff;
}
.lineTop{display:flex; justify-content:space-between; gap:10px}
.lineTop strong{font-size:13px}
.lineTop span{font-size:13px; font-weight:900}
.lineSub{margin-top:6px; color:var(--muted); font-size:12px; line-height:1.3}

.totals{display:flex; flex-direction:column; gap:10px}
.totRow{display:flex; justify-content:space-between; align-items:center}
.totRow span{color:var(--muted)}
.totRow strong{font-size:15px}
.totRow.grand strong{font-size:20px}

.fineprint{
  margin:14px 0 0;
  color: rgba(102,112,133,.95);
  font-size:12px;
  line-height:1.35;
}

.footer{
  margin-top:14px;
  color: rgba(102,112,133,.85);
  font-size:12px;
  text-align:center;
}

/* Accordion */
.accordion{
  border:1px solid var(--line);
  border-radius:14px;
  overflow:hidden;
  background:#fff;
  margin: 10px 0 12px;
}
.accordionBtn{
  width:100%;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  padding:12px 14px;
  background:#f9fafb;
  border:none;
  cursor:pointer;
  font-weight:900;
  color:#111827;
}
.chev{opacity:.75}
.accordionBody{
  padding:12px 14px 14px;
  display:none;
}
.accordionBody.open{display:block}

.compare{
  display:grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap:10px;
}
@media (max-width: 860px){
  .compare{grid-template-columns: 1fr;}
}
.compareCol{
  border:1px solid var(--line);
  border-radius:14px;
  padding:12px;
  background:#fff;
}
.compareTitle{font-weight:900; margin-bottom:8px}
.compareList{
  margin:0;
  padding-left: 18px;
  color:#344054;
  font-size:12px;
  line-height:1.45;
  display:flex;
  flex-direction:column;
  gap:6px;
}
.muted{color:var(--muted)}
.fineNote{
  margin-top:10px;
  font-size:12px;
  color: var(--muted);
}

/* Listings applicability box */
.applyBox{
  border:1px solid var(--line);
  border-radius:14px;
  background:#ffffff;
  padding:12px;
  margin: 10px 0 12px;
}
.applyHead{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
  margin-bottom:10px;
}
.applyTitle{font-weight:900; font-size:13px;}
.applyHint{color:var(--muted); font-size:12px; margin-top:4px; line-height:1.35;}
.applyMeta{color:var(--muted); font-size:12px; font-weight:900;}
.channelsSmall{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap:10px;
}
@media (max-width: 640px){
  .channelsSmall{grid-template-columns: repeat(2, minmax(0, 1fr));}
}
.checkSmall{
  display:flex; align-items:center; gap:10px;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--line);
  background: #f9fafb;
  cursor:pointer;
  user-select:none;
  font-size:13px;
}
.checkSmall input{accent-color: var(--accent); transform: scale(1.05);}
.applyEmpty{
  color:var(--muted);
  font-size:12px;
  padding:10px 0 0;
  display:none;
}

/* Recurring plans */
.recurring{margin-top:18px;}
.recHead{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:14px;
  flex-wrap:wrap;
}
.recToggle{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}
.pillBtn{
  display:flex;
  align-items:center;
  gap:8px;
  padding:10px 12px;
  border-radius:999px;
  border:1px solid var(--line);
  background:#ffffff;
  color:var(--text);
  cursor:pointer;
  font-weight:800;
}
.pillBtn.active{
  border-color: rgba(60,59,209,.35);
  background: rgba(60,59,209,.08);
  color: #2f2ea8;
}
.tag{
  font-size:11px;
  padding:3px 8px;
  border-radius:999px;
  border:1px solid rgba(15,157,88,.22);
  background: rgba(15,157,88,.10);
  color: #0f9d58;
  font-weight:900;
}
.planGrid{
  margin-top:12px;
  display:grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap:12px;
}
@media (max-width: 1040px){
  .planGrid{grid-template-columns: repeat(2, minmax(0,1fr));}
}
@media (max-width: 560px){
  .planGrid{grid-template-columns: 1fr;}
}
.planCard{
  border:1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--shadow);
  padding:16px;
  display:flex;
  flex-direction:column;
  min-height: 260px;
}
.planTop{
  display:flex;
  justify-content:space-between;
  gap:10px;
  align-items:flex-start;
}
.planName{font-weight:900; font-size:14px;}
.planDesc{margin-top:6px; color:var(--muted); font-size:12px; line-height:1.35;}
.badge{
  font-size:11px;
  padding:4px 10px;
  border-radius:999px;
  border:1px solid rgba(60,59,209,.25);
  background: rgba(60,59,209,.08);
  color:#2f2ea8;
  font-weight:900;
}
.planPrice{
  margin-top:14px;
  font-size:28px;
  font-weight:900;
  letter-spacing:-.3px;
}
.planPer{color:var(--muted); font-size:12px; font-weight:800; margin-top:4px;}
.planDivider{height:1px; background:var(--line); margin:14px 0 12px;}
.planList{margin:0; padding-left:16px; color:#344054; font-size:12px; line-height:1.45; display:flex; flex-direction:column; gap:8px;}
.planNote{margin-top:auto; font-size:11px; color:var(--muted);}

/* PDF preview root */
#pdfPreviewRoot{
  position: fixed;
  left: -99999px;
  top: 0;
  width: 794px;
  background: #fff;
  color:#111827;
}
.pdfPage{
  padding: 26px;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
}
.pdfHeader{
  display:flex;
  justify-content:space-between;
  gap:16px;
  align-items:flex-start;
}
.pdfBrand{font-weight: 900; font-size: 18px;}
.pdfMeta{
  text-align:right;
  font-size: 11px;
  color:#6b7280;
  line-height:1.35;
}
.pdfTitle{
  margin-top: 10px;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.2px;
}
.pdfDeliver{
  margin-top: 10px;
  display:grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap:10px;
}
.pdfDeliver .box{
  border:1px solid #e5e7eb;
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 11px;
  color:#344054;
  line-height:1.35;
}
.pdfDeliver .box .t{font-weight:900; margin-bottom:6px; color:#111827}

.pdfGrid{
  margin-top: 14px;
  display:grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 14px;
}
.pdfCard{
  border:1px solid #e5e7eb;
  border-radius: 14px;
  padding: 14px;
}
.pdfCard h3{
  margin:0 0 10px;
  font-size: 13px;
  color:#111827;
}
.pdfRow{
  display:flex;
  justify-content:space-between;
  gap:10px;
  font-size: 12px;
  padding: 6px 0;
  border-bottom: 1px dashed #eef2f7;
}
.pdfRow:last-child{border-bottom:none}
.pdfRow .k{color:#6b7280}
.pdfRow .v{font-weight:800}

.pdfItems{display:flex; flex-direction:column; gap:10px}
.pdfItem{
  border:1px solid #eef2f7;
  border-radius: 14px;
  padding: 10px 12px;
}
.pdfItemTop{
  display:flex;
  justify-content:space-between;
  gap:10px;
  font-size: 12px;
}
.pdfItemTop .t{font-weight:900}
.pdfItemTop .a{font-weight:900}
.pdfItemSub{
  margin-top: 6px;
  color:#6b7280;
  font-size: 11px;
  line-height:1.35;
}

.pdfTotals{
  margin-top: 12px;
  border-top: 1px solid #e5e7eb;
  padding-top: 10px;
}
.pdfTotals .pdfRow .v{font-size: 13px}
.pdfTotals .grand .v{font-size: 16px}
.pdfFoot{
  margin-top: 12px;
  font-size: 10.5px;
  color:#6b7280;
  line-height:1.4;
}
/* When per-channel listings mode is enabled, hide single-qty input blocks */
.hiddenByMode { display: none !important; }

/* Make listing table inputs consistent width */
#listingQtyTableWrap .table input[type="number"]{
  width: 100%;
  min-width: 120px;
}

/* Ensure the listing table doesn't look detached */
#listingQtyTableWrap{
  margin-top: 10px;
}

