/* HDCF brand colours */
:root {
  --hdcf-blue-light: #5B9BD5;
  --hdcf-blue-dark:  #1A3C6E;
  --hdcf-navy-deep:  #0c2038;
  --hdcf-pink:       #E01D8C;
  --hdcf-pink-light: #f06ab4;
  --hdcf-bg:         #f0f4f8;
  --hdcf-card-bg:    #ffffff;
  --hdcf-sidebar-width: 220px;
  --hdcf-sidebar-collapsed-width: 68px;
  --hdcf-topbar-height: 56px;
}

/* ── Base ────────────────────────────────────────────────────────────────── */
body {
  background: var(--hdcf-bg);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: #2d3748;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.hdcf-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--hdcf-sidebar-width);
  background: linear-gradient(180deg, var(--hdcf-blue-dark) 0%, var(--hdcf-navy-deep) 100%);
  display: flex;
  flex-direction: column;
  z-index: 1030;
  transition: width .2s ease;
}
html.sidebar-collapsed .hdcf-sidebar {
  width: var(--hdcf-sidebar-collapsed-width);
}

.sidebar-top {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: 1rem .75rem;
}
html.sidebar-collapsed .sidebar-top {
  flex-direction: column;
  padding: .75rem .5rem;
}
.sidebar-logo-chip {
  background: #fff;
  border-radius: 10px;
  padding: .4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 auto;
  min-width: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.sidebar-logo-chip img {
  max-width: 100%;
  max-height: 40px;
  display: block;
}
.sidebar-logo-fallback {
  color: var(--hdcf-blue-dark);
  font-weight: 800;
  font-size: .85rem;
  padding: .2rem .3rem;
}
html.sidebar-collapsed .sidebar-logo-chip {
  flex: 0 0 auto;
  width: 100%;
  max-width: 44px;
}
html.sidebar-collapsed .sidebar-logo-chip img { max-height: 28px; }

.sidebar-collapse-btn {
  background: rgba(255,255,255,.1);
  border: none;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  line-height: 1;
  flex: 0 0 auto;
  transition: background .15s, transform .2s;
}
.sidebar-collapse-btn:hover { background: rgba(255,255,255,.2); }
html.sidebar-collapsed .sidebar-collapse-btn { transform: rotate(180deg); }

.sidebar-close-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.2rem;
  line-height: 1;
  flex: 0 0 auto;
}

.sidebar-nav {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: .5rem;
  display: flex;
  flex-direction: column;
  gap: .15rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem .75rem;
  border-radius: 8px;
  color: rgba(255,255,255,.8);
  font-weight: 600;
  font-size: .92rem;
  text-decoration: none;
  white-space: nowrap;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.sidebar-link:hover {
  background: rgba(255,255,255,.1);
  color: #fff;
}
.sidebar-link.active {
  background: var(--hdcf-pink);
  color: #fff;
}
.sidebar-icon {
  flex: 0 0 auto;
  width: 20px;
  text-align: center;
  font-size: 1.05rem;
}
html.sidebar-collapsed .sidebar-label { display: none; }
html.sidebar-collapsed .sidebar-link { justify-content: center; }

.sidebar-section-heading {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255,255,255,.45);
  font-weight: 800;
  padding: .9rem .75rem .3rem;
}
html.sidebar-collapsed .sidebar-section-heading { padding: .9rem 0 .3rem; text-align: center; }

.sidebar-account {
  border-top: 1px solid rgba(255,255,255,.12);
  padding: .5rem;
  display: flex;
  flex-direction: column;
  gap: .15rem;
}
.sidebar-account-name .sidebar-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Main content offset ────────────────────────────────────────────────── */
.hdcf-main {
  margin-left: var(--hdcf-sidebar-width);
  transition: margin-left .2s ease;
  padding-top: 1.5rem;
}
html.sidebar-collapsed .hdcf-main {
  margin-left: var(--hdcf-sidebar-collapsed-width);
}

/* ── Mobile topbar + drawer ─────────────────────────────────────────────── */
.mobile-topbar {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--hdcf-topbar-height);
  background: #fff;
  border-bottom: 3px solid var(--hdcf-pink);
  box-shadow: 0 2px 12px rgba(0,0,0,.08);
  align-items: center;
  gap: .75rem;
  padding: 0 1rem;
  z-index: 1040;
}
.mobile-topbar-brand img { height: 36px; }
.mobile-topbar-brand span { color: var(--hdcf-blue-dark); font-weight: 800; }
.hamburger-btn {
  background: none;
  border: none;
  width: 32px;
  height: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.hamburger-btn span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--hdcf-blue-dark);
  border-radius: 2px;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 1020;
}

@media (max-width: 767.98px) {
  .mobile-topbar { display: flex; }
  .hdcf-sidebar {
    top: var(--hdcf-topbar-height);
    height: calc(100% - var(--hdcf-topbar-height));
    width: 260px;
    transform: translateX(-100%);
    box-shadow: 4px 0 24px rgba(0,0,0,.2);
  }
  html.sidebar-collapsed .hdcf-sidebar { width: 260px; }
  html.sidebar-collapsed .sidebar-top { flex-direction: row; padding: 1rem .75rem; }
  html.sidebar-collapsed .sidebar-logo-chip { flex: 1 1 auto; width: auto; max-width: none; }
  html.sidebar-collapsed .sidebar-logo-chip img { max-height: 40px; }
  html.sidebar-collapsed .sidebar-label { display: inline; }
  html.sidebar-collapsed .sidebar-link { justify-content: flex-start; }
  html.sidebar-open .hdcf-sidebar { transform: translateX(0); }
  html.sidebar-open .sidebar-backdrop {
    display: block;
    top: var(--hdcf-topbar-height);
  }
  .hdcf-main {
    margin-left: 0 !important;
    padding-top: calc(var(--hdcf-topbar-height) + 1rem);
  }
}

/* ── Page heading strip ──────────────────────────────────────────────────── */
.page-header {
  background: linear-gradient(135deg, var(--hdcf-blue-dark) 0%, #2a5298 100%);
  color: #fff;
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
}
.page-header h1 {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0;
}
.page-header .sub {
  font-size: .9rem;
  color: rgba(255,255,255,.75);
  margin-top: .1rem;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  border: none;
  border-radius: 12px;
  box-shadow: 0 1px 6px rgba(0,0,0,.07);
}
.card-header-accent {
  background: linear-gradient(135deg, var(--hdcf-blue-dark) 0%, #2a5298 100%);
  color: #fff;
  border-radius: 12px 12px 0 0 !important;
  font-weight: 700;
  padding: .75rem 1.25rem;
  font-size: .95rem;
  letter-spacing: .01em;
}

/* ── Stat cards ──────────────────────────────────────────────────────────── */
.stat-card {
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.stat-card.blue {
  background: linear-gradient(135deg, var(--hdcf-blue-dark), #2a5298);
}
.stat-card.pink {
  background: linear-gradient(135deg, var(--hdcf-pink), #c4177c);
}
.stat-card.lightblue {
  background: linear-gradient(135deg, #2b6cb0, #1e4e8c);
}
.stat-card.red {
  background: linear-gradient(135deg, #c53030, #9b2c2c);
}
.stat-card.grey {
  background: #f7faff;
  color: #4a5568;
}
.stat-card .stat-value {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1;
}
.stat-card .stat-label {
  font-size: .85rem;
  opacity: .85;
  margin-top: .25rem;
}
.stat-card::after {
  content: '';
  position: absolute;
  right: -20px; top: -20px;
  width: 100px; height: 100px;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
}

/* ── Section headings ────────────────────────────────────────────────────── */
.section-heading {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--hdcf-blue-dark);
  font-weight: 800;
  margin-top: 1.75rem;
  margin-bottom: .6rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.section-heading::after {
  content: '';
  flex: 1;
  height: 2px;
  background: linear-gradient(to right, var(--hdcf-pink), transparent);
  border-radius: 2px;
}

/* ── List groups ─────────────────────────────────────────────────────────── */
.list-group-item {
  border-left: none;
  border-right: none;
  border-color: #edf2f7;
  padding: .85rem 1.1rem;
}
.list-group-item:first-child { border-top: none; border-radius: 12px 12px 0 0; }
.list-group-item:last-child  { border-bottom: none; border-radius: 0 0 12px 12px; }
.list-group-item:only-child  { border-radius: 12px; }

.list-group-item-action:hover {
  background: #f7faff;
}
.list-group-item-action .client-info {
  min-width: 0;
  flex: 1 1 auto;
}
@media (max-width: 575.98px) {
  .list-group-item-action .badge {
    white-space: normal;
    text-align: left;
  }
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn-primary {
  background: linear-gradient(135deg, var(--hdcf-blue-dark), #2a5298);
  border: none;
  border-radius: 8px;
  font-weight: 600;
  padding: .45rem 1.1rem;
  box-shadow: 0 2px 6px rgba(26,60,110,.25);
  transition: opacity .15s, box-shadow .15s;
}
.btn-primary:hover {
  opacity: .9;
  box-shadow: 0 4px 12px rgba(26,60,110,.3);
  background: linear-gradient(135deg, var(--hdcf-blue-dark), #2a5298);
  border: none;
}
.btn-outline-primary {
  color: var(--hdcf-blue-dark);
  border: 1.5px solid var(--hdcf-blue-dark);
  border-radius: 8px;
  font-weight: 600;
}
.btn-outline-primary:hover {
  background: var(--hdcf-blue-dark);
  border-color: var(--hdcf-blue-dark);
}
.btn-outline-secondary {
  border-radius: 8px;
  font-weight: 500;
}
.btn-outline-danger {
  border-radius: 8px;
  font-weight: 500;
}
.btn-sm { font-size: .82rem; }

/* Drill-down arrow next to a monthly hours total (respite invoice detail) —
   needs to read as clickable at a glance, not just a stray character. */
.lines-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  font-size: 1.15rem;
  line-height: 1;
  color: var(--hdcf-blue-dark);
  background: #eaf1fc;
  border: 1px solid #cddef5;
  border-radius: 50%;
  vertical-align: middle;
}
.lines-toggle:hover {
  background: #dbe7fa;
}
/* Keeps the hours figure legible next to the toggle button rather than being
   flex-shrunk to near-zero on a narrow viewport (the row still scrolls
   horizontally via .table-responsive if there's genuinely no room). */
.hours-with-toggle input {
  min-width: 3.5rem;
  flex: 0 1 auto;
}

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge {
  border-radius: 20px;
  font-weight: 600;
  font-size: .72rem;
  padding: .3em .7em;
}
.badge.bg-primary   { background: var(--hdcf-blue-dark) !important; }
.badge.bg-secondary { background: var(--hdcf-blue-light) !important; }
.badge-pink         { background: var(--hdcf-pink); color: #fff; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-control, .form-select {
  border-radius: 8px;
  border: 1.5px solid #e2e8f0;
  font-size: .92rem;
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--hdcf-blue-light);
  box-shadow: 0 0 0 3px rgba(91,155,213,.18);
}
.form-label {
  font-size: .82rem;
  color: #4a5568;
  margin-bottom: .3rem;
}

/* ── Login page ──────────────────────────────────────────────────────────── */
.login-header {
  background: linear-gradient(135deg, var(--hdcf-blue-dark) 0%, #2a5298 100%);
  color: white;
  border-radius: 12px 12px 0 0;
  padding: 2rem 1.5rem 1.5rem;
  text-align: center;
}
.login-header img {
  max-height: 80px;
  max-width: 100%;
  filter: brightness(0) invert(1);
}
.login-header .tagline {
  color: rgba(255,255,255,.75);
  font-size: .82rem;
  margin-top: .4rem;
}

/* ── Detail page dl rows ─────────────────────────────────────────────────── */
dt.col-sm-4 {
  font-size: .82rem;
  color: #718096;
  font-weight: 500;
}
dd.col-sm-8 {
  font-size: .92rem;
  color: #2d3748;
}
