/* Design tokens for Direction B & C */

:root {
  /* Direction B — Private Bank Light (default) */
  --bg: #F5F2EA;
  --surface: #FFFFFF;
  --sidebar-bg: #FBFAF6;
  --sidebar-border: #E8E4D8;
  --divider: #EFEBDD;
  --border: #E8E4D8;
  --fg: #0F1C3F;
  --fg-muted: rgba(15, 28, 63, 0.62);
  --fg-muted-strong: rgba(15, 28, 63, 0.55);
  --fg-light: rgba(20, 28, 24, 0.42);

  /* Accent & brand */
  --accent: #6EA08D;
  --accent-alt: #0F5132;
  --navy: #0F1C3F;
  --sage: #6EA08D;
  --cream: #F5F2EA;

  /* Sidebar sizing */
  --sidebar-width: 252px;
  --sidebar-top-py: 22px;
  --sidebar-top-px: 22px;
}

/* Direction C — Navy Brand */
body.theme-c {
  --bg: #F4EFE2;
  --surface: #FBF8EE;
  --sidebar-bg: #0F1C3F;
  --sidebar-border: rgba(244, 239, 226, 0.08);
  --divider: #E2DBC4;
  --border: #E2DBC4;
  --fg: #0F1C3F;
  --fg-inv: #F4EFE2;
  --fg-inv-muted: rgba(244, 239, 226, 0.78);
  --fg-inv-muted-strong: rgba(244, 239, 226, 0.55);

  --sidebar-width: 256px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

/* ========= SIDEBAR ========= */

#sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 20;
  border-right: 1px solid var(--sidebar-border);
  color: var(--fg);
  font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body.theme-c #sidebar {
  color: var(--fg-inv);
}

/* Sidebar Brand Block */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 22px 18px;
  border-bottom: 1px solid var(--divider);
  box-sizing: border-box;
}

.sidebar-logo {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.sidebar-wordmark {
  display: flex;
  flex-direction: column;
  line-height: 0.95;
}

.sidebar-wordmark-financial {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--fg);
}

body.theme-c .sidebar-wordmark-financial {
  color: var(--fg-inv);
}

.sidebar-wordmark-ledger {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--sage);
  margin-top: 4px;
}

/* Workspace selector (Direction B) */
.workspace-selector {
  padding: 14px 22px 4px;
  box-sizing: border-box;
  position: relative;
}

.direction-b-only {
  display: block;
}

body.theme-c .direction-b-only {
  display: none;
}

.workspace-label {
  font-size: 10.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--fg-light);
  margin-bottom: 6px;
  display: block;
}

.workspace-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  cursor: pointer;
  font-size: 13px;
  width: 100%;
  box-sizing: border-box;
  position: relative;
  transition: background 0.12s, border-color 0.12s;
  text-align: left;
  font-family: inherit;
  font-weight: inherit;
}

.workspace-pill:hover {
  background: #F9F7F2;
  border-color: #DFD9CC;
}

.workspace-chevron {
  margin-left: auto;
  flex-shrink: 0;
  transition: transform 0.2s;
}

.workspace-pill[aria-expanded="true"] .workspace-chevron {
  transform: rotate(180deg);
}

.workspace-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  z-index: 1000;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.05);
  max-height: 300px;
  overflow-y: auto;
  min-width: 100%;
  box-sizing: border-box;
}

.workspace-dropdown-menu {
  display: flex;
  flex-direction: column;
}

.workspace-option {
  padding: 10px 14px;
  color: var(--fg);
  cursor: pointer;
  font-size: 13px;
  transition: background 0.12s;
  border: none;
  background: transparent;
  text-align: left;
  font-family: inherit;
  width: 100%;
  box-sizing: border-box;
}

.workspace-option:hover {
  background: rgba(0, 0, 0, 0.04);
}

.workspace-option.active {
  background: rgba(110, 160, 141, 0.1);
  color: var(--accent);
  font-weight: 500;
}

.workspace-badge {
  width: 22px;
  height: 22px;
  background: var(--navy);
  color: var(--cream);
  border-radius: 5px;
  font-size: 9.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.workspace-info {
  flex: 1;
  line-height: 1.2;
}

.workspace-name {
  font-weight: 500;
  color: var(--fg);
  font-size: 13px;
}

.workspace-subtitle {
  font-size: 10.5px;
  font-weight: 400;
  color: var(--fg-light);
}

/* Client selector (Direction C) */
.client-selector {
  display: none;
  padding: 14px 22px 6px;
  box-sizing: border-box;
}

body.theme-c .client-selector {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px 6px;
  cursor: pointer;
}

.direction-c-only {
  display: none;
}

body.theme-c .direction-c-only {
  display: block;
}

.client-avatars {
  display: flex;
  align-items: center;
  gap: -6px;
}

.client-avatar {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1.5px solid var(--navy);
  font-size: 9px;
  font-weight: 600;
  color: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: -6px;
  flex-shrink: 0;
}

body.theme-c .client-avatar {
  border-color: var(--fg-inv);
  color: var(--fg-inv);
}

.client-avatar:first-child {
  margin-left: 0;
}

.client-count {
  font-size: 12px;
  color: var(--fg-inv-muted);
  flex: 1;
}

/* Navigation */
.sidebar-nav {
  flex: 1;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  box-sizing: border-box;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-top: 16px;
}

.nav-group-label {
  font-size: 10.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 0 22px 6px;
  color: var(--fg-light);
  box-sizing: border-box;
}

body.theme-c .nav-group-label {
  color: rgba(244, 239, 226, 0.45);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 22px;
  margin: 0;
  background: transparent;
  border: none;
  color: var(--fg-muted);
  font-size: 14px;
  font-weight: 400;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.12s, background 0.12s;
  font-family: inherit;
  text-align: left;
  position: relative;
}

body.theme-c .nav-item {
  padding: 8px 14px;
  margin: 0 10px;
  border-radius: 6px;
  color: rgba(244, 239, 226, 0.78);
}

.nav-item:hover {
  background: rgba(0, 0, 0, 0.02);
  color: var(--fg);
}

body.theme-c .nav-item:hover {
  background: rgba(0, 0, 0, 0.1);
}

.nav-item.active {
  color: var(--fg);
  font-weight: 600;
}

body.theme-c .nav-item.active {
  background: #F4EFE2;
  color: var(--navy);
  font-weight: 600;
}

/* Direction B: Green dot indicator */
.nav-item::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: transparent;
  flex-shrink: 0;
  transition: background 0.12s;
}

.nav-item.active::before {
  background: var(--sage);
}

body.theme-c .nav-item::before {
  display: none;
}

.nav-item::after {
  content: attr(data-count);
  font-size: 11.5px;
  color: rgba(20, 28, 24, 0.4);
  margin-left: auto;
  font-family: 'IBM Plex Mono', monospace;
  font-variant-numeric: tabular-nums;
}

body.theme-c .nav-item::after {
  color: rgba(244, 239, 226, 0.5);
}

.nav-item[data-count='']::after {
  content: '';
}

/* Status/Treasury card */
#status-card {
  padding: 10px 22px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--fg-muted-strong);
  border-top: 1px solid var(--divider);
  box-sizing: border-box;
  font-family: 'IBM Plex Mono', monospace;
  font-variant-numeric: tabular-nums;
}

body.theme-c #status-card {
  border-top: none;
  border-bottom: none;
  padding: 12px 14px;
  margin: 0 14px 12px;
  background: rgba(0, 0, 0, 0.22);
  border-radius: 8px;
  border: 1px solid rgba(244, 239, 226, 0.06);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--sage);
  flex-shrink: 0;
}

body.theme-c .status-dot {
  display: none;
}

.status-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(244, 239, 226, 0.55);
  font-weight: 500;
  display: none;
}

body.theme-c .status-label {
  display: block;
}

.status-value {
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -0.015em;
  color: var(--fg-inv);
  margin-top: 4px;
  display: none;
}

body.theme-c .status-value {
  display: block;
}

/* User row */
.sidebar-user {
  padding: 12px 16px;
  border-top: 1px solid var(--divider);
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg);
  box-sizing: border-box;
}

body.theme-c .sidebar-user {
  background: transparent;
  border-top: 1px solid rgba(244, 239, 226, 0.08);
  padding: 12px 16px;
  color: var(--fg-inv);
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--navy);
  color: var(--cream);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  font-weight: 600;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

body.theme-c .user-avatar {
  background: var(--fg-inv);
  color: var(--navy);
  width: 28px;
  height: 28px;
}

.user-info {
  flex: 1;
  min-width: 0;
  line-height: 1.25;
}

.user-name {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--fg);
}

body.theme-c .user-name {
  color: var(--fg-inv);
}

.user-subtitle {
  font-size: 11px;
  color: var(--fg-muted-strong);
}

body.theme-c .user-subtitle {
  color: rgba(244, 239, 226, 0.5);
}

.user-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.theme-toggle-btn,
.logout-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--fg-muted-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.12s;
  width: 22px;
  height: 22px;
}

.theme-toggle-btn:hover,
.logout-btn:hover {
  color: var(--fg);
}

body.theme-c .theme-toggle-btn,
body.theme-c .logout-btn {
  color: rgba(244, 239, 226, 0.55);
}

body.theme-c .theme-toggle-btn:hover,
body.theme-c .logout-btn:hover {
  color: var(--fg-inv);
}

/* ========= MAIN CONTENT ========= */

#main-wrapper {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

main {
  padding: 28px 32px;
}

/* ========= TOPBAR ========= */

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  margin-bottom: 24px;
}

.topbar-breadcrumb {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--fg-muted-strong);
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: 0.04em;
}

.topbar-date {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--fg-muted);
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
}

.topbar-btn {
  padding: 7px 13px;
  font-size: 13px;
  font-weight: 500;
  background: var(--navy);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  transition: background 0.12s;
}

.topbar-btn:hover {
  background: #0D1A38;
}

/* ========= DASHBOARD HEADING ========= */

.dashboard-heading {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.dashboard-h1 {
  font-size: 22px;
  font-weight: 500;
  margin: 0 0 4px;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}

.dashboard-meta {
  font-size: 12px;
  color: var(--fg-muted-strong);
  margin: 0;
}

/* ========= CARDS & PANELS ========= */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 16px;
}

.card-header {
  display: flex;
  align-items: center;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
}

.card-body {
  padding: 20px 22px;
}

/* Forms */
label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg);
  margin-bottom: 16px;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="date"],
input[type="number"],
select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  color: var(--fg);
  background: var(--surface);
}

button {
  font-family: inherit;
}

/* Utilities */
.mono {
  font-family: 'IBM Plex Mono', monospace;
  font-variant-numeric: tabular-nums;
}

.num {
  font-variant-numeric: tabular-nums;
}

.muted {
  color: var(--fg-muted);
}

.muted-inline {
  color: var(--fg-muted);
  font-size: 0.9em;
}

.error {
  color: #A14729;
  font-size: 12px;
  margin: 8px 0 0;
}

.success {
  color: #2D7A56;
  font-size: 12px;
  margin: 8px 0 0;
}

/* Admin-only sections */
body.role-user #view-newTxn,
body.role-user #view-storage,
body.role-user #view-clients {
  display: none !important;
}
