/* ─── Variables ─────────────────────────────────────────────────────────── */
:root {
  --sidebar-width: 240px;
  --sidebar-bg: #0f1923;
  --sidebar-text: #c5cfe0;
  --sidebar-active: #1a6faf;
  --topbar-height: 52px;
  --primary: #1a6faf;
}

/* ─── Layout ────────────────────────────────────────────────────────────── */
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 0.875rem;
  background: #f4f6fb;
  overflow-x: hidden;
}

.wrapper {
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar ───────────────────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 1000;
  transition: width 0.25s ease, min-width 0.25s ease;
  overflow: hidden;
}

#sidebar.collapsed {
  width: 64px;
  min-width: 64px;
}

#sidebar.collapsed .sidebar-header h5,
#sidebar.collapsed .nav-label,
#sidebar.collapsed .sidebar-nav a span,
#sidebar.collapsed .user-info span,
#sidebar.collapsed .btn-logout span {
  display: none;
}

#sidebar.collapsed .sidebar-header {
  justify-content: center;
  padding: 1rem 0;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.brand-logo {
  width: 40px;
  height: 40px;
  min-width: 40px;
  background: var(--sidebar-active);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: #fff;
}

.sidebar-header h5 {
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  margin: 0;
  line-height: 1.3;
}
.sidebar-header h5 span { color: #6da9e4; }

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

.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 1rem;
  color: var(--sidebar-text);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.sidebar-nav li a i {
  font-size: 1.05rem;
  min-width: 20px;
  text-align: center;
}

.sidebar-nav li a:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
}

.sidebar-nav li.active a {
  background: rgba(26,111,175,0.25);
  color: #6da9e4;
  border-right: 3px solid var(--sidebar-active);
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid rgba(255,255,255,0.07);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #6da9e4;
  font-size: 0.82rem;
  margin-bottom: 0.5rem;
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: #8fa8c0;
  text-decoration: none;
  font-size: 0.82rem;
  transition: color 0.15s;
}
.btn-logout:hover { color: #e07070; }

/* ─── Main Content ──────────────────────────────────────────────────────── */
#content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.25s ease;
  min-width: 0;
}

#content.expanded { margin-left: 64px; }

/* Topbar */
.topbar {
  height: var(--topbar-height);
  background: #fff;
  border-bottom: 1px solid #e8ecf0;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.25rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.topbar .btn {
  padding: 0.3rem 0.5rem;
  color: #666;
}

.topbar .breadcrumb { font-size: 0.82rem; }
.topbar .breadcrumb-item + .breadcrumb-item::before { color: #aaa; }

.main-content {
  padding: 1.5rem;
  flex: 1;
}

/* ─── Page Header ───────────────────────────────────────────────────────── */
.page-header { margin-bottom: 1.25rem; }
.page-header h4 { font-weight: 700; color: #1a2d3f; margin-bottom: 0.2rem; }
.page-header p { margin: 0; font-size: 0.82rem; }

/* ─── Stat Cards ────────────────────────────────────────────────────────── */
.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  border-left: 4px solid transparent;
}

.stat-blue   { border-left-color: #1a6faf; }
.stat-green  { border-left-color: #28a745; }
.stat-orange { border-left-color: #fd7e14; }
.stat-purple { border-left-color: #6f42c1; }
.stat-red    { border-left-color: #dc3545; }

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.stat-blue   .stat-icon { background: #e8f2fb; color: #1a6faf; }
.stat-green  .stat-icon { background: #e8f8ec; color: #28a745; }
.stat-orange .stat-icon { background: #fff3e8; color: #fd7e14; }
.stat-purple .stat-icon { background: #f0ebfb; color: #6f42c1; }
.stat-red    .stat-icon { background: #f8d7da; color: #dc3545; }

.stat-value { font-size: 1.75rem; font-weight: 800; color: #1a2d3f; line-height: 1; }
.stat-label { font-size: 0.78rem; color: #6c757d; margin-top: 0.2rem; }

/* ─── Cards ─────────────────────────────────────────────────────────────── */
.card { border: 1px solid #e8ecf0; border-radius: 10px; }
.card-header {
  background: #f8fafc;
  border-bottom: 1px solid #e8ecf0;
  font-weight: 600;
  padding: 0.7rem 1rem;
  font-size: 0.875rem;
  color: #344054;
}

/* ─── Tables ────────────────────────────────────────────────────────────── */
.table > :not(caption) > * > * { padding: 0.45rem 0.6rem; vertical-align: middle; }
.table-hover > tbody > tr:hover > * { background-color: #f0f5fb; }

/* ─── Info Cards ────────────────────────────────────────────────────────── */
.info-card {
  background: #fff;
  border: 1px solid #e8ecf0;
  border-radius: 10px;
  padding: 0.875rem 1rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.info-label {
  font-size: 0.72rem;
  color: #8a9ab0;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.2rem;
}
.info-value { font-size: 1.15rem; font-weight: 700; color: #1a2d3f; }

/* ─── Badges ────────────────────────────────────────────────────────────── */
.status-badge { background: #eef2f7; color: #445; font-weight: 500; }
.badge { font-size: 0.72rem; font-weight: 600; }
.status-Open, .status-PENDING, .status-Pending           { background:#fff3cd; color:#856404; }
.status-InProgress, .status-Submitted, .status-Linked    { background:#cfe2ff; color:#084298; }
.status-Resolved, .status-APPROVED, .status-VERIFIED,
.status-Verified, .status-Active                          { background:#d1e7dd; color:#0a3622; }
.status-Closed, .status-Inactive                          { background:#e2e3e5; color:#41464b; }
.status-Rejected, .status-REJECTED                        { background:#f8d7da; color:#842029; }
.status-ANNOUNCED, .status-GENERATED, .status-PENDING      { background:#fff3cd; color:#856404; }
.status-SNAPSHOT_DONE, .status-ENTITLEMENT_COMPUTED,
.status-PROCESSING                                          { background:#cfe2ff; color:#084298; }
.status-COMPLETED, .status-PAID, .status-PROCESSED,
.status-SUCCESS, .status-Imported, .status-TRANSFERRED      { background:#d1e7dd; color:#0a3622; }
.status-UNPAID, .status-UNCLAIMED, .status-FAILED,
.status-RETURNED                                             { background:#f8d7da; color:#842029; }
.status-IEPF_TRANSFERRED                                     { background:#e2d9f3; color:#432874; }
.status-DRAFT, .status-CUTOFF_SNAPSHOT_DONE                  { background:#e2e3e5; color:#41464b; }
.status-OPEN, .status-VOTING_OPEN                             { background:#d1e7dd; color:#0a3622; }
.status-PARTIAL                                                { background:#ffe5d0; color:#7c3800; }
.status-ALLOTTED, .status-TABULATED, .status-PASSED           { background:#d1e7dd; color:#0a3622; }
.status-FAILED                                                 { background:#f8d7da; color:#842029; }
.status-SENT                                                    { background:#d1e7dd; color:#0a3622; }
.status-SKIPPED                                                 { background:#e2e3e5; color:#41464b; }
/* Meetings + pledges (SBM RFP rounds) */
.status-MAILING_GENERATED, .status-RELEASE_PENDING,
.status-INVOKE_PENDING                                          { background:#cfe2ff; color:#084298; }
.status-NOTICES_SENT, .status-RELEASED, .status-ACTIVE          { background:#d1e7dd; color:#0a3622; }
.status-CANCELLED, .status-PLEDGE_BLOCKED                       { background:#f8d7da; color:#842029; }
.status-INVOKED                                                 { background:#e2d9f3; color:#432874; }
/* Mauritius compliance round: UBO crossings + STR SLA */
.status-Filed, .status-CROSSED_ABOVE                            { background:#d1e7dd; color:#0a3622; }
.status-CROSSED_BELOW                                           { background:#e2e3e5; color:#41464b; }
.status-Overdue                                                 { background:#f8d7da; color:#842029; }
.status-SUBMITTED                                               { background:#cfe2ff; color:#084298; }
/* Reconciliation-exception workflow (multi-bank-payments round). Prefixed
   RECON_ rather than reusing status-OPEN/status-RESOLVED verbatim --
   status-OPEN already means "green/healthy" for e.g. VOTING_OPEN, which
   would be a misleading colour for an exception that still needs work. */
.status-RECON_OPEN                                              { background:#fff3cd; color:#856404; }
.status-RECON_IN_PROGRESS                                       { background:#cfe2ff; color:#084298; }
.status-RECON_RESOLVED                                          { background:#d1e7dd; color:#0a3622; }
[class^="status-"] { font-size:0.72rem; font-weight:600; padding:0.25rem 0.6rem; border-radius:20px; }

/* ─── Sidebar role chip ─────────────────────────────────────────────────── */
.role-chip {
  font-size: 0.65rem;
  background: rgba(255,255,255,0.15);
  border-radius: 20px;
  padding: 1px 6px;
  color: #9fc8e8;
}

/* ─── Sidebar nav sections (collapsible groups) ──────────────────────────── */
.nav-section { list-style: none; }
.nav-section-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  background: none;
  border: none;
  color: var(--sidebar-text);
  padding: 0.55rem 1rem;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.nav-section-btn:hover { background: rgba(255,255,255,0.05); color: #fff; }

.sec-icon { font-size: 1rem; min-width: 20px; text-align: center; color: #6da9e4; }
.sec-label { flex: 1; }
.nav-arrow { font-size: 0.65rem; transition: transform 0.2s; margin-left: auto; color: #5a7a9a; }
.nav-section-btn:not(.collapsed) .nav-arrow { transform: rotate(180deg); }

.nav-sub { padding: 0; }
.nav-sub li a { padding-left: 2.4rem; font-size: 0.8rem; }

/* ─── Pagination ────────────────────────────────────────────────────────── */
.pagination .page-link { color: var(--primary); border-color: #dde3ee; font-size: 0.8rem; }
.pagination .page-item.active .page-link { background: var(--primary); border-color: var(--primary); }

/* ─── XS button ─────────────────────────────────────────────────────────── */
.btn-xs { padding: 0.15rem 0.45rem; font-size: 0.75rem; border-radius: 4px; }

/* ─── Login pages ───────────────────────────────────────────────────────── */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f1923 0%, #1a3a5c 100%);
}
.login-card {
  background: #fff;
  border-radius: 14px;
  padding: 2.5rem;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}
.login-card .brand-logo { margin: 0 auto 1rem; }

/* ─── Scrollbar ─────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #c0c8d4; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #a0aab8; }

/* ─── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  #sidebar { width: 64px; min-width: 64px; }
  #sidebar .sidebar-header h5,
  #sidebar .sidebar-nav a span,
  #sidebar .user-info span { display: none; }
  #sidebar .sidebar-header { justify-content: center; padding: 1rem 0; }
  #content { margin-left: 64px; }
}
