/* base styles kept intact (from user) */
:root {
  --bg: #fffaf6;
  --card: #ffffff;
  --text: #2b2b2b;
  --accent: #6b4226;
  --accent-2: #8b5e3c;
  --muted: #666;
  --danger: #c1121f;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans";
  background: var(--bg);
  color: var(--text);
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  padding: 12px;
}
.wrap {
  max-width: 520px;
  margin: 0 auto;
}
h1 {
  font-size: clamp(20px, 5vw, 28px);
  text-align: center;
  color: var(--accent);
  margin: 10px 0 14px;
}
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
  padding: 14px;
  margin-bottom: 16px;
}
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.input-group {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 12px;
  padding: 10px;
}
.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 14px;
  color: var(--muted);
}
.label-row .price { font-weight: 700; color: #333; }
input[type="number"] {
  width: 100%;
  font-size: 16px;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 10px;
  outline: none;
}
input[type="number"]:focus { border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(139,94,60,0.12); }

.btn {
  width: 100%;
  margin-top: 10px;
  padding: 12px 14px;
  font-size: 17px;
  border: 0;
  border-radius: 12px;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
}
.btn:active { transform: translateY(1px); }
.btn:hover { background: var(--accent-2); }

.totals { text-align: center; margin-top: 14px; }
.total { font-weight: 800; font-size: 20px; margin-bottom: 6px; color: #1f2937; }
.remain { color: var(--danger); font-weight: 600; margin-bottom: 8px; }

.section-title {
  margin: 14px 0 8px;
  font-weight: 700;
  color: #374151;
  font-size: 15px;
}
.breakdown-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.bd-item {
  padding: 10px;
  border: 1px solid #eee;
  border-radius: 10px;
  background: #fff;
  font-size: 14px;
}
.bd-item .line { font-weight: 600; }
.bd-item .sub { color: var(--muted); font-size: 13px; }

.footer-note { color: #6b7280; font-size: 12px; text-align: center; margin-top: 12px; }

/* History styles */
.history-container {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid #ddd;
  border-radius: var(--radius);
  background: #fff;
  padding: 10px;
}
.history-item {
  border-bottom: 1px dashed #d4c4b4;
  padding: 10px 0;
  margin-bottom: 6px;
  font-size: 14px;
  background: #fffaf6;
  border-radius: 10px;
}
.history-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
}
.history-total { font-weight: 700; }
.clear-history {
  margin-top: 8px;
  padding: 8px;
  font-size: 14px;
  border: 0;
  border-radius: 10px;
  background: var(--danger);
  color: #fff;
  cursor: pointer;
  width: 100%;
}

/* Modal (upgrade) */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.modal {
  background: #fff;
  border-radius: 12px;
  padding: 18px;
  max-width: 420px;
  width: calc(100% - 40px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.2);
  text-align: center;
  transform: translateY(10px);
  opacity: 0;
  transition: all 200ms ease;
}
.modal.show { transform: translateY(0); opacity: 1; }
.modal h2 { margin: 0 0 8px; color: var(--accent); }
.modal p { color: #444; margin: 8px 0 14px; }
.modal .modal-btn {
  background: var(--accent);
  color: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  border: 0;
  cursor: pointer;
}

/* Upgrade page styles */
.upgrade-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
.compare-table { width:100%; border-collapse: collapse; }
.compare-table th, .compare-table td { text-align:left; padding:8px; border-bottom:1px solid #eee; }
.banner-ad { text-align:center; padding:10px; border:1px dashed #eee; margin:12px 0; }
