/* ========================================
   Dashboard — Hero
   ======================================== */
.hero-row {
  align-items: end;
  display: flex;
  gap: 32px;
  justify-content: space-between;
  margin-bottom: 40px;
}

.eyebrow {
  color: var(--gold-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.2em;
  margin: 0 0 10px;
  text-transform: uppercase;
}

h1, h2, h3 {
  font-family: "Cormorant Garamond", serif;
  line-height: 1;
  margin: 0;
}

h1 {
  font-size: clamp(36px, 4vw, 54px);
  font-weight: 700;
}

h1 em {
  font-style: italic;
  font-weight: 600;
}

h2 {
  font-size: 26px;
  font-weight: 700;
}

h2 i {
  font-style: italic;
  font-weight: 600;
}

.muted {
  color: var(--muted);
  line-height: 1.55;
  margin: 10px 0 0;
  max-width: 520px;
}

.hero-actions {
  align-items: center;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

/* ========================================
   Dashboard — Usage / Stats
   ======================================== */
.usage-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 28px;
  padding: 24px 28px;
  transition: box-shadow var(--transition);
}
.usage-panel:hover {
  box-shadow: var(--shadow-lg);
}

.usage-title {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 14px;
}
.usage-title strong {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-secondary);
}
.usage-title span {
  color: var(--green);
  font-weight: 800;
  font-size: 14px;
}

.usage-track {
  background: #e8e0d6;
  border-radius: 99px;
  height: 10px;
  overflow: hidden;
  position: relative;
}

.usage-track span {
  background: linear-gradient(90deg, var(--gold-light), var(--gold));
  border-radius: inherit;
  display: block;
  height: 100%;
  min-width: 3%;
  transition: width 600ms var(--ease-out);
  position: relative;
}
.usage-track span::after {
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3));
  border-radius: inherit;
  content: "";
  inset: 0;
  position: absolute;
  width: 50%;
}

/* ========================================
   Dashboard — Stats Cards
   ======================================== */
.stats-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  margin-bottom: 28px;
}

.stat-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.stat-card.clickable {
  cursor: pointer;
}
.stat-card.clickable:active {
  transform: scale(0.98);
}
.stat-card.active {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold-glow), var(--shadow);
}

/* Card accent bar */
.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius) var(--radius) 0 0;
}
.stat-card.card-gold::before { background: var(--gold-gradient); }
.stat-card.card-green::before { background: linear-gradient(90deg, #3ba34a, #55ca63); }
.stat-card.card-red::before { background: linear-gradient(90deg, #c93b37, #e8605b); }
.stat-card.card-brown::before { background: linear-gradient(90deg, var(--brown), var(--brown-soft)); }

/* Card header row */
.stat-header {
  align-items: flex-start;
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.stat-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  margin: 0;
  text-transform: uppercase;
}

.stat-icon {
  align-items: center;
  border-radius: 8px;
  display: flex;
  font-size: 16px;
  height: 32px;
  justify-content: center;
  width: 32px;
  flex-shrink: 0;
}
.stat-icon.gold { background: var(--gold-soft); color: var(--gold-dark); }
.stat-icon.green { background: var(--green-soft); color: #2a7a35; }
.stat-icon.red { background: var(--red-soft); color: var(--red); }
.stat-icon.brown { background: #efe6dc; color: var(--brown); }

.stat-value {
  font-family: Inter, system-ui, -apple-system, sans-serif;
  font-size: 28px;
  font-weight: 800;
  color: var(--ink);
  margin: 0 0 10px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.stat-value.gold {
  color: var(--gold-dark);
}

/* Mini chart bar inside cards */
.stat-chart {
  height: 6px;
  background: #eee8df;
  border-radius: 99px;
  overflow: hidden;
  display: flex;
}
.stat-chart-bar {
  height: 100%;
  transition: width 500ms var(--ease-out);
}
.stat-chart-bar.green { background: linear-gradient(90deg, #3ba34a, #55ca63); }
.stat-chart-bar.red { background: linear-gradient(90deg, #c93b37, #e8605b); }
.stat-chart-bar:first-child {
  border-radius: 99px 0 0 99px;
}
.stat-chart-bar:last-child {
  border-radius: 0 99px 99px 0;
}

/* Card subtitle */
.stat-sub {
  color: var(--muted);
  font-size: 11px;
  margin: 6px 0 0;
}
.stat-sub.green { color: #2a7a35; }
.stat-sub.red { color: var(--red); }

.stat-breakdown {
  display: flex;
  gap: 14px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(0,0,0,0.06);
}
.breakdown-line {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.breakdown-line.green { color: #2a7a35; }
.breakdown-line.red { color: var(--red); }

/* ========================================
   Dashboard — Table
   ======================================== */
.table-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow var(--transition);
}
.table-panel:hover {
  box-shadow: var(--shadow-lg);
}

.table-header {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 20px 24px 18px;
}
.table-header h2 {
  font-size: 20px;
}
.table-header .count-badge {
  background: var(--wash);
  border-radius: 99px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  padding: 4px 12px;
}

.table-header-right {
  align-items: center;
  display: flex;
  gap: 12px;
}
.search-wrap {
  position: relative;
}
.search-icon {
  color: var(--muted);
  font-size: 13px;
  left: 12px;
  pointer-events: none;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}
.search-input {
  background: var(--wash);
  border: 1.5px solid var(--line);
  border-radius: 99px;
  font-size: 13px;
  min-height: 34px;
  outline: none;
  padding: 0 14px 0 34px;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 200px;
}
.search-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}
.search-input::placeholder {
  color: var(--muted);
}
.search-clear {
  align-items: center;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  display: none;
  font-size: 14px;
  height: 100%;
  justify-content: center;
  padding: 0 12px;
  position: absolute;
  right: 0;
  top: 0;
  transition: color var(--transition);
}
.search-clear:hover {
  color: var(--ink-secondary);
}
.search-clear.visible {
  display: flex;
}

.table-wrap {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  width: 100%;
}

th, td {
  padding: 18px 24px;
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
  background: var(--wash-warm);
}

td {
  font-weight: 600;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

tbody tr {
  cursor: pointer;
  transition: background 150ms ease;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: rgba(194, 143, 43, 0.05);
}

tbody tr:active {
  background: rgba(194, 143, 43, 0.1);
}

/* --- Status Pill --- */
.status-pill {
  align-items: center;
  background: #fdeeec;
  border-radius: 999px;
  color: #c93b37;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  gap: 8px;
  min-height: 30px;
  padding: 0 14px;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.status-pill::before {
  background: #c93b37;
  border-radius: 50%;
  content: "";
  height: 7px;
  width: 7px;
}

.status-pill.paid {
  background: #dff3df;
  color: #2a7a35;
}

.status-pill.paid::before {
  background: var(--green);
}

/* --- Empty State --- */
.empty-state {
  color: var(--muted);
  padding: 56px 24px;
  text-align: center;
}

.empty-state-icon {
  display: block;
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state strong {
  display: block;
  color: var(--ink-secondary);
  font-size: 16px;
  margin-bottom: 6px;
}

.empty-state span {
  font-size: 14px;
  color: var(--muted);
}


/* ========================================
   Alert Stok Menipis (dashboard)
   ======================================== */
.lowstock-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  margin-bottom: 20px;
  border-radius: var(--radius);
  background: var(--gold-glow);
  border: 1px solid var(--line-gold);
  color: var(--ink);
  text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s;
}
.lowstock-banner:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.lowstock-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--gold-gradient); color: #fff; flex-shrink: 0;
}
.lowstock-text { flex: 1; font-size: 14px; }
.lowstock-cta { font-size: 13px; font-weight: 700; color: var(--gold-dark); white-space: nowrap; }
.lowstock-cta i { margin-left: 4px; }

/* Banner PO terlambat: tampil lebih urgent (merah) */
.po-banner.po-banner-overdue {
  background: var(--red-soft);
  border-color: var(--red);
}
.po-banner.po-banner-overdue .lowstock-icon { background: var(--red); }
.po-banner.po-banner-overdue .lowstock-cta { color: var(--red); }

/* ========================================
   Panel Laporan Laba (dashboard)
   ======================================== */
.profit-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}
.profit-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 18px;
}
.profit-head h2 { font-size: 18px; font-weight: 700; margin: 0; color: var(--ink); }
.profit-head h2 i { color: var(--gold); margin-right: 8px; }
.profit-period {
  font-size: 12px; font-weight: 500; color: var(--muted);
  background: var(--wash); padding: 2px 10px; border-radius: 100px; margin-left: 6px;
}
.profit-margin { font-size: 13px; color: var(--muted); font-weight: 600; }
.profit-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
}
.profit-item {
  padding: 16px 18px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--wash-warm);
}
.profit-item.highlight { border-color: var(--line-gold); background: var(--gold-glow); }
.profit-label { display: block; font-size: 12.5px; color: var(--ink-secondary); margin-bottom: 6px; }
.profit-value { font-size: 20px; font-weight: 800; letter-spacing: -0.01em; }
.profit-item.highlight .profit-value { color: var(--green); }
.profit-note { margin: 16px 0 0; font-size: 12px; color: var(--muted); }
.profit-note i { color: var(--gold); margin-right: 6px; }
@media (max-width: 640px) {
  .profit-grid { grid-template-columns: 1fr; }
}

/* ========================================
   Laporan Laba (COGS / FIFO) — halaman #/reports
   ======================================== */
.reports-page { max-width: 1000px; margin: 0 auto; padding: 0 20px 60px; }
.reports-page .table-panel { margin-bottom: 24px; }

.report-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.report-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.report-card.highlight {
  border-color: var(--line-gold);
  background: var(--gold-glow);
}
.report-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.report-value {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.report-sub { font-size: 11px; color: var(--muted); }

/* Tabel laba (per invoice & per pecahan) */
.report-table {
  font-size: 13px;
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.report-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
}
.report-table th,
.report-table td {
  padding: 10px 14px;
  white-space: nowrap;
}
.report-table th {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--wash);
  border-bottom: 2px solid var(--line);
  position: sticky;
  top: 0;
}
.report-table td { font-weight: 600; color: var(--ink-secondary); }
.report-table td strong { color: var(--ink); }
.report-table th.num,
.report-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.report-table tbody tr { cursor: pointer; transition: background 150ms; }
.report-table tbody tr:only-child { cursor: default; }
.report-table tbody tr:hover { background: var(--wash-warm); }
.report-table tbody tr:nth-child(even) { background: rgba(0,0,0,0.02); }
.report-table tbody tr:nth-child(even):hover { background: var(--wash-warm); }
.report-table tbody tr.report-footer {
  cursor: default;
  background: var(--wash) !important;
  border-top: 2px solid var(--line);
  font-weight: 700;
}
.report-table tbody tr.report-footer td {
  border-top: 2px solid var(--line);
  padding: 12px 14px;
  font-size: 13px;
}
.report-table tbody tr.report-footer td strong { color: var(--ink); }

.report-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}

/* Dark mode */
[data-theme="dark"] .report-card { background: #2a2622; border-color: #3a3632; }
[data-theme="dark"] .report-card.highlight { background: rgba(194,143,43,0.15); border-color: var(--line-gold); }
[data-theme="dark"] .report-value { color: var(--paper); }
[data-theme="dark"] .report-table td { color: var(--ink-secondary); }
[data-theme="dark"] .report-table th { background: #2a2622; border-color: #3a3632; color: #9a8e82; }
[data-theme="dark"] .report-table tbody tr:nth-child(even) { background: rgba(255,255,255,0.02); }
[data-theme="dark"] .report-table tbody tr.report-footer { background: #2a2622 !important; }
[data-theme="dark"] .report-table tbody tr.report-footer td strong { color: var(--paper); }

@media (max-width: 640px) {
  .report-summary-grid { grid-template-columns: 1fr 1fr; }
}
