@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
  color-scheme: dark;
  --app-bg: #101713;
  --panel: #171f1a;
  --panel-raised: #1c2620;
  --panel-hover: #222f27;
  --sidebar-bg: #121a15;
  --line: #2a382f;
  --line-soft: #223027;
  --text: #edf5ef;
  --text-soft: #a3b2a7;
  --text-muted: #718276;
  --green: #73e2a1;
  --green-strong: #2ecb78;
  --green-dark: #143b28;
  --red: #ff8989;
  --amber: #f3c878;
  --radius: 16px;
  --sidebar-width: 264px;
}

html { font-size: 14px; min-height: 100%; background: var(--app-bg); }
@media (min-width: 768px) { html { font-size: 15px; } }
body, .app-body { margin: 0; min-height: 100vh; background: var(--app-bg); color: var(--text); font-family: 'DM Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
* { scrollbar-color: #3b5143 #172019; }
a { color: var(--green); text-decoration: none; }
a:hover { color: #a5f2c1; }
button, input, select, textarea { font: inherit; }
::selection { color: #08150d; background: var(--green); }

/* App shell and navigation */
.app-shell { min-height: 100vh; }
.app-sidebar { position: fixed; z-index: 1040; inset: 0 auto 0 0; display: flex; flex-direction: column; width: var(--sidebar-width); padding: 24px 16px 14px; overflow-y: auto; background: var(--sidebar-bg); border-right: 1px solid var(--line-soft); transition: transform .24s ease; }
.brand-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.brand-lockup, .auth-brand { display: flex; align-items: center; gap: 11px; min-height: 42px; color: var(--text); }
.brand-lockup:hover, .auth-brand:hover { color: var(--text); }
.brand-mark { display: inline-flex; flex: 0 0 38px; width: 38px; height: 38px; align-items: center; justify-content: center; border-radius: 13px; background: linear-gradient(145deg, #8af0b1, #28bd6b); box-shadow: 0 5px 18px #2ecb7822; }
.brand-mark-inner { position: relative; display: block; width: 18px; height: 18px; border: 2.5px solid #103a23; border-radius: 6px 6px 6px 2px; transform: rotate(-8deg); }
.brand-mark-inner::after { position: absolute; content: ''; width: 7px; height: 7px; right: -5px; bottom: -4px; border: 2px solid #103a23; border-radius: 50%; background: #8af0b1; }
.brand-copy, .auth-brand > span:last-child { display: flex; flex-direction: column; line-height: 1.2; }
.brand-copy strong, .auth-brand strong { font: 800 20px/1.1 'Manrope', sans-serif; letter-spacing: -.8px; }
.brand-copy small, .auth-brand small { margin-top: 5px; color: var(--text-muted); font-size: 9px; font-weight: 700; letter-spacing: 1.5px; }
.sidebar-close { display: none; margin-left: auto; color: var(--text-soft); border: 0; background: transparent; font-size: 28px; line-height: 1; }
.workspace-switcher { display: flex; align-items: center; gap: 10px; margin: 29px 0 22px; padding: 12px 10px; border: 1px solid var(--line); border-radius: 13px; background: #18221b; }
.workspace-icon { display: grid; place-items: center; width: 35px; height: 35px; flex: 0 0 35px; border-radius: 10px; background: #244432; color: var(--green); font-size: 21px; }
.workspace-copy { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 3px; }
.workspace-copy small { color: var(--text-muted); font-size: 9px; font-weight: 700; letter-spacing: 1px; }
.workspace-copy strong { overflow: hidden; color: #e4eee7; font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.workspace-change { color: var(--text-soft); font-size: 19px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; }
.nav-section-label { margin: 15px 10px 7px; color: #6f8174; font-size: 9px; font-weight: 800; letter-spacing: 1.45px; }
.nav-section-label:first-child { margin-top: 0; }
.nav-section-business { margin-top: 24px; }
.side-link { position: relative; display: flex; align-items: center; gap: 12px; min-height: 41px; padding: 9px 11px; border: 1px solid transparent; border-radius: 10px; color: #9eafa3; font-size: 12.5px; font-weight: 500; transition: color .15s ease, background .15s ease, border-color .15s ease; }
.side-link:hover { color: #f0f8f2; background: #1a261e; }
.side-link.active { color: #a1f0bc; border-color: #28543a; background: linear-gradient(90deg, #1c3927, #19291f); font-weight: 700; }
.side-link.active::before { position: absolute; top: 9px; bottom: 9px; left: -1px; width: 3px; border-radius: 0 4px 4px 0; background: var(--green-strong); content: ''; }
.side-icon { display: inline-grid; place-items: center; width: 20px; color: #829789; font-size: 18px; line-height: 1; }
.side-link.active .side-icon { color: var(--green); }
.sidebar-bottom { margin-top: auto; padding-top: 24px; }
.sidebar-tip { display: flex; gap: 10px; margin-bottom: 17px; padding: 12px; border: 1px solid #294735; border-radius: 12px; background: linear-gradient(140deg, #1c3023, #17251c); }
.tip-spark { color: var(--green); font-size: 20px; }
.sidebar-tip div { display: flex; flex-direction: column; gap: 4px; }
.sidebar-tip strong { color: #d9f5e2; font-size: 11px; }
.sidebar-tip small { color: #91a899; font-size: 10px; line-height: 1.45; }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 14px 3px 0; border-top: 1px solid var(--line-soft); }
.user-avatar { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 34px; border: 1px solid #47775a; border-radius: 50%; background: #234a32; color: #b2f4c8; font-weight: 800; }
.user-details { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 3px; }
.user-details strong { overflow: hidden; color: #dce8df; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.user-details small { color: var(--text-muted); font-size: 10px; }
.sidebar-user form { margin: 0; }
.logout-button { width: 32px; height: 32px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: #8b9e90; font-size: 20px; }
.logout-button:hover { border-color: #4b3939; background: #302020; color: var(--red); }
.sidebar-backdrop { display: none; }

/* Main content */
.app-main-wrap { min-height: 100vh; margin-left: var(--sidebar-width); }
.app-topbar { position: sticky; z-index: 1020; top: 0; display: flex; align-items: center; justify-content: space-between; min-height: 82px; gap: 20px; padding: 15px clamp(20px, 3vw, 42px); border-bottom: 1px solid var(--line-soft); background: #101713ed; backdrop-filter: blur(16px); }
.topbar-heading { min-width: 0; }
.topbar-eyebrow { display: block; margin-bottom: 5px; color: #839589; font-size: 9px; font-weight: 800; letter-spacing: 1.3px; }
.topbar-eyebrow span { padding: 0 5px; color: #4e6354; }
.topbar-heading h1 { overflow: hidden; margin: 0; color: #f0f7f2; font: 700 21px/1.25 'Manrope', sans-serif; letter-spacing: -.45px; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: 17px; }
.system-status { display: inline-flex; align-items: center; gap: 7px; color: #91a598; font-size: 11px; white-space: nowrap; }
.system-status > span { width: 7px; height: 7px; border-radius: 50%; background: var(--green-strong); box-shadow: 0 0 0 4px #2ecb781c; }
.topbar-switch { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 11px; color: #9caf9f; font-size: 20px; }
.topbar-switch:hover { border-color: #3a7550; background: #1b2b20; color: var(--green); }
.mobile-menu-toggle { display: none; }
.app-content { width: 100%; max-width: 1600px; min-height: calc(100vh - 82px); margin: 0 auto; padding: 28px clamp(20px, 3vw, 42px) 22px; }
.app-footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 44px; padding: 18px 0 4px; border-top: 1px solid var(--line-soft); color: #64766a; font-size: 10px; }
.app-fab { position: fixed; z-index: 1010; right: 27px; bottom: 25px; display: flex; align-items: center; gap: 8px; padding: 12px 17px 12px 13px; border: 1px solid #72e2a17a; border-radius: 999px; background: var(--green-strong); box-shadow: 0 9px 28px #0005, 0 0 0 5px #2ecb7815; color: #082011; font-weight: 800; transition: transform .15s ease, box-shadow .15s ease; }
.app-fab:hover { transform: translateY(-2px); box-shadow: 0 12px 32px #0006, 0 0 0 6px #2ecb7822; color: #06180c; }
.app-fab span { font-size: 23px; line-height: 1; }
.app-fab small { font-size: 11px; }

/* Dark-theme controls and components, including existing Razor pages */
.card, .modal-content, .dropdown-menu, .list-group-item { border-color: var(--line) !important; background-color: var(--panel); color: var(--text); }
.card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 7px 24px #00000012; }
.card-header, .card-footer { border-color: var(--line) !important; background: #1b251e; color: var(--text); }
.card-body { color: var(--text); }
.table { --bs-table-color: var(--text); --bs-table-bg: transparent; --bs-table-border-color: var(--line); --bs-table-striped-color: var(--text); --bs-table-striped-bg: #ffffff05; --bs-table-hover-color: var(--text); --bs-table-hover-bg: #73e2a10a; color: var(--text); }
.table > :not(caption) > * > * { padding: .78rem .85rem; border-bottom-color: var(--line); }
.table thead th { color: #a9bbae; background: #1b251e; font-size: 11px; font-weight: 700; white-space: nowrap; }
.table-responsive { border: 1px solid var(--line); border-radius: 13px; }
.form-control, .form-select, .input-group-text { border-color: #34463a; background-color: #131c16; color: var(--text); }
.form-control::placeholder { color: #6f8175; }
.form-control:focus, .form-select:focus { border-color: #4bbd78; background-color: #152019; color: var(--text); box-shadow: 0 0 0 .2rem #2ecb7822; }
.form-select option { background: #172019; color: var(--text); }
.form-label, .form-check-label { color: #c2d0c6; }
.form-text, .text-muted { color: #8b9c90 !important; }
.form-check-input { border-color: #506456; background-color: #172019; }
.form-check-input:checked { border-color: var(--green-strong); background-color: var(--green-strong); }
.btn { border-radius: 9px; font-weight: 600; transition: transform .12s ease, background-color .12s ease, border-color .12s ease; }
.btn:active { transform: translateY(1px); }
.btn-primary, .btn-success { border-color: var(--green-strong); background: var(--green-strong); color: #082011; }
.btn-primary:hover, .btn-success:hover { border-color: #69e99b; background: #69e99b; color: #06180c; }
.btn-outline-primary, .btn-outline-success { border-color: #398557; color: #8be7ab; }
.btn-outline-primary:hover, .btn-outline-success:hover { border-color: var(--green-strong); background: #21452e; color: #c4f7d3; }
.btn-light { border-color: #35463a; background: #202c23; color: #d8e5db; }
.btn-light:hover { border-color: #496551; background: #29392d; color: #f2faf4; }
.btn-secondary { border-color: #405247; background: #2a382f; color: #e0e9e2; }
.btn-secondary:hover { border-color: #566c5c; background: #35483b; color: #fff; }
.btn-outline-secondary { border-color: #405247; color: #b5c4b9; }
.btn-outline-secondary:hover { background: #26352b; color: #fff; }
.btn-danger { border-color: #9f4646; background: #8d3636; }
.btn-outline-danger { border-color: #8d4848; color: #ff9b9b; }
.btn-link { color: var(--green); }
.dropdown-menu { padding: 6px; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 15px 38px #0006; }
.dropdown-item { padding: 8px 11px; border-radius: 7px; color: #d0ddd3; }
.dropdown-item:hover, .dropdown-item:focus { background: #26372b; color: var(--green); }
.modal-header, .modal-footer { border-color: var(--line); }
.modal-backdrop { --bs-backdrop-bg: #000; }
.alert { border-radius: 12px; }
.alert-success { border-color: #2f6744; background: #172b1e; color: #b4efc5; }
.alert-danger { border-color: #713b3b; background: #2d1c1c; color: #ffc0c0; }
.alert-warning { border-color: #6a552d; background: #302817; color: #f5d99b; }
.alert-info { border-color: #315b63; background: #17292c; color: #b7e8ef; }
.text-danger, .field-validation-error, .validation-summary-errors { color: #ff9696 !important; }
.app-alert { display: flex; align-items: center; gap: 11px; padding: 12px 14px; border: 1px solid var(--line); background: var(--panel); color: var(--text); }
.app-alert > span { display: grid; place-items: center; width: 24px; height: 24px; flex: 0 0 24px; border-radius: 50%; font-weight: 800; }
.app-alert > div { flex: 1; }
.app-alert-success { border-color: #2f6744; background: #172b1e; }
.app-alert-success > span { background: #244f34; color: #8bf0ac; }
.app-alert-danger { border-color: #713b3b; background: #2d1c1c; }
.app-alert-danger > span { background: #5a2929; color: #ffb0b0; }
.alert-dismiss { margin-left: auto; border: 0; background: transparent; color: inherit; font-size: 20px; }
.badge.text-bg-success, .bg-success-subtle { background: #1f4b30 !important; color: #a5f0bb !important; }
.badge.text-bg-danger, .bg-danger-subtle { background: #512626 !important; color: #ffb0b0 !important; }
.badge.text-bg-warning, .bg-warning-subtle { background: #4a3b1e !important; color: #f7d58c !important; }
.border, .border-top, .border-bottom, .border-start, .border-end { border-color: var(--line) !important; }
.bg-light, .bg-white { background-color: var(--panel) !important; }
.text-dark { color: var(--text) !important; }
hr { border-color: var(--line); opacity: 1; }
.breadcrumb-item, .breadcrumb-item a { color: var(--text-soft); }
.breadcrumb-item.active { color: var(--text); }
.pagination { --bs-pagination-bg: #172019; --bs-pagination-color: #c6d5ca; --bs-pagination-border-color: var(--line); --bs-pagination-hover-bg: #25372b; --bs-pagination-hover-color: var(--green); --bs-pagination-hover-border-color: #3c6549; --bs-pagination-active-bg: #28633d; --bs-pagination-active-border-color: #3b9a5c; --bs-pagination-disabled-bg: #131a15; --bs-pagination-disabled-color: #607064; --bs-pagination-disabled-border-color: var(--line); }
.bar-track { background: #2a382f; border-radius: 5px; height: 10px; overflow: hidden; }
.bar-fill { height: 100%; }
.amount-in { color: var(--green) !important; }
.amount-out { color: var(--red) !important; }
.stat-value { color: var(--text); font-size: 1.35rem; font-weight: 700; }
.table td, .table th { vertical-align: middle; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }

/* Sign-in and onboarding pages */
.auth-shell { display: flex; flex-direction: column; align-items: center; min-height: 100vh; padding: 34px 18px 60px; background: radial-gradient(ellipse at 50% 0%, #1d3927 0%, #101713 48%); }
.auth-brand { margin-bottom: 38px; }
.auth-shell > .card, .auth-shell > form, .auth-shell > .container, .auth-shell > section, .auth-shell > .row { width: 100%; max-width: 490px; }
.auth-shell > .row > [class*=col-] { width: 100%; }
.auth-shell .card { width: 100%; max-width: 490px; }

@media (max-width: 991.98px) {
  .app-sidebar { z-index: 1060; width: min(300px, 86vw); transform: translateX(-105%); box-shadow: 20px 0 60px #0007; }
  body.sidebar-open .app-sidebar { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; z-index: 1050; inset: 0; background: #0009; opacity: 0; pointer-events: none; transition: opacity .2s ease; }
  body.sidebar-open .sidebar-backdrop { display: block; opacity: 1; pointer-events: auto; }
  .sidebar-close { display: block; }
  .app-main-wrap { margin-left: 0; }
  .mobile-menu-toggle { display: flex; flex: 0 0 38px; width: 38px; height: 38px; flex-direction: column; align-items: center; justify-content: center; gap: 5px; border: 1px solid var(--line); border-radius: 10px; background: #172019; }
  .mobile-menu-toggle span { width: 16px; height: 2px; border-radius: 2px; background: #c8d8cc; }
  .app-topbar { justify-content: flex-start; gap: 13px; }
  .topbar-heading { flex: 1; }
  .topbar-actions { gap: 10px; }
  .system-status { display: none; }
}
@media (max-width: 575.98px) {
  .app-topbar { min-height: 72px; padding: 12px 15px; }
  .topbar-eyebrow { font-size: 8px; letter-spacing: .8px; }
  .topbar-heading h1 { font-size: 17px; }
  .app-content { padding: 19px 14px 20px; }
  .app-footer { flex-direction: column; gap: 5px; margin-top: 30px; }
  .app-fab { right: 16px; bottom: 17px; padding: 12px; }
  .app-fab small { display: none; }
  .app-fab span { font-size: 25px; }
  .table > :not(caption) > * > * { padding: .65rem .65rem; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; } }
