/**
 * PHONE STORE MANAGEMENT SYSTEM - Modern CSS Design System
 * Inspired by DIK-APPS Reference
 * Primary: #6238E8 | Background: #F7F8FC | Card: #FFFFFF | Text: #17213A
 * Fully Polished for Desktop, Laptop, Tablet, Android & iOS
 */

:root {
  --primary: #6238e8;
  --primary-hover: #5028d6;
  --primary-light: #f0edfd;
  --primary-subtle: #f8f6fe;
  
  --bg-main: #f7f8fc;
  --bg-card: #ffffff;
  --bg-input: #ffffff;
  
  --text-primary: #17213a;
  --text-secondary: #6e768e;
  --text-muted: #94a3b8;
  
  --border-color: #e6e9f2;
  --border-light: #f1f4f9;
  
  --success: #10b981;
  --success-bg: #e7f9f0;
  --success-text: #0a8558;
  
  --danger: #ef4444;
  --danger-bg: #fee2e2;
  --danger-text: #dc2626;
  
  --warning: #f59e0b;
  --warning-bg: #fef3c7;
  --warning-text: #d97706;

  --blue: #3b82f6;
  --blue-bg: #eff6ff;
  --blue-text: #1d4ed8;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.02);
  --shadow-md: 0 4px 16px rgba(98, 56, 232, 0.05), 0 2px 6px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 30px rgba(98, 56, 232, 0.08), 0 4px 12px rgba(0, 0, 0, 0.03);
  
  --sidebar-width: 250px;
  --header-height: 70px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  max-width: 100vw;
  overflow-x: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--primary-hover);
}

/* ========================================================
   LAYOUT & SHELL
   ======================================================== */
.app-container {
  display: flex;
  min-height: 100vh;
  position: relative;
  width: 100%;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-card);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: var(--transition);
}

.sidebar-header {
  height: var(--header-height);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-light);
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-icon {
  width: 38px;
  height: 38px;
  background: var(--primary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(98, 56, 232, 0.3);
}

.brand-info {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: 0.5px;
}

.brand-sub {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
}

.sidebar-close-btn {
  display: none;
}

.sidebar-nav {
  flex: 1;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 13.5px;
  transition: var(--transition);
}

.nav-link svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: currentColor;
}

.nav-link:hover {
  background: var(--primary-subtle);
  color: var(--primary);
}

.nav-link.active {
  background: var(--primary-light);
  color: var(--primary);
}

.nav-link.active svg {
  color: var(--primary);
}

.sidebar-footer {
  padding: 16px 14px 20px;
  border-top: 1px solid var(--border-light);
}

.logout-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: var(--danger);
  font-weight: 600;
  font-size: 13.5px;
  transition: var(--transition);
}

.logout-link:hover {
  background: var(--danger-bg);
  color: var(--danger-text);
}

/* Main Content Area */
.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: calc(100% - var(--sidebar-width));
}

/* Header Navbar */
.top-navbar {
  height: var(--header-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
}

.top-navbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
}

.mobile-menu-btn:hover {
  background: var(--bg-main);
}

.header-title-box {
  min-width: 0;
}

.header-title-box h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-title-box p {
  font-size: 12.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-navbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: var(--transition);
}

.icon-btn:hover {
  background: var(--primary-subtle);
  color: var(--primary);
  border-color: #d8d0f8;
}

.notification-badge {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid #ffffff;
}

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px 5px 6px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 99px;
  cursor: pointer;
  position: relative;
  transition: var(--transition);
}

.user-profile-badge:hover {
  border-color: #cbd5e1;
  background: #ffffff;
}

.user-avatar {
  width: 32px;
  height: 32px;
  background: var(--primary);
  color: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  overflow: hidden;
  flex-shrink: 0;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-meta {
  display: flex;
  flex-direction: column;
}

.user-meta .name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.user-meta .role {
  font-size: 11px;
  color: var(--text-secondary);
}

/* User Dropdown Menu */
.user-dropdown {
  position: absolute;
  top: 115%;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 210px;
  max-width: 90vw;
  padding: 8px;
  display: none;
  flex-direction: column;
  gap: 4px;
  z-index: 200;
}

.user-dropdown.show {
  display: flex;
}

.user-dropdown a {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-dropdown a:hover {
  background: var(--primary-subtle);
  color: var(--primary);
}

.user-dropdown a.logout {
  color: var(--danger);
  border-top: 1px solid var(--border-light);
  margin-top: 4px;
}

.user-dropdown a.logout:hover {
  background: var(--danger-bg);
}

/* Page Content */
.content-body {
  padding: 28px 32px;
  flex: 1;
  min-width: 0;
}

/* ========================================================
   CARDS & STATS
   ======================================================== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  position: relative;
  margin-bottom: 24px;
}

.card:last-child {
  margin-bottom: 0;
}

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

.card-title-group h2, .card-title-group h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.card-title-group p {
  font-size: 12.5px;
  color: var(--text-secondary);
}

/* 4 Stat Cards Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #d4d0f5;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon.green {
  background: var(--success-bg);
  color: var(--success);
}

.stat-icon.blue {
  background: var(--blue-bg);
  color: var(--blue);
}

.stat-icon.purple {
  background: var(--primary-light);
  color: var(--primary);
}

.stat-icon.warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.stat-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: capitalize;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ========================================================
   TABLES & CONTROLS
   ======================================================== */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
  position: relative;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  background: #f8fafc;
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.data-table td {
  padding: 15px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  font-size: 13.5px;
  vertical-align: middle;
}

.data-table tbody tr {
  transition: var(--transition);
}

.data-table tbody tr:hover {
  background: #fafafc;
}

.sub-cell-text {
  font-size: 12px;
  color: var(--text-muted);
  display: block;
  margin-top: 3px;
}

/* Styling Khusus Form Tabel Item Cash Sales (Rapi, Luas, Bebas Terpotong) */
#itemsTable {
  min-width: 1230px;
}

#itemsTable th {
  padding: 12px 10px !important;
  font-size: 11.5px !important;
  color: var(--text-secondary) !important;
  background: #f8fafc !important;
  border-bottom: 2px solid var(--border-color) !important;
  white-space: nowrap !important;
}

#itemsTable td {
  padding: 10px 8px !important;
  vertical-align: middle !important;
  border-bottom: 1px solid var(--border-light) !important;
}

#itemsTable .form-control {
  min-height: 40px !important;
  height: 40px !important;
  padding: 6px 10px !important;
  font-size: 13px !important;
  border-radius: 8px !important;
  box-sizing: border-box !important;
  width: 100% !important;
  background: #ffffff !important;
  border: 1px solid var(--border-color) !important;
}

#itemsTable select.form-control {
  padding-right: 26px !important;
  background-size: 14px !important;
}

#itemsTable .input-prod-name {
  margin-top: 6px !important;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.badge-cash, .badge-success {
  background: var(--success-bg);
  color: var(--success-text);
}

.badge-credit-card {
  background: #fef3c7;
  color: #b45309;
}

.badge-debit-card {
  background: #e0e7ff;
  color: #4338ca;
}

.badge-transfer, .badge-blue {
  background: var(--blue-bg);
  color: var(--blue-text);
}

.badge-qris, .badge-duitnow-qr, .badge-purple {
  background: var(--primary-light);
  color: var(--primary);
}

.badge-stock {
  font-weight: 700;
}

/* Action Icon Buttons */
.action-btns {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-icon-square {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.btn-icon-square.edit {
  background: #ede9fe;
  color: var(--primary);
}

.btn-icon-square.edit:hover {
  background: var(--primary);
  color: #ffffff;
}

.btn-icon-square.delete {
  background: #fee2e2;
  color: var(--danger);
}

.btn-icon-square.delete:hover {
  background: var(--danger);
  color: #ffffff;
}

.btn-icon-square.view {
  background: #e0f2fe;
  color: #0284c7;
}

.btn-icon-square.view:hover {
  background: #0284c7;
  color: #ffffff;
}

/* Table Controls Toolbar */
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  min-width: 260px;
}

.search-box input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  font-size: 13.5px;
  outline: none;
  transition: var(--transition);
}

.search-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(98, 56, 232, 0.12);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

/* ========================================================
   BUTTONS & FORMS
   ======================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(98, 56, 232, 0.25);
}

.btn-primary:hover {
  background: var(--primary-hover);
  color: #ffffff;
  box-shadow: 0 6px 16px rgba(98, 56, 232, 0.35);
}

.btn-outline {
  background: transparent;
  border-color: var(--border-color);
  color: var(--text-primary);
}

.btn-outline:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.btn-outline-primary {
  background: transparent;
  border-color: #c4b5fd;
  color: var(--primary);
}

.btn-outline-primary:hover {
  background: var(--primary-light);
  border-color: var(--primary);
}

.btn-success {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}

.btn-success:hover {
  background: #059669;
  color: #ffffff;
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-danger-outline {
  background: #fef2f2;
  color: var(--danger);
  border: 1px solid #fecaca;
}

.btn-danger-outline:hover {
  background: var(--danger);
  color: #ffffff;
}

.btn-sm {
  padding: 7px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

/* Form Controls */
.form-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.form-label .required {
  color: var(--danger);
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  font-size: 13.5px;
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  outline: none;
  transition: var(--transition);
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(98, 56, 232, 0.12);
}

.form-control[readonly] {
  background: #f8fafc;
  color: #64748b;
  cursor: not-allowed;
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236e768e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 36px;
}

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

/* ========================================================
   DIK-APPS CASH SALES FORM STYLES
   ======================================================== */
.dikapps-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.dikapps-toolbar-left,
.dikapps-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.print-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: #ffffff;
  font-size: 12.5px;
  color: var(--text-secondary);
  font-weight: 600;
}

.store-select-btn {
  background: #f1edfe;
  color: #6238e8;
  border: 1px solid #ddd6fe;
  font-weight: 700;
  padding: 9px 14px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.btn-print-kedai {
  background: #6238e8;
  color: #ffffff;
  border: 1px solid #582be8;
  font-weight: 600;
}
.btn-print-kedai:hover {
  background: #5027cb;
  color: #ffffff;
}

.btn-save-data {
  background: #1d4ed8;
  color: #ffffff;
  border: 1px solid #1e40af;
  font-weight: 600;
}
.btn-save-data:hover {
  background: #1e40af;
  color: #ffffff;
}

.btn-print-lokal {
  background: #059669;
  color: #ffffff;
  border: 1px solid #047857;
  font-weight: 600;
}
.btn-print-lokal:hover {
  background: #047857;
  color: #ffffff;
}

.display-settings-row {
  display: flex;
  align-items: center;
  gap: 20px;
}

.display-logo-preview-box {
  width: 90px;
  height: 90px;
  min-width: 90px;
  border-radius: 12px;
  border: 1.5px dashed #cbd5e1;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.item-card-dikapps {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

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

.item-badge-pill {
  background: #ede9fe;
  color: #6238e8;
  font-size: 11.5px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 6px;
  letter-spacing: 0.5px;
}

.btn-remove-item {
  background: transparent;
  border: none;
  color: #ef4444;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.btn-remove-item:hover {
  background: #fee2e2;
}

.item-row-3col {
  display: grid;
  grid-template-columns: 2fr 1.6fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.item-row-5col {
  display: grid;
  grid-template-columns: 1.5fr 0.8fr 0.9fr 1.1fr 1.1fr;
  gap: 12px;
}

.summary-dikapps-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 24px;
}

.summary-totals-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Alert Toasts & Messages */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.alert-success {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.alert-danger {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* Modal Dialog */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.show {
  display: flex;
}

.modal-box {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  max-width: 500px;
  width: 100%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  animation: modalEnter 0.2s ease-out;
}

@keyframes modalEnter {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 20px;
  line-height: 1;
}

.modal-body {
  padding: 22px;
}

.modal-footer {
  padding: 16px 22px;
  background: #f8fafc;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ========================================================
   RESPONSIVE MEDIA QUERIES (Universal All-Phones & Tablets)
   ======================================================== */

/* Tablet & Medium Screens */
@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Smartphone & Small Screens (Android, iPhone, All Brands 320px - 850px) */
@media (max-width: 850px) {
  html, body {
    max-width: 100vw;
    overflow-x: hidden;
  }

  /* 1. Sidebar Drawer */
  .sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
    width: 280px;
    max-width: 85vw;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .sidebar-header {
    justify-content: space-between;
  }

  .sidebar-close-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--border-light);
    background: #f8fafc;
    color: var(--text-secondary);
    cursor: pointer;
  }

  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    z-index: 99;
  }

  .sidebar-backdrop.active {
    display: block;
  }

  .main-wrapper {
    margin-left: 0;
    width: 100%;
    min-width: 0;
  }

  /* 2. Top Navigation Bar (Tidak Ada Tulisan Terpotong) */
  .top-navbar {
    padding: 0 12px;
    height: 62px;
  }

  .mobile-menu-btn {
    display: flex !important;
    padding: 6px;
  }

  .top-navbar-left {
    gap: 10px;
    min-width: 0;
    flex: 1;
  }

  .header-title-box {
    min-width: 0;
    flex: 1;
  }

  .header-title-box h1 {
    font-size: clamp(14px, 4.2vw, 17px);
    white-space: normal !important;
    line-height: 1.25;
    word-break: break-word;
    overflow: visible;
    text-overflow: clip;
  }

  .header-title-box p {
    display: none !important;
  }

  .top-navbar-right {
    gap: 8px;
  }

  .icon-btn {
    width: 34px;
    height: 34px;
  }

  .user-profile-badge {
    padding: 3px 6px 3px 3px;
    gap: 4px;
  }

  .user-meta {
    display: none !important; /* Sembunyikan nama panjang di HP agar judul tidak terdesak */
  }

  .user-dropdown {
    right: 0;
    max-width: 85vw;
  }

  /* 3. Konten Utama & Kartu */
  .content-body {
    padding: 14px 12px 60px;
    min-width: 0;
  }

  .card {
    padding: 16px 14px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    word-break: break-word;
  }

  .card-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 14px;
  }

  .card-title-group h2,
  .card-title-group h3 {
    font-size: clamp(15px, 4.5vw, 17px);
    word-break: break-word;
    line-height: 1.3;
  }

  /* 4. Stat Cards di HP */
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .stat-card {
    padding: 16px 14px;
    gap: 14px;
  }

  .stat-value {
    font-size: clamp(18px, 5.5vw, 22px);
    white-space: normal !important;
    word-break: break-word;
  }

  /* 5. Toolbars & Pencarian */
  .table-toolbar {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 14px;
  }

  .search-box {
    width: 100%;
    min-width: 0;
  }

  .table-toolbar select.form-control,
  .table-toolbar .btn {
    width: 100%;
    justify-content: center;
  }

  /* 6. Form Multi-Kolom Menjadi 1 Kolom Rapi di Semua HP */
  .form-dual-grid,
  .form-summary-grid,
  .products-grid-layout,
  .profile-grid-layout,
  .stats-dual-grid,
  .form-row-2col,
  .item-row-3col,
  .item-row-5col,
  .summary-dikapps-grid {
    grid-template-columns: 1fr !important;
    width: 100% !important;
    gap: 14px !important;
  }

  .display-settings-row {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 14px !important;
  }

  .dikapps-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .dikapps-toolbar-left,
  .dikapps-toolbar-right {
    width: 100%;
    justify-content: stretch;
  }
  .dikapps-toolbar-left .btn,
  .dikapps-toolbar-right .btn,
  .dikapps-toolbar-right .store-select-btn {
    flex: 1 1 calc(50% - 6px);
    justify-content: center;
  }

  .cash-sales-actions {
    justify-content: stretch !important;
    width: 100%;
    gap: 8px;
  }
  .cash-sales-actions .btn {
    flex: 1 1 calc(50% - 4px);
    font-size: 12px;
  }
  .cash-sales-actions .btn-primary {
    flex: 1 1 100%;
    order: -1;
    padding: 13px;
    font-size: 14.5px;
  }

  .reports-toolbar-form {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
  }
  .reports-filter-left {
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100% !important;
    gap: 8px !important;
  }
  .reports-filter-left select.form-control {
    width: 100% !important;
  }
  .reports-export-btns {
    width: 100% !important;
    display: flex;
    gap: 8px;
  }
  .reports-export-btns .btn {
    flex: 1 !important;
    justify-content: center !important;
  }

  /* 7. Input & Touch Targets (Nyaman di Semua Layar HP) */
  .form-control, 
  .search-box input, 
  select.form-control,
  .login-input {
    font-size: 16px !important;
    min-height: 44px;
  }

  .btn {
    min-height: 42px;
  }

  /* 8. Pagination di HP */
  .products-pagination {
    flex-direction: column;
    gap: 10px;
    align-items: center;
    text-align: center;
  }
}

/* Tip Scroll Khusus Tabel di HP */
.mobile-table-tip {
  display: none;
  font-size: 11.5px;
  color: var(--primary);
  background: var(--primary-light);
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 8px;
  font-weight: 600;
  border: 1px solid #dcd7fa;
}

@media (max-width: 850px) {
  .mobile-table-tip {
    display: block;
  }
}

@media (min-width: 851px) {
  .sidebar-close-btn {
    display: none !important;
  }
}
