:root {
  --bg: #f7f7f8;
  --card: #ffffff;
  --ink: #17142b;
  --muted: #6d6987;
  --line: #e6e6ea;
  --chilli: #ff4d2e;
  --chilli-2: #ff8a3d;
  --violet: #4f46e5;
  --c1: #6c4cf5; /* New Upwork */
  --c2: #0ea5a0; /* Old Upwork */
  --c3: #ff8a3d; /* Direct */
  --c4: #e8336d; /* Indian */
  --good: #12a150;
  --bad: #d92d20;
  --radius: 14px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.45; }
a { color: var(--violet); text-decoration: none; }
button, input, select { font: inherit; color: inherit; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 16px; padding: 14px 28px;
  background: #fff; border-bottom: 1px solid var(--line);
  color: var(--ink); position: sticky; top: 0; z-index: 20;
}
.brand { font-weight: 800; font-size: 19px; letter-spacing: -.2px; display: flex; align-items: center; gap: 10px; }
.brand .dot { width: 30px; height: 30px; border-radius: 9px; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 16px; }
.topbar .spacer { flex: 1; }
.topbar nav { display: flex; gap: 6px; }
.topbar nav a, .topbar .ghost {
  color: var(--muted); padding: 7px 14px; border-radius: 8px; font-weight: 600; font-size: 14px;
  background: transparent; border: 0; cursor: pointer;
}
.topbar nav a.active, .topbar nav a:hover, .topbar .ghost:hover { background: #f1f0f5; color: var(--ink); }
.who { font-size: 13px; color: var(--muted); }

/* ---------- layout ---------- */
.wrap { padding: 22px 28px 60px; }
.grid { display: grid; grid-template-columns: minmax(290px, 1fr) minmax(230px, .7fr) minmax(560px, 2.1fr); gap: 20px; align-items: start; }
@media (max-width: 1250px) { .grid { grid-template-columns: 1fr 1fr; } .grid .results { grid-column: 1 / -1; } }
@media (max-width: 760px) { .grid { grid-template-columns: 1fr; } .wrap { padding: 16px; } .topbar { padding: 12px 16px; } }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: 0 1px 2px rgba(23,20,43,.04); }
.card h2 { margin: 0 0 4px; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.card h2 .tag { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.card .sub { color: var(--muted); font-size: 13px; margin: 0 0 14px; }

/* ---------- calculator rows ---------- */
.row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.row:last-child { border-bottom: 0; }
.row label { flex: 1; font-size: 14px; }
.row.on label { font-weight: 600; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.stepper button { width: 30px; height: 32px; border: 0; background: #f4f4f6; cursor: pointer; font-size: 16px; font-weight: 700; color: var(--violet); }
.stepper button:hover { background: #e9e9ee; }
.stepper input { width: 64px; height: 32px; border: 0; text-align: center; font-weight: 700; outline: none; }
.row.on .stepper { border-color: var(--ink); }
input.num { width: 84px; height: 34px; border: 1px solid var(--line); border-radius: 10px; padding: 0 10px; text-align: right; font-weight: 600; }
input.num:focus, .field input:focus, .field select:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px rgba(108,76,245,.15); }
.group-title { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 700; margin: 14px 0 2px; }
.group-title:first-child { margin-top: 0; }
.auto { color: var(--muted); font-size: 13px; }

.chips { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.chip { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px; min-width: 130px; }
.chip b { display: block; font-size: 22px; letter-spacing: -.4px; }
.chip span { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }

/* ---------- results ---------- */
.channels { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.channel { border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: #fff; }
.channel .head { padding: 11px 14px; color: var(--ink); background: #f7f7f8 !important; border-bottom: 1px solid var(--line); font-weight: 700; display: flex; justify-content: space-between; align-items: center; gap: 6px; flex-wrap: wrap; }
.channel .tier { padding: 11px 14px; border-top: 1px solid var(--line); }
.channel .tier:first-of-type { border-top: 0; }
.tier .t-name { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 700; }
.tier .price { font-size: 22px; font-weight: 800; letter-spacing: -.5px; }
.tier .inr { font-size: 13px; font-weight: 700; color: var(--ink); }
.meta { font-size: 12.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 2px; }
.pct { font-weight: 700; padding: 1px 7px; border-radius: 999px; font-size: 12px; }
.pct.good { background: #e3f6ea; color: var(--good); }
.pct.mid { background: #fff3e0; color: #c26a00; }
.pct.bad { background: #fde8e7; color: var(--bad); }
.custom { padding: 11px 14px; background: #fafafa; border-top: 1px solid var(--line); }
.custom input { width: 100%; height: 34px; border: 1px solid var(--line); border-radius: 9px; padding: 0 10px; font-weight: 600; background: #fff; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty b { display: block; font-size: 18px; color: var(--ink); margin-bottom: 4px; }
.fx { font-size: 12px; color: var(--muted); margin-top: 12px; }

/* ---------- buttons & fields ---------- */
.btn { border: 0; border-radius: 10px; padding: 10px 18px; font-weight: 700; cursor: pointer; background: var(--violet); color: #fff; }
.btn:hover { filter: brightness(1.07); }
.btn.alt { background: #efedf8; color: var(--ink); }
.btn.danger { background: #fde8e7; color: var(--bad); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.field input, .field select { height: 42px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; background: #fff; }
.hint { font-size: 12.5px; color: var(--muted); }
.err { color: var(--bad); font-size: 13.5px; min-height: 20px; }

/* ---------- auth pages ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: var(--bg); }
.auth .card { width: 100%; max-width: 400px; padding: 30px; }
.auth h1 { margin: 0 0 4px; font-size: 24px; letter-spacing: -.4px; }
.auth .logo { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; font-size: 22px; margin-bottom: 14px;
  background: var(--ink); color: #fff; }
.auth .btn { width: 100%; height: 44px; margin-top: 4px; }

/* ---------- admin ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.tabs button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 16px; font-weight: 700; font-size: 14px; cursor: pointer; color: var(--muted); }
.tabs button.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.panel { display: none; }
.panel.active { display: block; }
table.edit { width: 100%; border-collapse: collapse; }
table.edit th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding: 8px; border-bottom: 2px solid var(--line); }
table.edit td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.edit input[type=text], table.edit input[type=number], table.edit select { height: 36px; border: 1px solid var(--line); border-radius: 9px; padding: 0 10px; width: 100%; background: #fff; }
table.edit input[type=number] { max-width: 110px; text-align: right; font-weight: 600; }
table.edit td.w-num { width: 130px; }
table.edit td.w-act { width: 90px; text-align: right; }
.savebar { position: sticky; bottom: 0; margin-top: 20px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; display: flex; gap: 10px; align-items: center; box-shadow: 0 -6px 24px rgba(23,20,43,.06); }
.savebar .status { flex: 1; font-size: 14px; color: var(--muted); }
.savebar .status.dirty { color: #c26a00; font-weight: 700; }
.savebar .status.ok { color: var(--good); font-weight: 700; }
.toggle { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.toggle input { width: 20px; height: 20px; accent-color: var(--violet); }
.toggle div b { display: block; }
.toggle div span { font-size: 13px; color: var(--muted); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .two { grid-template-columns: 1fr; } }
.kv { display: grid; align-content: start; grid-template-columns: 1fr auto; gap: 8px 16px; font-size: 14px; }
.kv div:nth-child(even) { text-align: right; font-weight: 700; }
.kv .total { border-top: 2px solid var(--line); padding-top: 6px; }
.formula { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; background: #f4f4f6; padding: 2px 6px; border-radius: 6px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 10px; font-weight: 600; opacity: 0; transition: .25s; pointer-events: none; z-index: 50; }
.toast.show { opacity: 1; }
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; gap: 8px; }
  .topbar .spacer, .who { display: none; }
  .brand { font-size: 16px; }
}

/* simple look: small coloured dot instead of coloured headers */
.channel .head::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--dot, var(--violet)); margin-right: 8px; display: inline-block; }
.channel .head { justify-content: flex-start; }
.channel .head span { margin-left: auto; color: var(--muted); }
.pct.good, .pct.mid, .pct.bad { background: transparent; padding: 0; }
.card h2 .tag { display: none; }

/* ---------- v3: cleaner layout ---------- */
.wrap.narrow { max-width: 1180px; margin: 0 auto; }
.wrap.mid { max-width: 1360px; margin: 0 auto; }
.layout { display: grid; grid-template-columns: 360px 1fr; gap: 20px; align-items: start; }
.layout .stick { position: sticky; top: 78px; }
@media (max-width: 960px) { .layout { grid-template-columns: 1fr; } .layout .stick { position: static; } }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.card-head h2 { margin: 0; }
.card-head .note { font-size: 13px; color: var(--muted); }
.linkbtn { background: none; border: 0; padding: 0; color: var(--muted); font-size: 13px; cursor: pointer; text-decoration: underline; }
.row { padding: 5px 0; border-bottom: 1px solid #f0f0f2; }
.row label { font-size: 14px; }
.row.on label { font-weight: 600; }
.stepper button { width: 28px; height: 30px; font-size: 15px; color: var(--ink); }
.stepper input { height: 30px; }
.group-title { font-size: 11px; margin: 12px 0 0; }
.ptable { width: 100%; border-collapse: collapse; }
.ptable th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 700; padding: 0 12px 10px; border-bottom: 1px solid var(--line); }
.ptable td { padding: 14px 12px; border-bottom: 1px solid #f0f0f2; vertical-align: top; }
.ptable tr:last-child td { border-bottom: 0; }
.ptable .ch { font-weight: 600; white-space: nowrap; }
.ptable .ch i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; }
.ptable .p { font-size: 18px; font-weight: 700; letter-spacing: -.3px; white-space: nowrap; }
.ptable .s { font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; }
.ptable .s .up { color: var(--good); font-weight: 600; }
.ptable .s .lo { color: #c26a00; font-weight: 600; }
.ptable input.cust { width: 110px; height: 32px; border: 1px solid var(--line); border-radius: 8px; padding: 0 8px; font-weight: 600; }
.ptable input.cust:focus { outline: none; border-color: var(--ink); }
.summary { font-size: 13px; color: var(--muted); }
.summary b { color: var(--ink); }
.scroll-x { overflow-x: auto; }
.layout > * { min-width: 0; }
.ptable .s { white-space: normal; line-height: 1.35; }
.ptable td, .ptable th { padding-left: 10px; padding-right: 10px; }
.ptable .p { font-size: 17px; }
.ptable input.cust { width: 96px; }
.onecalc { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 14px; padding: 14px 12px; border-top: 1px solid var(--line); background: #fafafa; border-radius: 0 0 10px 10px; }
.onecalc .onelabel { font-weight: 700; min-width: 180px; }
.onecalc input.cust { width: 130px; height: 36px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; font-weight: 600; background: #fff; }
.onecalc input.cust:focus { outline: none; border-color: var(--ink); }
.onecalc .oneres { font-size: 13px; color: var(--muted); }
.onecalc .oneres .up { color: var(--good); font-weight: 700; }
.onecalc .oneres .lo { color: #c26a00; font-weight: 700; }
.onecalc .oneres b { color: var(--ink); }
.subtotal { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); padding: 7px 0 2px; }
.subtotal:empty { display: none; }
.subtotal b { color: var(--ink); }
.totals { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.totals:empty { display: none; }
.totals div { display: flex; justify-content: space-between; padding: 4px 0; font-size: 14px; }
.totals b { font-size: 15px; }

/* ---------- v4: tiles + summary ---------- */
body { background: #f6f7f9; -webkit-font-smoothing: antialiased; }
.card { border-radius: 16px; padding: 22px; border-color: #ebecef; box-shadow: 0 1px 3px rgba(16,24,40,.04); }
.card-head h2 { font-size: 17px; letter-spacing: -.2px; }
.wrap.home { max-width: 1180px; margin: 0 auto; padding-top: 28px; }
.hero { margin-bottom: 20px; }
.hero h1 { margin: 0; font-size: 30px; font-weight: 800; letter-spacing: -.8px; }
.hero p { margin: 6px 0 0; color: var(--muted); font-size: 15px; }
.tsec { margin-top: 18px; }
.tsec:first-child { margin-top: 4px; }
.tsec-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.tsec-head > span:first-child { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.tsec-sum { font-size: 13px; color: var(--muted); }
.tsec-sum b { color: var(--ink); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 10px; }
.tile { border: 1px solid #ebecef; border-radius: 12px; padding: 10px 12px 12px; background: #fbfbfc; transition: border-color .15s, background .15s; }
.tile.on { background: #fff; border-color: #c7c9d3; box-shadow: 0 1px 2px rgba(16,24,40,.05); }
.tile-name { font-size: 13.5px; font-weight: 600; margin-bottom: 8px; }
.tile .stepper { width: 100%; display: flex; border-radius: 9px; }
.tile .stepper input { flex: 1; width: auto; min-width: 0; background: transparent; }
.tile.on .stepper { border-color: #c7c9d3; }
.auto-tile { background: transparent; border-style: dashed; }
.tile-auto { height: 32px; display: flex; align-items: center; font-weight: 600; color: var(--muted); font-size: 14px; }
.totals { margin-top: 22px; padding-top: 18px; border-top: 1px solid #ebecef; display: grid; grid-template-columns: repeat(4, 1fr) 1.3fr 1.3fr; gap: 10px; }
.totals .stat { display: flex; flex-direction: column; gap: 2px; padding: 0; font-size: 13px; }
.totals .stat span { color: var(--muted); font-size: 12.5px; }
.totals .stat b { font-size: 16px; font-weight: 700; }
.totals .stat.big { background: #f4f5f7; border-radius: 12px; padding: 10px 14px; }
.totals .stat.big b { font-size: 20px; letter-spacing: -.3px; }
@media (max-width: 900px) { .totals { grid-template-columns: repeat(2, 1fr); } }
.ptable th { padding-bottom: 12px; }
.ptable td { padding: 16px 10px; }
.ptable .p { font-size: 19px; }
.ptable tbody tr:hover td { background: #fafbfc; }
.onecalc { border-radius: 12px; margin-top: 16px; border: 1px solid #ebecef; background: #fbfbfc; }
.topbar { padding: 14px 32px; }
.stepper button { background: transparent; }
.stepper button:hover { background: #f1f2f4; }
/* calculator page: tiles inside the narrower left column */
.layout .tiles { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.layout .totals { grid-template-columns: 1fr 1fr; }
.totals { align-items: center; } .totals .stat:not(.big) { padding-left: 2px; }

/* ---------- v5: balanced colour ---------- */
.topbar { border-bottom: 0; box-shadow: 0 1px 0 #ebecef; }
.topbar::after { content: ''; position: absolute; left: 0; right: 0; bottom: -3px; height: 3px; background: linear-gradient(90deg, #ff4d2e, #ff8a3d 35%, #7c3aed); }
.brand .dot { background: linear-gradient(135deg, #ff4d2e, #7c3aed); }
.hero-band { background: linear-gradient(120deg, #fff1eb 0%, #fdf2f8 45%, #f1edff 100%); border: 1px solid #f3e8ef; border-radius: 18px; padding: 22px 26px; margin-bottom: 20px; }
.hero-band h1 { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -.7px; }
.hero-band p { margin: 6px 0 0; color: #5f5b73; }
.hicon { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; font-size: 14px; margin-right: 10px; vertical-align: -6px; font-weight: 800; }
.tsec { --sc: #7c3aed; --st: #f5f3ff; }
.tsec[data-c=teal] { --sc: #0d9488; --st: #ecfdf9; }
.tsec[data-c=orange] { --sc: #ea580c; --st: #fff4ec; }
.tsec-head > span:first-child { color: var(--sc); display: inline-flex; align-items: center; gap: 7px; }
.tsec-head > span:first-child::before { content: ''; width: 8px; height: 8px; border-radius: 3px; background: var(--sc); }
.tsec .tile.on { background: var(--st); border-color: var(--sc); box-shadow: none; }
.tsec .tile.on .stepper { border-color: var(--sc); background: #fff; }
.tsec .tile.on .tile-name { color: var(--sc); }
.tsec .stepper button { color: var(--sc); }
.auto-tile .tile-auto { color: var(--sc); }
.layout .tiles { grid-template-columns: repeat(2, 1fr); }
.totals { grid-template-columns: 1fr 1fr !important; gap: 10px; }
.totals .stat { border-radius: 12px; padding: 10px 14px !important; }
.totals .stat.violet { background: #f5f3ff; } .totals .stat.violet b { color: #5b21b6; }
.totals .stat.teal { background: #ecfdf9; } .totals .stat.teal b { color: #0f766e; }
.totals .stat.orange { background: #fff4ec; } .totals .stat.orange b { color: #c2410c; }
.totals .stat.pink { background: #fdf2f8; } .totals .stat.pink b { color: #be185d; }
.totals .stat.big { background: #eef2ff; } .totals .stat.big b { color: #3730a3; font-size: 20px; }
.totals .stat.dark { background: linear-gradient(135deg, #1e1b4b, #4c1d95); }
.totals .stat.dark span { color: #c7d2fe; } .totals .stat.dark b { color: #fff; }
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border-radius: 999px; font-weight: 700; font-size: 13.5px;
  color: var(--pc); background: color-mix(in srgb, var(--pc) 12%, white); }
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--pc); }
.ptable th.tier-better, .ptable td.tier-better { background: #faf8ff; }
.ptable th.tier-better { color: #6d28d9; }
.ptable thead th { border-bottom: 2px solid #ebecef; }
.onecalc { background: linear-gradient(120deg, #fff7ed, #fdf2f8); border-color: #fde3cf; }
.onecalc .onelabel { color: #c2410c; }
.empty b { background: linear-gradient(90deg, #ff4d2e, #7c3aed); -webkit-background-clip: text; background-clip: text; color: transparent; }
.layout .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tile { min-width: 0; }
.tile .stepper input { width: 0; }
.tiles .auto-tile .tile-auto { white-space: nowrap; }
.layout.two-col { grid-template-columns: 430px minmax(0, 1fr); }
@media (max-width: 1100px) { .layout.two-col { grid-template-columns: minmax(0, 1fr); } .layout .stick { position: static; } }
.totals.top { margin: 0 0 16px; padding: 0; border-top: 0; grid-template-columns: repeat(4, minmax(0,1fr)) repeat(2, minmax(0,1.25fr)) !important; }
.totals.top .stat { box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.totals.top .stat span { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.totals.top .stat b { font-size: 17px; }
.totals.top .stat.big b { font-size: 19px; }
@media (max-width: 1300px) { .totals.top { grid-template-columns: repeat(4, minmax(0,1fr)) !important; } .totals.top .stat.big { grid-column: span 2; } }
@media (max-width: 600px) { .totals.top { grid-template-columns: repeat(2, minmax(0,1fr)) !important; } .totals.top .stat.big { grid-column: span 1; } }
.ptable .cust-na { color: #c4c6cf; }
.ptable .cust-td .s { margin-top: 4px; }
.ptable .p .gst { font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
