﻿/* =========================================================
   RCTC • Dashboard Theme (sidebar + tiles + alerts)
   ========================================================= */
:root {
  --primary: #007ac2;
  --primary-dark: #005b9a;
  --bg: #f0f4f8;
  --card: #ffffff;
  --ink: #0f1c2f;
  --muted: #5b6472;
  --line: #dbe4ef;
  --blue1: var(--primary);
  --blue2: var(--primary-dark);
  --accent: var(--primary);
  --accent-hover: #005b9a;
  --highlight: #ffc107;
  --green: #159947;
  --purple: #6d5bd0;
  --orange: #f06a00;
  --danger: #e74c3c;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  /* spacing scale based on 8px grid */
  --space-0: 0;
  --space-1: 0.5rem; /* 8px */
  --space-2: 1rem; /* 16px */
  --space-3: 1.5rem; /* 24px */
  --space-4: 2rem; /* 32px */
  --space-5: 2.5rem; /* 40px */
  --space-6: 3rem; /* 48px */
  --radius-sm: 0.5rem; /* 8px */
  --radius-md: 1rem; /* 16px */
  --radius-lg: 1.5rem; /* 24px */
  /* --container-max:1200px; */
}

/* Base */
* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui,
    Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  font-size: 16px;
}
h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0 0 var(--space-2);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}
h1 {
  font-size: 2rem;
}
h2 {
  font-size: 1.5rem;
}
h3 {
  font-size: 1.25rem;
}
h4 {
  font-size: 1.125rem;
}
h5 {
  font-size: 1rem;
}
h6 {
  font-size: 0.875rem;
}
p {
  margin: 0 0 var(--space-2);
}
ul,
ol {
  margin: 0 0 var(--space-2);
  padding-left: var(--space-3);
}
a {
  color: var(--primary);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* ---------------- Auth (login) ---------------- */
.auth {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}
.card {
  background: var(--card);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  width: min(420px, 92vw);
}
.card h1 {
  margin: 0 0 var(--space-2);
}
label {
  display: block;
  margin: 0 0 var(--space-1);
  font-size: 0.875rem;
  color: var(--muted);
  font-weight: 600;
}
input,
select,
textarea {
  width: 100%;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.4;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 122, 194, 0.12);
}
button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-sm);
  border: none;
  background: var(--accent);
  color: #ffffff;
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.25;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.btn--primary {
  background: var(--accent);
  color: #fff;
}
.btn--primary:hover {
  background: var(--accent-hover);
}
.btn--success {
  background: #16a34a;
  color: #fff;
}
.btn--success:hover {
  background: #15803d;
}
.btn--warning {
  background: #f59e0b;
  color: #fff;
}
.btn--warning:hover {
  background: #d97706;
}
.btn--info {
  background: #2563eb;
  color: #fff;
}
.btn--info:hover {
  background: #1d4ed8;
}
.btn--neutral {
  background: #6b7280;
  color: #fff;
}
.btn--neutral:hover {
  background: #4b5563;
}
.btn--sm {
  padding: calc(var(--space-1) - 0.125rem) var(--space-2);
  font-size: 0.875rem;
  line-height: 1.2;
}
button:hover,
.btn:hover {
  background: var(--accent-hover);
}
button:focus-visible,
.btn:focus-visible {
  outline: 2px solid rgba(0, 122, 194, 0.4);
  outline-offset: 2px;
}
button:disabled,
.btn:disabled {
  background: #b0bbca;
  color: #fff;
  cursor: not-allowed;
  box-shadow: none;
}
.btn--secondary {
  background: #1d4ed8;
  color: #ffffff;
}
.btn--ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}
.btn--outline {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn--danger {
  background: var(--danger);
}
.btn--full {
  width: 100%;
}

/* New glass login layout */
body.login-page {
  margin: 0;
  min-height: 100vh;
  font-family: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, Arial,
    sans-serif;
  background: linear-gradient(
      135deg,
      rgba(0, 122, 194, 0.18),
      rgba(0, 91, 154, 0.28)
    ),
    url("../assets/login-hero.png") center/cover no-repeat fixed;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(20px, 6vw, 48px);
  color: var(--ink);
}
.login-surface {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  width: clamp(340px, 85vw, 480px);
  background: rgba(255, 255, 255, 0.32);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--radius-lg);
  padding: clamp(var(--space-3), 5vw, var(--space-5));
  box-shadow: 0 28px 50px rgba(4, 16, 31, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.42);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  text-align: center;
}
.login-logo img {
  width: 144px;
  height: auto;
  display: block;
}
.login-title {
  margin: 0;
  font-size: clamp(24px, 4.6vw, 32px);
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 0.4px;
}
.login-subtitle {
  margin: -0.5rem 0 0;
  font-size: clamp(13px, 3vw, 15px);
  color: #0b1520;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.7);
}
.login-alert {
  width: 100%;
  background: rgba(255, 82, 82, 0.15);
  border: 1px solid rgba(255, 82, 82, 0.35);
  color: #b91c1c;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-align: left;
}
.login-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-1);
}
.login-group {
  display: flex;
  align-items: center;
  width: 100%;
  background: rgba(255, 255, 255, 0.92);
  border-radius: var(--radius-sm);
  padding: var(--space-2);
  border: 1px solid rgba(12, 35, 64, 0.08);
  box-shadow: 0 1px 2px rgba(15, 24, 42, 0.08);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.login-group:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 122, 194, 0.2);
}
.login-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 10px;
  flex: 0 0 auto;
  opacity: 0.85;
}
.login-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.login-group input,
.login-group select {
  flex: 1 1 auto;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font-size: 16px;
  color: var(--ink);
  padding: 0;
}
.login-group select {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}
.login-btn {
  margin-top: var(--space-1);
  width: 100%;
  padding: var(--space-2);
  border: none;
  border-radius: var(--radius-md);
  background: var(--primary);
  color: #fff;
  font-size: 1.0625rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 16px 30px rgba(0, 122, 194, 0.32);
  transition: transform 0.1s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.login-btn:hover {
  background: var(--primary-dark);
}
.login-btn:active {
  transform: translateY(1px);
  box-shadow: 0 10px 20px rgba(0, 122, 194, 0.28);
}
.login-btn:focus-visible {
  outline: 3px solid rgba(0, 122, 194, 0.3);
  outline-offset: 2px;
}
.login-extra {
  width: 100%;
  margin-top: var(--space-1);
  font-size: 0.875rem;
  font-weight: 600;
  color: #0b1520;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.65);
  line-height: 1.4;
}
.login-extra code {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  background: rgba(15, 28, 47, 0.08);
}
@media (max-width: 520px) {
  .login-card {
    border-radius: var(--radius-md);
    padding: var(--space-3);
    gap: var(--space-2);
  }
  .login-group {
    padding: var(--space-1) var(--space-2);
  }
  .login-btn {
    font-size: 1rem;
  }
}
.alert {
  background: #e7f5ee;
  color: #116338;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  margin: var(--space-1) 0;
}

/* ---------------- Layout (sidebar + header) ---------------- */
.layout {
  display: flex;
  min-height: 100vh;
}

/* left sidebar (new pages that use .sidebar/.main structure) */
.sidebar {
  width: 256px;
  flex-shrink: 0;
  color: #fff;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--blue1) 0%, var(--blue2) 100%);
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(8px);
}
.sidebar .brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-3) var(--space-3);
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  text-decoration: none;
}
.sidebar .brand img {
  max-width: 168px;
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.25));
}
.brand .logo {
  width: 150px;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.brand .logo img {
  max-width: 100%;
  display: block;
}
.brand .title {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-3) 0;
  margin: 0;
  list-style: none;
}
.nav a {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  margin: 0 var(--space-2);
  color: rgba(255, 255, 255, 0.92);
  text-decoration: none;
  border-radius: var(--radius-sm);
  position: relative;
  transition: all 0.25s ease;
  font-weight: 500;
}
.nav a:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  transform: translateX(0.5rem);
}
.nav a.active {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.24),
    rgba(255, 255, 255, 0.08)
  );
  color: #fff;
  font-weight: 600;
  box-shadow: inset 4px 0 0 var(--highlight, #ffc107);
}
.nav a.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 0 6px 6px 0;
  background: var(--highlight, #ffc107);
}

/* main column */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.topbar {
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid rgba(15, 28, 47, 0.05);
  padding: var(--space-2) var(--space-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
  backdrop-filter: blur(6px);
}
.topbar .title {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: 0.2px;
}
.topbar .avatar {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

/* page container */
.container {
  padding: var(--space-3);
  max-width: var(--container-max);
  margin: 0 auto;
  width: 100%;
}
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.page-head .actions {
  display: flex;
  gap: var(--space-1);
  align-items: center;
  flex-wrap: wrap;
}
.searchbar {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-wrap: wrap;
}
.searchbar input {
  flex: 1 1 280px;
  min-width: 220px;
  max-width: 360px;
}
.page-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.stack--tight {
  gap: var(--space-1);
}
.stack--loose {
  gap: var(--space-3);
}
.grid {
  display: grid;
  gap: var(--space-3);
}
.grid--two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.grid--three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* ---------------- Tiles (dashboard cards) ---------------- */
.tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}
.tile {
  background: var(--card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  padding: var(--space-3);
  position: relative;
  overflow: hidden;
}
.tile.blue {
  background: #1c63ff;
  color: #fff;
}
.tile.green {
  background: #1da750;
  color: #fff;
}
.tile.purple {
  background: #6d5bd0;
  color: #fff;
}
.tile.orange {
  background: #ff7a1a;
  color: #fff;
}
.tile .label {
  font-size: 13px;
  opacity: 0.9;
}
.tile .value {
  font-size: 1.75rem;
  font-weight: 800;
  margin-top: var(--space-1);
}
.tile .sub {
  opacity: 0.9;
  font-size: 0.875rem;
  margin-top: var(--space-1);
}

/* ---------------- Alerts & Activity ---------------- */
.alert-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: #fff;
  border: 1px solid var(--line);
  border-left: 8px solid var(--orange);
  border-radius: var(--radius-sm);
  padding: var(--space-2);
  margin: var(--space-2) 0;
  box-shadow: var(--shadow);
}
.alert-row.success {
  border-left-color: var(--green);
  background: #f0fbf4;
}
.alert-row.info {
  border-left-color: var(--accent);
  background: #f2f8ff;
}

.section-title {
  font-size: 1.375rem;
  font-weight: 800;
  margin: var(--space-2) 0 var(--space-1);
}

.activity {
  background: #fff;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: var(--space-2);
}
.activity .item {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-1);
  border-bottom: 1px solid var(--line);
  align-items: flex-start;
}
.activity .item:last-child {
  border-bottom: none;
}
.activity .time {
  font-size: 12px;
  color: #1a7f3a;
  font-weight: 800;
}
.activity .text {
  font-size: 15px;
}
.activity .text strong {
  color: #0b3d91;
}

/* ---------------- Tables / Cards / Helpers ---------------- */
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin: var(--space-2) 0;
}
.table th,
.table td {
  padding: var(--space-2);
  border-bottom: 1px solid var(--line);
  font-size: 0.9375rem;
  text-align: left;
}
.table th {
  background: #f8f9fb;
  color: #677086;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}
.table tbody tr:hover {
  background: #f6f8fc;
}
.table tbody tr:last-child td {
  border-bottom: none;
}
.table .col--shrink,
.table th.col--shrink {
  width: 1%;
  white-space: nowrap;
}

.grid {
  display: grid;
  gap: var(--space-3);
}
.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.tableWrap,
.table-wrap {
  overflow-x: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
}
.tableWrap .table,
.table-wrap .table {
  margin: 0;
  border: none;
  box-shadow: none;
}
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin: var(--space-2) 0;
  flex-wrap: wrap;
}
.toolbar .muted {
  font-size: 0.9rem;
}
.btn.outline,
.btn--outline {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
}
.btn.outline:hover,
.btn--outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}
.report-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin: var(--space-2) 0;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.5rem 1rem;
  border-radius: 999px;
  background: #eef2ff;
  color: #1d3b8c;
  font-weight: 600;
  font-size: 0.75rem;
}
.report-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.report-table th,
.report-table td {
  padding: var(--space-2);
  font-size: 0.9375rem;
  border-bottom: 1px solid var(--line);
}
.report-table thead th {
  background: #f8f9fb;
  color: #677086;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}
.report-table tbody tr:nth-child(even) {
  background: #fdfdfe;
}
.report-table tbody tr:hover {
  background: #f6f8fc;
}
.report-table tbody tr:last-child td {
  border-bottom: none;
}
.cardBox {
  background: var(--card);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}
.muted {
  color: var(--muted);
}
.actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-wrap: wrap;
}
.actions a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}
.actions a:hover {
  text-decoration: underline;
}
.actions .toggle-activate {
  color: #0d9488;
  font-weight: 700;
}
.actions .toggle-deactivate {
  color: #e11d48;
  font-weight: 700;
}
.table-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-1);
  white-space: nowrap;
}
.pager {
  display: flex;
  gap: var(--space-1);
  align-items: center;
  justify-content: center;
  margin: var(--space-3) 0;
  flex-wrap: wrap;
}
.pager a,
.pager span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  padding: calc(var(--space-1) - 0.125rem) var(--space-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
}
.pager a:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.pager .active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.pager .ellipsis {
  border: none;
  background: transparent;
  min-width: auto;
  padding: 0;
  color: var(--muted);
}

.badge {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: #edf2ff;
  color: #2d3a8c;
  border: 1px solid transparent;
}
.badge--success {
  background: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0;
}
.badge--danger {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fecaca;
}
.badge--info {
  background: #eef2ff;
  color: #1d3b8c;
  border-color: #c7d2fe;
}
.badge--warning {
  background: #fff4d6;
  color: #8a5d00;
  border-color: #facc15;
}
.badge--neutral {
  background: #f3f4f6;
  color: #374151;
  border-color: #d1d5db;
}
.badge.acc-active,
.badge.wl-available {
  background: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0;
}
.badge.acc-inactive {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fecaca;
}
.badge.wl-busy {
  background: #eef2ff;
  color: #1d3b8c;
  border-color: #c7d2fe;
}
.stack-badges {
  display: flex;
  gap: var(--space-1);
  flex-wrap: wrap;
}
.status-urgent {
  background: #fff1c2;
  color: #8a5d00;
}
.proof-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  max-width: 320px;
}
.thumb {
  display: flex;
  width: 56px;
  height: 56px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #fff;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.thumb.video {
  font-size: 1.25rem;
  background: #f3f6ff;
  color: var(--accent);
}
button.thumb {
  border: none;
  background: transparent;
  padding: 0;
}
button.thumb:hover {
  transform: translateY(-0.25rem);
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.16);
}
.table td.proof {
  vertical-align: top;
}

/* ---------------- Forms (shared) ---------------- */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
}
@media (max-width: 920px) {
  .tiles {
    grid-template-columns: repeat(2, 1fr);
  }
  .form-row {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 640px) {
  .tiles {
    grid-template-columns: 1fr;
  }
}

/* ---------------- Legacy compatibility ----------------
   Keep a minimal top .nav style for old pages that still need it.
------------------------------------------------------- */
.nav.topbar-like {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  padding: var(--space-2) var(--space-3);
  background: #0f254d;
  color: #fff;
}
.nav.topbar-like a {
  color: #fff;
  text-decoration: none;
}

/* =========================================================
   Sidebar mode for legacy pages that only have <div class="nav">â€¦</div>
   Add class="has-sidebar" to <body> to enable.
   ========================================================= */
body.has-sidebar .nav {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 240px;
  background: linear-gradient(180deg, var(--blue1) 0%, var(--blue2) 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: var(--space-3) 0;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  z-index: 1000;
}
body.has-sidebar .nav strong {
  display: block;
  padding: 0 var(--space-3) var(--space-1);
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: var(--space-1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}
/* =========================================================
   Sidebar mode for legacy pages that only have <div class="nav">â€¦</div>
   Add class="has-sidebar" to <body> to enable.
   ========================================================= */
body.has-sidebar .nav {
  position: fixed; /* â† avoid 'inset' shorthand for compatibility */
  top: 0;
  left: 0;
  bottom: 0;
  width: 240px;
  background: linear-gradient(180deg, var(--blue1) 0%, var(--blue2) 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: var(--space-3) 0;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  z-index: 1000;
}
body.has-sidebar .nav strong {
  display: block;
  padding: 0 var(--space-3) var(--space-1) var(--space-3);
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: var(--space-1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}
body.has-sidebar .nav a {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  padding-left: var(--space-4);
  color: #fff;
  text-decoration: none;
  opacity: 0.95;
  border-left: 4px solid transparent;
  transition: background 0.2s, opacity 0.2s, padding 0.2s;
}
body.has-sidebar .nav a:hover {
  background: rgba(255, 255, 255, 0.14);
  opacity: 1;
}
body.has-sidebar .nav a.active {
  background: rgba(255, 255, 255, 0.2);
  border-left-color: #fff;
  padding-left: calc(
    var(--space-4) + var(--space-1)
  ); /* align after the border accent */
}

/* Push page content to the right of the sidebar */
body.has-sidebar .topbar,
body.has-sidebar .container,
body.has-sidebar .content,      /* add these in case some pages use .content/main */
body.has-sidebar main {
  margin-left: 240px !important;
}

/* Make sure any topbar-style nav canâ€™t override this */
body.has-sidebar .nav.topbar-like {
  display: block !important;
}

/* Small screens â€” sidebar collapses to top row */
@media (max-width: 900px) {
  body.has-sidebar .nav {
    position: relative;
    top: auto;
    left: auto;
    bottom: auto;
    width: auto;
    height: auto;
    flex-direction: row;
    gap: var(--space-1);
  }
  body.has-sidebar .topbar,
  body.has-sidebar .container,
  body.has-sidebar .content,
  body.has-sidebar main {
    margin-left: 0 !important;
  }
}

/* small screensâ€”sidebar collapses on top */
@media (max-width: 900px) {
  body.has-sidebar .nav {
    position: relative;
    width: auto;
    height: auto;
    flex-direction: row;
    gap: var(--space-1);
  }
  body.has-sidebar .nav a {
    border-left: none;
    padding: var(--space-1) var(--space-2);
  }
  body.has-sidebar .container,
  body.has-sidebar .topbar {
    margin-left: 0;
  }
}
/* --- Collapsible nav groups --- */
.nav .group {
  margin-top: var(--space-1);
}
.nav .parent {
  width: calc(100% - var(--space-4));
  margin: 0 var(--space-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  color: rgba(255, 255, 255, 0.92);
  text-decoration: none;
  border: 0;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.25s ease;
}
.nav .parent:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.nav .parent .label {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}
.nav .caret {
  transition: transform 0.2s ease;
}
.nav .parent.open {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.22),
    rgba(255, 255, 255, 0.08)
  );
  color: #fff;
}
.nav .parent.open .caret {
  transform: rotate(90deg);
}

.nav .subnav {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.25s ease;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  margin: var(--space-1) var(--space-3) 0;
}
.nav .subnav.open {
  max-height: 300px;
} /* enough to show two links */
.nav .subnav a {
  display: block;
  padding: var(--space-2) var(--space-3);
  padding-left: var(--space-4);
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  border-radius: var(--radius-sm);
  margin: var(--space-1) 0;
  transition: all 0.2s ease;
}
.nav .subnav a:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  transform: translateX(0.5rem);
}
.nav .subnav a.active {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}
.notif-bell {
  position: fixed;
  top: 12px;
  right: 20px;
  z-index: 9999;
}
.notif-btn {
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 50%;
  padding: 10px;
  cursor: pointer;
  font-size: 20px;
}
.notif-panel {
  position: absolute;
  right: 0;
  top: 40px;
  width: 320px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
  max-height: 400px;
  overflow-y: auto;
  padding: 10px;
}
.notif-item {
  border-bottom: 1px solid #eee;
  padding: 6px;
  font-size: 14px;
}
.toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: #0e5bd6;
  color: #fff;
  padding: 12px 18px;
  border-radius: 12px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}
.hidden {
  display: none;
}
/* bell + panel */
.rctc-notify-shell {
  position: fixed;
  top: 12px;
  right: 18px;
  z-index: 9999;
}
.rctc-bell {
  font-size: 18px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 8px 10px;
  cursor: pointer;
}
.rctc-bell.pulse {
  box-shadow: 0 0 0 6px rgba(14, 91, 214, 0.15);
}
.rctc-panel {
  position: absolute;
  right: 0;
  top: 44px;
  width: 340px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}
.rctc-panel.hidden {
  display: none;
}
.rctc-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid #eef2f7;
}
.rctc-mark {
  background: #eef6ff;
  border: 1px solid #d7e6ff;
  border-radius: 8px;
  padding: 4px 8px;
  cursor: pointer;
}
.rctc-list {
  max-height: 380px;
  overflow: auto;
}
.rctc-item {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
}
.rctc-item.unread {
  background: #f8fbff;
}
.rctc-item .meta {
  color: #6b7280;
  font-size: 12px;
  margin-top: 3px;
}
.rctc-foot {
  padding: 8px 12px;
  color: #6b7280;
  font-size: 12px;
}

/* toast */
.rctc-toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: #0e5bd6;
  color: #fff;
  padding: 10px 14px;
  border-radius: 12px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: translateY(12px);
  transition: all 0.25s;
}
.rctc-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast {
  position: fixed;
  right: 16px;
  top: 16px;
  max-width: 360px;
  background: #111827;
  color: #fff;
  padding: 12px 14px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  z-index: 9999;
  opacity: 0.98;
  transition: opacity 0.35s ease;
}
#toast {
  position: fixed;
  right: var(--space-3);
  bottom: var(--space-3);
  z-index: 9999;
  background: #10b981;
  color: #fff;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.875rem;
  box-shadow: 0 10px 22px rgba(16, 185, 129, 0.35);
  opacity: 0;
  transform: translateY(var(--space-1));
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}
#toast.show {
  opacity: 1;
  transform: translateY(0);
}
#toast.error {
  background: #ef4444;
  box-shadow: 0 10px 22px rgba(239, 68, 68, 0.3);
}

/* ---------- Lightbox preview ---------- */
body.lightbox-open {
  overflow: hidden;
}
.lightbox {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 11000;
  padding: 24px;
}
.lightbox.open {
  display: flex;
}
.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(4px);
}
.lightbox-dialog {
  position: relative;
  background: rgba(15, 23, 42, 0.9);
  border-radius: 22px;
  padding: 36px 48px 48px;
  max-width: min(92vw, 960px);
  width: 100%;
  box-shadow: 0 32px 64px rgba(15, 23, 42, 0.45);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
.lightbox-stage {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-image {
  max-width: 100%;
  max-height: 72vh;
  width: auto;
  height: auto;
  border-radius: 14px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
}
.lightbox-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.75);
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.15s ease;
  z-index: 1;
}
.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: scale(1.05);
}
.lightbox-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}
.lightbox-arrow:hover {
  background: rgba(255, 255, 255, 0.26);
  transform: translateY(-50%) scale(1.05);
}
.lightbox-arrow[disabled] {
  opacity: 0.35;
  cursor: default;
  transform: translateY(-50%);
}
.lightbox-arrow.prev {
  left: 16px;
}
.lightbox-arrow.next {
  right: 16px;
}
.lightbox-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  color: #e5e7eb;
  font-size: 13px;
  letter-spacing: 0.3px;
}
.lightbox-meta span:last-child {
  opacity: 0.8;
}
.lightbox-meta.single {
  justify-content: flex-start;
  gap: 12px;
}
.lightbox-meta.single span:last-child {
  display: none;
}
@media (max-width: 640px) {
  .lightbox-dialog {
    padding: 24px;
    border-radius: 18px;
  }
  .lightbox-arrow {
    width: 40px;
    height: 40px;
    font-size: 22px;
  }
}
