/* ==========================================================================
   FCS design system - "Clinic Clean" layout, in the app's original blue
   Loaded after Bootstrap 5.2 + template CSS and overrides them.
   Tokens first; every component below uses the tokens.
   ========================================================================== */

:root {
  /* Brand */
  --fcs-primary: #2563EB;          /* Royal Blue (chosen 2026-11-18) */
  --fcs-primary-hover: #1D4ED8;
  --fcs-primary-soft: #EFF4FF;     /* tint for active/hover backgrounds */
  --fcs-primary-rgb: 37, 99, 235;

  /* Neutrals */
  --fcs-bg: #F4F6F8;
  --fcs-surface: #FFFFFF;
  --fcs-border: #E3E8EE;
  --fcs-border-strong: #CBD5E1;
  --fcs-text: #0F172A;
  --fcs-text-2: #334155;
  --fcs-muted: #64748B;

  /* Status */
  --fcs-success: #15803D;
  --fcs-warning: #B45309;
  --fcs-danger: #B91C1C;
  --fcs-info: #1D4ED8;

  /* Shape */
  --fcs-radius: 10px;
  --fcs-radius-sm: 7px;
  --fcs-shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 1px 3px rgba(15, 23, 42, .06);
  --fcs-shadow-lg: 0 10px 30px rgba(15, 23, 42, .12);

  /* Type: the computer's own font (no download) + Hindi-capable fallbacks */
  --fcs-font: "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans", "Nirmala UI", "Noto Sans Devanagari", Arial, sans-serif;

  /* Bootstrap hooks */
  --bs-primary: var(--fcs-primary);
  --bs-primary-rgb: var(--fcs-primary-rgb);
  --bs-link-color: var(--fcs-primary);
  --bs-link-hover-color: var(--fcs-primary-hover);
  --bs-body-font-family: var(--fcs-font);
  --bs-body-color: var(--fcs-text);
  --bs-border-color: var(--fcs-border);
}

/* ---------- Base ---------- */
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--fcs-font);
  font-size: 14.5px;
  background: var(--fcs-bg);
  color: var(--fcs-text);
}
h1, h2, h3, h4, h5, h6, .logo span { font-family: var(--fcs-font); color: var(--fcs-text); }
a { color: var(--fcs-primary); }
a:hover { color: var(--fcs-primary-hover); }
label, .form-label { font-weight: 600; font-size: 13px; color: var(--fcs-text-2); margin-bottom: 4px; }
.text-muted { color: var(--fcs-muted) !important; }
.fw-semibold { font-weight: 600 !important; }
:focus-visible { outline: 2px solid rgba(var(--fcs-primary-rgb), .6); outline-offset: 2px; }

/* ---------- Header ---------- */
.header {
  height: 60px;
  background: var(--fcs-surface);
  box-shadow: none;
  border-bottom: 1px solid var(--fcs-border);
}
.logo span { font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.logo .fcs-mark {
  display: inline-grid; place-items: center;
  width: 32px; height: 32px; margin-right: 10px;
  border-radius: 8px; background: var(--fcs-primary); color: #fff; font-size: 17px;
}
.header .toggle-sidebar-btn { color: var(--fcs-text-2); font-size: 26px; }
.fcs-user { display: flex; align-items: center; gap: 12px; padding-right: 20px; }
.fcs-user .who { text-align: right; line-height: 1.2; }
.fcs-user .who .name { font-weight: 600; font-size: 13.5px; }
.fcs-user .who .role { font-size: 12px; color: var(--fcs-muted); }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 248px;
  padding: 16px 12px;
  background: var(--fcs-surface);
  box-shadow: none;
  border-right: 1px solid var(--fcs-border);
}
@media (max-width: 1199px) { .sidebar { left: -248px; } }
@media (min-width: 1200px) {
  #main, #footer { margin-left: 248px; }
  .toggle-sidebar .sidebar { left: -248px; }
}
.sidebar-nav .nav-heading { font-size: 11px; letter-spacing: .06em; color: var(--fcs-muted); margin: 16px 0 6px 12px; }
.sidebar-nav .nav-item { margin-bottom: 2px; }
.sidebar-nav .nav-link,
.sidebar-nav .nav-link.collapsed {
  font-size: 14px; font-weight: 500;
  color: var(--fcs-text-2);
  background: transparent;
  padding: 9px 12px;
  border-radius: var(--fcs-radius-sm);
}
.sidebar-nav .nav-link i,
.sidebar-nav .nav-link.collapsed i { color: var(--fcs-muted); font-size: 17px; margin-right: 11px; }
.sidebar-nav .nav-link:hover { background: var(--fcs-bg); color: var(--fcs-text); }
.sidebar-nav .nav-link:hover i { color: var(--fcs-text-2); }
.sidebar-nav .nav-link.active,
.sidebar-nav .nav-link.active:hover { background: var(--fcs-primary-soft); color: var(--fcs-primary); font-weight: 600; }
.sidebar-nav .nav-link.active i { color: var(--fcs-primary); }
.sidebar-nav .nav-content a { color: var(--fcs-text-2); font-weight: 500; padding: 8px 0 8px 40px; }
.sidebar-nav .nav-content a:hover, .sidebar-nav .nav-content a.active { color: var(--fcs-primary); }
.sidebar-nav .nav-content a.active i { background-color: var(--fcs-primary); }

/* ---------- Page header (title + breadcrumb + actions) ---------- */
#main { padding: 22px 28px; }
@media (max-width: 1199px) { #main { padding: 16px; } }
.pagetitle {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px;
  margin-bottom: 18px;
}
.pagetitle h1 { font-size: 22px; font-weight: 700; color: var(--fcs-text); letter-spacing: -.01em; }
.pagetitle .breadcrumb { margin: 2px 0 0; font-size: 13px; }
.pagetitle .page-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.breadcrumb { font-family: var(--fcs-font); color: var(--fcs-muted); }
.breadcrumb a { color: var(--fcs-muted); }
.breadcrumb a:hover { color: var(--fcs-primary); }
.breadcrumb .active { color: var(--fcs-text-2); font-weight: 500; }

/* ---------- Cards ---------- */
.card {
  border: 1px solid var(--fcs-border);
  border-radius: var(--fcs-radius);
  box-shadow: var(--fcs-shadow);
  margin-bottom: 20px;
}
.card-body { padding: 18px 20px; }
.card-title { font-family: var(--fcs-font); font-size: 15px; font-weight: 700; color: var(--fcs-text); padding: 4px 0 12px; }
.card-title span { color: var(--fcs-muted); font-weight: 500; font-size: 13px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head .card-title { padding: 0; margin: 0; }

/* ---------- Buttons ---------- */
.btn { font-weight: 600; border-radius: var(--fcs-radius-sm); font-size: 14px; }
.btn-sm { font-size: 13px; padding: 4px 10px; }
.btn-primary {
  --bs-btn-bg: var(--fcs-primary); --bs-btn-border-color: var(--fcs-primary);
  --bs-btn-hover-bg: var(--fcs-primary-hover); --bs-btn-hover-border-color: var(--fcs-primary-hover);
  --bs-btn-active-bg: var(--fcs-primary-hover); --bs-btn-active-border-color: var(--fcs-primary-hover);
  --bs-btn-disabled-bg: var(--fcs-primary); --bs-btn-disabled-border-color: var(--fcs-primary);
  --bs-btn-focus-shadow-rgb: var(--fcs-primary-rgb);
}
.btn-outline-primary {
  --bs-btn-color: var(--fcs-primary); --bs-btn-border-color: rgba(var(--fcs-primary-rgb), .45);
  --bs-btn-hover-bg: var(--fcs-primary); --bs-btn-hover-border-color: var(--fcs-primary); --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: var(--fcs-primary-hover); --bs-btn-active-border-color: var(--fcs-primary-hover);
  --bs-btn-focus-shadow-rgb: var(--fcs-primary-rgb);
}
.btn-success {
  --bs-btn-bg: #15803D; --bs-btn-border-color: #15803D; --bs-btn-hover-bg: #166534; --bs-btn-hover-border-color: #166534;
}
.btn-light {
  --bs-btn-bg: #fff; --bs-btn-border-color: var(--fcs-border); --bs-btn-color: var(--fcs-text-2);
  --bs-btn-hover-bg: var(--fcs-bg); --bs-btn-hover-border-color: var(--fcs-border-strong);
}
.btn-outline-secondary {
  --bs-btn-color: var(--fcs-text-2); --bs-btn-border-color: var(--fcs-border-strong);
  --bs-btn-hover-bg: var(--fcs-bg); --bs-btn-hover-color: var(--fcs-text); --bs-btn-hover-border-color: var(--fcs-border-strong);
}
.btn-icon { width: 32px; height: 32px; padding: 0; display: inline-grid; place-items: center; margin-right: 4px; }
.btn-icon i { font-size: 15px; }
.btn i + span, .btn i { vertical-align: -1px; }

/* ---------- Forms ---------- */
.form-control, .form-select {
  border-color: var(--fcs-border-strong);
  border-radius: var(--fcs-radius-sm);
  font-size: 14px;
  min-height: 38px;
}
.form-control-sm, .form-select-sm { min-height: 32px; font-size: 13px; }
.form-control:focus, .form-select:focus {
  border-color: var(--fcs-primary);
  box-shadow: 0 0 0 3px rgba(var(--fcs-primary-rgb), .15);
}
.form-control[readonly] { background: var(--fcs-bg); }
.form-check-input:checked { background-color: var(--fcs-primary); border-color: var(--fcs-primary); }

/* Select2 to match the form controls */
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
  border-color: var(--fcs-border-strong) !important;
  border-radius: var(--fcs-radius-sm) !important;
  min-height: 38px;
}
.select2-container--default .select2-selection--single { height: 38px; padding-top: 4px; }
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 36px; }
.select2-container--default.select2-container--focus .select2-selection--multiple,
.select2-container--default.select2-container--open .select2-selection--single {
  border-color: var(--fcs-primary) !important;
  box-shadow: 0 0 0 3px rgba(var(--fcs-primary-rgb), .15);
}
.select2-container--default .select2-results__option--highlighted[aria-selected] { background-color: var(--fcs-primary); }
.select2-container--default .select2-selection--multiple .select2-selection__choice {
  background: var(--fcs-primary-soft); border-color: rgba(var(--fcs-primary-rgb), .3); color: var(--fcs-primary); font-weight: 600;
}
.select2-dropdown { border-color: var(--fcs-border-strong); border-radius: var(--fcs-radius-sm); box-shadow: var(--fcs-shadow-lg); }
.select2-search--dropdown .select2-search__field { border-radius: 6px; padding: 6px 8px; }

/* ---------- Badges ---------- */
.fcs-badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; line-height: 1.6; white-space: nowrap;
}
.fcs-badge-teal   { background: #EFF4FF; color: #1D4ED8; }
.fcs-badge-blue   { background: #E0F2FE; color: #0369A1; }
.fcs-badge-amber  { background: #FEF3E2; color: #B45309; }
.fcs-badge-green  { background: #E7F6EC; color: #15803D; }
.fcs-badge-violet { background: #F1EBFE; color: #6D28D9; }
.fcs-badge-grey   { background: #EEF1F4; color: #475569; }

/* ---------- Data tables ---------- */
.fcs-table-tools { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.fcs-search { position: relative; flex: 1 1 260px; max-width: 360px; }
.fcs-search i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--fcs-muted); font-size: 14px; pointer-events: none; }
.fcs-search input { padding-left: 32px; }
.fcs-length select { width: auto; }
table.fcs-data { font-size: 14px; }
table.fcs-data thead th {
  background: #F8FAFC; color: var(--fcs-muted);
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 1px solid var(--fcs-border); border-top: 1px solid var(--fcs-border);
  padding: 10px 12px; white-space: nowrap; position: sticky; top: 0; z-index: 1;
}
table.fcs-data thead th:first-child { border-top-left-radius: 8px; }
table.fcs-data thead th:last-child { border-top-right-radius: 8px; }
table.fcs-data tbody td { padding: 10px 12px; border-bottom: 1px solid #EEF2F6; color: var(--fcs-text); vertical-align: middle; }
table.fcs-data tbody tr:hover td { background: #FAFBFC; }
table.fcs-data th.sortable { cursor: pointer; user-select: none; }
table.fcs-data th.sortable::after { content: "↕"; opacity: .35; margin-left: 6px; font-size: 11px; }
table.fcs-data th.sorted-asc::after { content: "↑"; opacity: 1; color: var(--fcs-primary); }
table.fcs-data th.sorted-desc::after { content: "↓"; opacity: 1; color: var(--fcs-primary); }
table.fcs-data .fcs-empty td { text-align: center; color: var(--fcs-muted); padding: 36px 12px; }
.fcs-clip { display: inline-block; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.fcs-table { position: relative; }
.fcs-table.is-loading tbody { opacity: .45; transition: opacity .15s; }
.fcs-table.is-loading::after {
  content: ""; position: absolute; left: 0; right: 0; top: 52px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--fcs-primary), transparent);
  animation: fcs-bar 0.9s linear infinite;
}
@keyframes fcs-bar { from { transform: translateX(-60%); } to { transform: translateX(60%); } }
.fcs-table-foot { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; margin-top: 12px; }
.fcs-info { font-size: 13px; color: var(--fcs-muted); }
.fcs-pager { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.fcs-pager .pg {
  min-width: 34px; height: 34px; padding: 0 10px; border-radius: var(--fcs-radius-sm);
  border: 1px solid var(--fcs-border); background: #fff; color: var(--fcs-text-2); font-weight: 600; font-size: 13px;
}
.fcs-pager .pg:hover:not([disabled]) { border-color: var(--fcs-border-strong); background: var(--fcs-bg); }
.fcs-pager .pg.active { background: var(--fcs-primary); border-color: var(--fcs-primary); color: #fff; }
.fcs-pager .pg[disabled] { opacity: .4; cursor: default; }
.fcs-pager .pg-gap { color: var(--fcs-muted); padding: 0 2px; }

/* Plain (non-paged) tables used on detail pages */
.table { --bs-table-hover-bg: #FAFBFC; }
.table > :not(caption) > * > * { border-bottom-color: #EEF2F6; }

/* ---------- Filter bar ---------- */
.fcs-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 12px 14px; margin-bottom: 14px; background: #F8FAFC; border: 1px solid var(--fcs-border); border-radius: var(--fcs-radius-sm); }
.fcs-filters .f { display: flex; flex-direction: column; min-width: 140px; }
.fcs-filters .f label { font-size: 12px; margin-bottom: 3px; }
.fcs-filters .actions { margin-left: auto; display: flex; gap: 8px; }
.fcs-segment { display: inline-flex; background: #EEF1F4; border-radius: var(--fcs-radius-sm); padding: 3px; gap: 2px; }
.fcs-segment button { border: 0; background: transparent; padding: 5px 14px; border-radius: 6px; font-weight: 600; font-size: 13px; color: var(--fcs-text-2); }
.fcs-segment button.active { background: #fff; color: var(--fcs-primary); box-shadow: var(--fcs-shadow); }

/* ---------- KPI / stat cards ---------- */
.fcs-kpi { display: flex; gap: 14px; align-items: center; }
.fcs-kpi .ico {
  width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; font-size: 20px; flex: none;
  background: var(--fcs-primary-soft); color: var(--fcs-primary);
}
.fcs-kpi .ico.blue { background: #E0F2FE; color: #0369A1; }
.fcs-kpi .ico.amber { background: #FEF3E2; color: #B45309; }
.fcs-kpi .ico.violet { background: #F1EBFE; color: #6D28D9; }
.fcs-kpi .label { font-size: 13px; color: var(--fcs-muted); font-weight: 600; }
.fcs-kpi .value { font-size: 24px; font-weight: 700; line-height: 1.15; letter-spacing: -.01em; }
.fcs-kpi .sub { font-size: 12.5px; color: var(--fcs-muted); }
.fcs-split { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--fcs-border); font-size: 12.5px; color: var(--fcs-muted); }
.fcs-split b { color: var(--fcs-text); font-weight: 700; }

/* Bars (last 7 days) */
.fcs-bars { display: flex; align-items: flex-end; gap: 10px; height: 140px; padding-top: 8px; }
.fcs-bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.fcs-bars .bar .fill { width: 100%; max-width: 38px; background: rgba(var(--fcs-primary-rgb), .22); border-radius: 6px 6px 3px 3px; min-height: 3px; }
.fcs-bars .bar.today .fill { background: var(--fcs-primary); }
.fcs-bars .bar .n { font-size: 12px; font-weight: 700; color: var(--fcs-text-2); }
.fcs-bars .bar .d { font-size: 11.5px; color: var(--fcs-muted); }

/* Simple lists on the dashboard */
.fcs-list { list-style: none; margin: 0; padding: 0; }
.fcs-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid #EEF2F6; }
.fcs-list li:last-child { border-bottom: 0; }
.fcs-list .t { font-weight: 600; }
.fcs-list .s { font-size: 12.5px; color: var(--fcs-muted); }
.fcs-empty-note { color: var(--fcs-muted); font-size: 13.5px; padding: 18px 0; text-align: center; }

/* Quick actions */
.fcs-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.fcs-action {
  display: flex; gap: 10px; align-items: center; padding: 12px; border-radius: var(--fcs-radius-sm);
  border: 1px solid var(--fcs-border); color: var(--fcs-text); font-weight: 600; background: #fff;
}
.fcs-action i { font-size: 18px; color: var(--fcs-primary); }
.fcs-action:hover { border-color: rgba(var(--fcs-primary-rgb), .5); background: var(--fcs-primary-soft); color: var(--fcs-primary); }

/* ---------- Detail rows (patient / visit) ---------- */
.fcs-dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px 24px; margin: 0; }
.fcs-dl dt { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--fcs-muted); font-weight: 700; margin-bottom: 2px; }
.fcs-dl dd { margin: 0; font-weight: 500; word-break: break-word; }

/* ---------- Alerts / flash ---------- */
.alert { border-radius: var(--fcs-radius-sm); }
.fcs-flash { position: fixed; top: 72px; right: 20px; z-index: 1080; max-width: 420px; }
.fcs-flash .alert { box-shadow: var(--fcs-shadow-lg); border: 0; border-left: 4px solid currentColor; }

/* ---------- Login ---------- */
.fcs-login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--fcs-bg); }
.fcs-login .card { width: 100%; max-width: 400px; }
.fcs-login .brand { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 6px; }

/* ---------- Small screens ---------- */
@media (max-width: 575px) {
  .pagetitle h1 { font-size: 19px; }
  .fcs-filters .actions { margin-left: 0; }
  .fcs-actions { grid-template-columns: 1fr; }
}

/* Older form pages use <h1> + <nav> directly inside .pagetitle: stack them */
.pagetitle > h1 { flex: 1 1 auto; }
.pagetitle > nav { order: 3; flex-basis: 100%; margin-top: -10px; }
.pagetitle > nav .breadcrumb { margin: 0; }

/* Print buttons in tables: wrap neatly instead of squeezing; stack on narrow columns */
.fcs-print { display: flex; flex-wrap: wrap; gap: 4px; min-width: 150px; max-width: 250px; }
.fcs-print .btn { white-space: nowrap; padding: 3px 9px; font-size: 12.5px; font-weight: 600; line-height: 1.4; }
.fcs-print .btn i { font-size: 12px; margin-right: 2px; }
@media (max-width: 991px) {
  .fcs-print { flex-direction: column; min-width: 120px; }
  .fcs-print .btn { text-align: left; }
}

/* Profile menu (top bar) */
.fcs-profile { display: flex; align-items: center; gap: 10px; background: transparent; border: 0; padding: 4px 6px; border-radius: var(--fcs-radius-sm); color: var(--fcs-text); }
.fcs-profile:hover, .fcs-profile[aria-expanded="true"] { background: var(--fcs-bg); }
.fcs-avatar {
  width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  background: var(--fcs-primary); color: #fff; font-weight: 700; font-size: 14px; letter-spacing: .02em;
}
.fcs-menu { min-width: 220px; border-color: var(--fcs-border); border-radius: var(--fcs-radius); box-shadow: var(--fcs-shadow-lg); padding: 6px; }
.fcs-menu .dropdown-item { border-radius: 6px; padding: 8px 10px; font-weight: 500; }
.fcs-menu .dropdown-item:active { background: var(--fcs-primary); color: #fff; }

/* Sidebar: menu on top, Log out pinned at the bottom */
.sidebar { display: flex; flex-direction: column; }
.sidebar .sidebar-nav { flex: 1 0 auto; }
.sidebar-foot { border-top: 1px solid var(--fcs-border); padding-top: 10px; margin-top: 12px; }
.sidebar-foot .fcs-logout { display: flex; align-items: center; padding: 9px 12px; border-radius: var(--fcs-radius-sm); color: var(--fcs-danger); font-weight: 600; font-size: 14px; }
.sidebar-foot .fcs-logout i { font-size: 17px; margin-right: 11px; color: var(--fcs-danger); }
.sidebar-foot .fcs-logout:hover { background: #FEF2F2; color: var(--fcs-danger); }

/* ==========================================================================
   "Balanced" layer (2026-11-18): user asked for a look between the live (template)
   design and the modern one. Restores the template's soft shadows, light blue-white
   background, navy headings, normal-case table headers and zebra rows.
   ========================================================================== */
:root {
  --fcs-bg: #F6F9FF;              /* template background */
  --fcs-heading: #012970;         /* template heading navy */
  --fcs-shadow: 0 0 30px rgba(1, 41, 112, .08);
  --fcs-radius: 8px;
}
.header { border-bottom: 0; box-shadow: 0 2px 20px rgba(1, 41, 112, .1); }
.sidebar { border-right: 0; box-shadow: 0 0 20px rgba(1, 41, 112, .1); }
.logo span, .pagetitle h1, .card-title, h1, h2, h3, h4, h5 { color: var(--fcs-heading); }
.pagetitle h1 { font-weight: 600; font-size: 23px; letter-spacing: 0; }
.card { border: 0; box-shadow: var(--fcs-shadow); }
.card-title { font-weight: 600; font-size: 17px; }

/* Tables: closer to the old bordered/striped Bootstrap tables */
table.fcs-data thead th {
  text-transform: none; letter-spacing: 0; font-size: 13.5px; font-weight: 700;
  color: var(--fcs-heading); background: #F1F5FD; border-top: 0;
}
table.fcs-data tbody tr:nth-child(even) td { background: #FAFCFF; }
table.fcs-data tbody tr:hover td { background: #F1F5FD; }
table.fcs-data tbody td { border-bottom-color: #E6ECF5; }

/* Badges: Bootstrap-like rounded rectangles instead of pills */
.fcs-badge { border-radius: 5px; font-weight: 600; }

/* Filter bar: plain white like the old forms */
.fcs-filters { background: #fff; border-color: #E6ECF5; }

/* Segmented control -> classic outline button group look */
.fcs-segment { background: transparent; padding: 0; gap: 0; }
.fcs-segment button { border: 1px solid rgba(var(--fcs-primary-rgb), .45); color: var(--fcs-primary); border-radius: 0; padding: 5px 16px; margin-left: -1px; }
.fcs-segment button:first-child { border-radius: 6px 0 0 6px; margin-left: 0; }
.fcs-segment button:last-child { border-radius: 0 6px 6px 0; }
.fcs-segment button.active { background: var(--fcs-primary); color: #fff; box-shadow: none; }

/* Labelled row action buttons (View / Edit / Delete), colours like the old text links */
.fcs-act { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.fcs-act .btn { padding: 2px 9px; font-size: 12.5px; white-space: nowrap; }
.fcs-act { flex-wrap: nowrap; }
table.fcs-data tbody td, table.fcs-data thead th { padding-left: 9px; padding-right: 9px; }

/* Quick links on the dashboard cards (same links as the live dashboard) */
.fcs-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 14px; }
.fcs-quick a {
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: 6px;
  border: 1px solid rgba(var(--fcs-primary-rgb), .3); background: #fff;
  color: var(--fcs-primary); font-weight: 600; font-size: 13px; white-space: nowrap;
}
.fcs-quick a:hover { background: var(--fcs-primary); border-color: var(--fcs-primary); color: #fff; }
.fcs-logout-top { font-size: 14px; padding: 6px 14px; }

/* ==========================================================================
   Colour palette (2026-11-19, user choice): PRIMARY #012970 navy,
   SECONDARY #4154F1 blue, TERTIARY #F6F9FF / #E9EFFD pale blue tints.
   (Same navy + blue pair the live template uses.) Overrides the tokens above.
   ========================================================================== */
:root {
  --fcs-primary: #012970;            /* primary: solid buttons, headings, active states */
  --fcs-primary-hover: #001A4D;
  --fcs-primary-rgb: 1, 41, 112;
  --fcs-primary-soft: #E9EFFD;       /* tertiary tint for active/hover backgrounds */
  --fcs-secondary: #4154F1;          /* secondary: links, outline buttons, focus */
  --fcs-secondary-hover: #2E40D9;
  --fcs-secondary-rgb: 65, 84, 241;
  --fcs-tertiary: #F6F9FF;           /* tertiary: page background */
  --fcs-bg: var(--fcs-tertiary);
  --fcs-heading: var(--fcs-primary);
  --bs-link-color: var(--fcs-secondary);
  --bs-link-hover-color: var(--fcs-secondary-hover);
}
a { color: var(--fcs-secondary); }
a:hover { color: var(--fcs-secondary-hover); }
:focus-visible { outline-color: rgba(var(--fcs-secondary-rgb), .6); }

/* Outline buttons (print, receipt, edit, export...) in the secondary blue */
.btn-outline-primary {
  --bs-btn-color: var(--fcs-secondary); --bs-btn-border-color: rgba(var(--fcs-secondary-rgb), .5);
  --bs-btn-hover-bg: var(--fcs-secondary); --bs-btn-hover-border-color: var(--fcs-secondary); --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: var(--fcs-secondary-hover); --bs-btn-active-border-color: var(--fcs-secondary-hover);
  --bs-btn-focus-shadow-rgb: var(--fcs-secondary-rgb);
}
.fcs-quick a { color: var(--fcs-secondary); border-color: rgba(var(--fcs-secondary-rgb), .35); }
.fcs-quick a:hover { background: var(--fcs-secondary); border-color: var(--fcs-secondary); color: #fff; }
.fcs-action i { color: var(--fcs-secondary); }
.fcs-action:hover { border-color: rgba(var(--fcs-secondary-rgb), .5); background: var(--fcs-primary-soft); color: var(--fcs-primary); }

/* Form focus + select2 in the secondary blue */
.form-control:focus, .form-select:focus { border-color: var(--fcs-secondary); box-shadow: 0 0 0 3px rgba(var(--fcs-secondary-rgb), .15); }
.select2-container--default.select2-container--focus .select2-selection--multiple,
.select2-container--default.select2-container--open .select2-selection--single { border-color: var(--fcs-secondary) !important; box-shadow: 0 0 0 3px rgba(var(--fcs-secondary-rgb), .15); }
.select2-container--default .select2-results__option--highlighted[aria-selected] { background-color: var(--fcs-secondary); }
.form-check-input:checked { background-color: var(--fcs-secondary); border-color: var(--fcs-secondary); }

/* Tables: tertiary tints */
table.fcs-data thead th { background: #EEF3FE; color: var(--fcs-primary); }
table.fcs-data tbody tr:nth-child(even) td { background: #FAFCFF; }
table.fcs-data tbody tr:hover td { background: var(--fcs-primary-soft); }
table.fcs-data th.sorted-asc::after, table.fcs-data th.sorted-desc::after { color: var(--fcs-secondary); }

/* Badges: blue family in secondary/tertiary */
.fcs-badge-teal { background: var(--fcs-primary-soft); color: var(--fcs-primary); }
.fcs-badge-blue { background: #ECEEFE; color: var(--fcs-secondary-hover); }

/* Sidebar (live markup): hover/active in tertiary + secondary */
.sidebar-nav .nav-link:hover, .sidebar-nav .nav-link:hover i { color: var(--fcs-secondary); }
.sidebar-nav .nav-link:hover { background: var(--fcs-tertiary); }
.sidebar-nav .nav-content a:hover, .sidebar-nav .nav-content a.active { color: var(--fcs-secondary); }

/* KPI icons */
.fcs-kpi .ico { background: var(--fcs-primary-soft); color: var(--fcs-primary); }
.fcs-kpi .ico.blue { background: #ECEEFE; color: var(--fcs-secondary); }

/* Confirmation dialog (SweetAlert-style) */
.fcs-swal {
  position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; padding: 16px;
  background: rgba(1, 21, 56, .45); backdrop-filter: blur(2px);
  opacity: 0; transition: opacity .18s ease;
}
.fcs-swal.show { opacity: 1; }
.fcs-swal[hidden] { display: none; }
.fcs-swal-box {
  width: 100%; max-width: 420px; background: #fff; border-radius: 14px; padding: 30px 26px 24px;
  text-align: center; box-shadow: 0 20px 60px rgba(1, 21, 56, .3);
  transform: scale(.85); transition: transform .22s cubic-bezier(.2, 1.4, .4, 1);
}
.fcs-swal.show .fcs-swal-box { transform: scale(1); }
.fcs-swal-icon {
  width: 76px; height: 76px; margin: 0 auto 16px; border-radius: 50%;
  border: 4px solid #F8BB86; display: grid; place-items: center; font-size: 42px;
  color: #F0A35E; animation: fcs-pulse .7s ease-out;
}
@keyframes fcs-pulse { 0% { transform: scale(.5); opacity: 0; } 60% { transform: scale(1.12); opacity: 1; } 100% { transform: scale(1); } }
.fcs-swal-title { font-size: 22px; font-weight: 700; color: var(--fcs-primary); margin: 0 0 8px; }
.fcs-swal-text { color: var(--fcs-text-2); font-size: 15px; margin: 0 0 22px; }
.fcs-swal-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.fcs-swal-actions .btn { min-width: 130px; padding: 9px 18px; font-size: 15px; }
.fcs-swal-actions .btn-danger { background: #DC3545; border-color: #DC3545; }
.fcs-swal-actions .btn-danger:hover { background: #BB2D3B; border-color: #BB2D3B; }

/* ==========================================================================
   Responsive tables (2026-11-19): one structure, three layouts
   - >= 1400px : table, print buttons on ONE line
   - 1200-1399px: table, print buttons in a fixed 2-line block (same height on every row)
   - < 1200px  : every row becomes a card with labelled fields; buttons full width
   ========================================================================== */
/* Visits column sizing (desktop) */
table.fcs-data td.c-uhid { white-space: nowrap; }
table.fcs-data td.c-patient { min-width: 140px; }
table.fcs-data td.c-diag .fcs-clip { max-width: 180px; }
table.fcs-data td.c-date, table.fcs-data td.c-fee, table.fcs-data td.c-rx { white-space: nowrap; }
table.fcs-data td.c-actions .fcs-act { flex-wrap: nowrap; }

/* Print buttons: fixed grid so every row looks the same */
.fcs-print { display: grid; grid-template-columns: auto auto; gap: 4px; justify-content: start; min-width: 0; max-width: none; flex-direction: initial; }
.fcs-print .btn { text-align: center; }
.fcs-print .btn:nth-child(3) { grid-column: 1 / -1; }
.fcs-print .btn:nth-child(4) { grid-column: auto; }
@media (min-width: 1400px) {
  .fcs-print { grid-template-columns: auto auto auto auto; }
  .fcs-print .btn:nth-child(3) { grid-column: auto; }
}

/* Phone / tablet: rows become cards */
@media (max-width: 1199.98px) {
  .fcs-table .table-responsive { overflow: visible; }
  table.fcs-data, table.fcs-data tbody { display: block; width: 100%; }
  table.fcs-data thead { display: none; }
  table.fcs-data tbody tr {
    display: block; background: #fff; border: 1px solid var(--fcs-border); border-radius: 10px;
    padding: 6px 14px; margin-bottom: 12px; box-shadow: var(--fcs-shadow);
  }
  table.fcs-data tbody tr:nth-child(even) td,
  table.fcs-data tbody tr:hover td { background: transparent; }
  table.fcs-data tbody td {
    display: flex; justify-content: space-between; align-items: center; gap: 14px;
    padding: 8px 0; border-bottom: 1px dashed #E6ECF5; text-align: right; min-width: 0;
  }
  table.fcs-data tbody td:last-child { border-bottom: 0; }
  table.fcs-data tbody td::before {
    content: attr(data-label); flex: none; text-align: left;
    font-size: 12.5px; font-weight: 700; color: var(--fcs-muted);
  }
  table.fcs-data tbody td[data-label=""]::before { content: none; }
  table.fcs-data tbody td .fcs-clip { max-width: 60vw; }
  /* Buttons get the full card width, label on top */
  table.fcs-data tbody td.c-wide { display: block; text-align: left; }
  table.fcs-data tbody td.c-wide::before { display: block; margin-bottom: 6px; }
  table.fcs-data tbody td.c-wide .fcs-act { flex-wrap: wrap; }
  .fcs-print { grid-template-columns: 1fr 1fr 1fr; }
  .fcs-print .btn:nth-child(3) { grid-column: auto; }
  .fcs-print .btn:nth-child(4) { grid-column: 1 / -1; }
  /* Empty / message rows stay simple */
  table.fcs-data tbody tr.fcs-empty td { display: block; text-align: center; }
  table.fcs-data tbody tr.fcs-empty td::before { content: none; }
  .fcs-table-foot { justify-content: center; }
}
@media (max-width: 420px) {
  .fcs-print { grid-template-columns: 1fr 1fr; }
  .fcs-print .btn:nth-child(3) { grid-column: 1 / -1; }
}
/* Same row height everywhere on the table layouts */
@media (min-width: 1200px) {
  table.fcs-data td.c-patient .fcs-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 210px; }
  table.fcs-data td.c-diag .fcs-clip { white-space: nowrap; }
}
/* Compact table for 1200-1399px (sidebar visible, less room): icon-only actions, tighter cells */
@media (min-width: 1200px) and (max-width: 1399.98px) {
  table.fcs-data tbody td, table.fcs-data thead th { padding-left: 6px; padding-right: 6px; }
  table.fcs-data td.c-patient .fcs-name { max-width: 150px; }
  table.fcs-data td.c-diag .fcs-clip { max-width: 110px; }
  table.fcs-data td.c-actions .btn .lbl { display: none; }
  table.fcs-data td.c-actions .btn { padding: 3px 8px; }
  .fcs-print .btn { padding: 3px 7px; }
}
/* Cards: label on the left, value(s) stacked on the right (e.g. patient name over mobile) */
@media (max-width: 1199.98px) {
  table.fcs-data tbody td:not(.c-wide) {
    display: grid; grid-template-columns: auto 1fr; column-gap: 14px; row-gap: 1px; align-items: center; justify-items: end;
  }
  table.fcs-data tbody td:not(.c-wide)::before { grid-column: 1; grid-row: 1 / span 3; align-self: center; justify-self: start; }
  table.fcs-data tbody td:not(.c-wide) > * { grid-column: 2; }
  table.fcs-data tbody td .fcs-name { text-align: right; }
}
/* Filters on phones: two per row, full width */
@media (max-width: 575.98px) {
  .fcs-filters .f { flex: 1 1 calc(50% - 10px); min-width: 0; }
  .fcs-filters .actions { flex: 1 1 100%; justify-content: flex-end; }
  .fcs-table-tools .fcs-search { flex: 1 1 100%; max-width: none; }
}
