:root {
  --rc-bg: #0f1115;
  --rc-panel: #181b22;
  --rc-panel-2: #1f232d;
  --rc-border: #2a2f3a;
  --rc-text: #e8eaed;
  --rc-muted: #9aa0a6;
  --rc-red: #dc3545;
  --rc-red-dark: #a61e2d;
}
body {
  background: linear-gradient(180deg, #0d0f14 0%, #12141b 100%);
  color: var(--rc-text);
  min-height: 100vh;
}
#wrapper { min-height: 100vh; }
.sidebar {
  width: 280px;
  min-width: 280px;
  background: linear-gradient(180deg, #12151d 0%, #171a22 100%);
  border-right: 1px solid var(--rc-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1030;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--rc-border); border-radius: 4px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: var(--rc-muted); }
.sidebar-divider { border-top: 1px solid var(--rc-border); }
.sidebar-link {
  color: #c7ccd3;
  border-radius: 10px;
  margin: 2px 0;
  padding: 0.72rem 0.9rem;
  transition: all .2s ease;
}
.sidebar-link:hover, .sidebar-link.active {
  background: rgba(220,53,69,.12);
  color: #fff;
}
.sidebar-section-header {
  color: var(--rc-muted);
  font-size: .72rem;
  letter-spacing: .08em;
  padding: 1rem .9rem .4rem;
  text-transform: uppercase;
}
.sidebar-footer { border-top: 1px solid var(--rc-border); }
.top-navbar {
  min-height: 64px;
  background: rgba(17,20,27,.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rc-border);
  position: sticky;
  top: 0;
  z-index: 1020;
}
#page-content-wrapper { min-width: 0; }
.card {
  background: var(--rc-panel);
  border: 1px solid var(--rc-border) !important;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
}
.table { --bs-table-bg: transparent; --bs-table-color: var(--rc-text); --bs-table-border-color: var(--rc-border); }
.table thead th { color: var(--rc-muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; }
.table-hover tbody tr:hover { --bs-table-accent-bg: rgba(255,255,255,.03); }
.form-control, .form-select {
  background-color: var(--rc-panel-2);
  border-color: var(--rc-border);
  color: var(--rc-text);
}
.form-control:focus, .form-select:focus {
  background-color: var(--rc-panel-2);
  border-color: rgba(220,53,69,.6);
  box-shadow: 0 0 0 .2rem rgba(220,53,69,.12);
  color: var(--rc-text);
}
.progress { background-color: #2b303b; }
.kpi-card { overflow: hidden; position: relative; }
.kpi-card::after {
  content: '';
  position: absolute;
  inset: auto -30px -30px auto;
  width: 90px;
  height: 90px;
  background: radial-gradient(circle, rgba(220,53,69,.22) 0%, rgba(220,53,69,0) 70%);
}
.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}
.btn-xs {
  --bs-btn-padding-y: .15rem;
  --bs-btn-padding-x: .4rem;
  --bs-btn-font-size: .75rem;
}
.report-card:hover {
  transform: translateY(-2px);
  transition: transform .2s ease, box-shadow .2s ease;
  box-shadow: 0 12px 32px rgba(0,0,0,.28);
}
.breadcrumb { --bs-breadcrumb-divider-color: var(--rc-muted); }
.breadcrumb-item, .breadcrumb-item a { color: var(--rc-muted); }
.breadcrumb-item.active { color: var(--rc-text); }
.page-link {
  background: var(--rc-panel-2);
  border-color: var(--rc-border);
  color: var(--rc-text);
}
.page-item.active .page-link {
  background: var(--rc-red);
  border-color: var(--rc-red);
}
.sidebar-overlay { display: none; }
.x-small { font-size: .72rem; }

/* ── Config cards (configuration/index.html) ── */
.config-card {
  display: block;
  text-decoration: none;
  background: var(--rc-panel);
  border: 1px solid var(--rc-border) !important;
  border-radius: var(--bs-card-border-radius, .375rem);
  transition: border-color .2s ease, transform .2s ease;
  overflow: hidden;
}
.config-card:hover {
  border-color: var(--rc-red) !important;
  transform: translateY(-2px);
}
.config-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

/* ── Mobile utilities ── */
@media (max-width: 575.98px) {
  .hide-xs { display: none !important; }
  /* ensure adequate card body padding on small screens */
  .card-body { padding: .85rem; }
  /* modal: scrollable by default on tiny screens */
  .modal-dialog { margin: .5rem; }
}

@media (max-width: 991.98px) {
  .sidebar {
    position: fixed;
    transform: translateX(-100%);
    transition: transform .25s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    opacity: 0;
    visibility: hidden;
    transition: all .25s ease;
    z-index: 1025;
  }
  .sidebar-overlay.show { opacity: 1; visibility: visible; }
}

/* ── FullCalendar dark theme ── */
.fc {
  --fc-border-color: var(--rc-border);
  --fc-page-bg-color: transparent;
  --fc-neutral-bg-color: var(--rc-panel-2);
  --fc-neutral-text-color: var(--rc-muted);
  --fc-today-bg-color: rgba(220,53,69,.08);
  --fc-highlight-color: rgba(220,53,69,.12);
  --fc-now-indicator-color: var(--rc-red);
  --fc-button-bg-color: var(--rc-panel-2);
  --fc-button-border-color: var(--rc-border);
  --fc-button-text-color: var(--rc-text);
  --fc-button-hover-bg-color: rgba(220,53,69,.15);
  --fc-button-hover-border-color: var(--rc-red);
  --fc-button-active-bg-color: var(--rc-red);
  --fc-button-active-border-color: var(--rc-red);
  --fc-event-border-color: transparent;
  color: var(--rc-text);
  font-family: inherit;
}
.fc-theme-standard td, .fc-theme-standard th, .fc-theme-standard .fc-scrollgrid { border-color: var(--rc-border); }
.fc .fc-col-header-cell { background: var(--rc-panel-2); }
.fc .fc-col-header-cell-cushion { color: var(--rc-muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; text-decoration: none; padding: 8px 4px; }
.fc .fc-daygrid-day-number { color: var(--rc-text); font-size: .85rem; text-decoration: none; padding: 6px 8px; }
.fc .fc-day-today .fc-daygrid-day-number { color: var(--rc-red); font-weight: 700; }
.fc .fc-day-today { background: rgba(220,53,69,.07) !important; }
.fc .fc-daygrid-day:hover { background: rgba(255,255,255,.025); }
.fc .fc-button { border-radius: 8px; font-size: .82rem; font-weight: 500; padding: .35rem .75rem; transition: all .2s; box-shadow: none !important; }
.fc .fc-button:focus { box-shadow: none !important; outline: none; }
.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active { background: var(--rc-red); border-color: var(--rc-red); color: #fff; }
.fc .fc-toolbar-title { font-size: 1.15rem; font-weight: 700; color: var(--rc-text); }
.fc .fc-event { border-radius: 5px; font-size: .76rem; font-weight: 500; padding: 1px 5px; border: none; cursor: pointer; }
.fc .fc-event:hover { filter: brightness(1.15); }
.fc .fc-daygrid-more-link { color: var(--rc-muted); font-size: .76rem; }
.fc .fc-daygrid-more-link:hover { color: var(--rc-red); }
.fc .fc-list-event:hover td { background: rgba(255,255,255,.03); }
.fc .fc-list-day-cushion { background: var(--rc-panel-2); }
.fc .fc-list-day-text, .fc .fc-list-day-side-text { color: var(--rc-text); text-decoration: none; font-weight: 600; }
.fc .fc-list-event-title a { color: var(--rc-text); text-decoration: none; }
.fc .fc-timegrid-slot { border-color: var(--rc-border); }
.fc .fc-timegrid-axis { color: var(--rc-muted); font-size: .75rem; }
.fc .fc-scrollgrid-section-header th { background: var(--rc-panel-2); }
.fc .fc-popover { background: var(--rc-panel); border: 1px solid var(--rc-border); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.fc .fc-popover-header { background: var(--rc-panel-2); border-radius: 10px 10px 0 0; color: var(--rc-text); font-weight: 600; }
.fc .fc-popover-body { padding: 8px; }
