:root {
  --bg-primary: #0f172a;
  --bg-surface: #1e293b;
  --bg-card: rgba(30, 41, 59, 0.75);
  --bg-card-hover: #334155;
  --border-color: rgba(255, 255, 255, 0.1);
  --border-light: rgba(255, 255, 255, 0.05);

  --navbar-bg: #0b1120;
  --footer-bg: #080c14;
  --sidebar-bg: #090d16;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-teal: #0d9488;
  --accent-teal-glow: rgba(13, 148, 136, 0.4);
  --accent-blue: #2563eb;
  --accent-gold: #f59e0b;
  --status-success: #10b981;
  --status-warning: #f59e0b;
  --status-danger: #ef4444;
  --status-info: #06b6d4;

  --sidebar-width: 270px;
  --navbar-height: 70px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-main: 0 10px 30px -5px rgba(0, 0, 0, 0.5);
  --font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

[data-theme="dark"] {
  --bg-primary: #0b1120;
  --bg-surface: #1e293b;
  --bg-card: rgba(30, 41, 59, 0.85);
  --bg-card-hover: #334155;
  --border-color: rgba(255, 255, 255, 0.12);
  --border-light: rgba(255, 255, 255, 0.06);

  --navbar-bg: #0b1120;
  --footer-bg: #080c14;
  --sidebar-bg: #090d16;

  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --shadow-main: 0 10px 30px -5px rgba(0, 0, 0, 0.5);
}

[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --border-color: #e2e8f0;
  --border-light: #f1f5f9;

  --navbar-bg: #ffffff;
  --footer-bg: #ffffff;
  --sidebar-bg: #ffffff;

  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;

  --shadow-main: 0 10px 30px -5px rgba(0, 0, 0, 0.08);
}

/* Sidebar Theme Rules */
[data-theme="light"] .sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid #e2e8f0;
}

[data-theme="light"] .sidebar-header {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

[data-theme="light"] .sidebar-footer {
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
}

[data-theme="light"] .user-name {
  color: #0f172a;
}

[data-theme="light"] .nav-link {
  color: #334155;
}

[data-theme="light"] .nav-link:hover {
  background: #f1f5f9;
  color: #0f172a;
}

[data-theme="light"] .nav-link.active {
  background: #e6fffa;
  color: #0d9488;
  border-left: 3px solid #0d9488;
}

[data-theme="light"] .nav-section-title {
  color: #64748b;
}

/* Navbar Theme Rules */
[data-theme="light"] .top-navbar {
  background: var(--navbar-bg) !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

[data-theme="light"] .branch-badge {
  background: #e6fffa;
  color: #0d9488;
  border: 1px solid #99f6e4;
}

[data-theme="light"] .app-footer {
  background: var(--footer-bg) !important;
  border-top: 1px solid #e2e8f0 !important;
  color: #64748b !important;
}

[data-theme="light"] .table th,
[data-theme="light"] .custom-table th {
  background: #f8fafc;
  color: #475569;
  border-bottom: 1px solid #e2e8f0;
}

[data-theme="light"] .table td,
[data-theme="light"] .custom-table td {
  color: #0f172a;
  border-bottom: 1px solid #f1f5f9;
}

[data-theme="light"] .table tbody tr:hover,
[data-theme="light"] .custom-table tbody tr:hover {
  background: rgba(0, 0, 0, 0.02);
}

[data-theme="light"] .form-control {
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #cbd5e1;
}

[data-theme="light"] .login-page-body {
  background: radial-gradient(circle at top right, #e2e8f0 0%, #cbd5e1 60%, #94a3b8 100%);
}

[data-theme="light"] .login-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  color: #0f172a;
}

[data-theme="light"] .login-title {
  color: #0f172a;
}

[data-theme="light"] .btn-secondary,
[data-theme="light"] a.btn-secondary,
[data-theme="light"] a.btn-secondary:visited {
  background: #e2e8f0;
  color: #0f172a !important;
  border: 1px solid #cbd5e1;
}

[data-theme="light"] .btn-secondary:hover,
[data-theme="light"] a.btn-secondary:hover {
  background: #cbd5e1;
  color: #0f172a !important;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

a {
  color: var(--accent-teal);
  text-decoration: none;
  transition: all 0.2s ease;
}

a:hover {
  color: #14b8a6;
}

/* App Layout Wrapper */
.app-wrapper {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.3s ease;
  min-width: 0;
  max-width: calc(100vw - var(--sidebar-width));
}

.content-container {
  padding: 1.5rem 2rem;
  flex: 1;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

/* Page Headers & Breadcrumbs */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.8rem;
}

.page-title {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.page-subtitle {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.branch-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.8rem;
  background: rgba(13, 148, 136, 0.15);
  border: 1px solid var(--accent-teal);
  color: var(--accent-teal);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
}

/* Top Navbar */
.top-navbar {
  height: var(--navbar-height);
  background: var(--navbar-bg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 90;
  transition: background 0.3s ease;
}

/* App Footer */
.app-footer {
  padding: 1.25rem 2rem;
  border-top: 1px solid var(--border-color);
  background: var(--footer-bg);
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  transition: background 0.3s ease, color 0.3s ease;
  margin-top: auto;
  width: 100%;
  box-sizing: border-box;
}

/* Glassmorphism Cards */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-main);
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.3s ease;
}

.card:hover {
  border-color: rgba(13, 148, 136, 0.4);
}

/* Alert Banners */
.alert {
  padding: 0.9rem 1.2rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.alert-success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid var(--status-success);
  color: #34d399;
}

.alert-warning {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid var(--status-warning);
  color: #fbbf24;
}

.alert-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--status-danger);
  color: #f87171;
}

/* Theme Toggle Button Styling */
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

[data-theme="light"] .theme-toggle-btn {
  background: #e2e8f0;
  border-color: rgba(0, 0, 0, 0.2);
  color: #0f172a;
}

.theme-toggle-btn:hover {
  background: rgba(13, 148, 136, 0.2);
  border-color: var(--accent-teal);
  color: var(--accent-teal);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none !important;
}

.btn-primary,
a.btn-primary,
a.btn-primary:visited {
  background: linear-gradient(135deg, #0d9488, #0f766e);
  color: #ffffff !important;
  box-shadow: 0 4px 14px var(--accent-teal-glow);
}

.btn-primary:hover,
a.btn-primary:hover,
a.btn-primary:focus {
  background: linear-gradient(135deg, #14b8a6, #0d9488);
  color: #ffffff !important;
  transform: translateY(-1px);
}

.btn-secondary,
a.btn-secondary,
a.btn-secondary:visited {
  background: #334155;
  color: #f8fafc !important;
  border: 1px solid var(--border-color);
}

.btn-secondary:hover,
a.btn-secondary:hover,
a.btn-secondary:focus {
  background: #475569;
  color: #ffffff !important;
}

.btn-success,
a.btn-success {
  background: var(--status-success);
  color: #ffffff !important;
}

.btn-danger,
a.btn-danger {
  background: var(--status-danger);
  color: #ffffff !important;
}
  color: white;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
}

/* Status Badges */
.badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-success {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.badge-info {
  background: rgba(6, 182, 212, 0.2);
  color: #22d3ee;
  border: 1px solid rgba(6, 182, 212, 0.4);
}

/* Sidebar Overlay for Mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 990;
  transition: opacity 0.3s ease;
}

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

/* Global Responsive Media Queries */
@media (max-width: 992px) {
  .main-content {
    margin-left: 0 !important;
    max-width: 100vw !important;
    width: 100vw !important;
  }

  .content-container {
    padding: 1.2rem 1rem !important;
  }

  .top-navbar {
    padding: 0 1rem !important;
  }

  .mobile-toggle-btn {
    display: inline-flex !important;
  }
}

@media (max-width: 768px) {
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .page-title {
    font-size: 1.35rem;
  }

  .navbar-info-text {
    display: none;
  }

  .content-container {
    padding: 1rem 0.75rem !important;
  }

  .card {
    padding: 1rem !important;
  }

  .table-controls-bar {
    flex-direction: column;
    align-items: stretch !important;
    gap: 0.75rem;
  }

  .table-search-box .search-input {
    width: 100% !important;
  }

  .table-pagination-bar {
    flex-direction: column;
    align-items: center !important;
    gap: 0.75rem;
    text-align: center;
  }

  .pagination-controls {
    flex-wrap: wrap;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .login-card {
    padding: 1.5rem 1rem !important;
  }

  .branch-badge {
    font-size: 0.7rem !important;
    padding: 0.25rem 0.5rem !important;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }
}
