:root {
  --sidebar-width: 260px;
  --topbar-height: 64px;
  /* Brand palette sampled from static/img/logo.png (Mwambe Royal Court: orange + black) */
  --brand: #f7931e;
  --brand-dark: #c2690a;
  --brand-light: #fff1e0;
  --ink: #17181c;
  --sidebar-bg: #181a1f;
  --bg-soft: #f7f6f4;
}

* { box-sizing: border-box; }
body { background: var(--bg-soft); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }

/* ---------- Bootstrap primary → brand orange (buttons, links, pagination, focus rings) ---------- */
.btn-primary {
  --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand-dark); --bs-btn-hover-border-color: var(--brand-dark);
  --bs-btn-active-bg: var(--brand-dark); --bs-btn-active-border-color: var(--brand-dark);
  --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand);
  --bs-btn-focus-shadow-rgb: 247, 147, 30;
}
.btn-outline-primary {
  --bs-btn-color: var(--brand-dark); --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand);
  --bs-btn-active-bg: var(--brand); --bs-btn-active-border-color: var(--brand);
  --bs-btn-focus-shadow-rgb: 247, 147, 30;
}
.text-primary { color: var(--brand) !important; }
.bg-primary { background-color: var(--brand) !important; }
a { color: var(--brand-dark); }
a:hover { color: var(--brand); }
.page-link { color: var(--brand-dark); }
.page-item.active .page-link { background-color: var(--brand); border-color: var(--brand); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.spinner-border.text-primary { color: var(--brand) !important; }

/* ---------- Topbar ---------- */
.app-topbar {
  height: var(--topbar-height);
  position: fixed; top: 0; left: 0; right: 0; z-index: 1030;
  background: #fff; border-bottom: 1px solid #eceef3;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.app-topbar .brand { font-weight: 700; color: var(--ink); font-size: 1.1rem; }
.app-topbar .brand-logo { height: 38px; width: auto; display: block; }
.topbar-btn {
  width: 38px; height: 38px; border-radius: 50%; border: none; background: transparent;
  display: inline-flex; align-items: center; justify-content: center; position: relative;
  color: #444; transition: background .15s;
}
.topbar-btn:hover { background: var(--brand-light); color: var(--brand-dark); }
.notif-badge {
  position: absolute; top: 2px; right: 2px; background: #ef4444; color: #fff;
  font-size: .62rem; border-radius: 50%; min-width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center; padding: 0 3px;
}
.avatar-sm { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; border: 2px solid #eceef3; }
.avatar-lg { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; border: 3px solid #eceef3; }

/* ---------- Sidebar (dark, matching the logo's black + orange accents) ---------- */
.app-sidebar {
  position: fixed; top: var(--topbar-height); left: 0; bottom: 0; width: var(--sidebar-width);
  background: var(--sidebar-bg); border-right: 1px solid #000; overflow-y: auto; z-index: 1020;
  padding: 0 .5rem 2rem;
  transition: transform .25s ease;
  scrollbar-width: thin; scrollbar-color: rgba(247,147,30,.5) var(--sidebar-bg);
}
.app-sidebar::-webkit-scrollbar { width: 6px; }
.app-sidebar::-webkit-scrollbar-track { background: var(--sidebar-bg); }
.app-sidebar::-webkit-scrollbar-thumb { background: rgba(247,147,30,.5); border-radius: 3px; }
.app-sidebar::-webkit-scrollbar-thumb:hover { background: var(--brand); }
.sidebar-user-panel {
  display: flex; align-items: center; gap: .65rem;
  padding: 1rem .5rem 1rem;
  margin: 0 -.5rem 1rem; padding-left: 1rem; padding-right: 1rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-user-panel .avatar-wrap { position: relative; flex-shrink: 0; }
.sidebar-user-panel .avatar-sm { border-color: rgba(255,255,255,.18); }
.sidebar-user-panel .online-dot {
  position: absolute; bottom: 0; right: 0; width: 10px; height: 10px; border-radius: 50%;
  background: #22c55e; border: 2px solid var(--sidebar-bg);
}
.sidebar-user-panel .user-name { color: #fff; font-weight: 600; font-size: .88rem; line-height: 1.25; }
.sidebar-user-panel .user-role { color: #9a9ea8; font-size: .72rem; }
.sidebar-user-panel a { color: inherit; text-decoration: none; }
.sidebar-user-panel a:hover .user-name { color: var(--brand); }

.app-sidebar .nav-link { color: #b9bcc4; border-radius: .5rem; padding: .55rem .75rem; font-size: .92rem;
  display: flex; align-items: center; gap: .6rem; margin-bottom: 2px; }
.app-sidebar .nav-link:hover { background: rgba(247,147,30,.14); color: var(--brand); }
.app-sidebar .nav-link.active { background: var(--brand); color: #fff; box-shadow: 0 4px 10px rgba(247,147,30,.35); }
.app-sidebar .nav-link .bi, .app-sidebar .nav-link .icon { width: 18px; text-align: center; }
.app-sidebar .sub-link { padding-left: 2.2rem; font-size: .87rem; }
.app-sidebar .sub-sub-link { padding-left: 3.2rem; font-size: .85rem; }
.app-sidebar .section-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: #6d7079; margin: 1rem .75rem .35rem; }
.app-sidebar .collapse-caret { margin-left: auto; transition: transform .2s; font-size: .75rem; }
.app-sidebar a[aria-expanded="true"] .collapse-caret { transform: rotate(90deg); }

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

/* ---------- App shell ---------- */
.app-content {
  margin-left: var(--sidebar-width);
  padding-top: calc(var(--topbar-height) + 1rem);
  padding-left: 1rem; padding-right: 1rem; padding-bottom: 2rem;
  min-height: 100vh;
}

@media (max-width: 991.98px) {
  .app-sidebar { transform: translateX(-100%); }
  .app-sidebar.show { transform: translateX(0); box-shadow: 4px 0 16px rgba(0,0,0,.15); }
  .sidebar-backdrop.show { display: block; }
  .app-content { margin-left: 0; }
}

/* ---------- Cards ---------- */
.stat-card {
  background: #fff; border-radius: 1rem; padding: 1.1rem 1.25rem; border: 1px solid #eceef3;
  transition: transform .18s ease, box-shadow .18s ease;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(247,147,30,.16); }
.stat-card .stat-value {
  font-size: 0.8rem; font-weight: 700; line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.stat-icon {
  width: 46px; height: 46px; border-radius: .8rem; display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
}

.app-card { background: #fff; border-radius: 1rem; border: 1px solid #eceef3; transition: box-shadow .18s ease; }
.app-card:hover { box-shadow: 0 8px 20px rgba(0,0,0,.06); }

.room-card { transition: transform .18s ease, box-shadow .18s ease; }
.room-card:hover { transform: translateY(-3px); box-shadow: 0 10px 22px rgba(0,0,0,.08); }

.table-card { background: #fff; border-radius: 1rem; border: 1px solid #eceef3; overflow: hidden; }
.table-card table { margin-bottom: 0; }
.table-card thead th { background: #fafbfe; border-bottom: 1px solid #eceef3; font-size: .78rem; text-transform: uppercase; color: #6b7280; letter-spacing: .04em; }
.table-card tbody tr { transition: background .12s; }
.table-card tbody tr:hover { background: #fff8f0; }

/* AdminLTE-style profile card (accounts/profile.html) */
.profile-card { background: #fff; border-radius: 1rem; border: 1px solid #eceef3; overflow: hidden; }
.profile-card .profile-cover {
  height: 90px;
  background: linear-gradient(120deg, var(--ink), var(--brand-dark) 130%);
}
.profile-card .profile-avatar { margin-top: -52px; border: 4px solid #fff; }
.profile-card .profile-stat { border-left: 1px solid #eceef3; }
.profile-card .profile-stat:first-child { border-left: none; }

.badge-soft-success { background: #dcfce7; color: #15803d; }
.badge-soft-warning { background: #fef9c3; color: #a16207; }
.badge-soft-danger { background: #fee2e2; color: #b91c1c; }
.badge-soft-info { background: #dbeafe; color: #1d4ed8; }
.badge-soft-secondary { background: #f1f2f6; color: #4b5563; }

.btn-icon { width: 34px; height: 34px; border-radius: .6rem; display: inline-flex; align-items: center; justify-content: center; }

.htmx-indicator { opacity: 0; transition: opacity 150ms ease-in; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }

input[type=text], input[type=password], input[type=search], input[type=email],
input[type=number], input[type=tel], input[type=date], input[type=datetime-local],
input[type=file], select, textarea {
  display: block; width: 100%; padding: .5rem .75rem; font-size: .92rem;
  border: 1px solid #dde1ea; border-radius: .6rem; background: #fff;
}
input[type=checkbox], input[type=radio] { width: auto; display: inline-block; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(247,147,30,.15); }

/* ---------- Auth pages (login) ---------- */
.auth-wrapper {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem;
  background: var(--bg-soft);
}
.auth-shell { width: 100%; max-width: 920px; display: flex; flex-direction: column; gap: 1rem; align-items: stretch; }

.login-panel {
  width: 100%; min-height: 560px; background: #fff; border-radius: 1.5rem; overflow: hidden;
  box-shadow: 0 24px 60px rgba(17,24,39,.12);
  display: flex; flex-wrap: wrap;
}
.login-hero {
  flex: 1 1 340px; position: relative; overflow: hidden; min-height: 320px;
  background: linear-gradient(155deg, var(--brand-light) 0%, var(--brand) 55%, var(--brand-dark) 100%);
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 2.5rem 2rem;
}
.login-hero-shape { position: absolute; border-radius: 50%; background: #fff; opacity: .3; }
.login-hero-shape.shape-1 { width: 440px; height: 440px; left: -170px; bottom: -200px; }
.login-hero-shape.shape-2 { width: 260px; height: 260px; right: -110px; top: -90px; background: var(--brand-dark); opacity: .22; }
.login-hero-logo-wrap {
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff; border-radius: 1.1rem; padding: .9rem 1.2rem;
  box-shadow: 0 12px 28px rgba(0,0,0,.18);
  position: relative; z-index: 1; align-self: flex-start;
}
.login-hero-logo { width: 160px; height: auto; display: block; }
.login-hero-title {
  color: #fff; font-weight: 800; font-size: 2.5rem; line-height: 1.15; position: relative; z-index: 1; margin: 0;
  text-shadow: 0 4px 18px rgba(0,0,0,.15);
}
.login-form-side { flex: 1 1 360px; padding: 3rem 2.75rem; display: flex; flex-direction: column; justify-content: center; }
.login-form-side h2 { font-weight: 800; margin-bottom: .35rem; color: var(--ink); }
.login-btn { padding: .65rem; border-radius: .7rem; font-weight: 600; }

@media (max-width: 767.98px) {
  .login-hero { min-height: 200px; padding: 1.75rem 1.5rem; }
  .login-hero-title { font-size: 1.85rem; }
  .login-form-side { padding: 2rem 1.5rem; }
  .login-hero-logo { width: 120px; }
}

/* Mobile app feel: bottom-safe padding + rounder everything on small screens */
@media (max-width: 575.98px) {
  .app-content { padding-left: .6rem; padding-right: .6rem; }
  .stat-card { padding: .9rem 1rem; }
}
