:root {
  --primary: #1A365D;
  --secondary: #F7FAFC;
  --accent: #319795;
  --positive: #276749;
  --negative: #C53030;
}

body {
  font-family: "Inter", sans-serif;
  background-color: var(--secondary);
  color: #1a202c;
}

/* ===== TOPBAR ===== */
.sa-topbar {
  height: 56px;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 1400;
}

.sa-topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sa-topbar-right {
  display: flex;
  gap: 8px;
}

.sa-topbar,
.sa-topbar-right {
  overflow: visible;
}

.sa-settings-dropdown .dropdown-menu {
  min-width: 180px;
  white-space: nowrap;
}

.sa-logo-text {
  font-weight: 600;
}

/* ===== SIDEBAR STATES ===== */
.sa-sidebar {
  position: sticky;
  top: 56px;
  z-index: 1000;
  height: calc(100vh - 56px);
  overflow-y: auto;
  overflow-x: hidden;
  width: 200px;
  background-color: var(--primary);
  color: #fff;
  flex-shrink: 0;
  padding: 20px;
  transition:
    width 0.45s cubic-bezier(0.4, 0, 0.2, 1),
    padding 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

.sa-sidebar.is-collapsed {
  width: 72px;
  padding: 20px 26px;
}

.nav-text {
  white-space: nowrap;
  overflow: hidden;
  margin-left: 12px;
  transition:
    opacity 0.25s ease,
    transform 0.25s ease,
    width 0.25s ease,
    margin-left 0.25s ease;
}

.sa-sidebar.is-collapsed .nav-text {
  opacity: 0;
  width: 0;
  margin-left: 0;
  transform: translateX(-8px);
  pointer-events: none;
}

/* Hide header text when collapsed */
.sa-sidebar.is-collapsed .sa-sidebar-header h5 {
  opacity: 0;
  pointer-events: none;
} 

/* Sidebar icons */
.sa-sidebar .nav-link {
  display: flex;
  align-items: center;
}

.sa-sidebar i {
  font-size: 1.2rem;
}

.sa-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.sa-sidebar-header h5 {
  color: #fff;
}

.sa-sidebar-nav .nav-link {
  color: #e2e8f0;
  padding: 0.6rem 0;
}

.sa-sidebar-nav .nav-link.active,
.sa-sidebar-nav .nav-link:hover {
  color: #fff;
  font-weight: 600;
}

.sa-main-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

@media (max-width: 768px) {
  .sa-layout {
    flex-direction: column;
  }

  .sa-sidebar {
    position: fixed;
    top: 56px;
    left: 0;
    height: 100vh;
    width: 180px;
    transform: translateX(-100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1300;
  }

  .sa-sidebar.is-mobile-open {
    transform: translateX(0);
  }

  /* Force text visible on mobile */
  .nav-text {
    opacity: 1 !important;
    transform: none !important;
    display: inline !important;
  }

  .sa-main-content {
    margin-left: 0;
    width: 100%;
  }
}

.sa-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sa-logo h5 {
  color: #fff;
}

.sa-menu-toggle {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.6rem;
  cursor: pointer;
}

/* ================= MOBILE OFF-CANVAS SIDEBAR ================= */
.sa-mobile-topbar {
  display: none;
}

@media (max-width: 768px) {

  /* Mobile top bar */
  .sa-mobile-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background-color: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    z-index: 1200;
  }

  .sa-mobile-logo {
    font-weight: 600;
    font-size: 1rem;
  }

  /* Sidebar off-canvas */
  .sa-sidebar {
    position: fixed;
    top: 56px;
    left: 0;
    height: calc(100vh - 56px);
    width: 260px;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 1300;
  }

  .sa-sidebar.is-mobile-open {
    transform: translateX(0);
  }

  /* Overlay behind sidebar */
  .sa-overlay {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1250;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }

  .sa-overlay.show {
    opacity: 1;
    pointer-events: auto;
  }

}

/* ================= PRIMARY ACTION BAR ================= */

.sa-action-bar {
  background-color: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  padding: 0.75rem 1.5rem;
}

.sa-action-tabs {
  display: flex;
  gap: 0.75rem;
  width: 100%;
  overflow-x: auto;
}

.sa-action-tab {
  text-decoration: none;
  flex: 1;
  text-align: center;
  background-color: var(--primary);
  border: 1px solid #cbd5e0;
  border-radius: 6px;
  padding: 0.6rem 1.4rem;
  font-weight: 500;
  color: var(--secondary);
  white-space: nowrap;
  transition: all 0.15s ease-in-out;
}

.sa-action-tab:hover,
.sa-action-tab:focus {
  background-color: #edf2f7;
  border-color: var(--accent);
  color: var(--primary);
  outline: none;
}

.sa-action-tab:focus-visible {
  outline: 3px solid var(--accent);
}

@media (max-width: 768px) {
  .sa-action-tabs {
    flex-wrap: wrap;
    /* allow wrapping */
    overflow-x: hidden;
    /* remove scrolling */
  }

  .sa-action-tab {
    flex: 0 0 calc(50% - 0.375rem);
    padding: 0.9rem;
  }
}

/* ================= MOBILE BOTTOM ACTION BAR ================= */

.sa-mobile-action-bar {
  display: none;
}

/* Mobile only */
@media (max-width: 768px) {

  /* Hide desktop action tabs */
  .sa-action-bar {
    display: none;
  }

  /* Space for bottom bar so content doesn't hide */
  .sa-main-content {
    padding-bottom: 64px;
  }

  .sa-mobile-action-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background-color: var(--primary);
    border-top: 1px solid #e2e8f0;
    display: flex;
    z-index: 1100;
  }

  .sa-mobile-action {
    flex: 1;
    text-align: center;
    text-decoration: none;
    padding: 6px 4px;
    font-size: 11px;
    color: var(--secondary);
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2px;
  }

  .sa-mobile-action:last-child {
    border-right: none;
  }

  .sa-mobile-action i {
    font-size: 18px;
  }

  .sa-mobile-action.active {
    color: var(--primary);
    font-weight: 600;
  }

  .sa-mobile-action:active {
    background-color: #f1f5f9;
  }
}

/* Cards */
.sa-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: #fff;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.sa-card h6 {
  min-height: 1.5rem;
}


.sa-card.clickable:hover {
  transform: translateY(-2px);
  cursor: pointer;
}

/* Metrics */
.sa-metric {
  line-height: 1.3;
  font-size: 1.4rem;
  font-weight: 600;
}

/* Ledger action buttons – mobile fix */
@media (max-width: 576px) {
  .ledger-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    /* space between buttons */
    align-items: stretch;
  }

  .ledger-actions .btn {
    width: 100%;
    /* equal width */
    text-align: center;
  }
}

/* Footer */
.sa-footer {
  height: auto;
  background-color: var(--primary);
  color: #fff;
  padding: 1.5rem 0;
}

.sa-footer a {
  color: #fff;
  text-decoration: none;
  margin-left: 0.5rem;
}

.sa-footer a:hover {
  text-decoration: underline;
}

/* Settings dropdown – hover behavior */
/* Keep dropdown open while hovering button OR menu */
.sa-settings-dropdown {
  position: relative;
}

.sa-settings-dropdown .dropdown-toggle::after {
  display: none;
  /* removes caret */
}

.sa-settings-dropdown .dropdown-toggle {
  padding: 6px 10px;
}

/* Desktop hover */
@media (hover: hover) {
  .sa-settings-dropdown:hover>.dropdown-menu,
  .sa-settings-dropdown .dropdown-menu:hover {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
    /* Add a delay so the tooltip has time to appear before the menu covers it */
    transition-delay: 0.4s;
  }
}

/* Default hidden */
.sa-settings-dropdown .dropdown-menu {
  /* Replaced display:none with opacity/visibility for transitions */
  visibility: hidden;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.sa-settings-dropdown .dropdown-menu.show {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
}

.sa-settings-dropdown .dropdown-menu {
  position: absolute;
  right: 0;
  left: auto;
  margin-top: 0;
  top: 100%;
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}

/* Form */
.form-label {
  font-weight: 500;
}

.required::after {
  content: " *";
  color: #dc3545;
}

.form-feedback {
  display: none;
  margin-top: 1rem;
}

.form-feedback.show {
  display: block;
}