@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Mono:wght@400;500&display=swap');

:root {
  --bg: #0a0d14;
  --surface: #111520;
  --surface2: #161b2b;
  --border: rgba(255,255,255,0.07);
  --accent: #4f8ef7;
  --accent2: #f75f8e;
  --gold: #f5c842;
  --green: #3df5b0;
  --text: #e8eaf2;
  --muted: #5a6180;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Syne', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed; inset: 0;
  background-image:
    linear-gradient(rgba(79,142,247,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79,142,247,0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none; z-index: 0;
}

body::after {
  content: '';
  position: fixed; top: -200px; left: 50%; transform: translateX(-50%);
  width: 800px; height: 600px;
  background: radial-gradient(ellipse, rgba(79,142,247,0.12) 0%, transparent 70%);
  pointer-events: none; z-index: 0;
}

.wrapper {
  position: relative; z-index: 1;
  max-width: 980px; margin: 0 auto;
  padding: 36px 18px 80px;
}

/* ===== HEADER ===== */
.header { text-align: center; margin-bottom: 40px; }

.badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(79,142,247,0.12);
  border: 1px solid rgba(79,142,247,0.3);
  border-radius: 100px; padding: 6px 16px;
  font-size: 11px; font-weight: 600; letter-spacing: 2px;
  text-transform: uppercase; color: var(--accent); margin-bottom: 18px;
}

.badge .dot {
  width: 6px; height: 6px;
  background: var(--accent); border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .5; transform: scale(.7); }
}

h1 {
  font-size: clamp(26px, 5vw, 44px);
  font-weight: 800; letter-spacing: -1px;
  line-height: 1.1; margin-bottom: 10px;
}

h1 .blue { color: var(--accent); }
h1 .pink { color: var(--accent2); }
.subtitle { color: var(--muted); font-size: 14px; }

/* ===== TABS ===== */
.tabs {
  display: flex; gap: 6px; margin-bottom: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px; padding: 5px;
}

.tab-btn {
  flex: 1; padding: 12px 16px;
  background: transparent; border: none; border-radius: 12px;
  cursor: pointer; font-family: 'Syne', sans-serif;
  font-size: 13px; font-weight: 700; color: var(--muted);
  display: flex; align-items: center; justify-content: center; gap: 7px;
  transition: all .2s;
}

.tab-btn.active { background: var(--surface2); box-shadow: 0 2px 12px rgba(0,0,0,.3); }
.tab-btn.active.t-calc { color: var(--accent); }
.tab-btn.active.t-profit { color: var(--green); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== RATE CARD ===== */
.rate-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; padding: 22px 26px; margin-bottom: 24px;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  position: relative; overflow: hidden;
}

.rate-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}

.rate-label { flex: 1; min-width: 160px; }
.rate-label h3 { font-size: 15px; font-weight: 700; margin-bottom: 3px; }
.rate-label p { font-size: 12px; color: var(--muted); font-family: 'DM Mono', monospace; }

.rate-input-wrap {
  display: flex; align-items: center;
  background: var(--surface2);
  border: 1px solid rgba(79,142,247,0.3); border-radius: 12px;
  overflow: hidden; transition: border-color .2s, box-shadow .2s;
}

.rate-input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79,142,247,0.15);
}

.rate-prefix {
  padding: 11px 12px; font-family: 'DM Mono', monospace;
  font-size: 17px; font-weight: 500; color: var(--accent);
  background: rgba(79,142,247,0.08);
  border-right: 1px solid rgba(79,142,247,0.2);
}

.rate-input-wrap input {
  background: transparent; border: none; outline: none;
  color: var(--text); font-family: 'DM Mono', monospace;
  font-size: 20px; font-weight: 500;
  padding: 11px 14px; width: 120px; text-align: center;
}

.rate-suffix {
  padding: 11px 12px; font-size: 12px; color: var(--muted);
  font-family: 'DM Mono', monospace;
  border-left: 1px solid rgba(255,255,255,0.06);
}

.live-tag {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 13px;
  background: rgba(61,245,176,0.07);
  border: 1px solid rgba(61,245,176,0.2); border-radius: 10px;
  font-family: 'DM Mono', monospace; font-size: 12px; color: var(--green);
}

/* ===== ORDER TABLE ===== */
.table-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; overflow: hidden;
}

.table-header-row {
  display: grid; grid-template-columns: 1fr 110px 120px 130px;
  padding: 14px 22px; gap: 10px;
  background: rgba(79,142,247,0.06); border-bottom: 1px solid var(--border);
  font-size: 10px; font-weight: 700; letter-spacing: 2px;
  text-transform: uppercase; color: var(--muted);
}

.cc { text-align: center; }
.cr { text-align: right; }

.voucher-row {
  display: grid; grid-template-columns: 1fr 110px 120px 130px;
  padding: 0 22px; gap: 10px; border-bottom: 1px solid var(--border);
  align-items: center; transition: background .15s;
  animation: fadeIn .4s ease both;
}

.voucher-row:last-child { border-bottom: none; }
.voucher-row:hover { background: rgba(255,255,255,0.02); }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.voucher-name { padding: 14px 0; display: flex; align-items: center; gap: 10px; }

.v-icon {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, rgba(79,142,247,.15), rgba(247,95,142,.15));
  border: 1px solid rgba(79,142,247,.2);
  display: flex; align-items: center; justify-content: center; font-size: 14px;
}

.v-title { font-size: 13px; font-weight: 700; }
.v-bdt { font-size: 10px; color: var(--muted); font-family: 'DM Mono', monospace; margin-top: 2px; }

.unit-p {
  text-align: center; font-family: 'DM Mono', monospace;
  font-size: 13px; font-weight: 500; color: var(--accent2); padding: 14px 0;
}

.qty-cell { text-align: center; padding: 11px 0; }

.qty-wrap {
  display: inline-flex; align-items: center;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden;
}

.qty-btn {
  width: 28px; height: 32px; background: transparent; border: none;
  color: var(--muted); font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}

.qty-btn:hover { background: rgba(79,142,247,.12); color: var(--accent); }

.qty-input {
  width: 40px; background: transparent; border: none; outline: none;
  color: var(--text); font-family: 'DM Mono', monospace;
  font-size: 13px; font-weight: 500; text-align: center; padding: 4px 0;
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button { -webkit-appearance: none; }

.total-cell {
  text-align: right; font-family: 'DM Mono', monospace;
  font-size: 13px; font-weight: 500; color: var(--text); padding: 14px 0;
  transition: color .3s;
}

.total-cell.on { color: var(--gold); }

/* ===== SUMMARY ===== */
.summary {
  margin-top: 22px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 20px; overflow: hidden;
}

.summary-inner { padding: 22px 26px; display: flex; flex-direction: column; gap: 12px; }

.s-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 14px; color: var(--muted);
}

.s-row.total {
  padding-top: 14px; margin-top: 4px;
  border-top: 1px solid var(--border);
  font-size: 16px; color: var(--text); font-weight: 700;
}

.s-val { font-family: 'DM Mono', monospace; font-size: 15px; font-weight: 500; }
.s-val.sub { color: var(--accent); }
.s-val.grand {
  font-size: 24px; font-weight: 700; color: var(--accent2);
  text-shadow: 0 0 20px rgba(247,95,142,.4);
}

.fn { font-size: 10px; color: var(--muted); font-family: 'DM Mono', monospace; }

.reset-btn {
  display: block; width: 100%; padding: 12px;
  background: rgba(247,95,142,.08); border: 1px solid rgba(247,95,142,.25);
  border-radius: 0 0 20px 20px; color: var(--accent2);
  font-family: 'Syne', sans-serif; font-size: 12px; font-weight: 700;
  letter-spacing: 1.5px; text-transform: uppercase; cursor: pointer;
  transition: background .2s;
}

.reset-btn:hover { background: rgba(247,95,142,.15); }

.chips-row { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(79,142,247,.08); border: 1px solid rgba(79,142,247,.2);
  border-radius: 100px; padding: 3px 9px 3px 6px;
  font-size: 11px; font-family: 'DM Mono', monospace; color: var(--accent);
}

.chip-q {
  background: var(--accent); color: #000; font-weight: 700;
  border-radius: 50%; width: 15px; height: 15px;
  display: flex; align-items: center; justify-content: center; font-size: 9px;
}

/* ===== PROFIT TAB ===== */
.profit-wrap { display: flex; flex-direction: column; gap: 20px; }

.profit-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; padding: 26px;
  position: relative; overflow: hidden;
}

.profit-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--green), var(--gold));
}

.pc-title {
  font-size: 11px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase;
  color: var(--green); margin-bottom: 18px;
  display: flex; align-items: center; gap: 8px;
}

/* Mode bar */
.mode-bar {
  display: flex; gap: 6px; background: var(--surface2);
  border: 1px solid var(--border); border-radius: 12px; padding: 5px; margin-bottom: 20px;
}

.mode-btn {
  flex: 1; padding: 10px 12px; background: transparent; border: none; border-radius: 9px;
  font-family: 'Syne', sans-serif; font-size: 13px; font-weight: 700; color: var(--muted);
  cursor: pointer; transition: all .2s;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}

.mode-btn.active { background: var(--surface); box-shadow: 0 2px 8px rgba(0,0,0,.3); }
.mode-btn.active.ms { color: var(--green); }
.mode-btn.active.mp { color: var(--gold); }

/* Input groups */
.p-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 20px; }

.ig { display: flex; flex-direction: column; gap: 7px; }
.ig label {
  font-size: 10px; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--muted);
}

.ib {
  display: flex; align-items: center; background: var(--surface2);
  border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
  transition: border-color .2s, box-shadow .2s;
}

.ib:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px rgba(61,245,176,.1); }
.ib.buy:focus-within { border-color: var(--accent2); box-shadow: 0 0 0 3px rgba(247,95,142,.1); }
.ib.pct:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(245,200,66,.1); }

.ib .px {
  padding: 12px 12px; font-family: 'DM Mono', monospace;
  font-size: 16px; font-weight: 500;
  background: rgba(61,245,176,.06);
  border-right: 1px solid rgba(61,245,176,.15); color: var(--green);
}

.ib.buy .px { background: rgba(247,95,142,.06); border-color: rgba(247,95,142,.15); color: var(--accent2); }
.ib.pct .px { background: rgba(245,200,66,.06); border-color: rgba(245,200,66,.15); color: var(--gold); }

.ib input {
  background: transparent; border: none; outline: none;
  color: var(--text); font-family: 'DM Mono', monospace;
  font-size: 18px; font-weight: 500;
  padding: 12px 14px; flex: 1; min-width: 0;
}

.ib .sx {
  padding: 12px 12px; font-size: 11px; color: var(--muted);
  font-family: 'DM Mono', monospace;
  border-left: 1px solid rgba(255,255,255,.06);
}

/* Result cards */
.res-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }

.rc {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 14px; padding: 16px; text-align: center;
  transition: border-color .3s, box-shadow .3s;
}

.rc.rg { border-color: rgba(61,245,176,.3); box-shadow: 0 0 18px rgba(61,245,176,.07); }
.rc.rp { border-color: rgba(247,95,142,.3); box-shadow: 0 0 18px rgba(247,95,142,.07); }
.rc.ry { border-color: rgba(245,200,66,.3); box-shadow: 0 0 18px rgba(245,200,66,.07); }

.rc-label {
  font-size: 9px; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--muted); margin-bottom: 8px;
}

.rc-val { font-family: 'DM Mono', monospace; font-size: 18px; font-weight: 700; }
.rc-val.g { color: var(--green); }
.rc-val.p { color: var(--accent2); }
.rc-val.y { color: var(--gold); }
.rc-sub { font-size: 10px; color: var(--muted); font-family: 'DM Mono', monospace; margin-top: 4px; }

/* Per-voucher table */
.pv-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; overflow: hidden;
}

.sec-head {
  font-size: 11px; font-weight: 700; letter-spacing: 2px;
  text-transform: uppercase; color: var(--muted);
  margin-bottom: 12px; display: flex; align-items: center; gap: 10px;
}

.sec-head::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.pv-thead {
  display: grid; grid-template-columns: 1fr 90px 90px 100px 90px;
  padding: 13px 22px; gap: 8px;
  background: rgba(61,245,176,.04); border-bottom: 1px solid var(--border);
  font-size: 10px; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--muted);
}

.pv-row {
  display: grid; grid-template-columns: 1fr 90px 90px 100px 90px;
  padding: 13px 22px; gap: 8px; border-bottom: 1px solid var(--border);
  align-items: center; animation: fadeIn .4s ease both;
}

.pv-row:last-child { border-bottom: none; }
.pv-row:hover { background: rgba(255,255,255,.02); }

.pv-n { font-size: 12px; font-weight: 700; }
.pv-b { font-size: 10px; color: var(--muted); font-family: 'DM Mono', monospace; margin-top: 2px; }

.pv-v { font-family: 'DM Mono', monospace; font-size: 12px; font-weight: 500; text-align: right; }
.pv-v.buy { color: var(--accent2); }
.pv-v.sell { color: var(--green); }

.pbadge {
  display: inline-block; padding: 3px 8px; border-radius: 100px;
  font-size: 11px; font-weight: 700; font-family: 'DM Mono', monospace;
}

.pbadge.pos { background: rgba(61,245,176,.12); color: var(--green); }
.pbadge.neg { background: rgba(247,95,142,.12); color: var(--accent2); }

/* ===== MOBILE ===== */
@media (max-width: 600px) {
  .table-header-row, .voucher-row {
    grid-template-columns: 1fr 75px 80px 80px;
    padding: 0 12px; gap: 6px;
  }
  .table-header-row { padding: 12px 12px; }
  .p-inputs { grid-template-columns: 1fr; }
  .res-grid { grid-template-columns: 1fr 1fr; }
  .pv-thead, .pv-row { grid-template-columns: 1fr 75px 75px 80px; }
  .pv-thead .hide, .pv-row .hide { display: none; }
  .rate-card { padding: 18px; gap: 12px; }
  .rate-input-wrap input { width: 90px; font-size: 17px; }
  .summary-inner { padding: 18px; }
  .s-val.grand { font-size: 20px; }
  .v-icon { display: none; }
  .tab-btn { font-size: 12px; padding: 10px 8px; }
  .mode-btn { font-size: 11px; padding: 9px 8px; }
}
