:root {
  --sidebar-width: 250px;
  --color-primary: #e8852e;
  --color-primary-dark: #d4701a;
  --color-dark: #1a1a1a;
  --color-sidebar: #1a1a1a;
  --color-sidebar-hover: #2a2a2a;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f5f5f5;
  margin: 0;
  padding: 0;
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--color-dark) 0%, #2c1810 100%);
}

.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.3);
}

.login-card .logo {
  text-align: center;
  margin-bottom: 1.5rem;
}

.login-card .logo img {
  height: 48px;
}

.login-card h1 {
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 0.25rem;
  color: var(--color-dark);
}

.login-card .subtitle {
  text-align: center;
  color: #6c757d;
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

.admin-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--color-sidebar);
  color: #fff;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-brand img {
  height: 36px;
}

.sidebar-brand span {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0;
}

.sidebar-nav .nav-section {
  padding: 0.5rem 1.5rem 0.25rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.35);
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1.5rem;
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-size: 0.875rem;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
  background: var(--color-sidebar-hover);
  color: #fff;
}

.sidebar-nav a.active {
  background: var(--color-sidebar-hover);
  color: var(--color-primary);
  border-left-color: var(--color-primary);
}

.sidebar-nav a i {
  width: 20px;
  text-align: center;
  font-size: 1rem;
}

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-footer a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: rgba(255,255,255,0.5);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.2s;
}

.sidebar-footer a:hover {
  color: #fff;
}

.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 1.5rem 2rem;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.top-bar h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  color: var(--color-dark);
}

.top-bar .user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  color: #6c757d;
}

.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  border: 1px solid rgba(0,0,0,0.04);
  transition: transform 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
}

.stat-card .stat-label {
  font-size: 0.8rem;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.stat-card .stat-number {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-dark);
}

.stat-card .stat-icon {
  font-size: 2rem;
  color: var(--color-primary);
  opacity: 0.5;
}

.card {
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.04);
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.card-header {
  background: #fff;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  padding: 1rem 1.25rem;
  font-weight: 600;
}

.table {
  margin-bottom: 0;
  font-size: 0.875rem;
}

.table th {
  font-weight: 600;
  color: #495057;
  border-top: none;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.table td {
  vertical-align: middle;
}

.badge-status {
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
  border-radius: 50px;
  font-weight: 500;
}

.badge-draft { background: #fff3cd; color: #856404; }
.badge-sent { background: #e0e0e0; color: #333333; }
.badge-paid { background: #d4edda; color: #155724; }
.badge-cancelled { background: #f8d7da; color: #721c24; }
.badge-pending { background: #fff3cd; color: #856404; }
.badge-approved { background: #d4edda; color: #155724; }
.badge-rejected { background: #f8d7da; color: #721c24; }

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

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

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

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

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.modal-header {
  background: var(--color-sidebar);
  color: #fff;
  border-radius: 12px 12px 0 0;
}

.modal-header .btn-close {
  filter: invert(1);
}

.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
}

/* ============================================================
   ADMIN — MOBILE RESPONSIVE
   ============================================================ */

.nav-toggle {
  display: none;
}
.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--color-dark);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
  margin-right: 0.75rem;
}

.sidebar-toggle:focus {
  outline: 2px solid var(--color-primary);
  border-radius: 4px;
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
  opacity: 1;
}

/* ===== TABLET & MOBILE (max-width: 992px) ===== */
@media (max-width: 992px) {
  .stat-card .stat-number {
    font-size: 1.4rem;
  }

  .stat-card .stat-label {
    font-size: 0.7rem;
  }

  .stat-card .stat-icon {
    font-size: 1.5rem;
  }
}

/* ===== MOBILE (max-width: 768px) ===== */
@media (max-width: 768px) {
  .sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .sidebar {
    transform: translateX(-100%);
    width: 260px;
    transition: transform 0.3s cubic-bezier(.4,0,.2,1);
    z-index: 100;
  }

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

  .sidebar-overlay {
    display: block;
    pointer-events: none;
  }

  .sidebar-overlay.active {
    pointer-events: auto;
  }

  .sidebar .sidebar-brand span,
  .sidebar .nav-section,
  .sidebar-nav a span {
    display: inline;
  }

  .sidebar-nav a {
    justify-content: flex-start;
    padding: 0.65rem 1.5rem;
  }

  .main-content {
    margin-left: 0;
    padding: 1rem;
  }

  .top-bar h2 {
    font-size: 1.2rem;
  }

  .top-bar {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .user-info {
    font-size: 0.8rem;
  }

  .stat-card {
    padding: 1rem;
  }

  .card-header {
    font-size: 0.9rem;
    padding: 0.75rem 1rem;
  }

  .table {
    font-size: 0.8rem;
  }

  .table th, .table td {
    padding: 0.5rem;
    white-space: nowrap;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .section-header .btn {
    width: 100%;
  }

  .modal-dialog {
    margin: 0.5rem;
  }

  .modal-content {
    border-radius: 12px;
  }

  .login-card {
    padding: 1.5rem;
    margin: 1rem;
  }

  .login-card h1 {
    font-size: 1.2rem;
  }
}

/* ===== SMALL PHONES (max-width: 576px) ===== */
@media (max-width: 576px) {
  .sidebar {
    width: 100%;
    max-width: 280px;
  }

  .main-content {
    padding: 0.75rem;
  }

  .top-bar h2 {
    font-size: 1rem;
  }

  .stat-card .stat-number {
    font-size: 1.2rem;
  }

  .table {
    font-size: 0.75rem;
  }

  .table th, .table td {
    padding: 0.4rem;
  }

  .modal-dialog {
    margin: 0;
    height: 100%;
    max-height: 100%;
  }

  .modal-content {
    border-radius: 0;
    min-height: 100vh;
    border: none;
  }

  .modal-header {
    border-radius: 0;
  }

  .section-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .section-header .btn {
    width: 100%;
  }

  .login-card {
    padding: 1.25rem;
    margin: 0.75rem;
    border-radius: 12px;
  }

  .login-card .logo img {
    height: 36px;
  }

  .btn {
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
  }

  .badge-status {
    font-size: 0.65rem;
    padding: 0.2rem 0.5rem;
  }
}

/* ===== WORKER/CLIENT NAVBAR — MOBILE RESPONSIVE ===== */
@media (max-width: 768px) {
  .worker-nav, .client-nav {
    position: relative;
    flex-wrap: wrap;
  }

  .nav-toggle {
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    line-height: 1;
    min-width: 44px;
    min-height: 44px;
  }

  .worker-nav .nav-links,
  .client-nav .nav-links {
    display: none;
    width: 100%;
    flex-direction: column;
    padding: 0.75rem 0 0.25rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    margin-top: 0.75rem;
  }

  .worker-nav .nav-links.open,
  .client-nav .nav-links.open {
    display: flex;
  }

  .worker-nav .nav-links a,
  .client-nav .nav-links a {
    margin-left: 0;
    padding: 0.65rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-size: 0.9rem;
  }

  .worker-nav .nav-links a:last-child,
  .client-nav .nav-links a:last-child {
    border-bottom: none;
  }

  .worker-nav .brand span,
  .client-nav .brand span {
    font-size: 0.9rem;
  }
}

@media (max-width: 576px) {
  .worker-nav, .client-nav {
    padding: 0.6rem 1rem;
  }

  .worker-nav .brand img,
  .client-nav .brand img {
    height: 28px;
  }

  .worker-nav .brand span,
  .client-nav .brand span {
    font-size: 0.8rem;
  }
}

/* ===== RESPONSIVE TABLE HELPER ===== */
@media (max-width: 576px) {
  .table-responsive-card table,
  .table-responsive-card thead,
  .table-responsive-card tbody,
  .table-responsive-card th,
  .table-responsive-card td,
  .table-responsive-card tr {
    display: block;
  }

  .table-responsive-card thead {
    display: none;
  }

  .table-responsive-card tr {
    margin-bottom: 0.75rem;
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 8px;
    padding: 0.75rem;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  }

  .table-responsive-card td {
    padding: 0.35rem 0;
    border: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
  }

  .table-responsive-card td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #6c757d;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-right: 1rem;
    flex-shrink: 0;
  }
}
