/* WBcloud.in - Banking CSP SaaS Core Stylesheet */
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css');

:root {
  --primary: #0b3d91;
  --primary-dark: #082a66;
  --primary-light: #1e5cb3;
  --accent: #ffd60a;
  --bg: #f0f4f8;
  --card: #ffffff;
  --text: #14213d;
  --text-muted: #5b6b82;
  --border: #c9d3e0;
  --in: #0a9b4b;
  --in-bg: #e8f8f0;
  --out: #c00000;
  --out-bg: #fde8e8;
  --sky: #00a7e8;
  --purple: #6b2fa0;
  --warn-bg: #fff3cd;
  --warn-border: #ffe69c;
  --warn-text: #664d03;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow: 0 4px 12px rgba(11,61,145,0.08);
  --radius: 8px;
}

@media (prefers-color-scheme: dark) {
  :root.dark-theme {
    --bg: #0d131f;
    --card: #162032;
    --text: #e8edf5;
    --text-muted: #9fb0c8;
    --border: #28374d;
    --shadow: 0 4px 12px rgba(0,0,0,0.3);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Typography & Links */
h1, h2, h3, h4, h5 { color: var(--text); font-weight: 700; line-height: 1.25; }
a { color: var(--primary); text-decoration: none; font-weight: 600; }
a:hover { text-decoration: underline; }
.tabular { font-variant-numeric: tabular-nums; }

/* Forms & Inputs */
input, select, textarea {
  font: inherit;
  color: inherit;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(11,61,145,0.18);
}
input[readonly], select:disabled { background: rgba(0,0,0,0.04); cursor: not-allowed; }

/* Buttons */
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border: none;
  border-radius: var(--radius);
  padding: 8px 16px;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  transition: all 0.15s ease;
  min-height: 38px;
}
button:hover, .btn:hover { background: var(--primary-dark); text-decoration: none; color: #fff; }
button:active, .btn:active { transform: translateY(1px); }
button:disabled, .btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-secondary { background: var(--card); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: rgba(0,0,0,0.05); color: var(--text); }
.btn-success { background: var(--in); color: #fff; }
.btn-success:hover { background: #08823f; }
.btn-danger { background: var(--out); color: #fff; }
.btn-danger:hover { background: #9e0000; }
.btn-accent { background: var(--accent); color: #111; font-weight: 700; }
.btn-accent:hover { background: #e6be00; color: #111; }
.btn-sm { padding: 4px 10px; font-size: 12px; min-height: 28px; border-radius: 5px; }
.btn-lg { padding: 12px 24px; font-size: 16px; min-height: 48px; }
.btn-block { width: 100%; }

/* Layouts & Containers */
.container { width: 100%; max-width: 1400px; margin: 0 auto; padding: 0 16px; }
.page-wrap { padding: 20px 0 60px; flex: 1; }

/* Header & Navigation */
.site-header {
  background: var(--primary);
  color: #fff;
  padding: 10px 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.brand-group { display: flex; align-items: center; gap: 12px; }
.brand-logo-icon {
  width: 38px;
  height: 38px;
  background: var(--accent);
  color: var(--primary);
  font-weight: 800;
  font-size: 20px;
  border-radius: 8px;
  display: grid;
  place-items: center;
}
.brand-titles h1 { font-size: 18px; color: #fff; margin: 0; }
.brand-titles small { color: rgba(255,255,255,0.85); font-size: 11px; display: block; }
.header-nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.header-nav a, .header-nav button {
  background: rgba(255,255,255,0.14);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
}
.header-nav a:hover, .header-nav button:hover {
  background: rgba(255,255,255,0.28);
  color: #fff;
}
.header-nav a.active {
  background: #fff;
  color: var(--primary);
  border-color: #fff;
}
.user-badge {
  background: rgba(0,0,0,0.2);
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 12px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Banners */
.banner-impersonate {
  background: #ff5722;
  color: #fff;
  padding: 8px 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.banner-demo {
  background: #ff9800;
  color: #fff;
  padding: 8px 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.banner-expiry {
  background: var(--warn-bg);
  border-bottom: 1px solid var(--warn-border);
  color: var(--warn-text);
  padding: 8px 16px;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Cards & Grid */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 8px;
}
.card-title { font-size: 16px; margin: 0; color: var(--primary); }

/* KPI Dashboard Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.kpi-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 5px solid var(--primary);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: var(--shadow-sm);
}
.kpi-card span { font-size: 12px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; }
.kpi-card b { display: block; font-size: 22px; margin-top: 4px; font-variant-numeric: tabular-nums; }

/* Cash Book Control Bar */
.control-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  background: var(--card);
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.control-bar input[type="date"] { width: auto; font-weight: 700; padding: 6px 12px; }
.status-pill {
  padding: 4px 12px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
}
.status-pill.open { background: var(--in); }
.status-pill.closed { background: #6c757d; }
.clock-display {
  font-family: monospace;
  font-size: 14px;
  font-weight: 700;
  padding: 6px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
}

/* Denomination Entry Grid */
.den-grid {
  display: grid;
  grid-template-columns: repeat(9, minmax(62px, 1fr));
  gap: 8px;
  margin: 14px 0;
}
.den-col { text-align: center; }
.den-col label {
  display: block;
  background: var(--accent);
  color: #111;
  font-weight: 700;
  font-size: 13px;
  padding: 3px;
  border-radius: 4px;
  margin-bottom: 4px;
}
.den-col input {
  text-align: center;
  font-weight: 700;
  padding: 8px 4px;
}
.den-col small {
  color: var(--text-muted);
  font-size: 11px;
  display: block;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

/* Tables & Main Book Layout */
.table-responsive { width: 100%; overflow-x: auto; margin-bottom: 16px; }
table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}
th, td {
  border: 1px solid var(--border);
  padding: 7px 10px;
  text-align: right;
  white-space: nowrap;
}
th {
  background: var(--accent);
  color: #111;
  font-weight: 700;
}
th.text-left, td.text-left { text-align: left; }
th.text-center, td.text-center { text-align: center; }

/* Main Book Summary Matrix */
.matrix-table td.label-cell {
  color: #fff;
  font-weight: 700;
  text-align: center;
  min-width: 140px;
}
.matrix-table td.label-cell b { display: block; font-size: 16px; margin-top: 2px; }
.matrix-table .op { background: var(--sky); }
.matrix-table .dp { background: var(--in); }
.matrix-table .wd { background: var(--out); }
.matrix-table .cl { background: var(--purple); }
.matrix-table .id-row { background: #8eb4e3; color: #000; font-weight: 700; }

.badge-in { background: var(--in-bg); color: var(--in); font-weight: 700; padding: 2px 8px; border-radius: 4px; }
.badge-out { background: var(--out-bg); color: var(--out); font-weight: 700; padding: 2px 8px; border-radius: 4px; }

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(2px);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 1000;
  overflow: auto;
}
.modal-box {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  width: 680px;
  max-width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-footer { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* Toasts */
#toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: #111;
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(0,0,0,0.3);
  animation: slideUp 0.2s ease;
}
.toast.success { background: var(--in); }
.toast.error { background: var(--out); }

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Mobile Bottom Navigation */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card);
  border-top: 1px solid var(--border);
  z-index: 90;
  padding: 6px 0;
}
.mobile-nav-inner { display: flex; justify-content: space-around; }
.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 11px;
  color: var(--text-muted);
  text-decoration: none;
  padding: 4px;
}
.mobile-nav-item.active { color: var(--primary); font-weight: 700; }

/* Responsive adjustments */
@media (max-width: 860px) {
  .den-grid { grid-template-columns: repeat(3, 1fr); }
  .mobile-nav { display: block; }
  .page-wrap { padding-bottom: 80px; }
  .header-nav { display: none; }
}

/* ==========================================================
   APP SHELL & SIDEBAR NAVIGATION SYSTEM (Super & CSP Admin)
   ========================================================== */
.app-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
  background-color: var(--bg);
  position: relative;
}

/* Sidebar Backdrop for Mobile */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(5, 15, 35, 0.65);
  backdrop-filter: blur(3px);
  z-index: 998;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.sidebar-backdrop.active {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

/* Sidebar Component */
.app-sidebar {
  width: 270px;
  min-width: 270px;
  max-width: 270px;
  background: #082a66;
  color: #fff;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 999;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.12);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.super-sidebar {
  background: #051b44;
  border-right-color: rgba(255, 214, 10, 0.2);
}

/* Custom Scrollbar for Sidebar */
.app-sidebar ::-webkit-scrollbar {
  width: 5px;
}
.app-sidebar ::-webkit-scrollbar-track {
  background: transparent;
}
.app-sidebar ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 10px;
}
.app-sidebar ::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.35);
}

/* Sidebar Brand Header */
.sidebar-brand {
  padding: 16px 18px;
  background: rgba(0, 0, 0, 0.18);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.sidebar-brand-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.sidebar-logo {
  width: 40px;
  height: 40px;
  background: var(--accent);
  color: #082a66;
  font-weight: 800;
  font-size: 20px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}
.super-sidebar .sidebar-logo {
  background: #ffd60a;
  color: #051b44;
}
.sidebar-brand-text {
  min-width: 0;
  line-height: 1.25;
}
.sidebar-brand-text h2 {
  font-size: 15px;
  color: #fff;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 700;
}
.sidebar-brand-text small {
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-close-btn {
  display: none;
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  line-height: 1;
}
.sidebar-close-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Sidebar Tenant Badge */
.sidebar-tenant-badge {
  padding: 8px 18px;
  background: rgba(0, 0, 0, 0.12);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: rgba(255, 255, 255, 0.8);
}
.sidebar-tenant-badge code {
  background: rgba(255, 255, 255, 0.15);
  padding: 2px 6px;
  border-radius: 4px;
  color: #ffd60a;
  font-weight: 600;
  font-family: inherit;
}

/* Navigation Menu */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 10px;
}
.nav-section-title {
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: rgba(255, 255, 255, 0.45);
  padding: 14px 12px 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s ease;
  margin-bottom: 2px;
  position: relative;
}
.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  text-decoration: none;
  transform: translateX(3px);
}
.sidebar-link.active {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-weight: 700;
  box-shadow: inset 3px 0 0 #ffd60a;
}
.super-sidebar .sidebar-link.active {
  background: rgba(255, 214, 10, 0.16);
  color: #ffd60a;
  box-shadow: inset 3px 0 0 #ffd60a;
}
.sidebar-icon {
  font-size: 15px;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sidebar-icon i, .sidebar-icon .fas, .sidebar-icon .fa-solid {
  font-size: 14px;
}
.btn i, .btn .fas {
  font-size: 13px;
  margin-right: 4px;
}
.sidebar-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.sidebar-pill.accent {
  background: #ffd60a;
  color: #111;
}
.sidebar-pill.success {
  background: #0a9b4b;
  color: #fff;
}
.sidebar-pill.warn {
  background: #ff9800;
  color: #fff;
}

/* Sidebar Footer Profile */
.sidebar-footer {
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.28);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.sidebar-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.sidebar-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.3);
}
.sidebar-user-meta {
  min-width: 0;
  line-height: 1.25;
}
.sidebar-user-meta strong {
  display: block;
  font-size: 12px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-meta span {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.7);
  display: block;
  text-transform: capitalize;
}
.sidebar-logout-btn {
  background: rgba(192, 0, 0, 0.25);
  color: #ff9999;
  border: 1px solid rgba(192, 0, 0, 0.5);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
  text-decoration: none;
  flex-shrink: 0;
}
.sidebar-logout-btn:hover {
  background: #c00000;
  color: #fff;
  text-decoration: none;
}

/* App Main Content Area */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

/* App Topbar Header */
.app-topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: var(--shadow-sm);
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.sidebar-toggle-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 20px;
  padding: 0;
  transition: all 0.15s ease;
}
.sidebar-toggle-btn:hover {
  background: #e2e8f0;
  border-color: var(--primary);
  color: var(--primary);
}
.topbar-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-title small {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  margin-left: 8px;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.topbar-clock {
  font-family: monospace;
  font-size: 13px;
  font-weight: 700;
  padding: 5px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.topbar-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 99px;
  font-size: 12px;
  color: var(--text);
  font-weight: 600;
}

/* Page Content & Container inside App Layout */
.app-content {
  flex: 1;
  padding: 20px 24px 60px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* App Footer */
.app-footer {
  padding: 14px 24px;
  background: var(--card);
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

/* Mobile & Tablet Responsiveness for App Shell */
@media (max-width: 991px) {
  .app-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 280px;
    max-width: 85vw;
    transform: translateX(-100%);
    box-shadow: none;
  }
  .app-sidebar.open {
    transform: translateX(0);
    box-shadow: 0 0 35px rgba(0, 0, 0, 0.45);
  }
  .sidebar-close-btn {
    display: inline-flex;
  }
  .app-content {
    padding: 16px 14px 80px;
  }
}

@media (min-width: 992px) {
  .sidebar-toggle-btn {
    display: none;
  }
}

/* Print Stylesheet */
@media print {
  .site-header, .control-bar button, .mobile-nav, .no-print, button, #toast-container, .modal-overlay {
    display: none !important;
  }
  body { background: #fff; color: #000; font-size: 12px; }
  .card, .kpi-card { border: 1px solid #999; box-shadow: none; margin-bottom: 12px; }
  .page-wrap { padding: 0; }
  table { page-break-inside: auto; }
  tr { page-break-inside: avoid; page-break-after: auto; }
}
