@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --brand-navy: #0b3d4c;
  --brand-navy-dark: #072a35;
  --brand-teal: #1a8a7c;
  --brand-gold: #d9a441;
  --brand-bg: #f5f7f6;
  --text-dark: #1c2b2e;
}

* { box-sizing: border-box; }

body {
  background-color: var(--brand-bg);
  font-family: 'Inter', -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text-dark);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

main { min-height: calc(100vh - 200px); }
.container { padding-left: 1rem; padding-right: 1rem; }

h1, h2, h3, h4, h5, h6 { color: var(--brand-navy); font-weight: 700; line-height: 1.4; }
p { color: #3d4a4c; }
.text-muted { color: #6b7674 !important; }
a { color: var(--brand-teal); font-weight: 500; }
a:hover { color: var(--brand-navy); }

/* ---------- Top bar + sidebar layout ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(90deg, var(--brand-navy-dark), var(--brand-teal));
  color: white;
  padding: 0.65rem 1.25rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar .navbar-brand { color: #fff !important; font-weight: 700; font-size: 1.1rem; }
.topbar .navbar-brand { display: inline-flex; align-items: center; gap: 10px; }
.brand-logo { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; background: #fff; border: 2px solid rgba(255,255,255,0.95); box-shadow: 0 2px 8px rgba(0,0,0,0.3); flex: 0 0 auto; }
.brand-fallback { display: none; font-size: 1.3rem; line-height: 1; }
.topbar-right { display: flex; align-items: center; gap: 0.75rem; }
.topbar-right .nav-link { color: rgba(255,255,255,0.92) !important; padding: 0 !important; font-weight: 500; }
.topbar-right .nav-link:hover { color: var(--brand-gold) !important; }
.text-white-50 { color: rgba(255,255,255,0.7) !important; }
.sidebar-toggle { background: none; border: none; color: white; font-size: 1.3rem; margin-right: 0.75rem; }

.app-layout { display: flex; min-height: calc(100vh - 56px); }

.sidebar {
  width: 230px;
  background: white;
  border-right: 1px solid #e2e6e5;
  padding: 1rem 0;
  flex-shrink: 0;
}
.sidebar-section {
  font-size: 0.72rem;
  font-weight: 700;
  color: #8a9492;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.75rem 1.25rem 0.4rem;
}
.sidebar-link {
  display: block;
  padding: 0.6rem 1.25rem;
  color: var(--text-dark) !important;
  font-weight: 500;
  font-size: 0.92rem;
  text-decoration: none !important;
  border-left: 3px solid transparent;
}
.sidebar-link:hover { background: #f0f5f4; color: var(--brand-teal) !important; }
.sidebar-link.active {
  background: #eaf7f4;
  border-left-color: var(--brand-teal);
  color: var(--brand-navy) !important;
  font-weight: 700;
}

.main-content { flex: 1; padding: 1.5rem; min-width: 0; }

/* ---------- Buttons / forms ---------- */
.btn { font-weight: 600; border-radius: 6px; }
.btn-primary { background-color: var(--brand-teal); border-color: var(--brand-teal); }
.btn-primary:hover { background-color: var(--brand-navy); border-color: var(--brand-navy); }
.btn-outline-secondary { color: var(--brand-navy); border-color: #b8c2c0; }
.btn-outline-secondary:hover { background-color: var(--brand-navy); border-color: var(--brand-navy); color: #fff; }

label.form-label { font-weight: 600; color: var(--brand-navy); font-size: 0.88rem; }
.form-control, .form-select { border-color: #ccd6d5; border-radius: 6px; padding: 0.6rem 0.85rem; }
/* keep room on the right for the dropdown arrow (the shorthand above wiped Bootstrap's 2.25rem) */
.form-select { padding-right: 2.6rem; background-position: right 0.9rem center; background-size: 14px 10px; text-overflow: ellipsis; }
.form-control:focus, .form-select:focus { border-color: var(--brand-teal); box-shadow: 0 0 0 0.2rem rgba(26,138,124,0.2); }

.card, .list-group-item { border-radius: 10px; border-color: #e2e6e5; }

/* ---------- Dashboard tiles ---------- */
.dashboard-tile {
  display: block;
  background: white;
  border: 1px solid #e2e6e5;
  border-radius: 12px;
  padding: 1.6rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  height: 100%;
  text-decoration: none !important;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.dashboard-tile:hover { box-shadow: 0 6px 18px rgba(0,0,0,0.15); transform: translateY(-3px); }
.dashboard-tile .tile-icon { font-size: 1.8rem; margin-bottom: 0.5rem; display: block; }
.dashboard-tile h6 { color: var(--brand-navy); font-weight: 700; font-size: 1.15rem; margin-bottom: 0.35rem; }
.dashboard-tile p { font-size: 0.92rem; color: #55605e; margin-bottom: 0; }

/* ---------- Tables ---------- */
.table-responsive { border-radius: 10px; overflow: hidden; }
.table { background: white; font-size: 0.9rem; margin-bottom: 0; }
.table th, .table td { padding: 0.65rem 0.8rem !important; vertical-align: middle !important; }
.table thead th, .table-light { background-color: var(--brand-navy) !important; color: #fff !important; font-weight: 600; border-color: var(--brand-navy) !important; }
.table-secondary { background-color: #eaf2f1 !important; font-weight: 600; }
.table-warning th, .table-warning td { color: var(--text-dark) !important; }

.var-gold { background-color: #f4e3c1 !important; color: var(--text-dark) !important; }
.var-blue { background-color: #cfe0f2 !important; color: var(--text-dark) !important; }
.var-green { background-color: #c9de9e !important; color: var(--text-dark) !important; }

.badge.bg-secondary { background-color: var(--brand-teal) !important; }

.alert-success { border-left: 4px solid var(--brand-teal); background: #eaf7f4; color: #0d4a3f; }
.alert-danger { border-left: 4px solid #c94f4f; background: #fbeaea; color: #7a2323; }

footer.portal-footer { color: #8a9492; font-size: 12px; text-align: center; padding: 2rem 0 3rem; }
footer.portal-footer a { color: var(--brand-teal); font-weight: 600; }

#theme-toggle {
  cursor: pointer; background: none; border: 1px solid rgba(255,255,255,0.5);
  color: white; border-radius: 20px; padding: 4px 14px; font-size: 0.85rem;
}
#theme-toggle:hover { background: rgba(255,255,255,0.15); }
#cookie-banner a { text-decoration: underline; font-weight: 600; }

/* ---------- Dark mode ---------- */
[data-theme="dark"] { --brand-bg: #12181a; --text-dark: #e8ecec; }
[data-theme="dark"] body { background-color: var(--brand-bg); color: var(--text-dark); }
[data-theme="dark"] h1, [data-theme="dark"] h2, [data-theme="dark"] h3,
[data-theme="dark"] h4, [data-theme="dark"] h5, [data-theme="dark"] h6 { color: #7fd8c9; }
[data-theme="dark"] p, [data-theme="dark"] .text-muted { color: #a9b4b2 !important; }
[data-theme="dark"] .dashboard-tile, [data-theme="dark"] .card,
[data-theme="dark"] .list-group-item, [data-theme="dark"] .table {
  background: #1c2426 !important; border-color: #2c3739 !important; color: #e8ecec;
}
[data-theme="dark"] .form-control, [data-theme="dark"] .form-select {
  background: #1c2426; border-color: #3a4749; color: #e8ecec;
}
[data-theme="dark"] footer.portal-footer { color: #6b7674; }
[data-theme="dark"] .btn-outline-secondary { color: #7fd8c9; border-color: #3a4749; }
[data-theme="dark"] .topbar { background: linear-gradient(90deg, #051a20, #0f5148); }
[data-theme="dark"] .sidebar { background: #1c2426; border-color: #2c3739; }
[data-theme="dark"] .sidebar-link { color: #e8ecec !important; }
[data-theme="dark"] .sidebar-link:hover { background: #263030; }
[data-theme="dark"] .sidebar-link.active { background: #1a3d3a; }
[data-theme="dark"] .sidebar-section { color: #6b7674; }

/* ---------- Responsive ---------- */
@media (max-width: 991px) {
  .main-content {
    padding: 1.25rem;
  }
  h1 { font-size: 1.9rem; }
  h2 { font-size: 1.6rem; }
  h3 { font-size: 1.4rem; }
  h4 { font-size: 1.25rem; }
}

@media (max-width: 767px) {
  .topbar {
    padding: 0.55rem 0.9rem;
  }
  .topbar .navbar-brand {
    font-size: 0.98rem;
  }
  .brand-logo {
    width: 34px;
    height: 34px;
  }
  .brand-text {
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .topbar-right {
    gap: 0.5rem;
  }
  .topbar-right span {
    display: none !important;
  }

  .sidebar {
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    width: 260px;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 1050;
    box-shadow: 3px 0 18px rgba(0,0,0,0.16);
    overflow-y: auto;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  body.sidebar-open {
    overflow: hidden;
  }

  .app-layout {
    min-height: calc(100vh - 56px);
  }
  .main-content {
    padding: 0.9rem;
    width: 100%;
    overflow-x: hidden;
  }

  .dashboard-tile {
    padding: 1.15rem;
  }
  .dashboard-tile h6 {
    font-size: 1.05rem;
  }
  .dashboard-tile p {
    font-size: 0.88rem;
  }

  /* Make cards stack nicely */
  .card {
    margin-bottom: 1rem;
  }

  /* Tables: allow horizontal scroll */
  .table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .table {
    font-size: 0.82rem;
    min-width: 680px;
  }
  .table th,
  .table td {
    padding: 0.55rem 0.6rem !important;
    white-space: nowrap;
  }

  /* Forms stack full width */
  .form-control,
  .form-select {
    font-size: 0.95rem;
  }
  .btn {
    font-size: 0.92rem;
  }
  .btn-group {
    flex-wrap: wrap;
    gap: 0.4rem;
  }

  /* Stack action buttons in cards/tables */
  .card-body .btn,
  .table .btn {
    margin-bottom: 0.25rem;
  }

  h1 { font-size: 1.7rem; }
  h2 { font-size: 1.45rem; }
  h3 { font-size: 1.3rem; }
  h4 { font-size: 1.18rem; }
}

@media (max-width: 575px) {
  .topbar {
    padding: 0.5rem 0.75rem;
  }
  .brand-text {
    max-width: 120px;
  }
  .main-content {
    padding: 0.75rem;
  }
  .dashboard-tile {
    padding: 1rem;
  }
  .table {
    font-size: 0.8rem;
    min-width: 620px;
  }
  .container {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
  .card-body {
    padding: 0.9rem;
  }
}
/* Glassmorphism design system */
body { background: #F8FAFC; font-family: 'Inter', system-ui, sans-serif; }
.card, .feature-card { background: rgba(255,255,255,0.9); backdrop-filter: blur(8px); border: 1px solid rgba(0,0,0,0.06); border-radius: 12px; box-shadow: 0 4px 20px -2px rgba(0,0,0,0.05); }
h1 { font-size: 2.25rem; font-weight: 800; } h2 { font-size: 1.75rem; font-weight: 700; } body, p { font-size: 1rem; line-height: 1.6; }