/* ── DARK MODE (default) ── */
:root {
  --bg: #0b0e14;
  --surface: #131720;
  --card: #1a2030;
  --card2: #1f2638;
  --border: rgba(255,255,255,0.07);
  --border2: rgba(255,255,255,0.12);
  --text1: #e8eaf0;
  --text2: #8892a4;
  --text3: #55617a;
  --green: #2dca72;
  --green-dim: rgba(45,202,114,0.12);
  --green-glow: rgba(45,202,114,0.2);
  --red: #f05252;
  --red-dim: rgba(240,82,82,0.12);
  --blue: #4b9eff;
  --blue-dim: rgba(75,158,255,0.1);
  --amber: #f5a623;
  --amber-dim: rgba(245,166,35,0.12);
  --radius: 10px;
  --radius-lg: 16px;
  --panel-w: 440px;
  --header-blur-bg: rgba(11,14,20,0.92);
  --shadow-sm: 0 2px 12px rgba(0,0,0,0.35);
  font-size: 15px;
}

/* ── LIGHT MODE ── */
body.light {
  --bg: #f0f2f7;
  --surface: #ffffff;
  --card: #ffffff;
  --card2: #f5f7fc;
  --border: rgba(0,0,0,0.08);
  --border2: rgba(0,0,0,0.14);
  --text1: #111827;
  --text2: #4b5563;
  --text3: #9ca3af;
  --green: #16a34a;
  --green-dim: rgba(22,163,74,0.1);
  --green-glow: rgba(22,163,74,0.2);
  --red: #dc2626;
  --red-dim: rgba(220,38,38,0.1);
  --blue: #2563eb;
  --blue-dim: rgba(37,99,235,0.08);
  --amber: #d97706;
  --amber-dim: rgba(217,119,6,0.1);
  --header-blur-bg: rgba(240,242,247,0.92);
  --shadow-sm: 0 2px 12px rgba(0,0,0,0.1);
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text1);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
}

/* ── HEADER ── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-blur-bg);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.brand-icon {
  width: 32px;
  height: 32px;
  background: var(--green-dim);
  border: 1px solid var(--green-glow);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.brand-name {
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text1);
}
.brand-name span { color: var(--text2); font-weight: 400; margin-left: 6px; font-size: 0.8rem; }
.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-ghost {
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--border2);
}
.btn-ghost:hover { background: var(--card); color: var(--text1); }
.btn-primary {
  background: var(--green);
  color: #0b0e14;
  font-weight: 600;
}
.btn-primary:hover { filter: brightness(1.1); }
.btn-danger {
  background: transparent;
  color: var(--red);
  border: 1px solid rgba(240,82,82,0.3);
}
.btn-danger:hover { background: var(--red-dim); }
.btn-info {
  background: transparent;
  color: var(--blue);
  border: 1px solid rgba(75,158,255,0.3);
}
.btn-info:hover { background: var(--blue-dim); }
.btn svg { width: 14px; height: 14px; }

/* Hide long text on very small screens, show short emoji labels */
@media (max-width: 480px) {
  .btn-text { display: none; }
  .btn-label-short { display: inline !important; }
  .btn { padding: 7px 8px; gap: 3px; font-size: 0.72rem; }
}
@media (min-width: 481px) {
  .btn-label-short { display: none !important; }
}

/* ── MAIN ── */
.main { max-width: 1100px; margin: 0 auto; padding: 28px 16px 48px; }

/* ── SUMMARY BAR ── */
.summary-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 28px;
}
.summary-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.summary-card .label {
  font-size: 0.68rem;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 2px;
}
.summary-card .value {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text1);
  font-family: 'DM Mono', monospace;
  word-break: break-all;
}
.summary-card .value.green { color: var(--green); }

/* ── SECTION TITLE ── */
.section-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text3);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── SCENARIO CARDS ── */
.scenarios-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 32px;
}
@media (max-width: 700px) { .scenarios-grid { grid-template-columns: 1fr; } }

.scenario-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.2s;
}
.scenario-card:hover { border-color: var(--border2); }
.scenario-card.best { border-color: rgba(45,202,114,0.25); }
.scenario-card.worst { border-color: rgba(240,82,82,0.2); }

.scenario-header {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.scenario-tag {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.tag-ramai { background: var(--green-dim); color: var(--green); }
.tag-sedang { background: var(--blue-dim); color: var(--blue); }
.tag-sepi { background: var(--red-dim); color: var(--red); }

.scenario-target {
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  color: var(--text2);
  white-space: nowrap;
}

.scenario-body { padding: 14px 16px; }
.scenario-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 0.8rem;
  gap: 8px;
}
.scenario-row .row-label { color: var(--text2); }
.scenario-row .row-val {
  font-family: 'DM Mono', monospace;
  font-size: 0.78rem;
  color: var(--text1);
  text-align: right;
}

.scenario-divider { height: 1px; background: var(--border); margin: 8px 0; }

.laba-bersih {
  margin-top: 8px;
  background: var(--card2);
  border-radius: 8px;
  padding: 10px 12px;
}
.laba-bersih .lb-label {
  font-size: 0.7rem;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 2px;
}
.laba-bersih .lb-val {
  font-family: 'DM Mono', monospace;
  font-size: 1.2rem;
  font-weight: 700;
}
.lb-val.profit { color: var(--green); }
.lb-val.loss { color: var(--red); }
.lb-bep { font-size: 0.72rem; color: var(--text3); margin-top: 3px; }

/* ── COMPARISON TABLE ── */
.comparison-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 32px;
  overflow-x: auto;
}
.comparison-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 360px;
  font-size: 0.82rem;
}
.comparison-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text3);
  background: var(--card2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.comparison-table th:not(:first-child) { text-align: right; }
.comparison-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text2);
}
.comparison-table td:not(:first-child) {
  text-align: right;
  font-family: 'DM Mono', monospace;
  font-size: 0.78rem;
  color: var(--text1);
  white-space: nowrap;
}
.comparison-table tr:last-child td { border-bottom: none; }
.comparison-table .highlight-row td { background: var(--card2); font-weight: 600; }
.comparison-table .profit-cell { color: var(--green) !important; }
.comparison-table .loss-cell { color: var(--red) !important; }

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
}
.empty-icon { font-size: 3rem; margin-bottom: 16px; }
.empty-title { font-size: 1.2rem; font-weight: 600; margin-bottom: 8px; }
.empty-desc { color: var(--text2); font-size: 0.9rem; margin-bottom: 24px; }
.empty-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ── SLIDE PANEL ── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.overlay.open { opacity: 1; pointer-events: all; }

.panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(var(--panel-w), 100vw);
  background: var(--surface);
  border-left: 1px solid var(--border2);
  z-index: 201;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0, 0.14, 1);
  display: flex;
  flex-direction: column;
}
.panel.open { transform: translateX(0); }

.panel-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.panel-title { font-size: 0.95rem; font-weight: 600; }
.panel-close {
  width: 30px; height: 30px;
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: 8px;
  color: var(--text2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.15s;
}
.panel-close:hover { background: var(--card); color: var(--text1); }

/* Panel tabs - FIXED: nowrap + scroll horizontal, font lebih kecil di mobile */
.panel-tabs {
  display: flex;
  padding: 10px 14px 0;
  gap: 2px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.panel-tabs::-webkit-scrollbar { display: none; }

.ptab {
  padding: 6px 10px;
  border-radius: 8px 8px 0 0;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text2);
  cursor: pointer;
  border: none;
  background: transparent;
  font-family: inherit;
  white-space: nowrap;
  flex-shrink: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.15s;
}
.ptab.active { color: var(--green); border-bottom-color: var(--green); background: var(--green-dim); }
.ptab:hover:not(.active) { color: var(--text1); background: var(--card); }

/* Tab indicator arrows for scroll hint */
.panel-tabs-wrap {
  position: relative;
  flex-shrink: 0;
}
.tabs-scroll-hint {
  position: absolute;
  right: 0; top: 0; bottom: 1px;
  width: 28px;
  background: linear-gradient(to right, transparent, var(--surface));
  pointer-events: none;
  display: none;
}
.tabs-scroll-hint.visible { display: block; }

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
}

/* Form elements */
.form-section { display: none; }
.form-section.active { display: block; }

.form-hint {
  font-size: 0.75rem;
  color: var(--text3);
  margin-bottom: 14px;
  line-height: 1.5;
  padding: 10px 12px;
  background: var(--card);
  border-radius: 8px;
  border-left: 3px solid var(--green-glow);
}

.form-group { margin-bottom: 14px; }
.form-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text2);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.form-input {
  width: 100%;
  padding: 9px 12px;
  background: var(--card);
  border: 1px solid var(--border2);
  border-radius: 8px;
  color: var(--text1);
  font-family: inherit;
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.15s;
}
.form-input:focus { border-color: var(--green); }
.form-select {
  width: 100%;
  padding: 9px 12px;
  background: var(--card);
  border: 1px solid var(--border2);
  border-radius: 8px;
  color: var(--text1);
  font-family: inherit;
  font-size: 0.88rem;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2355617a' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
.form-select:focus { border-color: var(--green); outline: none; }

/* Item list */
.item-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.item-row {
  display: flex;
  gap: 6px;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  animation: slideIn 0.15s ease;
}
@keyframes slideIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.item-name {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text1);
  font-family: inherit;
  font-size: 0.82rem;
  outline: none;
  min-width: 0;
}
.item-name::placeholder { color: var(--text3); }
.item-sep { color: var(--border2); font-size: 0.7rem; flex-shrink: 0; }
.item-amount {
  width: 90px;
  background: transparent;
  border: none;
  color: var(--green);
  font-family: 'DM Mono', monospace;
  font-size: 0.82rem;
  text-align: right;
  outline: none;
}
.item-amount::placeholder { color: var(--text3); }
.item-del {
  width: 24px; height: 24px;
  background: transparent;
  border: none;
  color: var(--text3);
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
  font-size: 14px;
}
.item-del:hover { background: var(--red-dim); color: var(--red); }
.item-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  background: var(--card2);
  border-radius: 8px;
  font-size: 0.8rem;
  margin-bottom: 10px;
}
.item-total .tl { color: var(--text2); }
.item-total .tv { font-family: 'DM Mono', monospace; color: var(--green); font-weight: 600; }
.btn-add {
  width: 100%;
  padding: 8px;
  background: transparent;
  border: 1px dashed var(--border2);
  border-radius: 8px;
  color: var(--text2);
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn-add:hover { border-color: var(--green); color: var(--green); background: var(--green-dim); }

/* Target inputs */
.target-grid { display: grid; grid-template-columns: 1fr; gap: 10px; margin-bottom: 8px; }
.target-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}
.target-badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  letter-spacing: 0.04em;
  width: 56px;
  text-align: center;
  flex-shrink: 0;
}
.target-label { font-size: 0.8rem; color: var(--text2); flex: 1; }
.target-input {
  width: 65px;
  background: transparent;
  border: none;
  color: var(--text1);
  font-family: 'DM Mono', monospace;
  font-size: 0.88rem;
  font-weight: 600;
  text-align: right;
  outline: none;
}
.target-unit { font-size: 0.72rem; color: var(--text3); }

/* Panel footer */
.panel-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.panel-nav {
  display: flex;
  gap: 8px;
}
.panel-nav .btn { flex: 1; justify-content: center; }

/* ── TUTORIAL MODAL ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  transform: translateY(16px);
  transition: transform 0.3s cubic-bezier(0.32,0,0.14,1);
}
.modal-overlay.open .modal { transform: translateY(0); }

.modal-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.modal-title {
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal-close {
  width: 30px; height: 30px;
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: 8px;
  color: var(--text2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.15s;
}
.modal-close:hover { background: var(--card); color: var(--text1); }

.modal-body {
  overflow-y: auto;
  padding: 20px;
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
}

/* Tutorial step list */
.tut-steps { list-style: none; display: flex; flex-direction: column; gap: 16px; }
.tut-step {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.tut-num {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--green-dim);
  border: 1px solid var(--green-glow);
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.tut-content { flex: 1; }
.tut-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text1);
  margin-bottom: 4px;
}
.tut-desc {
  font-size: 0.8rem;
  color: var(--text2);
  line-height: 1.6;
}
.tut-desc strong { color: var(--text1); }
.tut-desc .tag-inline {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 600;
  margin: 0 2px;
  vertical-align: middle;
}
.tut-tip {
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--amber-dim);
  border-radius: 8px;
  border-left: 3px solid var(--amber);
  font-size: 0.77rem;
  color: var(--text2);
  line-height: 1.6;
}
.tut-tip strong { color: var(--amber); }
.tut-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}
.tut-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text3);
  margin-bottom: 12px;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.tut-section-label::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.modal-footer-note {
  font-size: 0.72rem;
  color: var(--text3);
}
.dont-show-again {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 0.75rem;
  color: var(--text3);
  user-select: none;
}
.dont-show-again input[type=checkbox] {
  accent-color: var(--green);
  width: 14px;
  height: 14px;
  cursor: pointer;
}

/* ── FOOTER ── */
.footer {
  text-align: center;
  padding: 24px 16px 16px;
  margin-top: 32px;
}
.footer-inner {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 24px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 40px;
  backdrop-filter: blur(8px);
}
.footer-icon {
  font-size: 1rem;
  animation: footer-bob 3s ease-in-out infinite;
}
.footer-text {
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  background: linear-gradient(90deg, var(--green), var(--blue), var(--amber));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-size: 200% auto;
  animation: shimmer 4s linear infinite;
}
@keyframes footer-bob {
  0%, 100% { transform: translateY(0) rotate(-5deg); }
  50% { transform: translateY(-2px) rotate(5deg); }
}
@keyframes shimmer {
  0% { background-position: 0% center; }
  100% { background-position: 200% center; }
}

/* ── TRAKTEER ── */
.kopi-float {
  position: fixed;
  bottom: 22px;
  right: 22px;
  width: 40px;
  height: 40px;
  background: rgba(190,30,45,0.85);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  text-decoration: none;
  cursor: pointer;
  animation: kopi-float 4s ease-in-out infinite;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 1px solid rgba(255,255,255,0.1);
}
.kopi-float:hover {
  transform: scale(1.15);
  animation: none;
  background: rgba(190,30,45,1);
}
.kopi-float:hover .kopi-ring { animation: none; opacity: 0; }
.kopi-float img {
  width: 20px; height: 20px;
  object-fit: contain;
  display: block;
  pointer-events: none;
  animation: kopi-wobble 5s ease-in-out infinite;
  transform-origin: center bottom;
}
.kopi-float:hover img { animation: none; }
.kopi-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(190,30,45,0.4);
  animation: kopi-ripple 2.8s ease-out infinite;
}
.kopi-r2 { animation-delay: 1.4s; }
@keyframes kopi-ripple {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(2.2); opacity: 0; }
}
@keyframes kopi-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}
@keyframes kopi-wobble {
  0%, 60% { transform: rotate(0deg); }
  63% { transform: rotate(-16deg); }
  66% { transform: rotate(14deg); }
  69% { transform: rotate(-10deg); }
  72% { transform: rotate(8deg); }
  75%, 100% { transform: rotate(0deg); }
}
@media (max-width: 720px) {
  .kopi-float { bottom: 18px; right: 18px; width: 36px; height: 36px; }
  .kopi-float img { width: 18px; height: 18px; }
}

/* ── UTILITIES ── */
.hidden { display: none !important; }
.mono { font-family: 'DM Mono', monospace; }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-muted { color: var(--text2); }

* { scrollbar-width: thin; scrollbar-color: var(--border2) transparent; }
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 99px; }

/* ── TOOLTIP INFO SYSTEM ── */
.info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(75,158,255,0.15);
  border: 1px solid rgba(75,158,255,0.3);
  color: var(--blue);
  font-size: 9px;
  font-weight: 700;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  margin-left: 5px;
  flex-shrink: 0;
  line-height: 1;
  vertical-align: middle;
  transition: background 0.15s, border-color 0.15s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.info-btn:hover, .info-btn.active {
  background: rgba(75,158,255,0.3);
  border-color: rgba(75,158,255,0.6);
}

/* Tooltip popup */
.info-popup {
  position: fixed;
  z-index: 9999;
  background: var(--card2);
  border: 1px solid rgba(75,158,255,0.35);
  border-radius: 10px;
  padding: 12px 14px;
  max-width: 260px;
  width: max-content;
  box-shadow: var(--shadow-sm), 0 0 0 1px rgba(75,158,255,0.1);
  pointer-events: auto;
  animation: popIn 0.15s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes popIn {
  from { opacity:0; transform: scale(0.88) translateY(4px); }
  to   { opacity:1; transform: scale(1) translateY(0); }
}
.info-popup-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.info-popup-body {
  font-size: 0.8rem;
  color: var(--text1);
  line-height: 1.5;
}
.info-popup-body .tip-formula {
  display: block;
  margin-top: 7px;
  padding: 6px 8px;
  background: var(--border);
  border-left: 2px solid var(--blue);
  border-radius: 4px;
  font-size: 0.73rem;
  color: var(--text2);
  font-family: 'DM Mono', monospace;
}
.info-popup-body .tip-example {
  display: block;
  margin-top: 6px;
  font-size: 0.73rem;
  color: var(--green);
}
.info-popup-close {
  position: absolute;
  top: 7px; right: 9px;
  font-size: 11px;
  color: var(--text3);
  cursor: pointer;
  line-height: 1;
}
.info-popup-close:hover { color: var(--text1); }

/* Make row-label flex so ⓘ sits inline */
.scenario-row .row-label,
.comparison-table td:first-child {
  display: inline-flex;
  align-items: center;
  gap: 0;
}
.lb-bep-wrap {
  display: flex;
  align-items: center;
  gap: 0;
}

/* ── THEME TRANSITION ── */
body, .header, .panel, .modal, .summary-card, .scenario-card,
.comparison-wrap, .form-input, .form-select, .info-popup {
  transition: background 0.25s ease, border-color 0.25s ease, color 0.2s ease;
}

/* ── THEME TOGGLE BUTTON ── */
.btn-theme {
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--text2);
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  flex-shrink: 0;
  transition: all 0.15s;
  line-height: 1;
}
.btn-theme:hover { background: var(--card); color: var(--text1); }

/* ── MOBILE: keep short label on action buttons ── */
/* Override the full hide at 480px — show short label instead */
@media (max-width: 480px) {
  .btn-text { display: none; }
  .btn-label-short { display: inline !important; font-size: 0.68rem; }
  .btn { padding: 7px 8px; gap: 4px; }
}
@media (min-width: 481px) {
  .btn-label-short { display: none; }
}

/* light mode: form inputs need visible bg */
body.light .form-input,
body.light .form-select,
body.light .item-amount,
body.light .item-name,
body.light .target-input {
  color: var(--text1);
}
body.light .form-input,
body.light .form-select {
  background: var(--card2);
  border-color: var(--border2);
}
body.light .item-row {
  border-color: var(--border);
}
body.light .btn-primary {
  color: #fff;
}
body.light .comparison-table td,
body.light .comparison-table th {
  border-color: var(--border);
}
