:root {
  --app-primary: #4f46e5;
  --app-primary-dark: #4338ca;
  --app-secondary: #0f766e;
  --app-bg: #f1f5f9;
  --app-surface: #ffffff;
  --app-text: #1e293b;
  --app-muted: #64748b;
  --app-border: #e2e8f0;
  --app-shadow: 0 4px 24px rgba(15, 23, 42, 0.08);
  --app-radius: 1rem;
}

* { box-sizing: border-box; }

body.app-page,
body.dashboard-page,
body.reports-page {
  background: linear-gradient(180deg, #eef2ff 0%, var(--app-bg) 200px, #fff 100%);
  color: var(--app-text);
  min-height: 100vh;
}

body.auth-page {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #0f766e 100%);
  min-height: 100vh;
}

/* Navbar */
.app-navbar {
  background: linear-gradient(90deg, #312e81 0%, #4f46e5 55%, #6366f1 100%) !important;
  box-shadow: 0 2px 16px rgba(49, 46, 129, 0.25);
  padding-top: 0.65rem;
  padding-bottom: 0.65rem;
}

.app-navbar .navbar-brand,
.app-navbar .nav-link,
.app-navbar .navbar-text,
.app-navbar .navbar-toggler {
  font-weight: 700 !important;
  letter-spacing: 0.01em;
}

.app-navbar .nav-link {
  border-radius: 2rem;
  padding: 0.4rem 0.85rem !important;
  margin: 0.15rem 0.1rem;
  transition: background 0.2s;
}

.app-navbar .nav-link:hover,
.app-navbar .nav-link.active {
  background: rgba(255, 255, 255, 0.18);
}

.app-navbar .navbar-text {
  font-size: 0.9rem;
  opacity: 0.95;
}

@media (max-width: 991.98px) {
  .app-navbar .navbar-collapse {
    background: rgba(49, 46, 129, 0.95);
    border-radius: 0.75rem;
    padding: 0.75rem;
    margin-top: 0.5rem;
  }
}

/* Page layout */
.app-container {
  max-width: 1320px;
}

.app-hero {
  background: linear-gradient(135deg, var(--app-primary) 0%, #7c3aed 100%);
  color: #fff;
  border-radius: var(--app-radius);
  padding: 1.5rem 1.75rem;
  box-shadow: var(--app-shadow);
}

.app-hero-title {
  font-size: clamp(1.35rem, 4vw, 1.85rem);
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.app-hero-subtitle {
  opacity: 0.92;
  font-size: 0.95rem;
}

.app-hero-actions .btn {
  border-radius: 2rem;
  font-weight: 500;
}

/* Panels */
.app-panel {
  border: 0;
  border-radius: var(--app-radius);
  box-shadow: var(--app-shadow);
  overflow: hidden;
}

.app-panel-head {
  background: var(--app-surface);
  border-bottom: 1px solid var(--app-border);
  padding: 1rem 1.25rem;
  font-weight: 700;
  font-size: 1.05rem;
}

.app-panel-body {
  padding: 1.25rem;
  background: var(--app-surface);
}

.app-alert {
  border: 0;
  border-radius: 0.75rem;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

/* Forms */
.app-form .form-label,
.form-label {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--app-muted);
  margin-bottom: 0.35rem;
}

.app-form .form-control,
.app-form .form-select {
  border-radius: 0.65rem;
  border-color: var(--app-border);
  padding: 0.55rem 0.85rem;
}

.app-form .form-control:focus,
.app-form .form-select:focus {
  border-color: var(--app-primary);
  box-shadow: 0 0 0 0.2rem rgba(79, 70, 229, 0.15);
}

/* Buttons */
.btn {
  border-radius: 0.65rem;
  font-weight: 500;
}

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

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

.btn-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

/* Tables */
.app-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--app-border);
  border-radius: 0.75rem;
}

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

.app-table thead th,
.table thead th,
table thead th {
  background: #f8fafc;
  color: var(--app-text);
  font-weight: 700 !important;
  white-space: nowrap;
  padding: 0.75rem;
  border-bottom-width: 1px;
}

.app-table tbody td {
  padding: 0.7rem 0.75rem;
  vertical-align: middle;
}

.app-table tbody tr:hover {
  background: #f8fafc;
}

.app-table .btn-sm {
  border-radius: 0.5rem;
}

.status-badge {
  border-radius: 2rem;
  padding: 0.25rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-badge.approved,
.status-badge.ready {
  background: #dcfce7;
  color: #166534;
}

.status-badge.pending,
.status-badge.partial {
  background: #fef3c7;
  color: #92400e;
}

.status-badge.inactive {
  background: #f1f5f9;
  color: #475569;
}

.status-badge.admin {
  background: #e0e7ff;
  color: #3730a3;
}

/* Mobile responsive tables */
@media (max-width: 767.98px) {
  .app-panel-body {
    padding: 1rem;
  }

  .app-table thead {
    display: none;
  }

  .app-table tbody tr {
    display: block;
    margin-bottom: 0.85rem;
    border: 1px solid var(--app-border);
    border-radius: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: #fff;
  }

  .app-table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.45rem 0;
    border: 0;
    text-align: right !important;
  }

  .app-table tbody td::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--app-text);
    text-align: left;
    flex-shrink: 0;
  }

  .app-table tbody td.actions-cell {
    justify-content: flex-end;
    padding-top: 0.65rem;
    border-top: 1px dashed var(--app-border);
    margin-top: 0.25rem;
  }

  .app-table tbody td.actions-cell::before {
    display: none;
  }
}

/* Auth pages */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: #fff;
  border-radius: 1.25rem;
  padding: 2rem 1.75rem;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.2);
}

.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: var(--app-primary);
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.auth-brand i {
  font-size: 1.5rem;
}

.auth-title {
  text-align: center;
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.auth-links {
  text-align: center;
  margin-top: 1.25rem;
  font-size: 0.9rem;
}

.auth-links a {
  color: var(--app-primary);
  text-decoration: none;
  font-weight: 700;
}

.auth-links a:hover {
  text-decoration: underline;
}

/* Order form */
.order-form-panel .form-text {
  color: var(--app-muted);
}

.order-items-table {
  border-radius: 0.75rem;
  overflow: hidden;
}

/* Empty state */
.app-empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--app-muted);
}

.app-empty i {
  font-size: 2.5rem;
  opacity: 0.4;
  display: block;
  margin-bottom: 0.75rem;
}

/* Footer note */
.app-footer-note {
  text-align: center;
  color: var(--app-muted);
  font-size: 0.8rem;
  padding: 1.5rem 0 0.5rem;
}

/* Bold headings project-wide */
body.app-page h1,
body.app-page h2,
body.app-page h3,
body.app-page h4,
body.app-page h5,
body.app-page h6,
body.dashboard-page h1,
body.dashboard-page h2,
body.dashboard-page h3,
body.dashboard-page h4,
body.dashboard-page h5,
body.dashboard-page h6,
body.reports-page h1,
body.reports-page h2,
body.reports-page h3,
body.reports-page h4,
body.reports-page h5,
body.reports-page h6,
body.auth-page h1,
body.auth-page h2,
body.auth-page h3 {
  font-weight: 700 !important;
}

.modal-title,
.modal-header h5,
.modal-header h6,
.panel-head,
.panel-header,
#stockPopupModal h6 {
  font-weight: 700 !important;
}

.app-hero-actions .btn,
.quick-actions .btn {
  font-weight: 700;
}
