/* ============================================================
   COMPONENTS — Card, Button, Form, List, Stat, Progress, Tabs
   ============================================================ */

/* ============ CARD ============ */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
  border: 1px solid rgba(226,232,240,.6);
}
.card-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  background: var(--bg);
  padding: 4px 10px;
  border-radius: 100px;
}
.badge-green {
  font-size: 10px;
  font-weight: 700;
  background: var(--green-soft);
  color: #059669;
  padding: 4px 10px;
  border-radius: 100px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ============ STAT GRID ============ */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.stat {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(226,232,240,.6);
}
.stat-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 16px;
  margin-bottom: 8px;
}
.stat-icon.green { background: var(--green-soft); color: #059669; }
.stat-icon.red   { background: var(--red-soft);   color: #DC2626; }
.stat-icon.blue  { background: var(--blue-soft);  color: #2563EB; }
.stat-icon.purple{ background: var(--purple-soft);color: #7C3AED; }

.stat-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.stat-value {
  font-size: 16px;
  font-weight: 800;
  margin-top: 2px;
  letter-spacing: -.4px;
}
.stat-value.green { color: #059669; }
.stat-value.red   { color: #DC2626; }

/* ============ FORM ============ */
.form-group { margin-bottom: 14px; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--navy-2);
  text-transform: uppercase;
  letter-spacing: .3px;
}
.form-label .opt {
  color: var(--muted);
  font-weight: 500;
  font-size: 11px;
  text-transform: none;
  letter-spacing: 0;
}
.form-control {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: .2s;
  font-weight: 500;
}
.form-control:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(16,185,129,.12);
}
textarea.form-control { resize: vertical; min-height: 70px; }
select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748B' d='M6 8L2 4h8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 18px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 14px;
  transition: .15s;
  width: 100%;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--navy); color: #fff; }
.btn-green   { background: var(--green); color: #fff; }
.btn-red     { background: var(--red); color: #fff; }
.btn-outline {
  background: #fff;
  color: var(--text);
  border: 1.5px solid var(--border);
}
.btn-sm {
  padding: 8px 12px;
  font-size: 13px;
  width: auto;
  border-radius: 10px;
}
.btn-ghost { background: var(--bg); color: var(--muted); }
.btn-auto { width: auto; }

/* ============ LIST ITEM ============ */
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }

.list-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 16px;
  flex-shrink: 0;
}
.list-avatar.green { background: var(--green-soft); color: #059669; }
.list-avatar.red   { background: var(--red-soft);   color: #DC2626; }
.list-avatar.blue  { background: var(--blue-soft);  color: #2563EB; }

.list-body { flex: 1; min-width: 0; }
.list-title {
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 1px;
}
.list-amount {
  font-weight: 800;
  font-size: 14px;
  text-align: right;
  flex-shrink: 0;
}
.list-amount.green { color: #059669; }
.list-amount.red   { color: #DC2626; }

.list-del {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--red-soft);
  color: #DC2626;
  display: grid;
  place-items: center;
  font-size: 14px;
  flex-shrink: 0;
  transition: .15s;
}
.list-del:active { transform: scale(.9); }

.list-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 14px;
  font-size: 12px;
  color: var(--muted);
}
.list-footer b { color: var(--navy); font-weight: 800; }

/* ============ PROGRESS ============ */
.progress-item { margin-bottom: 14px; }
.progress-head {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 6px;
}
.progress-head b { font-weight: 700; }
.progress-head span { color: var(--muted); font-weight: 600; font-size: 12px; }
.progress-bar {
  height: 8px;
  background: var(--bg);
  border-radius: 100px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 100px;
  transition: width .4s;
}
.progress-fill.green  { background: linear-gradient(90deg, #34D399, #10B981); }
.progress-fill.orange { background: linear-gradient(90deg, #FBBF24, #F59E0B); }
.progress-fill.red    { background: linear-gradient(90deg, #F87171, #EF4444); }

/* ============ TABS ============ */
.tabs {
  display: flex;
  background: var(--bg);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 14px;
}
.tab {
  flex: 1;
  text-align: center;
  padding: 9px;
  border-radius: 9px;
  font-weight: 600;
  font-size: 13px;
  color: var(--muted);
  transition: .2s;
}
.tab.active {
  background: #fff;
  color: var(--navy);
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

/* ============ SECTION HEAD ============ */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.section-head h3 { font-size: 15px; font-weight: 800; }

/* ============ CHIP ============ */
.chip {
  padding: 6px 12px;
  border-radius: 100px;
  background: var(--bg);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  transition: .15s;
}
.chip.active { background: var(--navy); color: #fff; }

/* ============ WARN BOX ============ */
.warn-box {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  border-radius: 14px;
  padding: 14px;
}
.warn-box .ico {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #FEF3C7;
  color: #D97706;
  display: grid;
  place-items: center;
  font-size: 16px;
  flex-shrink: 0;
}
.warn-box .txt {
  flex: 1;
  font-size: 12px;
  color: #92400E;
  font-weight: 600;
}
.warn-box .txt b { font-weight: 800; }
.warn-box .txt p {
  font-size: 11px;
  color: #B45309;
  margin-top: 2px;
  font-weight: 500;
}
.warn-box button {
  padding: 8px 14px;
  border-radius: 10px;
  background: #F59E0B;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ============ DONUT ============ */
.donut-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
}
.donut {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  flex-shrink: 0;
  background: conic-gradient(var(--green) 0% 62%, var(--red) 62% 100%);
  display: grid;
  place-items: center;
}
.donut::before {
  content: '';
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #fff;
}
.legend {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}
.legend-item span { flex: 1; font-weight: 600; }
.legend-item b { font-weight: 700; }

/* ============ INPUT PREFIX ============ */
.input-prefix { position: relative; }
.input-prefix .prefix {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 700;
  color: var(--muted);
  font-size: 13px;
  pointer-events: none;
}
.input-prefix .form-control { padding-left: 76px; font-weight: 800; }

/* ============ DESKTOP ENHANCEMENT ============ */
@media (min-width: 900px) {
  .card {
    padding: 22px;
    border-radius: 18px;
    margin-bottom: 20px;
  }
  .card-title {
    font-size: 15px;
    margin-bottom: 16px;
  }
  .list-item:hover {
    background: #F8FAFC;
    border-radius: 10px;
    padding-left: 8px;
    padding-right: 8px;
  }
  .btn:hover { filter: brightness(1.05); }
}