/* ============================================================================
   RUANG TAGIH — Modern Coffee Dashboard / Premium Financial SaaS
   ============================================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #F0F2F5;
  --beige: #E4E6EB;
  --surface: #FFFFFF;
  --surface-2: #F7F8FA;
  --espresso: #0E2447;
  --coffee: #1877F2;
  --caramel: #166FE5;
  --latte: #BDD7FB;
  --gold: #1877F2;
  --gold-soft: #E7F3FF;
  --text: #1C1E21;
  --text-secondary: #4B4F56;
  --muted: #65676B;
  --muted-light: #8A8D91;
  --border: #DADDE1;
  --border-strong: #CCD0D5;

  --success: #2E8B57;
  --success-bg: #E7F6EC;
  --danger: #E41E3F;
  --danger-bg: #FDECEE;
  --warning: #C27D0E;
  --warning-bg: #FEF5E6;
  --info: #1877F2;
  --info-bg: #E7F3FF;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 16px 36px rgba(0, 0, 0, 0.14);

  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 18px;
  --sidebar-w: 260px;
}

html, body { height: 100%; }

body {
  font-family: 'Manrope', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }

/* Custom Scrollbar (Coffee Theme) */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover { background: var(--caramel); }

.sidebar-nav {
  scrollbar-color: rgba(212, 184, 150, 0.28) transparent;
}
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(212, 184, 150, 0.28); }
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: rgba(212, 184, 150, 0.48); }

/* ============================================================================
   LOGIN PAGE (Large Split Coffee SaaS Card)
   ============================================================================ */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 15% 15%, rgba(201, 162, 39, 0.1) 0%, transparent 45%),
    radial-gradient(circle at 85% 85%, rgba(92, 58, 33, 0.08) 0%, transparent 45%),
    var(--bg);
  padding: 24px;
}

.login-shell {
  width: 100%;
  max-width: 960px;
  display: grid;
  grid-template-columns: 1fr;
  background: var(--surface);
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}

.login-aside {
  display: none;
  background: var(--espresso);
  color: #FAF6F0;
  padding: 48px 42px;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
}

.login-aside-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 32px;
}

.login-aside .login-logo {
  margin-bottom: 0;
  background: var(--gold);
  color: var(--espresso);
  box-shadow: none;
}

.login-aside-name { font-size: 18px; font-weight: 800; letter-spacing: 0.03em; color: #FAF6F0; }
.login-aside-tag { font-size: 11px; color: var(--latte); text-transform: uppercase; letter-spacing: 1.2px; }

.login-aside-title {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
  color: #FAF6F0;
}

.login-aside-desc {
  font-size: 14px;
  color: #D7C6B2;
  line-height: 1.6;
}

.login-aside-list { display: grid; gap: 14px; }
.login-aside-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
}
.login-aside-item svg { width: 18px; height: 18px; color: var(--gold-soft); margin-top: 2px; flex-shrink: 0; }
.login-aside-item strong { display: block; font-size: 13px; color: #FAF6F0; }
.login-aside-item span { font-size: 12px; color: var(--latte); }

.login-box {
  background: var(--surface);
  padding: 36px 30px;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.login-box-single {
  max-width: 460px;
  padding: 40px 36px;
  border-radius: 22px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}
.login-brand-top {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 26px;
}
.login-brand-img {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  object-fit: cover;
  flex-shrink: 0;
}

.login-mobile-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}
.login-mobile-head .login-logo { margin-bottom: 0; width: 44px; height: 44px; }
.login-mobile-brand { font-size: 16px; font-weight: 800; letter-spacing: 0.03em; color: var(--espresso); }

.login-logo {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--coffee);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--surface);
  margin-bottom: 18px;
}
.login-logo svg { width: 24px; height: 24px; }

.login-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--espresso);
  line-height: 1.15;
}
.login-subtitle { color: var(--muted); font-size: 14px; margin-top: 6px; margin-bottom: 24px; }

.form-input-lg { padding: 13px 14px !important; font-size: 15px !important; }
.input-icon .form-input-lg { padding-left: 42px !important; }

@media (min-width: 860px) {
  .login-shell { grid-template-columns: 1.05fr 1fr; }
  .login-aside { display: flex; }
  .login-mobile-head { display: none; }
  .login-box { padding: 48px 44px; }
}

.login-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  background: var(--beige);
  padding: 4px;
  border-radius: 12px;
  margin-bottom: 20px;
}
.login-tab {
  padding: 8px 12px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  transition: all 0.18s ease;
}
.login-tab.active {
  background: var(--surface);
  color: var(--espresso);
  box-shadow: var(--shadow-sm);
}

.input-icon { position: relative; display: flex; align-items: center; }
.input-icon > svg { position: absolute; left: 13px; width: 17px; height: 17px; color: var(--muted); pointer-events: none; }
.input-icon .form-input { padding-left: 40px; }

.form-input {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.form-input:focus {
  outline: none;
  border-color: var(--caramel);
  box-shadow: 0 0 0 4px rgba(166, 123, 91, 0.14);
}

.input-password-wrap { position: relative; display: flex; align-items: center; }
.input-password-wrap .form-input { padding-right: 40px; }
.toggle-pass-btn {
  position: absolute;
  right: 11px;
  color: var(--muted);
  padding: 4px;
  display: flex;
  align-items: center;
}
.toggle-pass-btn:hover { color: var(--espresso); }
.toggle-pass-btn svg { width: 17px; height: 17px; }

.login-hint {
  margin-top: 20px;
  padding: 12px;
  background: var(--beige);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--muted);
}
.login-hint-label { font-weight: 700; color: var(--espresso); margin-bottom: 8px; font-size: 11.5px; }
.demo-click-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.demo-chip {
  text-align: left;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  transition: border-color 0.18s ease, transform 0.15s ease;
}
.demo-chip:hover { border-color: var(--caramel); transform: translateY(-1px); }
.demo-chip strong { display: block; color: var(--espresso); font-size: 12px; }
.demo-chip span { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--muted); }

/* ============================================================================
   APP SHELL & ESPRESSO SIDEBAR
   ============================================================================ */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--espresso);
  color: var(--bg);
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 50;
  transform: translateX(-100%);
  transition: transform 0.22s ease;
}
.sidebar.open { transform: translateX(0); }

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(59, 36, 22, 0.45);
  backdrop-filter: blur(3px);
  z-index: 45;
}
.sidebar-backdrop.open { display: block; }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 14px;
}
.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--espresso);
  flex-shrink: 0;
}
.brand-logo svg { width: 19px; height: 19px; }
.brand-name { font-size: 15px; font-weight: 800; letter-spacing: 0.03em; color: #FAF6F0; }
.brand-sub { font-size: 10.5px; color: var(--latte); text-transform: uppercase; letter-spacing: 1.2px; margin-top: 1px; }

.sidebar-nav { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; }
.sidebar-section {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--muted-light);
  padding: 10px 12px 6px;
  font-weight: 700;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 11px;
  color: #D7C6B2;
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.18s ease;
}
.nav-item svg { width: 18px; height: 18px; stroke-width: 2; }
.nav-item:hover { background: rgba(255, 255, 255, 0.07); color: #FAF6F0; }
.nav-item.active {
  background: #1877F2;
  color: #FFFFFF;
  font-weight: 700;
}
.nav-item.active svg { color: #FFFFFF; }

.sidebar-user {
  padding: 11px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}
.sidebar-avatar {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--espresso);
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
  overflow: hidden;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 12.5px; font-weight: 700; color: #FAF6F0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 10.5px; color: var(--latte); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-logout { color: var(--latte); padding: 6px; border-radius: 7px; transition: all 0.15s; display: flex; }
.sidebar-logout:hover { background: rgba(180, 71, 46, 0.25); color: #F5E3DE; }

.app-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 40;
  gap: 16px;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-title h1 { font-size: 19px; font-weight: 800; letter-spacing: -0.02em; color: var(--espresso); line-height: 1.2; }
.topbar-title p { font-size: 12px; color: var(--muted); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.notif-wrap { position: relative; }
.notif-pill {
  position: relative;
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--espresso);
  transition: border-color 0.15s, background 0.15s;
}
.notif-pill:hover { border-color: var(--caramel); background: var(--beige); }
.notif-pill svg { width: 17px; height: 17px; }
.notif-badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 0 5px; border-radius: 999px;
  line-height: 16px;
}
.notif-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  max-width: calc(100vw - 24px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  z-index: 60;
  overflow: hidden;
}
.notif-dropdown.open { display: block; }
.notif-dropdown-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; font-weight: 700; color: var(--espresso);
}
.notif-mark-all { font-size: 11.5px; color: var(--caramel); font-weight: 600; }
.notif-mark-all:hover { color: var(--coffee); }
.notif-dropdown-list { max-height: 320px; overflow-y: auto; }
.notif-item {
  display: block; width: 100%; text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg); }
.notif-item.unread { background: rgba(201, 162, 39, 0.06); }
.notif-item-title { font-size: 12.5px; font-weight: 700; color: var(--espresso); display: flex; align-items: center; gap: 6px; }
.notif-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); flex-shrink: 0; }
.notif-item-msg { font-size: 12px; color: var(--muted); margin-top: 2px; }
.notif-item-time { font-size: 11px; color: var(--muted-light); margin-top: 4px; }
.notif-empty { padding: 24px 14px; text-align: center; font-size: 12.5px; color: var(--muted); }

.user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 11px 4px 4px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
}
.user-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface); color: #FAF6F0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px;
  overflow: hidden;
}
.avatar-logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.user-meta { display: none; flex-direction: column; line-height: 1.15; }
.user-name { font-size: 12px; font-weight: 700; color: var(--espresso); }
.user-role { font-size: 10px; color: var(--muted); font-weight: 600; }

.content-area { flex: 1; padding: 22px 24px 52px; max-width: 1380px; width: 100%; margin: 0 auto; }
.app-footer {
  padding: 14px 24px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  background: var(--surface);
}

/* ============================================================================
   PAGE HEADER, CARDS & STATS
   ============================================================================ */
.page-header {
  margin-bottom: 18px;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap;
}
.page-header h2 { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; color: var(--espresso); }
.page-header p { font-size: 13px; color: var(--muted); margin-top: 2px; }

.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}
.card:hover { box-shadow: var(--shadow); }
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.card-header h2 { font-size: 15px; font-weight: 700; color: var(--espresso); }
.card-body { padding: 20px; }

.stats-grid { display: grid; grid-template-columns: 1fr; gap: 14px; margin-bottom: 18px; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex; align-items: flex-start; gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.stat-icon {
  width: 42px; height: 42px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.stat-icon svg { width: 20px; height: 20px; }
.stat-teal .stat-icon { background: var(--success-bg); color: var(--success); }
.stat-amber .stat-icon { background: var(--warning-bg); color: var(--warning); }
.stat-blue .stat-icon { background: var(--beige); color: var(--coffee); }
.stat-indigo .stat-icon { background: var(--info-bg); color: var(--info); }

.stat-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--muted); font-weight: 700; margin-bottom: 5px; }
.stat-value { font-size: 23px; font-weight: 800; letter-spacing: -0.02em; color: var(--espresso); font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

.grid-2 { display: grid; grid-template-columns: 1fr; gap: 16px; }
.grid-form-list { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: start; }

/* Responsive Chart Containers */
.chart-box { position: relative; width: 100%; height: 220px; }
.chart-box-doughnut { position: relative; width: 100%; height: 250px; max-width: 340px; margin: 0 auto; }
@media (min-width: 768px) {
  .chart-box { height: 270px; }
}

/* ============================================================================
   FORMS, SELECTABLE CARDS & BUTTONS
   ============================================================================ */
.form-group { margin-bottom: 15px; }
.form-group label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="month"], select, textarea {
  width: 100%;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--espresso);
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--caramel);
  box-shadow: 0 0 0 4px rgba(166, 123, 91, 0.12);
}
.amount-input-lg {
  font-size: 22px !important;
  font-weight: 800 !important;
  padding: 14px 16px !important;
  font-variant-numeric: tabular-nums;
}

.method-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.method-card { position: relative; cursor: pointer; }
.method-card input { position: absolute; opacity: 0; pointer-events: none; }
.method-card-inner {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  transition: all 0.18s ease;
}
.method-card-inner svg { width: 18px; height: 18px; color: var(--caramel); flex-shrink: 0; }
.method-card-inner span { font-size: 13px; font-weight: 700; color: var(--espresso); }
.method-card input:checked + .method-card-inner {
  border-color: var(--coffee);
  background: var(--beige);
  box-shadow: 0 0 0 3px rgba(92, 58, 33, 0.1);
}

.form-row { display: grid; grid-template-columns: 1fr; gap: 12px; }
.form-row-inline { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.form-check { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; font-size: 13px; color: var(--espresso); }
.form-check input { width: auto; accent-color: var(--coffee); }
.search-inline { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.search-inline input, .search-inline select { width: auto; min-width: 150px; padding: 7px 12px; font-size: 13px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  transition: all 0.18s ease;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; stroke-width: 2.2; }
.btn-primary { background: var(--coffee); color: #FAF6F0; }
.btn-primary:hover { background: var(--espresso); box-shadow: var(--shadow); }
.btn-gold { background: var(--gold); color: var(--espresso); }
.btn-gold:hover { background: var(--gold-soft); }
.btn-outline { border: 1.5px solid var(--border); background: var(--surface); color: var(--espresso); }
.btn-outline:hover { border-color: var(--caramel); background: var(--beige); }
.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-danger:hover { background: #EFD1C8; }
.btn-wa { background: #25D366; color: #FFFFFF; }
.btn-wa:hover { background: #1EBE5D; color: #FFFFFF; }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 9px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-lg { padding: 12px 20px; font-size: 14.5px; }
.btn-block { width: 100%; }
.btn-icon {
  padding: 7px; width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--espresso);
}
.btn-group { display: flex; gap: 6px; flex-wrap: wrap; }
.btn-stack { display: flex; flex-direction: column; gap: 10px; }
.quick-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.quick-chips { display: flex; gap: 6px; flex-wrap: wrap; }

/* ============================================================================
   TABLES, BADGES & ALERTS
   ============================================================================ */
.table-responsive { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table thead { background: var(--beige); }
.table th {
  padding: 12px 14px;
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}
.table td {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  color: var(--espresso);
  vertical-align: middle;
}
.table tbody tr:hover td { background: var(--bg); }
.table td strong { font-weight: 700; color: var(--espresso); }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700;
  white-space: nowrap;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-secondary { background: var(--beige); color: var(--muted); }
.badge-dark { background: var(--espresso); color: var(--bg); }

/* Pagination */
.pagination-wrap {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--surface);
}
.pagination-info { font-size: 12px; color: var(--muted); font-weight: 500; }
.pagination { display: flex; gap: 5px; flex-wrap: wrap; }
.page-link {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; height: 32px; padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--espresso);
  font-size: 12px; font-weight: 600;
  transition: all 0.15s;
}
.page-link:hover:not(.disabled):not(.active) { border-color: var(--caramel); background: var(--beige); }
.page-link.active { background: var(--coffee); color: #FAF6F0; border-color: var(--coffee); }
.page-link.disabled { opacity: 0.45; pointer-events: none; }

.alert {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 13px;
  font-weight: 600;
}
.alert svg { width: 18px; height: 18px; flex-shrink: 0; }
.alert-success { background: var(--success-bg); color: var(--success); }
.alert-danger { background: var(--danger-bg); color: var(--danger); }
.alert-info { background: var(--info-bg); color: var(--info); }

/* Customer Cards */
.customer-cards { display: grid; grid-template-columns: 1fr; gap: 12px; }
.customer-card-top { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.customer-card-top h3 { font-size: 15px; font-weight: 700; color: var(--espresso); margin-bottom: 2px; }
.customer-card-actions {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 10px; border-top: 1px solid var(--border);
}

/* ============================================================================
   MODALS (Backdrop Blur)
   ============================================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(59, 36, 22, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
.modal-overlay.open { display: flex; animation: modalFadeIn 0.16s ease; }
@keyframes modalFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalPopIn { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalPopIn 0.2s ease;
}
.modal-sm { max-width: 400px; }
.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; background: var(--surface); z-index: 2;
}
.modal-title { font-size: 16px; font-weight: 800; color: var(--espresso); }
.modal-close {
  color: var(--muted);
  width: 30px; height: 30px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.modal-close:hover { background: var(--beige); color: var(--espresso); }
.modal-close svg { width: 17px; height: 17px; }
.modal-body { padding: 22px; overflow-x: hidden; }
.modal-grid-2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.modal-grid-3 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
@media (min-width: 480px) {
  .modal-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .modal-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.modal-grid-2 > div, .modal-grid-3 > div { min-width: 0; overflow-wrap: anywhere; }
.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: flex-end;
  background: var(--bg);
}

/* Utilities */
.text-muted { color: var(--muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-bold { font-weight: 700; font-variant-numeric: tabular-nums; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.divider { border: none; border-top: 1px solid var(--border); margin: 18px 0; }
.hide-mobile { display: none; }

/* Thermal 58mm Receipt Preview */
.receipt-58mm {
  width: 58mm;
  background: #fff;
  color: #000;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 10.5px;
  line-height: 1.45;
  padding: 14px 10px;
  border: 1px dashed #8B7355;
  margin: 0 auto;
}
.r-center { text-align: center; }
.r-bold { font-weight: 700; }
.r-small { font-size: 9.5px; }
.r-line { margin: 5px 0; overflow: hidden; white-space: nowrap; }
.r-row { display: flex; justify-content: space-between; gap: 6px; }

/* Mobile / Android Bottom Navbar */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 42;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.bottom-nav-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; padding: 6px 4px; border-radius: 10px;
  color: var(--muted); font-size: 10.5px; font-weight: 600;
  transition: color 0.15s;
}
.bottom-nav-item svg { width: 18px; height: 18px; stroke-width: 2; }
.bottom-nav-item.active { color: var(--espresso); font-weight: 700; }
.bottom-nav-item.active svg { color: var(--gold); }

/* Responsive */
@media (min-width: 768px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: repeat(2, 1fr); }
  .user-meta { display: flex; }
  .hide-mobile { display: inline; }
  .customer-cards { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .sidebar { position: sticky; top: 0; height: 100vh; transform: translateX(0); }
  .mobile-menu-btn, .sidebar-backdrop, .bottom-nav { display: none !important; }
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-form-list { grid-template-columns: 380px 1fr; }
}

@media (max-width: 1023px) {
  .app-main { padding-bottom: 66px; }
}

@media (max-width: 640px) {
  .notif-dropdown {
    position: fixed;
    top: 62px; left: 12px; right: 12px;
    width: auto; max-width: none;
  }
}

@media (max-width: 480px) {
  .login-box { padding: 28px 22px; }
  .content-area { padding: 14px; }
  .topbar { padding: 12px 14px; }
  .demo-click-row { grid-template-columns: 1fr; }
  .method-cards { grid-template-columns: 1fr; }
}

/* Custom File Dropzone */
.file-dropzone {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 2px dashed var(--border-strong);
  border-radius: 12px;
  background: var(--cream);
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
}
.file-dropzone:hover,
.file-dropzone.dragover {
  border-color: var(--caramel);
  background: var(--caramel-soft);
}
.file-dropzone.has-file {
  border-style: solid;
  border-color: var(--success);
  background: rgba(22, 163, 74, 0.06);
}
.file-dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.file-drop-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--caramel-soft);
  color: var(--caramel);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.file-dropzone.has-file .file-drop-icon {
  background: rgba(22, 163, 74, 0.14);
  color: var(--success);
}
.file-drop-icon svg { width: 20px; height: 20px; }
.file-drop-text { min-width: 0; flex: 1; }
.file-drop-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--espresso);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-drop-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.file-drop-btn {
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  font-size: 12px;
  font-weight: 700;
  color: var(--espresso);
  flex-shrink: 0;
}

/* Print */
@media print {
  body { background: #fff; color: #000; }
  .sidebar, .topbar, .app-footer, .no-print, .sidebar-backdrop, .bottom-nav { display: none !important; }
  .app-main, .content-area { padding: 0 !important; margin: 0 !important; }
  .card { border: none !important; box-shadow: none !important; margin: 0 !important; background: #fff !important; }
  .receipt-58mm { width: 58mm !important; border: none !important; margin: 0 !important; padding: 0 !important; }
}
