/* ============================================
   JOUGA GROUP — Business Admin Dashboard
   Dark-theme operational sidebar dashboard
   ============================================ */

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

:root {
  --bg: #F5F5F5;
  --surface: #FFFFFF;
  --card: #FFFFFF;
  --card-hover: #EEEEEE;
  --primary: #F8CB46;
  --primary-light: #FBD96B;
  --primary-dark: #D9A400;
  --primary-ink: #7A6200;
  --primary-bg: rgba(248,203,70,0.15);
  --text: #212121;
  --text-sec: #616161;
  --text-muted: #9E9E9E;
  --success: #22C55E;
  --success-bg: rgba(34,197,94,0.15);
  --error: #EF4444;
  --error-bg: rgba(239,68,68,0.15);
  --warning: #F59E0B;
  --warning-bg: rgba(245,158,11,0.15);
  --info: var(--primary-ink);
  --info-bg: var(--primary-bg);
  --border: rgba(0,0,0,0.08);
  --border-light: rgba(0,0,0,0.12);
  --shadow: 0 4px 24px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.12);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.2);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --sidebar-width: 260px;
  --topbar-height: 60px;
  --transition: 0.2s ease;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img, video { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font: inherit; color: inherit; outline: none; }
ul, ol { list-style: none; }

/* ─── Scrollbar ────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.25); }

/* ─── Layout ───────────────────────────────── */
.sidebar {
  position: fixed;
  left: 0; top: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-logo {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  gap: 10px;
}

.sidebar-logo .logo-icon {
  width: 36px; height: 36px;
  background: var(--primary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 21px;
  color: #212121;
  flex-shrink: 0;
}

.sidebar-logo .logo-text {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-logo .logo-badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary-ink);
  background: var(--primary-bg);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: auto;
  flex-shrink: 0;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.nav-section-label {
  padding: 16px 20px 6px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: var(--text-sec);
  font-size: 15px;
  font-weight: 500;
  transition: all var(--transition);
  cursor: pointer;
  border-left: 3px solid transparent;
  margin: 2px 0;
}

.nav-item:hover {
  color: var(--text);
  background: rgba(0,0,0,0.04);
}

.nav-item.active {
  color: var(--primary-ink);
  background: var(--primary-bg);
  border-left-color: var(--primary);
  font-weight: 600;
}

.nav-item .nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.nav-item .nav-badge {
  margin-left: auto;
  background: var(--error);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-footer .user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--primary-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  color: var(--primary-ink);
  flex-shrink: 0;
}

.sidebar-footer .user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-footer .user-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-footer .user-role {
  font-size: 13px;
  color: var(--text-muted);
}

.sidebar-footer .logout-btn {
  padding: 6px;
  color: var(--text-muted);
  transition: color var(--transition);
}

.sidebar-footer .logout-btn:hover {
  color: var(--error);
}

/* ─── Main Content ─────────────────────────── */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  transition: margin-left var(--transition);
}

/* ─── Top Bar ──────────────────────────────── */
.topbar {
  height: var(--topbar-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hamburger {
  display: none;
  padding: 8px;
  color: var(--text-sec);
  font-size: 23px;
  cursor: pointer;
}

.page-title {
  font-size: 21px;
  font-weight: 700;
  color: var(--text);
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.topbar-search input {
  width: 100%;
  padding: 8px 14px 8px 36px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 15px;
  transition: border-color var(--transition);
}

.topbar-search input:focus { border-color: var(--primary); }
.topbar-search input::placeholder { color: var(--text-muted); }

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

.notification-btn {
  position: relative;
  padding: 8px;
  color: var(--text-sec);
  font-size: 21px;
  transition: color var(--transition);
}

.notification-btn:hover { color: var(--text); }

.notification-btn .badge {
  position: absolute;
  top: 4px; right: 4px;
  width: 8px; height: 8px;
  background: var(--error);
  border-radius: 50%;
  border: 2px solid var(--surface);
}

.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
  position: relative;
}

.user-menu-btn:hover { background: rgba(255,255,255,0.05); }

.user-menu-btn .avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--primary-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: var(--primary-ink);
}

.user-menu-btn .user-name {
  font-size: 15px;
  font-weight: 600;
}

.user-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 180px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: all var(--transition);
  z-index: 60;
}

.user-dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.user-dropdown a,
.user-dropdown button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  font-size: 15px;
  color: var(--text-sec);
  transition: all var(--transition);
  text-align: left;
}

.user-dropdown a:hover,
.user-dropdown button:hover {
  background: rgba(255,255,255,0.04);
  color: var(--text);
}

.user-dropdown .divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* ─── Page Container ───────────────────────── */
.page-container {
  padding: 24px;
}

/* ─── Metric Cards ─────────────────────────── */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.metric-card .metric-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-sec);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.metric-card .metric-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
}

.metric-card .metric-sub {
  font-size: 14px;
  color: var(--text-muted);
}

.metric-card .metric-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 21px;
  margin-bottom: 4px;
}

.metric-card .metric-icon.primary { background: var(--primary-bg); color: var(--primary-ink); }
.metric-card .metric-icon.success { background: var(--success-bg); color: var(--success); }
.metric-card .metric-icon.warning { background: var(--warning-bg); color: var(--warning); }
.metric-card .metric-icon.error { background: var(--error-bg); color: var(--error); }
.metric-card .metric-icon.info { background: var(--info-bg); color: var(--info); }

/* ─── Content Grid ─────────────────────────── */
.content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.content-grid.full { grid-template-columns: 1fr; }

/* ─── Data Tables ──────────────────────────── */
.table-wrapper {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.table-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.table-header-title {
  font-size: 18px;
  font-weight: 700;
}

.table-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.data-table thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: color var(--transition);
}

.data-table thead th:hover { color: var(--text-sec); }
.data-table thead th.sorted { color: var(--primary-ink); }

.data-table thead th .sort-icon {
  margin-left: 4px;
  font-size: 12px;
}

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

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: rgba(255,255,255,0.02); }

.data-table .cell-main {
  font-weight: 600;
  color: var(--text);
}

.table-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  color: var(--text-muted);
}

.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-sec);
  transition: all var(--transition);
}

.pagination a:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.pagination .active { background: var(--primary); color: #212121; }
.pagination .disabled { opacity: 0.3; pointer-events: none; }

/* ─── Status Badges ────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  text-transform: capitalize;
}

.status-badge .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
}

.status-badge.active,
.status-badge.online,
.status-badge.delivered,
.status-badge.approved { background: var(--success-bg); color: var(--success); }
.status-badge.active .dot,
.status-badge.online .dot,
.status-badge.delivered .dot,
.status-badge.approved .dot { background: var(--success); }

.status-badge.inactive,
.status-badge.offline,
.status-badge.cancelled,
.status-badge.rejected,
.status-badge.returned,
.status-badge.refunded { background: var(--error-bg); color: var(--error); }
.status-badge.inactive .dot,
.status-badge.offline .dot,
.status-badge.cancelled .dot,
.status-badge.rejected .dot,
.status-badge.returned .dot,
.status-badge.refunded .dot { background: var(--error); }

.status-badge.pending,
.status-badge.created,
.status-badge.picking,
.status-badge.processing { background: var(--warning-bg); color: var(--warning); }
.status-badge.pending .dot,
.status-badge.created .dot,
.status-badge.picking .dot,
.status-badge.processing .dot { background: var(--warning); }

.status-badge.confirmed,
.status-badge.packed { background: var(--info-bg); color: var(--info); }
.status-badge.confirmed .dot,
.status-badge.packed .dot { background: var(--info); }

.status-badge.on_delivery,
.status-badge.out_for_delivery { background: var(--primary-bg); color: var(--primary-ink); }
.status-badge.on_delivery .dot,
.status-badge.out_for_delivery .dot { background: var(--primary); }

.status-badge.suspended,
.status-badge.paused { background: rgba(97,97,97,0.15); color: #616161; }
.status-badge.suspended .dot,
.status-badge.paused .dot { background: #616161; }

/* ─── Forms ────────────────────────────────── */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-sec);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 15px;
  transition: border-color var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--primary);
}

.form-input::placeholder { color: var(--text-muted); }

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238899AA' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-select option { background: var(--surface); color: var(--text); }

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

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.form-help {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-error {
  font-size: 13px;
  color: var(--error);
  margin-top: 4px;
}

/* ─── Buttons ──────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  border: none;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  color: #212121;
}

.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }

.btn-secondary {
  background: var(--card);
  border: 1px solid var(--border-light);
  color: var(--text);
}

.btn-secondary:hover:not(:disabled) { background: var(--card-hover); }

.btn-danger {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid rgba(239,68,68,0.2);
}

.btn-danger:hover:not(:disabled) { background: var(--error); color: #fff; }

.btn-success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(34,197,94,0.2);
}

.btn-success:hover:not(:disabled) { background: var(--success); color: #fff; }

.btn-warning {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid rgba(245,158,11,0.2);
}

.btn-warning:hover:not(:disabled) { background: var(--warning); color: #fff; }

.btn-ghost {
  background: transparent;
  color: var(--text-sec);
}

.btn-ghost:hover:not(:disabled) { background: rgba(255,255,255,0.05); color: var(--text); }

.btn-sm { padding: 5px 10px; font-size: 14px; }
.btn-lg { padding: 12px 24px; font-size: 17px; }
.btn-icon { padding: 8px; width: 36px; height: 36px; }

/* ─── Modals ───────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(10px);
  transition: transform var(--transition);
  box-shadow: var(--shadow-lg);
}

.modal.modal-lg { max-width: 720px; }
.modal.modal-xl { max-width: 900px; }

.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

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

.modal-title {
  font-size: 18px;
  font-weight: 700;
}

.modal-close {
  padding: 4px;
  color: var(--text-muted);
  font-size: 21px;
  transition: color var(--transition);
}

.modal-close:hover { color: var(--text); }

.modal-body {
  padding: 24px;
}

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

/* ─── Confirm Dialog ───────────────────────── */
.confirm-dialog .modal { max-width: 400px; }
.confirm-dialog .modal-body { text-align: center; }
.confirm-dialog .confirm-icon { font-size: 40px; margin-bottom: 12px; }
.confirm-dialog .confirm-text { font-size: 16px; color: var(--text-sec); margin-top: 4px; }

/* ─── Filters Bar ──────────────────────────── */
.filters-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-chip {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-sec);
  cursor: pointer;
  transition: all var(--transition);
}

.filter-chip:hover { border-color: var(--text-muted); color: var(--text); }

.filter-chip.active {
  background: var(--primary-bg);
  border-color: var(--primary);
  color: var(--primary-ink);
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 360px;
}

.search-box input {
  width: 100%;
  padding: 8px 14px 8px 36px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 15px;
}

.search-box input:focus { border-color: var(--primary); }
.search-box input::placeholder { color: var(--text-muted); }

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

/* ─── Charts ───────────────────────────────── */
.chart-container {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  min-height: 280px;
  position: relative;
}

.chart-container .chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.chart-container .chart-title {
  font-size: 16px;
  font-weight: 700;
}

.chart-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 240px;
  color: var(--text-muted);
  font-size: 15px;
  gap: 8px;
}

.chart-placeholder .chart-icon { font-size: 32px; opacity: 0.3; }

.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 200px;
  padding: 0 10px;
}

.chart-bar {
  flex: 1;
  background: var(--primary);
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  position: relative;
  transition: background var(--transition);
}

.chart-bar:hover { background: var(--primary-light); }

.chart-bar .bar-label {
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.chart-bar .bar-value {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-sec);
  white-space: nowrap;
}

/* ─── Kanban Board ─────────────────────────── */
.kanban-board {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 16px;
  min-height: 400px;
}

.kanban-column {
  flex: 0 0 300px;
  min-width: 300px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 220px);
}

.kanban-column-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.kanban-column-title {
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.kanban-column-title .status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
}

.kanban-column-count {
  background: var(--card);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-sec);
}

.kanban-column-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kanban-empty {
  text-align: center;
  padding: 40px 16px;
  color: var(--text-muted);
  font-size: 15px;
}

.kanban-empty .empty-icon {
  font-size: 32px;
  margin-bottom: 8px;
  opacity: 0.4;
}

/* ─── Map Placeholder ──────────────────────── */
.map-container {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.map-placeholder {
  text-align: center;
  color: var(--text-muted);
}

.map-placeholder .map-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.3;
}

.map-controls {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.radius-slider {
  width: 100%;
  appearance: none;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
}

.radius-slider::-webkit-slider-thumb {
  appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
}

/* ─── Tab Navigation ───────────────────────── */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.tab {
  padding: 10px 20px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-sec);
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
  cursor: pointer;
}

.tab:hover { color: var(--text); }

.tab.active {
  color: var(--primary-ink);
  border-bottom-color: var(--primary);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

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

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.3;
}

.empty-state .empty-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-sec);
  margin-bottom: 4px;
}

.empty-state .empty-text {
  font-size: 15px;
  margin-bottom: 20px;
}

/* ─── Loading State ────────────────────────── */
.loading-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ─── Error State ──────────────────────────── */
.error-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--error);
}

.error-state .error-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

/* ─── Quick Actions ────────────────────────── */
.quick-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.quick-action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-sec);
  transition: all var(--transition);
}

.quick-action-btn:hover {
  border-color: var(--primary);
  color: var(--primary-ink);
  background: var(--primary-bg);
}

.quick-action-btn .qa-icon {
  font-size: 18px;
}

/* ─── Timeline ─────────────────────────────── */
.timeline {
  position: relative;
  padding-left: 28px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: 20px;
}

.timeline-item:last-child { padding-bottom: 0; }

.timeline-dot {
  position: absolute;
  left: -24px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--success);
  border: 2px solid var(--surface);
}

.timeline-dot.pending { background: var(--text-muted); }
.timeline-dot.active { background: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg); }

.timeline-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.timeline-meta {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ─── Toast Notifications ──────────────────── */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toastIn 0.25s ease;
  font-size: 15px;
}

.toast.removing { animation: toastOut 0.25s ease forwards; }

.toast-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
}

.toast-success .toast-icon { background: var(--success-bg); color: var(--success); }
.toast-error .toast-icon { background: var(--error-bg); color: var(--error); }
.toast-warning .toast-icon { background: var(--warning-bg); color: var(--warning); }
.toast-info .toast-icon { background: var(--info-bg); color: var(--info); }

.toast-message { flex: 1; color: var(--text); }

.toast-close {
  padding: 2px;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(40px); }
}

/* ─── Detail Cards ─────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
}

.detail-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.detail-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.detail-card-body {
  padding: 20px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
}

.info-row:last-child { border-bottom: none; }

.info-row .info-label { color: var(--text-sec); }
.info-row .info-value { color: var(--text); font-weight: 600; }

/* ─── Settings Sections ────────────────────── */
.settings-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

.settings-section-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* ─── Settings Tabs (reference-style) ──────── */
.set-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.set-nav {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  position: sticky;
  top: calc(var(--topbar-height) + 16px);
}

.set-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-sec);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: all var(--transition);
}

.set-nav a:hover {
  background: var(--card-hover);
  color: var(--text);
}

.set-nav a.active {
  background: var(--primary-bg);
  color: var(--primary-ink);
  border-left-color: var(--primary);
}

.set-nav .nav-icon {
  width: 20px;
  text-align: center;
  font-size: 16px;
}

.set-panel { display: none; }
.set-panel.active { display: block; }

.set-panel-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #212121;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 20px 24px;
}

.set-panel-header h2 {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 4px;
}

.set-panel-header p {
  font-size: 14px;
  opacity: 0.85;
}

.set-panel-body {
  background: var(--card);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 22px 24px 26px;
}

.set-section-label {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--primary-ink);
  margin: 22px 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.set-section-label:first-child { margin-top: 0; }

.set-info-box {
  background: var(--primary-bg);
  border: 1px solid rgba(248, 203, 70, 0.35);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 14px;
  color: var(--text-sec);
  line-height: 1.65;
  margin-bottom: 16px;
}

.set-info-box strong { color: var(--text); }

.set-toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
}

.set-toggle-row label {
  font-size: 15px;
  color: var(--text);
  font-weight: 500;
}

.set-secret-wrap {
  position: relative;
}

.set-secret-wrap .set-secret-eye {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 16px;
  padding: 4px;
}

.set-secret-wrap .form-input { padding-right: 38px; }

.set-gateway-grid {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.set-gateway-card {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 12px 18px;
  border: 2px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--card);
  min-width: 170px;
  transition: all var(--transition);
}

.set-gateway-card.selected {
  border-color: var(--primary);
  background: var(--primary-bg);
}

.set-gateway-card .gw-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.set-gateway-card .gw-desc {
  font-size: 13px;
  color: var(--text-muted);
}

.set-cred-box {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px;
  background: var(--bg);
  margin-bottom: 16px;
}

.set-cred-box.configured {
  background: var(--success-bg);
  border-color: rgba(34, 197, 94, 0.3);
}

.set-cred-box.not-configured {
  background: var(--warning-bg);
  border-color: rgba(245, 158, 11, 0.3);
}

.set-preview-img {
  max-height: 48px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px;
  background: var(--card);
  margin-bottom: 10px;
}

.set-flash {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 15px;
  font-weight: 500;
}

.set-flash.success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.set-flash.error {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.set-actions {
  margin-top: 22px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

@media (max-width: 900px) {
  .set-layout { grid-template-columns: 1fr; }
  .set-nav { position: static; display: flex; flex-wrap: wrap; }
  .set-nav a { flex: 1 1 140px; }
}


/* ─── Utility ──────────────────────────────── */
.text-primary { color: var(--primary-ink) !important; }
.text-success { color: var(--success) !important; }
.text-error { color: var(--error) !important; }
.text-warning { color: var(--warning) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-sec { color: var(--text-sec) !important; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.hidden { display: none !important; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-full { width: 100%; }

/* ─── Responsive ───────────────────────────── */
@media (max-width: 1200px) {
  .metrics-row {
    grid-template-columns: repeat(2, 1fr);
  }
  .content-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

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

  .main-content {
    margin-left: 0;
  }

  .hamburger {
    display: flex;
  }

  .metrics-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .page-container {
    padding: 16px;
  }

  .topbar {
    padding: 0 16px;
  }

  .topbar-search {
    display: none;
  }

  .table-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .filters-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .search-box {
    max-width: none;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
    display: none;
  }

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

  .kanban-board {
    flex-direction: column;
  }

  .kanban-column {
    flex: none;
    min-width: 100%;
    max-height: none;
  }

  .quick-actions {
    flex-direction: column;
  }

  .user-menu-btn .user-name {
    display: none;
  }
}

@media (max-width: 480px) {
  .metrics-row {
    grid-template-columns: 1fr;
  }

  .modal {
    margin: 12px;
    max-height: 95vh;
  }

  .modal-body {
    padding: 16px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }
}
