/* Shell containers for auth vs app */
#dash-app-root {
  display: none;
}

#auth-root {
  display: none;
  max-width: 380px;
  margin: 60px auto;
}

/* Ensure body spans full viewport so auth background can anchor */
html,
body {
  min-height: 100vh;
  background-color: #ffffff;
}

/* Login background anchored bottom-right */
body.auth-mode {
  background-color: #ffffff;
  background-image: linear-gradient(rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0.35)),
    url("/assets/images/login-background.svg");
  background-repeat: no-repeat, no-repeat;
  background-position: right bottom, right bottom;
  background-size: 100% 100%, auto clamp(1000px, 110vh, 2600px);
  background-attachment: fixed, fixed;
}

/* Header user area */
#userButtonWrap {
  position: relative;
  z-index: 6100;
  margin-left: auto;
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 10px 0 6px;
  gap: 6px;
}

#userButtonWrap .userSidebarHubBtn {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #ffffff;
  color: #000000;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-right: 6px;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

#userButtonWrap .userSidebarHubBtn::before {
  content: "";
  width: 22px;
  height: 22px;
  background-color: currentColor;
  -webkit-mask: url("/assets/images/sidebar-flip-solid-full.svg") center/contain no-repeat;
  mask: url("/assets/images/sidebar-flip-solid-full.svg") center/contain no-repeat;
}

#userButtonWrap .userSidebarHubBtn:hover {
  background-color: #ffffff;
  border-color: #0059ff;
  color: #000000;
}

#userButtonWrap .userSidebarHubBtn.active {
  background-color: #ffffff;
  border-color: transparent;
  color: #0059ff;
}

#userButtonWrap .avatarBox {
  position: relative;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

#userButtonWrap .avatarBox::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: 0 0 0 2px #acacac;
  pointer-events: none;
}

#userButtonWrap .avatarBox:hover {
  background-color: #f6f9ff;
}

#userButtonWrap .avatarBox:hover::after {
  box-shadow: 0 0 0 2px #0059ff;
}

#userButtonWrap.active .avatarBox {
  background-color: #ffffff;
}

#userButtonWrap.active .avatarBox::after {
  box-shadow: 0 0 0 2px #0059ff;
}

#user-button {
  pointer-events: none;
}

#user-button-overlay {
  position: absolute;
  inset: 0;
  cursor: pointer;
  border-radius: 50%;
}

#btnAccountLogoutHeader {
  width: 36px;
  height: 36px;
  margin-left: 6px;
  border: 1px solid transparent;
  background: transparent url("/assets/images/right-from-bracket-solid-full.svg") center/22px no-repeat;
  cursor: pointer;
  border-radius: 8px;
  opacity: 0.78;
  transition: background-color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

#btnAccountLogoutHeader:hover {
  background-color: #ffffff;
  border-color: #0059ff;
  opacity: 1;
}

/* User Hub panel */
.userHubPanelHost {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: flex-end;
  pointer-events: none;
  z-index: 6000;
}

.userHubDismissArea {
  flex: 1 1 auto;
  border: 0;
  margin: 0;
  padding: 0;
  background: rgba(15, 23, 42, 0);
  opacity: 0;
  pointer-events: none;
  cursor: pointer;
  transition: background-color 0.2s ease, opacity 0.2s ease;
}

.userHubPanel {
  width: min(420px, calc(100vw - 20px));
  height: 100vh;
  box-sizing: border-box;
  background: #ffffff;
  border-left: 1px solid #d7dce8;
  box-shadow: -14px 0 40px rgba(15, 23, 42, 0.2);
  transform: translateX(100%);
  transition: transform 0.28s ease;
  display: flex;
  flex-direction: column;
  padding: calc(var(--header-height) + 16px) 18px 18px 18px;
}

.userHubPanelHost.is-open {
  pointer-events: auto;
}

.userHubPanelHost.is-open .userHubDismissArea {
  pointer-events: auto;
  background: rgba(15, 23, 42, 0.24);
  opacity: 1;
}

.userHubPanelHost.is-open .userHubPanel {
  transform: translateX(0);
}

.userHubPanel__header {
  border-bottom: 1px solid #dce2ef;
  padding-bottom: 12px;
}

.userHubPanel__title {
  margin: 0;
  color: #0f172a;
  font-size: 1.08rem;
  font-weight: 700;
}

.userHubPanel__subtitle {
  margin: 3px 0 0 0;
  color: #5b6789;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.userHubPanel__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.userHubSection {
  border: 1px solid #e3e8f4;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.userHubSection__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.userHubSection__header--compact {
  align-items: center;
}

.userHubSection__titleWrap {
  min-width: 0;
}

.userHubSection__title {
  margin: 0;
  color: #0f172a;
  font-size: 0.92rem;
  font-weight: 700;
}

.userHubSection__subtitle {
  margin: 2px 0 0 0;
  color: #64748b;
  font-size: 0.75rem;
  line-height: 1.25;
}

.userHubSection__count,
.userHubSection__badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid #d7deee;
  background: #ffffff;
  color: #334155;
  font-size: 0.75rem;
  font-weight: 700;
}

.userHubSection__badge {
  color: #0059ff;
  border-color: #cfe0ff;
  background: #f4f8ff;
}

.userHubSection__emptyNote {
  margin: 0;
  color: #64748b;
  font-size: 0.79rem;
  line-height: 1.35;
}

.userHubQuickLinks__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: min(42vh, 420px);
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
}

.userHubQuickLinks__list::-webkit-scrollbar {
  width: 8px;
}

.userHubQuickLinks__list::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.3);
  border-radius: 999px;
}

.userHubQuickLinks__item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.userHubQuickLinks__item:hover {
  border-color: #cfd8ea;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
}

.userHubQuickLinks__item.is-pinned {
  border-color: #eadf99;
  background: linear-gradient(180deg, #fffdf3 0%, #fffef9 100%);
}

.userHubQuickLinks__item--dragging {
  opacity: 0.72;
}

.userHubQuickLinks__drag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 36px;
  border-radius: 8px;
  cursor: grab;
  user-select: none;
}

.userHubQuickLinks__drag:active {
  cursor: grabbing;
}

.userHubQuickLinks__dragIcon {
  width: 14px;
  height: 14px;
  opacity: 0.65;
}

.userHubQuickLinks__main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.userHubQuickLinks__link {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  color: #0f172a;
  text-decoration: none;
  font-weight: 600;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
}

.userHubQuickLinks__link:hover .userHubQuickLinks__title {
  color: #0059ff;
}

.userHubQuickLinks__icon {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  opacity: 0.82;
}

.userHubQuickLinks__title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.84rem;
}

.userHubQuickLinks__subtitle {
  min-width: 0;
  color: #64748b;
  font-size: 0.72rem;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.userHubQuickLinks__actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}

.userHubQuickLinks__actionBtn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
}

.userHubQuickLinks__actionBtn .journaling-action-icon {
  width: 14px;
  height: 14px;
}

.userHubQuickLinks__actionBtn--danger:hover {
  border-color: #fecaca;
  background: #fff7f7;
}

.userHubQuickLinks__empty {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px dashed #d6deef;
  border-radius: 10px;
  padding: 10px;
  background: #fbfdff;
}

.userHubQuickLinks__emptyIcon {
  width: 18px;
  height: 18px;
  opacity: 0.75;
}

.userHubQuickLinks__emptyText {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.userHubQuickLinks__emptyTitle {
  color: #0f172a;
  font-size: 0.82rem;
  font-weight: 600;
}

.userHubQuickLinks__emptySubtitle {
  color: #64748b;
  font-size: 0.72rem;
  line-height: 1.25;
}

/* Account profile host and Clerk overrides */
#account-profile {
  display: block;
  width: 100%;
}

#account-profile.cl-rootBox {
  margin: 0 !important;
  max-width: none !important;
  width: 100% !important;
}

#account-profile .cl-cardBox {
  margin: 0 !important;
  width: 100% !important;
}

#account-profile cl-user-profile::part(root) {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
}

#account-profile cl-user-profile::part(card),
#account-profile cl-user-profile::part(page),
#account-profile cl-user-profile::part(main),
#account-profile cl-user-profile::part(scrollBox) {
  box-shadow: none !important;
  filter: none !important;
  border: 0 !important;
  margin: 0 !important;
  width: 100% !important;
  max-width: none !important;
}

#account-profile cl-user-profile::part(navbar) {
  background: #ffffff !important;
  background-image: none !important;
}

#account-profile cl-user-profile::part(card),
#account-profile .cl-card,
#account-profile .cl-cardBox {
  border-radius: 0 !important;
}

#pageContentAccountTab {
  height: calc(100vh - var(--header-height) - var(--subnav-height));
  display: flex;
  align-items: stretch;
  width: 100%;
  overflow: hidden;
  --account-sidebar-width: 220px;
  --account-sidebar-padding: 24px 12px 16px;
  --account-sidebar-divider: #d9e2f0;
  --account-sidebar-title-font-size: 24px;
  --account-sidebar-title-line-height: 32px;
  --account-sidebar-title-font-weight: 600;
  --account-sidebar-title-color: #343a40;
  --account-sidebar-subtitle-font-size: 15px;
  --account-sidebar-subtitle-line-height: 20.7692px;
  --account-sidebar-subtitle-font-weight: 400;
  --account-sidebar-subtitle-color: rgba(52, 58, 64, 0.65);
  --account-sidebar-head-padding: 0 12px;
  --account-sidebar-head-gap: 2px;
  --account-sidebar-head-margin-bottom: 24px;
  --account-menu-gap: 2px;
  --account-menu-item-height: 32px;
  --account-menu-item-padding: 6px 12px;
  --account-menu-item-gap: 12px;
  --account-menu-item-radius: 6px;
  --account-menu-item-font-size: 15px;
  --account-menu-item-line-height: 20.7692px;
  --account-menu-item-font-weight: 500;
  --account-menu-item-color: rgba(52, 58, 64, 0.65);
  --account-menu-item-hover-color: #343a40;
  --account-menu-item-active-color: #0059ff;
  --account-menu-item-hover-bg: rgba(0, 0, 0, 0.04);
  --account-menu-item-active-bg: rgba(0, 0, 0, 0.07);
  --account-menu-icon-size: 16px;
  --account-mobile-row-height: 56px;
  --account-mobile-row-padding: 8px 12px 16px;
  --account-mobile-row-gap: 10px;
  --account-mobile-row-font-size: 17px;
  --account-mobile-row-line-height: 24px;
  --account-mobile-row-font-weight: 700;
  --account-mobile-row-color: #343a40;
}

#account-profile,
#account-settings-shell {
  height: 100%;
}

#account-settings-shell {
  display: none;
  width: 100%;
  min-height: 100%;
  box-sizing: border-box;
  background: #ffffff;
  color: #0f172a;
}

.account-settings-shell__mobile-row {
  display: none;
  align-items: center;
  gap: var(--account-mobile-row-gap);
  width: 100%;
  min-height: var(--account-mobile-row-height);
  padding: var(--account-mobile-row-padding);
  border: 0;
  background: #ffffff;
  color: var(--account-mobile-row-color);
  font-size: var(--account-mobile-row-font-size);
  line-height: var(--account-mobile-row-line-height);
  font-weight: var(--account-mobile-row-font-weight);
  text-align: left;
  box-sizing: border-box;
}

.account-settings-shell__mobile-row-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  display: inline-block;
  background-color: currentColor;
  -webkit-mask-image: url("/assets/images/bars-solid.svg");
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
  mask-image: url("/assets/images/bars-solid.svg");
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
}

.account-settings-shell__mobile-row-label {
  display: inline-flex;
  align-items: center;
}

.account-settings-shell__sidebar {
  flex: 0 0 var(--account-sidebar-width);
  width: var(--account-sidebar-width);
  min-width: var(--account-sidebar-width);
  max-width: var(--account-sidebar-width);
  padding: var(--account-sidebar-padding);
  box-sizing: border-box;
  border-right: 1px solid var(--account-sidebar-divider);
  background: #ffffff;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.account-settings-shell__sidebar-head {
  display: flex;
  flex-direction: column;
  gap: var(--account-sidebar-head-gap);
  margin: 0 0 var(--account-sidebar-head-margin-bottom);
  padding: var(--account-sidebar-head-padding);
}

.account-settings-shell__sidebar-title {
  margin: 0;
  font-size: var(--account-sidebar-title-font-size);
  line-height: var(--account-sidebar-title-line-height);
  font-weight: var(--account-sidebar-title-font-weight);
  color: var(--account-sidebar-title-color);
}

.account-settings-shell__sidebar-subtitle {
  margin: 0;
  font-size: var(--account-sidebar-subtitle-font-size);
  line-height: var(--account-sidebar-subtitle-line-height);
  font-weight: var(--account-sidebar-subtitle-font-weight);
  color: var(--account-sidebar-subtitle-color);
}

.account-settings-shell__menu {
  display: flex;
  flex-direction: column;
  gap: var(--account-menu-gap);
  margin: 0;
  padding: 0;
}

.account-settings-shell__menu-item {
  width: 100%;
  min-height: var(--account-menu-item-height);
  height: var(--account-menu-item-height);
  margin: 0;
  padding: var(--account-menu-item-padding);
  border: 0;
  border-radius: var(--account-menu-item-radius);
  background: transparent;
  color: var(--account-menu-item-color);
  display: flex;
  align-items: center;
  gap: var(--account-menu-item-gap);
  text-align: left;
  font-size: 13px;
  line-height: 18px;
  font-weight: 500;
  cursor: pointer;
  box-sizing: border-box;
  outline: none;
  box-shadow: none;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

.account-settings-shell__menu-item:hover {
  background: var(--account-menu-item-hover-bg);
  color: var(--account-menu-item-hover-color);
}

.account-settings-shell__menu-item.active {
  background: var(--account-menu-item-active-bg);
  color: var(--account-menu-item-active-color);
}

.account-settings-shell__menu-icon {
  width: var(--account-menu-icon-size);
  height: var(--account-menu-icon-size);
  flex: 0 0 auto;
  display: inline-block;
  color: currentColor;
}

.account-settings-shell__menu-icon {
  background-color: currentColor;
  opacity: 1;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
}

.account-settings-shell__menu-icon--general {
  -webkit-mask-image: url("/assets/images/gear-solid-full.svg");
  mask-image: url("/assets/images/gear-solid-full.svg");
}

.account-settings-shell__menu-icon--preferences {
  -webkit-mask-image: url("/assets/images/sliders-light-full.svg");
  mask-image: url("/assets/images/sliders-light-full.svg");
}

.account-settings-shell__menu-icon--privacy {
  -webkit-mask-image: url("/assets/images/circle-info-regular.svg");
  mask-image: url("/assets/images/circle-info-regular.svg");
}

.account-settings-shell__menu-icon--advanced {
  -webkit-mask-image: url("/assets/images/gauge-high-solid.svg");
  mask-image: url("/assets/images/gauge-high-solid.svg");
}

.account-settings-shell__menu-icon--journal-accounts {
  -webkit-mask-image: url("/assets/images/money-check-dollar-regular-full.svg");
  mask-image: url("/assets/images/money-check-dollar-regular-full.svg");
}

.account-settings-shell__menu-label {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  font-size: var(--account-menu-item-font-size);
  line-height: var(--account-menu-item-line-height);
  font-weight: var(--account-menu-item-font-weight);
}

.account-settings-shell__content {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 100%;
  padding: 40px 42px;
  box-sizing: border-box;
  display: block;
  background: #ffffff;
}

.account-settings-shell__section {
  display: block;
  min-height: 100%;
}

.account-settings-shell__section-card {
  max-width: 720px;
  padding: 28px 30px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: none;
}

.account-settings-shell__section-eyebrow {
  display: inline-flex;
  align-items: center;
  margin-bottom: 12px;
  color: #4f6b95;
  font-size: 12px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.account-settings-shell__section-title {
  margin: 0 0 10px;
  color: #0f172a;
  font-size: 26px;
  line-height: 1.2;
  font-weight: 700;
}

.account-settings-shell__section-description {
  margin: 0;
  color: #51627d;
  font-size: 15px;
  line-height: 1.65;
}

.account-settings-shell__content-placeholder {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  color: #63789a;
}

@media (max-width: 920px) {
  #account-settings-shell {
    flex-direction: column;
  }

  .account-settings-shell__mobile-row {
    display: inline-flex;
  }

  .account-settings-shell__sidebar {
    display: none;
  }

  .account-settings-shell__content {
    min-height: 320px;
    padding: 0 24px 24px;
  }

  .account-settings-shell__section-card {
    padding: 24px 22px;
  }
}

#account-profile.cl-rootBox,
#account-profile cl-user-profile::part(root) {
  height: 100% !important;
}

#account-profile .cl-cardBox,
#account-profile .cl-card,
#account-profile cl-user-profile::part(card),
#account-profile cl-user-profile::part(page),
#account-profile cl-user-profile::part(main),
#account-profile cl-user-profile::part(scrollBox) {
  height: 100% !important;
}

#account-profile .cl-cardBox {
  display: flex !important;
  align-items: stretch !important;
}

#account-profile .cl-scrollBox,
#account-profile .cl-navbar {
  height: 100% !important;
}

#account-profile .cl-navbar {
  background: #ffffff !important;
  background-image: none !important;
}

#account-profile .cl-internal-15hkgn2 {
  background: #ffffff !important;
  background-image: none !important;
}

#account-profile .cl-internal-1m0mkxm {
  background: #ffffff !important;
  background-image: none !important;
}

#account-profile .cl-card,
#account-profile .cl-card::before,
#account-profile .cl-card::after,
#account-profile .cl-cardBox,
#account-profile .cl-cardBox::before,
#account-profile .cl-cardBox::after {
  box-shadow: none !important;
  filter: none !important;
}

#account-profile,
#account-profile [class^="cl-"],
#account-profile [class*=" cl-"] {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    "Noto Sans", sans-serif !important;
}

#account-profile .cl-menuList,
#account-profile .cl-menuItem,
#account-profile .cl-button,
#account-profile button {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    "Noto Sans", sans-serif !important;
}

[data-floating-ui-portal] .cl-menuList,
[data-floating-ui-portal] .cl-menuItem,
[data-floating-ui-portal] .cl-button,
[data-floating-ui-portal] [class^="cl-"],
[data-floating-ui-portal] [class*=" cl-"] {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    "Noto Sans", sans-serif !important;
}

#account-profile .cl-headerTitle {
  color: #000000 !important;
}

#account-profile cl-user-profile::part(page),
#account-profile cl-user-profile::part(main),
#account-profile cl-user-profile::part(scrollBox) {
  font-size: 15px !important;
  line-height: 1.5 !important;
}

#account-profile p,
#account-profile label,
#account-profile li,
#account-profile span,
#account-profile a,
#account-profile input,
#account-profile select,
#account-profile textarea,
#account-profile .cl-text,
#account-profile .cl-description,
#account-profile .cl-formFieldLabel,
#account-profile .cl-formFieldHintText {
  font-size: 15px !important;
}

#account-profile .cl-card {
  box-shadow: none !important;
  filter: none !important;
  border: 0 !important;
  margin: 0 !important;
}
