/* ========== Base Reset ========== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
  /* CapantraONE-like shell */
  --bg-0: #020617; /* slate-950 */
  --panel: rgba(2, 6, 23, 0.72);
  --panel-solid: #0b1220;
  --stroke: rgba(51, 65, 85, 0.75);
  --stroke-strong: rgba(51, 65, 85, 0.95);
  --text: #e5e7eb;
  --muted: #9ca3af;

  /* Capantra accent (green from mark) */
  --accent: #22c55e; /* emerald-500 */
  --accent-2: #34d399; /* emerald-400 */
  --accent-3: #86efac; /* emerald-200 */
  --accent-ink: #052e16;

  background:
    radial-gradient(900px 600px at 18% 10%, rgba(34, 197, 94, 0.18), transparent 60%),
    radial-gradient(850px 520px at 82% 18%, rgba(52, 211, 153, 0.16), transparent 55%),
    radial-gradient(760px 520px at 55% 95%, rgba(34, 197, 94, 0.10), transparent 55%),
    var(--bg-0);
  color: var(--text);
}

a { color: inherit; }

::selection {
  background: rgba(34, 197, 94, 0.28);
}

/* ========== Layout Shell ========== */

/* Fixed header at top */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: 60px;
  backdrop-filter: blur(16px);
  background:
    radial-gradient(700px 160px at 20% 0%, rgba(34, 197, 94, 0.18), transparent 70%),
    linear-gradient(to bottom, rgba(2, 6, 23, 0.88), rgba(2, 6, 23, 0.62));
  border-bottom: 1px solid var(--stroke);
}

.site-header-inner {
  max-width: 100%;
  margin: 0;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  height: 100%;
}

.header-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  min-width: 0;
}

.sidebar-mobile-toggle {
  display: none;
}

.sidebar-overlay {
  display: none;
}

.user-menu {
  position: relative;
  min-width: 0;
}

.user-menu-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border-radius: 999px;
  border: 1px solid rgba(34, 197, 94, 0.35);
  background: rgba(15, 23, 42, 0.92);
  box-shadow:
    0 10px 24px rgba(15, 23, 42, 0.85),
    0 0 0 1px rgba(15, 23, 42, 1);
  color: #e5e7eb;
  font-size: 0.82rem;
  padding: 0.35rem 0.7rem;
  cursor: pointer;
  max-width: min(48vw, 320px);
}

.user-menu-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu-caret {
  color: var(--accent-3);
  font-size: 0.75rem;
}

.user-menu-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  min-width: 170px;
  border-radius: 0.7rem;
  border: 1px solid var(--stroke-strong);
  background: rgba(2, 6, 23, 0.98);
  box-shadow: 0 16px 36px rgba(2, 6, 23, 0.9);
  overflow: hidden;
  display: none;
  z-index: 140;
}

.user-menu.open .user-menu-dropdown {
  display: block;
}

@media (hover: hover) and (pointer: fine) {
  .user-menu:hover .user-menu-dropdown {
    display: block;
  }
}

.user-menu-item {
  display: block;
  padding: 0.55rem 0.75rem;
  color: #e5e7eb;
  text-decoration: none;
  font-size: 0.85rem;
  border-bottom: 1px solid rgba(51, 65, 85, 0.7);
}

.user-menu-item:last-child {
  border-bottom: none;
}

.user-menu-item:hover {
  background: rgba(34, 197, 94, 0.14);
  color: #f9fafb;
}

.brand-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: #f9fafb;
  letter-spacing: 0.02em;
}

/* Capantra wordmark feel */
.brand-wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
}

.brand-title {
  background: linear-gradient(90deg, #f9fafb, var(--accent-3), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: 0.01em;
}

.brand-chip {
  display: inline-flex;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.14);
  border: 1px solid rgba(34, 197, 94, 0.32);
  color: var(--accent-3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.site-main {
  margin-left: 0;
  margin-top: 60px;
  margin-bottom: 0;
  min-height: calc(100vh - 60px);
  max-width: none;
  padding: 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.has-sidebar .site-main {
  margin-left: 250px;
  padding-bottom: 5rem;
}

/* Fixed sidebar for admin/subadmin users */
.site-sidebar {
  position: fixed;
  left: 0;
  top: 60px;
  bottom: 0;
  width: 250px;
  z-index: 90;
  background:
    radial-gradient(800px 260px at 18% 0%, rgba(34, 197, 94, 0.08), transparent 70%),
    linear-gradient(to bottom, rgba(2, 6, 23, 0.95), rgba(15, 23, 42, 0.98));
  border-right: 1px solid var(--stroke);
  display: flex;
  flex-direction: column;
  padding: 0;
}

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

.sidebar-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--stroke);
  padding: 1rem 0.75rem;
  background: rgba(2, 6, 23, 0.5);
}

.sidebar-footer-content {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-start;
}

.sidebar-footer-copyright {
  margin: 0;
  font-size: 0.7rem;
  color: #6b7280;
  line-height: 1.2;
}

.sidebar-footer-version {
  margin: 0;
  font-size: 0.7rem;
  color: #9ca3af;
  line-height: 1.2;
}

.site-sidebar nav a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: 0.6rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: all 0.15s ease-out;
}

.site-sidebar nav a:hover {
  background: rgba(34, 197, 94, 0.12);
  color: var(--text);
}

.site-sidebar nav a.active {
  background: rgba(34, 197, 94, 0.20);
  color: var(--accent-3);
  font-weight: 500;
}

.sidebar-divider {
  height: 1px;
  background: var(--stroke);
  margin: 0.75rem 0.75rem;
}

.site-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 95;
  border-top: 1px solid var(--stroke);
  background:
    radial-gradient(700px 280px at 50% 0%, rgba(34, 197, 94, 0.12), transparent 70%),
    radial-gradient(circle at top, #020617, #020617 50%, #020617 100%);
}

.has-sidebar .site-footer {
  left: 250px;
}

.site-footer-inner {
  max-width: 100%;
  margin: 0;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: #6b7280; /* slate-500 */
}

.footer-version {
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(34, 197, 94, 0.25);
  background: rgba(34, 197, 94, 0.08);
  color: rgba(167, 243, 208, 0.95);
}

/* ========== Navigation ========== */

/* Sidebar Navigation */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0;
}

.sidebar-menu {
  list-style: none;
  margin: 0;
  padding: 0 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sidebar-item {
  display: block;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: 0.6rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: all 0.15s ease-out;
}

.sidebar-link:hover {
  background: rgba(34, 197, 94, 0.12);
  color: var(--text);
}

.sidebar-link.active {
  background: rgba(34, 197, 94, 0.20);
  color: var(--accent-3);
  font-weight: 500;
}

.sidebar-icon {
  font-size: 1.1rem;
  display: inline-flex;
}

.sidebar-label {
  flex: 1;
}

.sidebar-divider {
  display: block;
  height: 1px;
  background: var(--stroke);
  margin: 0.75rem 0.75rem;
}

/* Header Navigation */
.main-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 0.75rem;
  align-items: center;
  font-size: 0.85rem;
}

.main-nav a {
  text-decoration: none;
  color: var(--muted);
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  transition: all 0.15s ease-out;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.main-nav a:hover {
  color: var(--text);
  background: rgba(34, 197, 94, 0.10);
  border: 1px solid rgba(34, 197, 94, 0.18);
}

.nav-separator {
  width: 1px;
  height: 1.25rem;
  background: rgba(55, 65, 81, 0.8); /* slate-600 */
}

/* mobile toggle base (hidden by default) */
.nav-toggle {
  display: none;
}

.nav-toggle-button {
  display: none;
}

/* ========== Cards & Typography ========== */

.card {
  background:
    radial-gradient(800px 260px at 18% 0%, rgba(34, 197, 94, 0.10), transparent 70%),
    radial-gradient(circle at top left, #020617, #020617 45%, #020617 100%);
  border-radius: 0.85rem;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--stroke-strong);
  box-shadow:
    0 10px 40px rgba(15, 23, 42, 0.8),
    0 0 0 1px rgba(15, 23, 42, 0.9);
}

/* CapantraONE-ish card header system */
.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.9rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid rgba(51, 65, 85, 0.7);
}

.card-header-title {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.card-header-title h1,
.card-header-title h2,
.card-header-title h3 {
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  text-transform: none;
  letter-spacing: 0.01em;
  color: #f9fafb;
  font-weight: 650;
}

.card-header-subtitle {
  font-size: 0.8rem;
  color: rgba(156, 163, 175, 0.95);
}

.card-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pill-link {
  text-decoration: none;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  border: 1px solid rgba(51, 65, 85, 0.85);
  background: rgba(15, 23, 42, 0.92);
  color: rgba(229, 231, 235, 0.95);
  font-size: 0.8rem;
  line-height: 1.2;
  transition: all 0.15s ease-out;
  white-space: nowrap;
}

.pill-link:hover {
  border-color: rgba(34, 197, 94, 0.65);
  background: rgba(34, 197, 94, 0.10);
  color: #f9fafb;
}

.page-title {
  margin: 0 0 0.4rem;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #f9fafb;
}

/* Section chips / badges */
.card h3,
.card h4 {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.10);
  border: 1px solid rgba(34, 197, 94, 0.28);
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(167, 243, 208, 0.95);
}

.card h3 {
  margin-top: 0.1rem;
  margin-bottom: 0.9rem;
}

.card h4 {
  margin-top: 0.1rem;
  margin-bottom: 0.7rem;
}

/* ========== Employee Tiles ========== */

.employee-tile-compact {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(55, 65, 81, 0.75);
  border-radius: 0.75rem;
  padding: 0.85rem;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.65);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: all 0.15s ease;
}

.employee-tile-compact:hover {
  border-color: rgba(34, 197, 94, 0.5);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.75), 0 0 0 1px rgba(34, 197, 94, 0.25);
  transform: translateY(-1px);
}

.tile-header-compact {
  min-height: 1.25rem;
  display: flex;
  align-items: center;
}

.tile-header-compact a {
  font-size: 0.85rem;
  font-weight: 600;
  color: #38bdf8;
  text-decoration: none;
  transition: color 0.15s ease;
  line-height: 1.3;
}

.tile-header-compact a:hover {
  color: #7dd3fc;
  text-decoration: underline;
}

.tile-content-compact {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.tile-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
}

.tile-label-compact {
  color: #9ca3af;
  font-weight: 500;
  min-width: fit-content;
}

.tile-value-compact {
  color: #e5e7eb;
  font-weight: 500;
  text-align: right;
}

.tile-kpi-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.25rem;
  padding-top: 0.35rem;
  border-top: 1px solid rgba(55, 65, 81, 0.5);
}

.kpi-item-compact {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

/* ========== Employee Tiles (Original) ========== */

.employee-tile {
  background: radial-gradient(circle at top left, #020617, #020617 60%, #020617 100%);
  border: 1px solid rgba(55, 65, 81, 0.85);
  border-radius: 0.95rem;
  padding: 1.25rem;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.75);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  transition: all 0.15s ease;
}

.employee-tile:hover {
  border-color: rgba(34, 197, 94, 0.55);
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.85), 0 0 0 1px rgba(34, 197, 94, 0.3);
  transform: translateY(-2px);
}

.tile-header {
  min-height: 1.8rem;
  display: flex;
  align-items: center;
}

.tile-header a {
  font-size: 0.95rem;
  font-weight: 600;
  color: #38bdf8;
  text-decoration: none;
  transition: color 0.15s ease;
  line-height: 1.3;
}

.tile-header a:hover {
  color: #7dd3fc;
  text-decoration: underline;
}

.tile-meta {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.65rem 0;
  border-top: 1px solid rgba(55, 65, 81, 0.5);
  border-bottom: 1px solid rgba(55, 65, 81, 0.5);
}

.tile-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #9ca3af;
  font-weight: 500;
}

.tile-value {
  font-size: 0.85rem;
  color: #e5e7eb;
  font-weight: 500;
}

.tile-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.metric {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.5rem;
  background: rgba(15, 23, 42, 0.8);
  border-radius: 0.65rem;
  border: 1px solid rgba(55, 65, 81, 0.6);
}

.metric-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #9ca3af;
  font-weight: 500;
}

.metric-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: #f9fafb;
}

.tile-kpi {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.65rem;
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.25);
  border-radius: 0.65rem;
}

.tile-kpi strong {
  color: var(--accent-3);
  font-size: 0.9rem;
}

/* ========== KPI Row / Chips ========== */

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.kpi {
  border-radius: 0.9rem;
  padding: 0.7rem 0.85rem;
  background: radial-gradient(circle at top left, #020617, #020617 60%, #020617 100%);
  border: 1px solid rgba(55, 65, 81, 0.95); /* slate-700 */
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.7);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.kpi span {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: #9ca3af;
}

.kpi strong {
  font-size: 1rem;
  font-weight: 600;
  color: #f9fafb;
}

.kpi::before {
  content: "";
  display: block;
  height: 3px;
  width: 34%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-3), var(--accent));
  opacity: 0.85;
}

/* ========== Forms ========== */

.form-grid {
  display: grid;
  gap: 0.75rem 1rem;
}

@media (min-width: 768px) {
  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.85rem;
}

.form-group label {
  color: #e5e7eb;
  font-weight: 500;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="number"],
input[type="time"],
textarea,
select,
.form-control {
  width: 100%;
  border-radius: 0.6rem;
  border: 1px solid #1f2937;
  background-color: rgba(15, 23, 42, 1);
  color: #e5e7eb;
  padding: 0.45rem 0.6rem;
  font-size: 0.9rem;
  outline: none;
  transition: all 0.15s ease;
}

input::placeholder {
  color: #6b7280;
}

textarea::placeholder {
  color: #6b7280;
}

select {
  cursor: pointer;
}

input:focus,
select:focus,
textarea:focus,
.form-control:focus {
  border-color: #38bdf8; /* sky-400 */
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.6),
    0 10px 20px rgba(15, 23, 42, 0.8);
}

input[disabled],
select[disabled],
textarea[disabled],
.form-control[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

.error {
  margin-bottom: 0.75rem;
  padding: 0.55rem 0.7rem;
  border-radius: 0.75rem;
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.55);
  color: #fecaca;
  font-size: 0.8rem;
}

/* ========== Buttons ========== */

.btn {
  border-radius: 999px;
  border: none;
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: var(--accent-ink);
  box-shadow:
    0 10px 25px rgba(15, 23, 42, 0.9),
    0 0 0 1px rgba(15, 23, 42, 1);
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.08s ease;
}

.btn:hover {
  filter: brightness(1.05);
  box-shadow:
    0 14px 30px rgba(15, 23, 42, 1),
    0 0 0 1px rgba(34, 197, 94, 0.65);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
  box-shadow:
    0 6px 18px rgba(15, 23, 42, 0.9),
    0 0 0 1px rgba(34, 197, 94, 0.55);
}

.btn,
.btn:link,
.btn:visited {
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: var(--accent-ink);
}

.btn-secondary,
.btn.secondary {
  background: rgba(15, 23, 42, 0.95);
  color: #e5e7eb;
  border: 1px solid rgba(55, 65, 81, 0.95);
  box-shadow:
    0 8px 20px rgba(15, 23, 42, 0.85),
    0 0 0 1px rgba(15, 23, 42, 1);
}

.btn-secondary:hover,
.btn.secondary:hover {
  background: rgba(15, 23, 42, 1);
  border-color: rgba(34, 197, 94, 0.75);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fee2e2;
}

.btn-sm {
  padding: 0.32rem 0.75rem;
  font-size: 0.78rem;
}

.btn-lg {
  padding: 0.58rem 1.3rem;
  font-size: 0.9rem;
}

.table-container {
  border: 1px solid rgba(51, 65, 85, 0.75);
  border-radius: 0.95rem;
  overflow: auto;
  background: rgba(2, 6, 23, 0.55);
  box-shadow:
    0 14px 36px rgba(15, 23, 42, 0.75),
    0 0 0 1px rgba(15, 23, 42, 0.95);
}

.layout-container,
.main-content {
  width: 100%;
}

.success-banner {
  margin-bottom: 0.75rem;
  padding: 0.65rem 0.8rem;
  border-radius: 0.75rem;
  background: rgba(34, 197, 94, 0.14);
  border: 1px solid rgba(34, 197, 94, 0.55);
  color: #bbf7d0;
  font-size: 0.85rem;
}

.btn.secondary {
  background: rgba(15, 23, 42, 0.95);
  color: #e5e7eb;
  border: 1px solid rgba(55, 65, 81, 0.95);
  box-shadow:
    0 8px 20px rgba(15, 23, 42, 0.85),
    0 0 0 1px rgba(15, 23, 42, 1);
}

.btn.secondary:hover {
  background: rgba(15, 23, 42, 1);
  border-color: rgba(34, 197, 94, 0.75);
}

/* ========== Tables ========== */

.table-wrapper {
  border: 1px solid rgba(51, 65, 85, 0.75);
  border-radius: 0.95rem;
  overflow: auto;
  background: rgba(2, 6, 23, 0.55);
  box-shadow:
    0 14px 36px rgba(15, 23, 42, 0.75),
    0 0 0 1px rgba(15, 23, 42, 0.95);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

thead {
  background: radial-gradient(circle at top, #020617, #020617 65%, #020617 100%);
}

thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(2, 6, 23, 0.92);
  backdrop-filter: blur(10px);
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid #1f2937;
  color: #9ca3af;
  font-weight: 500;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

tbody tr {
  border-bottom: 1px solid rgba(31, 41, 55, 0.85);
}

tbody tr:nth-child(even) {
  background-color: rgba(15, 23, 42, 0.85);
}

tbody tr:nth-child(odd) {
  background-color: rgba(15, 23, 42, 0.95);
}

tbody td {
  padding: 0.55rem 0.6rem;
  color: #e5e7eb;
}

tbody tr:hover {
  background: rgba(15, 23, 42, 1);
}

/* Links inside tables */
table a {
  color: #38bdf8;
  text-decoration: none;
}

table a:hover {
  text-decoration: underline;
}

/* ========== Responsive Layout (Mobile) ========== */

@media (max-width: 768px) {
  .site-header-inner {
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.75rem;
  }

  .brand-title {
    font-size: 1rem;
  }

  .brand-chip {
    display: none;
  }

  .header-right {
    gap: 0.45rem;
    flex-shrink: 1;
  }

  .sidebar-mobile-toggle {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 3px;
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 0.6rem;
    border: 1px solid rgba(34, 197, 94, 0.35);
    background: rgba(15, 23, 42, 0.92);
    box-shadow:
      0 10px 24px rgba(15, 23, 42, 0.85),
      0 0 0 1px rgba(15, 23, 42, 1);
    cursor: pointer;
  }

  .sidebar-mobile-toggle span {
    display: block;
    width: 14px;
    height: 2px;
    border-radius: 999px;
    background: #e5e7eb;
  }

  body.sidebar-open .sidebar-mobile-toggle span:nth-child(1) {
    transform: translateY(5px) rotate(45deg);
  }

  body.sidebar-open .sidebar-mobile-toggle span:nth-child(2) {
    opacity: 0;
  }

  body.sidebar-open .sidebar-mobile-toggle span:nth-child(3) {
    transform: translateY(-5px) rotate(-45deg);
  }

  .sidebar-mobile-toggle span {
    transition: transform 0.18s ease, opacity 0.18s ease;
  }

  .user-menu-toggle {
    max-width: 56vw;
    font-size: 0.78rem;
    padding: 0.3rem 0.55rem;
  }

  .user-menu-dropdown {
    min-width: 150px;
  }

  .site-sidebar {
    display: flex;
    width: min(82vw, 280px);
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    z-index: 180;
    box-shadow: 0 16px 40px rgba(2, 6, 23, 0.9);
  }

  body.sidebar-open .site-sidebar {
    transform: translateX(0);
  }

  .sidebar-overlay {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(2, 6, 23, 0.55);
    backdrop-filter: blur(2px);
    z-index: 170;
    display: none;
  }

  body.sidebar-open .sidebar-overlay {
    display: block;
  }

  body.sidebar-open {
    overflow: hidden;
  }

  .site-main {
    margin-left: 0;
    margin-top: 60px;
    margin-bottom: 120px;
    min-height: auto;
    padding: 0 0.75rem;
  }

  .has-sidebar .site-main {
    margin-left: 0;
    padding-bottom: 0;
  }

  .has-sidebar .site-footer {
    left: 0;
  }

  .card {
    padding: 1rem 1.1rem;
  }

  .site-footer-inner {
    padding-left: 1.25rem;
  }

  /* Mobile nav toggle button */
  .nav-toggle-button {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    padding: 0.35rem 0.5rem;
    border-radius: 999px;
    border: 1px solid #1f2937;
    background: rgba(15, 23, 42, 0.95);
    cursor: pointer;
  }

  .nav-toggle-button span {
    width: 16px;
    height: 2px;
    border-radius: 999px;
    background: #e5e7eb;
  }

  .main-nav {
    width: 100%;
    margin-top: 0.4rem;
    display: none; /* hidden until toggled */
  }

  .main-nav ul {
    flex-wrap: wrap;
    gap: 0.4rem;
  }

  /* When checkbox is checked, show nav */
  .nav-toggle:checked + .nav-toggle-button + .main-nav {
    display: block;
  }

  /* KPI row: stack more aggressively */
  .kpi-row {
    grid-template-columns: 1fr;
  }

  /* Tables: allow horizontal scroll instead of squish */
  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
  }

  thead {
    display: none; /* hide header on small screens */
  }

  tbody tr {
    margin-bottom: 0.6rem;
    border-radius: 0.75rem;
    overflow: hidden;
  }

  tbody td {
    padding: 0.4rem 0.6rem;
    position: relative;
    padding-left: 6.5rem;
    font-size: 0.82rem;
  }

  tbody td::before {
    content: attr(data-label);
    position: absolute;
    left: 0.7rem;
    top: 0.4rem;
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #9ca3af;
  }

  /* Buttons: easier tap targets */
  .btn {
    padding: 0.5rem 1.1rem;
  }

  /* Forms: always single-column on small screens */
  .form-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ========== Extra Small Phones ========== */

@media (max-width: 480px) {
  .site-header-inner {
    padding: 0.5rem 0.6rem;
  }

  .brand-link img {
    height: 22px;
  }

  .user-menu-toggle {
    max-width: 52vw;
  }

  .site-main {
    padding: 0 0.6rem;
  }

  .has-sidebar .site-main {
    margin-left: 0;
    padding-bottom: 0;
  }

  .page-title {
    font-size: 1.1rem;
  }

  .btn {
    width: 100%; /* buttons full-width on very small screens */
  }

  .site-footer-inner {
    padding-left: 0.75rem;
  }
}

/* ========== Footer (Responsive Alignment) ========== */

.site-footer {
  border-top: 1px solid #1f2937;
  background: #020617; /* slate-950 */
  padding: 1rem 0;
  margin-top: 0;
}

.site-footer-inner {
  max-width: 100%;
  margin: 0;
  padding: 1rem 1.25rem;

  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

/* Base text styling */
.footer-left,
.footer-right {
  font-size: 0.85rem;
  color: #9ca3af;
}

/* Version highlight */
.footer-version {
  color: #38bdf8;
  font-weight: 500;
}

/* ===== Mobile (stacked + centered) ===== */
@media (max-width: 639px) {
  .site-footer-inner {
    flex-direction: column;
    gap: 0.4rem;
    text-align: center;
    padding-left: 1.25rem;
  }

  .footer-left,
  .footer-right {
    width: 100%;
    text-align: center;
  }
}

/* ===== Desktop (left + right aligned) ===== */
@media (min-width: 640px) {
  .footer-left {
    text-align: left;
    flex: 1;
  }

  .footer-right {
    text-align: right;
    flex: 1;
  }
}


/* ========== Simple Layout (No Fixed Header/Sidebar) ========== */

/* Simple header for public pages */
.site-header-simple {
  border-bottom: 1px solid var(--stroke);
  background:
    radial-gradient(700px 160px at 20% 0%, rgba(34, 197, 94, 0.18), transparent 70%),
    linear-gradient(to bottom, rgba(2, 6, 23, 0.88), rgba(2, 6, 23, 0.62));
  padding: 0.75rem 1.25rem;
}

.site-header-inner-simple {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

/* For public pages: login, leaderboard_embed */
.site-main-simple {
  margin: 0;
  padding: 2rem 1.25rem;
  padding-bottom: 150px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-height: auto;
}

.site-footer-simple {
  border-top: 1px solid var(--stroke);
  background:
    radial-gradient(700px 280px at 50% 0%, rgba(34, 197, 94, 0.12), transparent 70%),
    radial-gradient(circle at top, #020617, #020617 50%, #020617 100%);
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 70;
}

.site-footer-inner-simple {
  max-width: 100%;
  margin: 0;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.8rem;
  color: #6b7280;
  min-height: 40px;
}

.footer-left {
  flex: 1;
  min-width: 0;
  text-align: left;
}

.footer-right {
  flex-shrink: 0;
  white-space: nowrap;
  text-align: right;
}

/* Login page specific */
.login-page .card {
  max-width: 420px;
  margin: 4rem auto 2rem auto;
}

/* Leaderboard embed - centered content */
.leaderboard-embed-page .card {
  max-width: 100%;
  margin: 0 auto;
}

/* Mobile responsive for simple layout */
@media (max-width: 768px) {
  .site-main-simple {
    padding: 1.5rem 0.75rem;
    padding-bottom: 150px;
    min-height: auto;
  }

  .site-main {
    margin-left: 0;
    margin-top: 60px;
    margin-bottom: 120px;
  }

  .site-header-simple {
    padding: 0.75rem 0.75rem;
  }

  .login-page .card {
    margin: 2rem auto 1rem auto;
  }

  .site-footer-inner-simple {
    flex-direction: row;
    gap: 0.75rem;
    text-align: left;
    padding: 1rem 0.75rem;
  }

  .footer-left {
    flex: 1;
    text-align: left;
  }

  .footer-right {
    flex: 0;
    text-align: right;
  }
}

/* ========== Utility / Scrollbar ========== */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #020617;
}
::-webkit-scrollbar-thumb {
  background: #111827;
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #1f2937;
}

/* ---- Reports UI helpers (avoid EJS inside inline CSS) ---- */
.muted { color: #9ca3af; }
.small { font-size: 0.85rem; }

.link {
  color: var(--accent, #22c55e);
  text-decoration: none;
}
.link:hover { text-decoration: underline; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(55,65,81,0.9);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(15,23,42,0.95);
}

.badge-success { color: #22c55e; }
.badge-info    { color: #60a5fa; }
.badge-warn    { color: #f97316; }

/* ---- Raffle Terms modal ---- */
.raffle-terms-ack {
  width: 100%;
}

.raffle-terms-modal {
  position: fixed;
  inset: 0;
  z-index: 220;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.raffle-terms-dialog {
  width: min(760px, 100%);
  max-height: calc(100vh - 2rem);
  border-radius: 0.9rem;
  border: 1px solid var(--stroke-strong);
  background: var(--panel-solid);
  box-shadow:
    0 16px 40px rgba(2, 6, 23, 0.9),
    0 0 0 1px rgba(15, 23, 42, 0.9);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.raffle-terms-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.8rem 0.95rem;
  border-bottom: 1px solid var(--stroke);
}

.raffle-terms-header h3 {
  margin: 0;
  font-size: 1rem;
  color: #f9fafb;
}

.raffle-terms-close {
  border: 1px solid var(--stroke-strong);
  background: rgba(15, 23, 42, 0.95);
  color: #e5e7eb;
  border-radius: 0.5rem;
  width: 32px;
  height: 32px;
  font-size: 0.9rem;
  cursor: pointer;
}

.raffle-terms-body {
  padding: 0.95rem;
  overflow-y: auto;
  font-size: 0.9rem;
  line-height: 1.55;
  color: #e5e7eb;
  max-height: 52vh;
}

.raffle-terms-body h4 {
  margin: 0.9rem 0 0.3rem;
  font-size: 0.9rem;
  color: var(--accent-3);
}

.raffle-terms-body p,
.raffle-terms-body ol {
  margin: 0 0 0.7rem;
}

.raffle-terms-body ol {
  padding-left: 1.15rem;
}

.raffle-terms-footer {
  border-top: 1px solid var(--stroke);
  padding: 0.8rem 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  background: rgba(2, 6, 23, 0.95);
}

.raffle-terms-agree {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  font-size: 0.88rem;
  color: #e5e7eb;
}

.raffle-terms-actions {
  display: flex;
  gap: 0.55rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.raffle-terms-progress {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.raffle-terms-actions .btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

body.terms-modal-open {
  overflow: hidden;
}

@media (max-width: 768px) {
  .raffle-terms-modal {
    padding: 0.55rem;
    align-items: flex-end;
  }

  .raffle-terms-dialog {
    width: 100%;
    max-height: calc(100vh - 0.8rem);
    border-radius: 0.8rem 0.8rem 0 0;
  }

  .raffle-terms-header {
    padding: 0.75rem 0.8rem;
  }

  .raffle-terms-header h3 {
    font-size: 0.96rem;
  }

  .raffle-terms-body {
    max-height: 55vh;
    padding: 0.8rem;
    font-size: 0.88rem;
  }

  .raffle-terms-footer {
    padding: 0.75rem 0.8rem;
  }

  .raffle-terms-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .raffle-terms-actions .btn,
  .raffle-terms-actions .btn.secondary {
    width: 100%;
  }
}
