/* === Reset & Base === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 14px;
  line-height: 1.5;
  color: #1A1A2E;
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
  background: #F5F6F8;
  min-height: 100vh;
}

/* === Layout === */
.layout {
  display: flex;
  min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
  width: 240px;
  background: #1B2A4A;
  color: #CBD5E1;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h1 {
  font-size: 16px;
  font-weight: 600;
  color: #FFFFFF;
  line-height: 1.3;
}

.sidebar-header .subtitle {
  font-size: 12px;
  color: #94A3B8;
  margin-top: 2px;
}

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

.nav-group-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748B;
  padding: 16px 20px 6px;
}

.nav-item {
  display: block;
  padding: 8px 20px;
  color: #CBD5E1;
  text-decoration: none;
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #FFFFFF;
}

.nav-item.active {
  border-left-color: #2AA198;
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.08);
}

.nav-item.sub {
  padding-left: 36px;
  font-size: 13px;
}

/* --- Top Bar --- */
.topbar {
  height: 56px;
  background: #FFFFFF;
  border-bottom: 1px solid #E5E7EB;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: fixed;
  top: 0;
  left: 240px;
  right: 0;
  z-index: 90;
}

.topbar-title {
  font-size: 16px;
  font-weight: 600;
  color: #1A1A2E;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #1A1A2E;
}

/* --- Main Content --- */
.main {
  margin-left: 240px;
  margin-top: 56px;
  padding: 24px;
  flex: 1;
  min-height: calc(100vh - 56px);
}

/* === Components === */

/* --- Cards --- */
.card {
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  padding: 20px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: #1A1A2E;
  margin-bottom: 8px;
}

.card-description {
  font-size: 14px;
  color: #6B7280;
  margin-bottom: 16px;
}

.card-link {
  color: #2AA198;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

.card-link:hover {
  text-decoration: underline;
}

/* --- Stat Cards --- */
.stat-card {
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  padding: 20px;
  border-top: 3px solid #2AA198;
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 600;
  color: #1B2A4A;
}

.stat-card .stat-label {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  color: #6B7280;
  margin-top: 4px;
}

.stat-card.warning {
  border-top-color: #F59E0B;
}

.stat-card.danger {
  border-top-color: #EF4444;
}

/* --- Badges --- */
.badge {
  display: inline-block;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 999px;
  line-height: 1.5;
}

.badge-role {
  background: #2AA198;
  color: #FFFFFF;
}

.badge-approved, .badge-success {
  background: #10B981;
  color: #FFFFFF;
}

.badge-pending, .badge-warning {
  background: #F59E0B;
  color: #FFFFFF;
}

.badge-rejected, .badge-error {
  background: #EF4444;
  color: #FFFFFF;
}

.badge-closed {
  background: #6B7280;
  color: #FFFFFF;
}

/* --- Buttons --- */
.btn {
  display: inline-block;
  padding: 8px 20px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s;
}

.btn:hover {
  opacity: 0.9;
}

.btn-primary {
  background: #1B2A4A;
  color: #FFFFFF;
}

.btn-accent {
  background: #2AA198;
  color: #FFFFFF;
}

.btn-secondary {
  background: #FFFFFF;
  color: #1B2A4A;
  border: 1px solid #1B2A4A;
}

.btn-danger {
  background: #EF4444;
  color: #FFFFFF;
}

/* --- Tables --- */
.table-wrap {
  overflow-x: auto;
}

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

thead th {
  background: #F5F6F8;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: #6B7280;
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #E5E7EB;
}

tbody td {
  padding: 12px;
  border-bottom: 1px solid #E5E7EB;
  font-size: 14px;
}

tbody tr:nth-child(even) {
  background: #FAFBFC;
}

tbody tr:hover {
  background: #F0FAFA;
}

td.numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

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

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: #6B7280;
  margin-bottom: 4px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  border: 1px solid #E5E7EB;
  border-radius: 6px;
  font-family: inherit;
  color: #1A1A2E;
  transition: border-color 0.15s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: #2AA198;
  box-shadow: 0 0 0 2px rgba(42, 161, 152, 0.15);
}

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

/* --- Alerts --- */
.alert {
  padding: 12px 16px;
  border-radius: 4px;
  border-left: 4px solid;
  margin-bottom: 16px;
  font-size: 14px;
}

.alert-info {
  border-left-color: #2AA198;
  background: #F0FAFA;
  color: #1A1A2E;
}

.alert-warning {
  border-left-color: #F59E0B;
  background: #FFFBEB;
  color: #1A1A2E;
}

.alert-error {
  border-left-color: #EF4444;
  background: #FEF2F2;
  color: #1A1A2E;
}

.alert-success {
  border-left-color: #10B981;
  background: #ECFDF5;
  color: #1A1A2E;
}

/* === Typography === */
.page-title {
  font-size: 24px;
  font-weight: 600;
  color: #1A1A2E;
  margin-bottom: 8px;
}

.page-subtitle {
  font-size: 14px;
  color: #6B7280;
  margin-bottom: 24px;
}

.section-heading {
  font-size: 18px;
  font-weight: 600;
  color: #1A1A2E;
  margin-bottom: 16px;
}

/* === Responsive === */
@media (max-width: 1024px) {
  .sidebar {
    width: 60px;
  }
  .sidebar-header h1,
  .sidebar-header .subtitle,
  .nav-group-label,
  .nav-item span {
    display: none;
  }
  .topbar {
    left: 60px;
  }
  .main {
    margin-left: 60px;
  }
}

@media (max-width: 768px) {
  .sidebar {
    display: none;
  }
  .topbar {
    left: 0;
  }
  .main {
    margin-left: 0;
  }
  .card-grid {
    grid-template-columns: 1fr;
  }
}
