
:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --sidebar: #101b31;
  --sidebar-light: #1c2b46;
  --primary: #315efb;
  --primary-dark: #244bd6;
  --text: #172033;
  --muted: #718096;
  --border: #e4e9f1;
  --success: #15803d;
  --danger: #dc2626;
  --warning: #d97706;
  --shadow: 0 8px 28px rgba(20, 35, 65, .07);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, Arial, sans-serif;
}

/* SIDEBAR */

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: 260px;
  padding: 26px 18px 18px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background: var(--sidebar);
  color: white;
}

.sidebar::-webkit-scrollbar {
  width: 5px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: #42516a;
  border-radius: 10px;
}

.logo,
.sidebar-logo {
  margin: 0 0 35px;
  padding: 0 10px;
  color: white;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.5px;
}

.logo span,
.sidebar-logo span {
  color: #7795ff;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.sidebar nav a,
.sidebar nav button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #bdc9dc;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background .2s, color .2s;
}

.sidebar nav a:hover,
.sidebar nav button:hover {
  background: var(--sidebar-light);
  color: white;
}

.sidebar nav a.active,
.sidebar nav button.active {
  background: #315efb;
  color: white;
}

.sidebar-footer {
  margin-top: auto;
  padding: 25px 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-footer a {
  display: block;
  padding: 12px;
  color: #cbd5e1;
  font-size: 13px;
  text-decoration: none;
  border-radius: 8px;
}

.sidebar-footer a:hover {
  background: var(--sidebar-light);
  color: white;
}

#logoutButton {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 12px 14px;
  border: 1px solid #ffffff35;
  border-radius: 9px;
  background: #263653;
  color: white;
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: background .2s, border-color .2s;
}

#logoutButton:hover {
  background: var(--danger);
  border-color: var(--danger);
}

/* MAIN CONTENT */

.main-content,
main {
  min-height: 100vh;
  margin-left: 260px;
  padding: 30px;
}

.topbar,
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 30px;
}

.topbar h1,
.admin-header h1 {
  margin: 0;
  font-size: 27px;
  font-weight: 800;
}

.topbar p,
.admin-header p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.profile,
.profile-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.profile-avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e8edff;
  color: var(--primary);
  font-weight: 800;
}

/* SECTIONS */

.admin-section,
section {
  margin-bottom: 28px;
}

.admin-section h2,
section h2 {
  margin: 0 0 18px;
  font-size: 21px;
}

.hidden,
[hidden] {
  display: none !important;
}

/* DASHBOARD CARDS */

.stats-grid,
.dashboard-grid,
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 18px;
  margin-bottom: 25px;
}

.stat-card,
.dashboard-card,
.card {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.stat-card h3,
.dashboard-card h3,
.card h3 {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.stat-card strong,
.dashboard-card strong {
  font-size: 28px;
  font-weight: 800;
}

/* GENERAL PANELS */

.panel,
.content-card,
.table-container {
  margin-bottom: 22px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 18px;
}

/* FORMS */

form {
  width: 100%;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.form-group,
.input-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 15px;
}

label {
  color: #354158;
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 43px;
  padding: 11px 13px;
  border: 1px solid #dce3ed;
  border-radius: 9px;
  outline: none;
  background: white;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  transition: border-color .2s, box-shadow .2s;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(49, 94, 251, .12);
}

/* BUTTONS */

button,
.btn {
  font-family: inherit;
}

button:not(#logoutButton),
.btn {
  cursor: pointer;
}

.btn,
button.primary,
button[type="submit"] {
  padding: 11px 17px;
  border: 0;
  border-radius: 9px;
  background: var(--primary);
  color: white;
  font-size: 13px;
  font-weight: 700;
  transition: background .2s;
}

.btn:hover,
button.primary:hover,
button[type="submit"]:hover {
  background: var(--primary-dark);
}

button:disabled {
  opacity: .6;
  cursor: not-allowed;
}

/* TABLES */

.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 650px;
  border-collapse: collapse;
  text-align: left;
}

thead {
  background: #f7f9fc;
}

th {
  padding: 14px 13px;
  color: #526078;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .4px;
  white-space: nowrap;
}

td {
  padding: 14px 13px;
  border-top: 1px solid var(--border);
  color: #354158;
  font-size: 13px;
  vertical-align: middle;
}

tbody tr:hover {
  background: #fafbfe;
}

td input,
td select {
  min-width: 100px;
  min-height: 36px;
  padding: 8px;
  font-size: 12px;
}

/* STATUS LABELS */

.status,
.badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 30px;
  background: #edf2ff;
  color: #315efb;
  font-size: 11px;
  font-weight: 800;
}

.status.approved,
.badge.success {
  background: #dcfce7;
  color: var(--success);
}

.status.rejected,
.badge.danger {
  background: #fee2e2;
  color: var(--danger);
}

.status.pending,
.badge.warning {
  background: #fef3c7;
  color: var(--warning);
}

/* SEARCH AND FILTERS */

.toolbar,
.table-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.toolbar input,
.toolbar select,
.table-toolbar input,
.table-toolbar select {
  width: auto;
  min-width: 180px;
}

/* NOTIFICATIONS AND MESSAGES */

.message,
.alert {
  margin: 12px 0;
  padding: 12px 15px;
  border-radius: 9px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 13px;
}

.message.error,
.alert.error {
  background: #fee2e2;
  color: #b91c1c;
}

.message.success,
.alert.success {
  background: #dcfce7;
  color: #166534;
}

/* EMPTY STATES */

.empty-state {
  padding: 35px 20px;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}

/* RESPONSIVE */

@media (max-width: 900px) {
  .sidebar {
    width: 230px;
  }

  .main-content,
  main {
    margin-left: 230px;
    padding: 22px;
  }

  .stats-grid,
  .dashboard-grid,
  .cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .sidebar {
    width: 260px;
    transform: translateX(-100%);
    transition: transform .25s ease;
  }

  .main-content,
  main {
    margin-left: 0;
    padding: 18px;
  }

  .topbar,
  .admin-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid,
  .dashboard-grid,
  .cards-grid {
    grid-template-columns: 1fr;
  }

  .panel,
  .content-card,
  .table-container {
    padding: 15px;
  }
}

@media (max-width: 420px) {
  .main-content,
  main {
    padding: 13px;
  }

  .topbar h1,
  .admin-header h1 {
    font-size: 22px;
  }
}

/* =========================================
   ADMIN HTML COMPATIBILITY FIX
========================================= */

.main {
  min-height: 100vh;
  margin-left: 260px;
  padding: 30px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 35px;
  padding: 0 8px;
}

.brand-logo {
  width: 43px;
  height: 43px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #315efb;
  color: white;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 15px;
}

.brand small {
  margin-top: 5px;
  color: #aab8cf;
  font-size: 11px;
}

.menu-label {
  margin: 18px 10px 10px;
  color: #8190a8;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.2px;
}

.nav-link {
  width: 100%;
  display: flex;
  align-items: center;
  padding: 13px 14px;
  margin-bottom: 5px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #bdc9dc;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.nav-link:hover,
.nav-link.active {
  background: #315efb;
  color: white;
}

.eyebrow {
  display: block;
  margin-bottom: 8px;
  color: #718096;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
}

.avatar {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e8edff;
  color: #315efb;
  font-weight: 800;
}

.page {
  margin-bottom: 28px;
}

.welcome {
  padding: 30px;
  margin-bottom: 22px;
  border-radius: 16px;
  background: linear-gradient(120deg, #172b4d, #315efb);
  color: white;
}

.welcome > span {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  opacity: .8;
}

.welcome h2 {
  margin: 13px 0 8px;
  font-size: 26px;
}

.welcome p {
  margin: 0;
  color: #e0e8ff;
  font-size: 14px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.stats article {
  padding: 21px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: white;
  box-shadow: var(--shadow);
}

.stats article span {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.stats article strong {
  font-size: 27px;
  font-weight: 800;
}

.workflow {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.workflow > div {
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8faff;
}

.workflow b,
.workflow strong,
.workflow small {
  display: block;
}

.workflow b {
  margin-bottom: 12px;
  color: var(--primary);
  font-size: 19px;
}

.workflow strong {
  margin-bottom: 7px;
  font-size: 13px;
}

.workflow small {
  color: var(--muted);
  font-size: 11px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 20px;
}

.section-heading h2 {
  margin: 0 0 7px;
}

.section-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.table-panel {
  overflow: hidden;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
}

.notice {
  padding: 12px 14px;
  border-radius: 9px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 12px;
  line-height: 1.6;
}

.message {
  min-height: 18px;
}

footer {
  padding: 25px 0 10px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

@media (max-width: 900px) {
  .main {
    margin-left: 230px;
    padding: 22px;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workflow {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .main {
    margin-left: 0;
    padding: 18px;
  }

  .stats {
    grid-template-columns: 1fr 1fr;
  }

  .workflow {
    grid-template-columns: 1fr;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 420px) {
  .main {
    padding: 13px;
  }

  .welcome {
    padding: 20px;
  }

  .welcome h2 {
    font-size: 21px;
  }
}
.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  margin-top: auto;
}

#logoutButton {
  display: block;
  width: 100%;
  padding: 13px 16px;
  background: #dc3545;
  color: white;
  border: none;
  border-radius: 9px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

#logoutButton:hover {
  background: #b02a37;
}