/* ============================================================
   KasirKu — Design System
   Theme: Elegant White / Clean Professional
   Font: DM Sans (body) + DM Serif Display (brand)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=DM+Serif+Display:ital@0;1&display=swap');

/* ── TOKENS ─────────────────────────────────────────────────── */
:root {
  /* Colors */
  --white:       #ffffff;
  --gray-50:     #f9fafb;
  --gray-100:    #f3f4f6;
  --gray-200:    #e5e7eb;
  --gray-300:    #d1d5db;
  --gray-400:    #9ca3af;
  --gray-500:    #6b7280;
  --gray-600:    #4b5563;
  --gray-700:    #374151;
  --gray-800:    #1f2937;
  --gray-900:    #111827;

  --emerald-50:  #ecfdf5;
  --emerald-100: #d1fae5;
  --emerald-400: #34d399;
  --emerald-500: #10b981;
  --emerald-600: #059669;
  --emerald-700: #047857;

  --amber-50:    #fffbeb;
  --amber-100:   #fef3c7;
  --amber-400:   #fbbf24;
  --amber-500:   #f59e0b;
  --amber-600:   #d97706;

  --red-50:      #fef2f2;
  --red-100:     #fee2e2;
  --red-400:     #f87171;
  --red-500:     #ef4444;
  --red-600:     #dc2626;

  --blue-50:     #eff6ff;
  --blue-500:    #3b82f6;
  --blue-600:    #2563eb;

  /* Brand */
  --primary:     var(--emerald-600);
  --primary-light: var(--emerald-50);
  --primary-hover: var(--emerald-700);

  /* Surfaces */
  --bg:          var(--gray-50);
  --surface:     var(--white);
  --surface-2:   var(--gray-50);
  --border:      var(--gray-200);
  --border-focus: var(--emerald-500);

  /* Text */
  --text-primary:   var(--gray-900);
  --text-secondary: var(--gray-600);
  --text-muted:     var(--gray-400);

  /* Shadows */
  --shadow-xs:  0 1px 2px rgba(0,0,0,.05);
  --shadow-sm:  0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:  0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -1px rgba(0,0,0,.04);
  --shadow-lg:  0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -2px rgba(0,0,0,.04);
  --shadow-xl:  0 20px 25px -5px rgba(0,0,0,.08), 0 10px 10px -5px rgba(0,0,0,.03);

  /* Radius */
  --r-sm:  6px;
  --r-md:  10px;
  --r-lg:  14px;
  --r-xl:  20px;
  --r-2xl: 28px;
  --r-full: 9999px;

  /* Spacing */
  --nav-h: 64px;
}

/* ── RESET ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ── LAYOUT ─────────────────────────────────────────────────── */
.wrap        { max-width: 1280px; margin: 0 auto; padding: 0 1.5rem; }
.wrap-sm     { max-width: 960px; margin: 0 auto; padding: 0 1.5rem; }
.wrap-xs     { max-width: 480px; margin: 0 auto; padding: 0 1.5rem; }
.page-body   { padding: 2rem 0; min-height: calc(100vh - var(--nav-h)); }

/* ── NAV ─────────────────────────────────────────────────────── */
.navbar {
  height: var(--nav-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow-xs);
}
.navbar .wrap { display: flex; align-items: center; gap: 1rem; width: 100%; }
.nav-brand {
  font-family: 'DM Serif Display', serif;
  font-size: 1.35rem;
  color: var(--primary);
  display: flex; align-items: center; gap: .5rem;
  flex-shrink: 0;
}
.nav-brand .dot {
  width: 8px; height: 8px;
  background: var(--emerald-400);
  border-radius: 50%;
  display: inline-block;
}
.nav-toko {
  font-size: .8rem;
  color: var(--text-muted);
  padding: .25rem .75rem;
  background: var(--gray-100);
  border-radius: var(--r-full);
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.nav-links {
  display: flex; align-items: center; gap: .25rem;
  flex: 1; margin-left: .5rem;
}
.nav-link {
  display: flex; align-items: center; gap: .35rem;
  padding: .45rem .85rem;
  border-radius: var(--r-md);
  font-size: .85rem;
  font-weight: 500;
  color: var(--text-secondary);
  border: 1px solid transparent;
  transition: all .15s;
  white-space: nowrap;
}
.nav-link:hover { background: var(--gray-100); color: var(--text-primary); }
.nav-link.active {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--emerald-100);
  font-weight: 600;
}
.nav-right { display: flex; align-items: center; gap: .5rem; margin-left: auto; }
.nav-user {
  display: flex; align-items: center; gap: .5rem;
  font-size: .82rem; color: var(--text-secondary);
}
.nav-avatar {
  width: 32px; height: 32px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .8rem;
  border: 1.5px solid var(--emerald-100);
  flex-shrink: 0;
}

/* ── BUTTONS ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .55rem 1.1rem;
  border-radius: var(--r-md);
  font-size: .85rem; font-weight: 600;
  border: 1px solid transparent;
  transition: all .15s;
  white-space: nowrap;
  line-height: 1;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
  box-shadow: var(--shadow-xs);
}
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-secondary {
  background: var(--white);
  color: var(--text-primary);
  border-color: var(--border);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover { background: var(--gray-50); }
.btn-danger {
  background: var(--red-50);
  color: var(--red-600);
  border-color: var(--red-100);
}
.btn-danger:hover { background: var(--red-100); }
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--gray-100); color: var(--text-primary); }
.btn-sm { padding: .35rem .75rem; font-size: .8rem; border-radius: var(--r-sm); }
.btn-lg { padding: .75rem 1.5rem; font-size: .95rem; border-radius: var(--r-lg); }
.btn-icon { padding: .5rem; width: 36px; height: 36px; }

/* ── CARDS ───────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: .75rem;
}
.card-header h3 {
  flex: 1; font-size: .95rem; font-weight: 600;
  color: var(--text-primary);
}
.card-body { padding: 1.25rem; }
.card-footer {
  padding: .85rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--gray-50);
}

/* ── STAT CARDS ──────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s, transform .2s;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-card .stat-icon {
  width: 40px; height: 40px;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  margin-bottom: .85rem;
}
.stat-card .stat-label { font-size: .78rem; color: var(--text-muted); font-weight: 500; margin-bottom: .25rem; text-transform: uppercase; letter-spacing: .04em; }
.stat-card .stat-value { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.stat-card .stat-sub { font-size: .75rem; color: var(--text-muted); margin-top: .25rem; }
.stat-icon.green  { background: var(--emerald-50); color: var(--emerald-600); }
.stat-icon.amber  { background: var(--amber-50);   color: var(--amber-600);   }
.stat-icon.red    { background: var(--red-50);      color: var(--red-600);     }
.stat-icon.blue   { background: var(--blue-50);     color: var(--blue-600);    }

/* ── TABLE ───────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  padding: .65rem 1rem;
  font-size: .73rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: left;
  text-transform: uppercase;
  letter-spacing: .06em;
  background: var(--gray-50);
  border-bottom: 1px solid var(--border);
}
tbody td {
  padding: .85rem 1rem;
  font-size: .85rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--gray-100);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--gray-50); }

/* ── BADGES ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .2rem .65rem;
  border-radius: var(--r-full);
  font-size: .72rem;
  font-weight: 600;
  line-height: 1.4;
}
.badge::before { content: '●'; font-size: .55rem; }
.badge-success  { background: var(--emerald-50);  color: var(--emerald-700); }
.badge-warning  { background: var(--amber-50);    color: var(--amber-600);   }
.badge-danger   { background: var(--red-50);      color: var(--red-600);     }
.badge-info     { background: var(--blue-50);     color: var(--blue-600);    }
.badge-gray     { background: var(--gray-100);    color: var(--gray-600);    }
/* Status aliases */
.badge-aktif    { background: var(--emerald-50);  color: var(--emerald-700); }
.badge-nonaktif { background: var(--red-50);      color: var(--red-600);     }
.badge-lunas    { background: var(--emerald-50);  color: var(--emerald-700); }
.badge-batal    { background: var(--red-50);      color: var(--red-600);     }
.badge-owner    { background: var(--amber-50);    color: var(--amber-600);   }
.badge-kasir    { background: var(--blue-50);     color: var(--blue-600);    }
.badge-superadmin { background: #f5f3ff;          color: #6d28d9;            }

/* ── FORMS ───────────────────────────────────────────────────── */
.form-group { margin-bottom: .9rem; }
.form-group label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: .35rem;
}
.form-control {
  width: 100%;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-primary);
  padding: .6rem .9rem;
  font-size: .9rem;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(16,185,129,.1);
}
.form-control::placeholder { color: var(--text-muted); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.form-hint { font-size: .75rem; color: var(--text-muted); margin-top: .3rem; }
.form-section { margin-bottom: 1.5rem; }
.form-section-title {
  font-size: .78rem; font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .06em;
  margin-bottom: .75rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
}

/* ── MODALS ──────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(4px);
  z-index: 200;
  align-items: center; justify-content: center;
  padding: 1rem;
  animation: fadeIn .15s ease;
}
.modal-overlay.show { display: flex; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--white);
  border-radius: var(--r-2xl);
  box-shadow: var(--shadow-xl);
  width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
  animation: slideUp .2s ease;
}
@keyframes slideUp { from { transform: translateY(16px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header {
  padding: 1.5rem 1.5rem 0;
  display: flex; align-items: flex-start; gap: 1rem;
}
.modal-icon {
  width: 44px; height: 44px;
  border-radius: var(--r-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.modal-icon.green { background: var(--emerald-50); }
.modal-icon.amber { background: var(--amber-50); }
.modal-title { font-size: 1rem; font-weight: 700; margin-bottom: .2rem; }
.modal-subtitle { font-size: .82rem; color: var(--text-muted); }
.modal-body { padding: 1.25rem 1.5rem; }
.modal-footer {
  padding: 0 1.5rem 1.5rem;
  display: flex; gap: .5rem; justify-content: flex-end;
}
.modal-close {
  margin-left: auto; background: none; border: none;
  color: var(--text-muted); font-size: 1.2rem;
  width: 32px; height: 32px;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  transition: .15s;
}
.modal-close:hover { background: var(--gray-100); color: var(--text-primary); }

/* ── FLASH / ALERTS ──────────────────────────────────────────── */
.alert {
  display: flex; align-items: flex-start; gap: .65rem;
  padding: .85rem 1rem;
  border-radius: var(--r-lg);
  font-size: .85rem;
  margin-bottom: 1.25rem;
  border: 1px solid;
}
.alert-icon { font-size: 1rem; flex-shrink: 0; margin-top: .05rem; }
.alert-success { background: var(--emerald-50); color: var(--emerald-700); border-color: var(--emerald-100); }
.alert-error   { background: var(--red-50);     color: var(--red-600);     border-color: var(--red-100);     }
.alert-warning { background: var(--amber-50);   color: var(--amber-600);   border-color: var(--amber-100);   }

/* ── PAGE HEADER ─────────────────────────────────────────────── */
.page-header {
  display: flex; align-items: center; gap: 1rem;
  margin-bottom: 1.5rem;
}
.page-header h1 {
  font-size: 1.35rem; font-weight: 700;
  color: var(--text-primary);
  flex: 1;
}
.page-header p {
  font-size: .85rem; color: var(--text-muted); margin-top: .15rem;
}

/* ── DIVIDER ─────────────────────────────────────────────────── */
.divider {
  height: 1px; background: var(--border);
  margin: 1.25rem 0;
}
.divider-label {
  display: flex; align-items: center; gap: .75rem;
  color: var(--text-muted); font-size: .75rem;
  margin: 1rem 0;
}
.divider-label::before, .divider-label::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ── SIDEBAR LAYOUT ──────────────────────────────────────────── */
.layout-sidebar {
  display: flex; gap: 1.5rem;
}
.sidebar {
  width: 220px; flex-shrink: 0;
}
.sidebar-nav { display: flex; flex-direction: column; gap: .15rem; }
.sidebar-link {
  display: flex; align-items: center; gap: .6rem;
  padding: .55rem .85rem;
  border-radius: var(--r-md);
  font-size: .85rem; font-weight: 500;
  color: var(--text-secondary);
  transition: .15s;
}
.sidebar-link:hover { background: var(--gray-100); color: var(--text-primary); }
.sidebar-link.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}
.sidebar-link .icon { width: 18px; text-align: center; font-size: .9rem; }
.sidebar-section {
  font-size: .7rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .07em;
  padding: .75rem .85rem .35rem;
}
.main-content { flex: 1; min-width: 0; }

/* ── CHART BAR ───────────────────────────────────────────────── */
.chart-container { padding: 1rem 1.25rem 2.5rem; }
.chart-bars { display: flex; align-items: flex-end; gap: 6px; height: 120px; }
.chart-bar-item {
  flex: 1; min-width: 20px;
  background: linear-gradient(to top, var(--emerald-500), var(--emerald-400));
  border-radius: 4px 4px 0 0;
  position: relative;
  transition: opacity .2s;
}
.chart-bar-item:hover { opacity: .8; }
.chart-bar-label {
  position: absolute; bottom: -22px; left: 50%;
  transform: translateX(-50%);
  font-size: .65rem; color: var(--text-muted);
  white-space: nowrap;
}
.chart-bar-item.empty { background: var(--gray-200); }

/* ── MISC ────────────────────────────────────────────────────── */
.text-primary   { color: var(--primary); }
.text-muted     { color: var(--text-muted); }
.text-danger    { color: var(--red-600); }
.text-success   { color: var(--emerald-600); }
.text-warning   { color: var(--amber-600); }
.font-bold      { font-weight: 700; }
.font-semibold  { font-weight: 600; }
.text-sm        { font-size: .82rem; }
.text-xs        { font-size: .75rem; }
.text-lg        { font-size: 1.05rem; }
.flex           { display: flex; }
.items-center   { align-items: center; }
.gap-1          { gap: .25rem; }
.gap-2          { gap: .5rem; }
.gap-3          { gap: .75rem; }
.mt-1           { margin-top: .25rem; }
.mb-1           { margin-bottom: .25rem; }
.mb-4           { margin-bottom: 1rem; }
.mb-6           { margin-bottom: 1.5rem; }

/* ── EMPTY STATE ─────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: .75rem; }
.empty-state p { font-size: .88rem; }

/* ── RESPONSIVE ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .form-row { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .layout-sidebar { flex-direction: column; }
  .sidebar { width: 100%; }
  .nav-links { display: none; }
  .wrap { padding: 0 1rem; }
}
