.wrapper {
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px 24px 60px;
}

/* Top Navbar */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40px;
  flex-wrap: wrap;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand-orange), var(--brand-amber));
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #050811;
  font-size: 1.2rem;
}

.brand-text h1 {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.brand-text span {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 99px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--brand-emerald);
  font-size: 0.8rem;
  font-weight: 600;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background: var(--brand-emerald);
  border-radius: 50%;
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Bento Grid Utama */
.bento-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 24px;
}

@media (max-width: 860px) {
  .bento-grid {
    grid-template-columns: 1fr;
  }
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.card-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
}

/* Input & Interactive Range Sliders */
.input-block {
  margin-bottom: 22px;
}

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.label-row label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.value-badge {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--brand-cyan);
  background: rgba(56, 189, 248, 0.1);
  padding: 4px 10px;
  border-radius: 6px;
}

input[type="text"], input[type="number"] {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: border-color 0.2s;
}

input[type="text"]:focus, input[type="number"]:focus {
  outline: none;
  border-color: var(--brand-orange);
}

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  outline: none;
  margin-top: 10px;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--brand-orange);
  cursor: pointer;
  border: 3px solid #fff;
  box-shadow: 0 0 10px rgba(243, 128, 32, 0.6);
  transition: transform 0.15s;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* Tombol Utama */
.btn-submit {
  width: 100%;
  padding: 15px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand-orange), #ea580c);
  color: white;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(243, 128, 32, 0.3);
  transition: transform 0.15s, box-shadow 0.2s;
}

.btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 25px rgba(243, 128, 32, 0.45);
}

.btn-submit:active {
  transform: translateY(0);
}

/* Panel Hasil & Donut Chart */
.hero-metric {
  text-align: center;
  padding: 20px;
  background: var(--bg-input);
  border-radius: 16px;
  border: 1px solid var(--border-glass);
  margin-bottom: 24px;
}

.hero-metric span {
  font-size: 0.82rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.hero-metric h3 {
  font-size: 2.1rem;
  font-weight: 800;
  margin-top: 6px;
  background: linear-gradient(90deg, #ffffff, var(--brand-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.chart-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 24px;
}

.legend-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
  margin-top: 18px;
}

.legend-item {
  background: var(--bg-input);
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border-glass);
}

.legend-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.legend-val {
  font-size: 0.95rem;
  font-weight: 700;
}

/* Riwayat Database D1 */
.history-card {
  margin-top: 24px;
}

.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.history-tile {
  background: var(--bg-input);
  border: 1px solid var(--border-glass);
  padding: 16px;
  border-radius: 12px;
  transition: border-color 0.2s;
}

.history-tile:hover {
  border-color: var(--brand-cyan);
}

.history-tile h4 {
  font-size: 0.95rem;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.history-tile p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.history-tile .tag-cicilan {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--brand-emerald);
  background: rgba(16, 185, 129, 0.12);
  padding: 4px 10px;
  border-radius: 6px;
}
