/* HMIPL Pricing & Discount dashboard — design system */
:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f9fafc;
  --ink: #16203a;
  --muted: #64748b;
  --line: #e6eaf2;
  --brand: #2257d6;
  --brand-dark: #18306f;
  --brand-soft: #eaf0ff;
  --pos: #08875a;
  --pos-soft: #e3f6ee;
  --neg: #d62b3a;
  --neg-soft: #fdeaec;
  --warn: #b06a00;
  --warn-soft: #fdf2e0;
  --shadow: 0 1px 2px rgba(16,32,58,.06), 0 4px 16px rgba(16,32,58,.06);
  --radius: 14px;
  --sidebar: 252px;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font-size: 14px;
  -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }

/* ---------- splash ---------- */
#splash { position: fixed; inset: 0; display: grid; place-items: center;
  background: var(--bg); z-index: 50; transition: opacity .3s; }
#splash .spin { width: 40px; height: 40px; border: 3px solid var(--line);
  border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.muted-note { color: var(--muted); margin-top: 14px; font-size: 13px; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar { background: linear-gradient(180deg, #16306e, #0f2350);
  color: #cdd8f3; padding: 22px 16px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 20px; }
.brand .logo { width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, #4f7bf0, #8aa8ff); display: grid;
  place-items: center; font-weight: 800; color: #0f2350; font-size: 17px; }
.brand .t1 { font-weight: 700; color: #fff; font-size: 15px; line-height: 1.1; }
.brand .t2 { font-size: 11.5px; color: #8ba0d6; letter-spacing: .3px; }
.nav { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .8px;
  color: #6d83bb; padding: 14px 12px 6px; }
.nav button { display: flex; align-items: center; gap: 11px; width: 100%;
  background: transparent; border: 0; color: #c2cef0; padding: 10px 12px;
  border-radius: 10px; cursor: pointer; font-size: 13.5px; text-align: left;
  font-weight: 500; transition: background .15s, color .15s; }
.nav button .ic { font-size: 16px; width: 20px; text-align: center; }
.nav button:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav button.active { background: #fff; color: var(--brand-dark); font-weight: 600;
  box-shadow: var(--shadow); }
.sidebar .foot { position: absolute; bottom: 18px; left: 16px; right: 16px;
  font-size: 11.5px; color: #6d83bb; line-height: 1.5; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 18px 30px; border-bottom: 1px solid var(--line);
  background: var(--surface); position: sticky; top: 0; z-index: 20; }
.topbar h1 { font-size: 19px; margin: 0; }
.topbar .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.content { padding: 26px 30px 60px; max-width: 1180px; width: 100%; }

/* ---------- segmented channel toggle ---------- */
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 7px 15px; border-radius: 7px;
  font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--brand); color: #fff; box-shadow: var(--shadow); }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad { padding: 22px 24px; }
.grid { display: grid; gap: 18px; }
.row { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-end; }

/* ---------- form controls ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 180px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.field .hint { font-size: 11.5px; color: var(--muted); font-weight: 400; }
.control, .combo input, select.control { width: 100%; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; font-size: 14px;
  background: var(--surface); color: var(--ink); outline: none; font-family: inherit; }
.control:focus, .combo input:focus { border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 7px 14px; font-size: 13px; font-weight: 600; color: var(--muted);
  cursor: pointer; }
.chip.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }

/* ---------- combobox ---------- */
.combo { position: relative; }
.combo .pop { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 30px rgba(16,32,58,.16); max-height: 320px; overflow: auto; padding: 6px; }
.combo .opt { padding: 9px 11px; border-radius: 8px; cursor: pointer; font-size: 13.5px;
  display: flex; justify-content: space-between; gap: 10px; }
.combo .opt small { color: var(--muted); }
.combo .opt:hover, .combo .opt.hl { background: var(--brand-soft); }
.combo .empty { padding: 12px; color: var(--muted); font-size: 13px; }

/* ---------- stat tiles ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow); }
.stat .k { font-size: 12.5px; color: var(--muted); font-weight: 600;
  display: flex; align-items: center; gap: 6px; }
.stat .v { font-size: 26px; font-weight: 750; margin-top: 8px; letter-spacing: -.5px; }
.stat .s { font-size: 12px; color: var(--muted); margin-top: 4px; }
.stat.big .v { font-size: 30px; }
.stat.accent { background: linear-gradient(135deg, #1f4fd0, #2f6bf0); border: 0; color: #fff; }
.stat.accent .k, .stat.accent .s { color: #d6e2ff; }

/* ---------- tables ---------- */
.table-wrap { overflow: auto; border-radius: var(--radius); border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; background: var(--surface); font-size: 13.5px; }
thead th { text-align: left; padding: 12px 16px; background: var(--surface-2);
  color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase;
  letter-spacing: .4px; position: sticky; top: 0; border-bottom: 1px solid var(--line); }
tbody td { padding: 12px 16px; border-bottom: 1px solid var(--line); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.is-base { background: var(--brand-soft); }
tr.is-base:hover { background: #dfe9ff; }
.mono { font-variant-numeric: tabular-nums; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px;
  border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.badge.pos { background: var(--pos-soft); color: var(--pos); }
.badge.neg { background: var(--neg-soft); color: var(--neg); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.muted { background: #eef1f6; color: var(--muted); }
.badge.brand { background: var(--brand-soft); color: var(--brand-dark); }
.delta.pos { color: var(--pos); font-weight: 700; }
.delta.neg { color: var(--neg); font-weight: 700; }

/* ---------- alert banner ---------- */
.alert { display: flex; align-items: center; gap: 12px; padding: 14px 18px;
  border-radius: 12px; font-size: 13.5px; font-weight: 500; }
.alert .ic { font-size: 18px; }
.alert.pos { background: var(--pos-soft); color: #06603f; }
.alert.neg { background: var(--neg-soft); color: #a31621; }
.alert.info { background: var(--brand-soft); color: var(--brand-dark); }

/* ---------- section headers ---------- */
.sec-h { display: flex; align-items: center; justify-content: space-between; margin: 4px 2px 12px; }
.sec-h h2 { font-size: 16px; margin: 0; }
.sec-h .desc { color: var(--muted); font-size: 13px; margin-top: 3px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); padding: 9px 15px; border-radius: 10px;
  font-size: 13px; font-weight: 600; cursor: pointer; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }

/* ---------- charts ---------- */
.chart { width: 100%; }
.chart text { font-family: inherit; }
.bar-row text.city { fill: var(--ink); font-size: 12.5px; font-weight: 600; }
.bar-row text.val { fill: var(--muted); font-size: 12px; }
.legend { display: flex; gap: 18px; flex-wrap: wrap; color: var(--muted); font-size: 12.5px; }
.legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block;
  margin-right: 6px; vertical-align: -1px; }

/* ---------- helpers ---------- */
.flex { display: flex; }
.between { justify-content: space-between; }
.center { align-items: center; }
.gap8 { gap: 8px; } .gap12 { gap: 12px; } .gap16 { gap: 16px; }
.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state .em { font-size: 40px; margin-bottom: 10px; }
.skeleton { background: linear-gradient(90deg, #eef1f6 25%, #f6f8fb 50%, #eef1f6 75%);
  background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; height: 14px; }
@keyframes sk { to { background-position: -200% 0; } }
.help { color: var(--muted); cursor: help; border-bottom: 1px dotted var(--muted); }

/* ---------- upload dropzone ---------- */
.dropzone { display: block; text-align: center; padding: 30px 20px; border: 2px dashed var(--line);
  border-radius: var(--radius); cursor: pointer; background: var(--surface-2); transition: border-color .15s, background .15s; }
.dropzone:hover { border-color: var(--brand); background: var(--brand-soft); }
.dropzone.has { border-style: solid; border-color: var(--brand); background: var(--brand-soft); }
.dropzone .dz-ic { font-size: 30px; }
.dropzone .dz-main { font-weight: 700; margin-top: 8px; font-size: 15px; color: var(--ink); }
.dropzone .dz-sub { color: var(--muted); font-size: 12.5px; margin-top: 4px; }

/* ---------- about / help docs ---------- */
.about { max-width: 880px; }
.about .lead { font-size: 15.5px; line-height: 1.65; color: var(--ink); }
.about h2 { font-size: 18px; margin: 0 0 4px; }
.about h3 { font-size: 14.5px; margin: 16px 0 4px; color: var(--ink); }
.about p { color: #3a4658; line-height: 1.65; font-size: 13.8px; margin: 6px 0; }
.about ul { margin: 6px 0; padding-left: 20px; }
.about li { color: #3a4658; line-height: 1.6; font-size: 13.8px; margin: 4px 0; }
.about .step { display: flex; gap: 14px; align-items: flex-start; padding: 10px 0; }
.about .step .n { flex: 0 0 30px; height: 30px; border-radius: 50%; background: var(--brand);
  color: #fff; font-weight: 700; display: grid; place-items: center; font-size: 14px; }
.about .viewrow { display: flex; gap: 14px; align-items: flex-start; padding: 14px 0; border-bottom: 1px solid var(--line); }
.about .viewrow:last-child { border-bottom: 0; }
.about .viewrow .em { font-size: 26px; flex: 0 0 34px; text-align: center; }
.about .viewrow .t { font-weight: 700; font-size: 14px; }
.formula { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 16px; font-size: 14px; line-height: 1.7; color: var(--ink); }
.formula b { color: var(--brand-dark); }
.toc { display: flex; flex-wrap: wrap; gap: 8px; }
.toc a { font-size: 12.5px; font-weight: 600; padding: 6px 12px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--brand-dark); }
.toc a:hover { background: var(--brand-soft); border-color: var(--brand); }
.faq-q { font-weight: 700; color: var(--ink); margin-top: 14px; font-size: 14px; }
.faq-a { color: #3a4658; line-height: 1.6; font-size: 13.8px; margin-top: 3px; }

/* ---------- login wall ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(1200px 600px at 50% -10%, #20408f, #0f2350); }
.login-card { width: 100%; max-width: 380px; background: var(--surface);
  border-radius: 18px; box-shadow: 0 20px 60px rgba(8,18,45,.35); padding: 30px 28px; }
.login-card .lbrand { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.login-card .lbrand .logo { width: 44px; height: 44px; border-radius: 12px;
  background: linear-gradient(135deg, #2f6bf0, #8aa8ff); display: grid; place-items: center;
  font-weight: 800; color: #0f2350; font-size: 20px; }
.login-card h1 { font-size: 18px; margin: 14px 0 2px; }
.login-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.login-card .field { margin-bottom: 14px; }
.login-card .btn.primary { width: 100%; justify-content: center; padding: 11px; font-size: 14px; }
.login-foot { text-align: center; color: #9fb0d6; font-size: 12px; margin-top: 18px; }
.signout { background: transparent; border: 0; color: #8ba0d6; cursor: pointer;
  font-size: 12px; padding: 0; text-decoration: underline; }
.signout:hover { color: #fff; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .content { padding: 18px; }
}
