.accounting-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  container-name: accounting-header;
  container-type: inline-size;
  border-bottom: 1px solid var(--color-line);
  background: rgba(249, 252, 255, 0.98);
  box-shadow: 0 5px 15px rgba(39, 76, 101, 0.07);
}

.accounting-header__grid {
  min-height: 142px;
  padding: 0.65rem 1rem 0.8rem;
  display: grid;
  grid-template-columns: max-content max-content max-content max-content max-content minmax(0, 1fr) max-content max-content;
  grid-template-areas:
    "menu account theme motion brand nav logout actions"
    "notify search search search search search search .";
  align-items: center;
  column-gap: 0.58rem;
  row-gap: 0.65rem;
}

.accounting-navigation-shell {
  display: contents;
}

.accounting-navigation-shell__header {
  display: none;
}

.accounting-nav-toggle {
  grid-area: menu;
}

.accounting-nav-toggle__mobile-icon {
  display: inline;
}

.accounting-nav-toggle__desktop-label,
.accounting-nav-toggle__desktop-chevron {
  display: none;
}

.accounting-header__controls {
  display: contents;
}

.accounting-account-button {
  grid-area: account;
}

.accounting-logout-form {
  grid-area: logout;
}

.accounting-auth-form {
  display: flex;
  margin: 0;
}

.accounting-auth-button {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-width: 74px;
  padding-inline: 0.85rem;
  border-color: #a8c2d3;
  background: linear-gradient(145deg, #ffffff 0%, #f7fbfe 54%, #e1f1fa 100%);
  box-shadow: 0 5px 12px rgba(35, 78, 108, 0.13), inset 0 1px 0 rgba(255, 255, 255, 0.96);
  color: var(--color-blue-deep);
  text-decoration: none;
}

.accounting-auth-button::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -45% 20% auto;
  height: 95%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(128, 200, 239, 0.24), rgba(128, 200, 239, 0) 72%);
  pointer-events: none;
}

.accounting-auth-button:hover {
  border-color: #77a9c8;
  background: linear-gradient(145deg, #ffffff 0%, #f2f9fd 48%, #d9edf8 100%);
  box-shadow: 0 7px 15px rgba(35, 78, 108, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.98);
}

.theme-switch {
  grid-area: theme;
  width: 52px;
  height: 30px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.theme-switch__track {
  position: relative;
  display: block;
  width: 52px;
  height: 30px;
  border: 1px solid #9db8ca;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff, #e8f1f7);
  box-shadow: var(--shadow-button), inset 0 1px 2px rgba(40, 82, 112, 0.1);
}

.theme-switch__thumb {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(180deg, #327aa7, #246b99);
  box-shadow: 0 2px 7px rgba(32, 71, 98, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.45);
  transition: transform 0.18s, background 0.18s, box-shadow 0.18s;
}

html[data-theme="dark"] .theme-switch__thumb {
  transform: translateX(22px);
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.motion-toggle {
  grid-area: motion;
  width: 34px;
  height: 34px;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  color: var(--color-text);
  font-size: 1rem;
}

.motion-toggle:hover,
.motion-toggle:focus-visible {
  border-color: #9db8ca;
  background: rgba(228, 241, 250, 0.72);
  box-shadow: 0 4px 10px rgba(35, 78, 108, 0.1);
  transform: none;
}

.motion-toggle[aria-pressed="true"] {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  color: var(--color-blue);
}

.accounting-nav {
  grid-area: nav;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: nowrap;
  gap: 0.35rem;
  min-width: 0;
}

.accounting-nav__form {
  display: flex;
  margin: 0;
}

.accounting-nav__button {
  min-height: 38px;
  padding: 0.5rem 0.66rem;
  border: 1px solid #b7cedd;
  border-radius: 7px;
  background: linear-gradient(180deg, #fff, #edf5fa);
  box-shadow: var(--shadow-button);
  color: var(--color-blue-deep);
  font-weight: 750;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.16s, border-color 0.16s, transform 0.16s, box-shadow 0.16s;
}

.accounting-nav__button:hover {
  border-color: #70a6c8;
  background: linear-gradient(180deg, #fff, #e4f1f8);
  transform: translateY(-1px);
}

.accounting-nav__button.is-active {
  border-color: #286f9e;
  background: linear-gradient(180deg, #327aa7, #246b99);
  box-shadow: 0 5px 12px rgba(38, 103, 148, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.32);
  color: #fff;
}

.accounting-brand {
  position: relative;
  isolation: isolate;
  grid-area: brand;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
  text-decoration: none;
}

.accounting-brand::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 18% 6% 12%;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(153, 211, 241, 0.16) 0%, rgba(83, 157, 203, 0.10) 48%, rgba(49, 124, 170, 0.05) 64%, transparent 76%);
  filter: blur(7px);
  pointer-events: none;
}

.accounting-brand__mark {
  position: relative;
  z-index: 1;
  display: block;
  width: clamp(126px, 9.5vw, 142px);
  height: auto;
  object-fit: contain;
  opacity: 0.96;
  filter: drop-shadow(0 4px 6px rgba(26, 67, 96, 0.18)) drop-shadow(0 7px 12px rgba(35, 81, 113, 0.10));
}

.accounting-header__actions {
  grid-area: actions;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}

.header-help {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-width: 76px;
  border-color: rgba(67, 145, 198, 0.48);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(227, 243, 253, 0.96));
  box-shadow: 0 7px 18px rgba(38, 91, 128, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.header-help img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(55, 144, 207, 0.42));
}

.notification-indicator {
  grid-area: notify;
  justify-self: center;
  align-self: center;
}

.accounting-search-row {
  grid-area: search;
  width: min(100%, 720px);
  justify-self: center;
}

.accounting-search {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0 0.85rem;
  border: 1px solid #b8cad7;
  border-radius: 9px;
  background: linear-gradient(180deg, #fff, #f1f7fb);
  box-shadow: var(--shadow-soft), inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.accounting-search:focus-within {
  border-color: #70a6c8;
  box-shadow: var(--focus-ring), var(--shadow-soft);
}

.accounting-search__icon {
  color: var(--color-blue-deep);
  font-size: 1.35rem;
  line-height: 1;
}

.accounting-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--color-text);
}

.accounting-search input::placeholder {
  color: var(--color-text-muted);
}

.help-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  z-index: var(--z-sidebar);
  width: min(92vw, 430px);
  height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr;
  border-left: 1px solid #a9c5d7;
  background: linear-gradient(180deg, #fbfdff, #edf6fb);
  box-shadow: -22px 0 55px rgba(29, 68, 95, 0.22);
  transform: translateX(105%);
  transition: transform 0.24s;
}

.help-sidebar.is-open {
  transform: none;
}

.help-sidebar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border-bottom: 1px solid var(--color-line);
  background: rgba(255, 255, 255, 0.86);
}

.help-sidebar__brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.help-sidebar__brand img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  filter: drop-shadow(0 0 14px rgba(64, 151, 215, 0.3));
}

.help-sidebar__brand h2,
.help-sidebar__brand p {
  margin: 0;
}

.help-sidebar__body {
  min-height: 0;
  padding: 1rem;
  overflow: auto;
}

.accounting-ai-sidebar__body {
  display: grid;
  align-content: center;
  justify-items: center;
}

.accounting-ai-visual {
  width: min(100%, 190px);
}

.accounting-ai-visual img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  border-radius: 26px;
  box-shadow: 0 18px 34px rgba(30, 67, 92, 0.22), 0 6px 14px rgba(43, 107, 149, 0.16);
  filter: drop-shadow(0 8px 14px rgba(36, 91, 128, 0.18));
}

html[data-motion="reduced"] *,
html[data-motion="reduced"] *::before,
html[data-motion="reduced"] *::after {
  scroll-behavior: auto !important;
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}

html[data-theme="dark"] body,
html[data-theme="dark"] .site-background {
  background: linear-gradient(180deg, #0b2232 0%, #102f44 100%);
}

html[data-theme="dark"] .site-shell,
html[data-theme="dark"] .accounting-header,
html[data-theme="dark"] .help-sidebar,
html[data-theme="dark"] .help-sidebar__header {
  background: var(--color-shell);
  border-color: var(--color-line);
}

html[data-theme="dark"] .button--quiet,
html[data-theme="dark"] .icon-button,
html[data-theme="dark"] .accounting-search {
  border-color: var(--color-line);
  background: var(--color-surface-soft);
  color: var(--color-text);
}

html[data-theme="dark"] .accounting-auth-button {
  border-color: #456f89;
  background: linear-gradient(145deg, #173e57 0%, #214f69 58%, #2a5d78 100%);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  color: #fff;
}

html[data-theme="dark"] .accounting-auth-button::before {
  background: radial-gradient(circle, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0) 72%);
}

html[data-theme="dark"] .accounting-auth-button:hover {
  border-color: #5b8aa7;
  background: linear-gradient(145deg, #1a425b 0%, #285771 58%, #316781 100%);
  box-shadow: 0 7px 16px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

html[data-theme="dark"] .accounting-nav__button {
  border-color: var(--color-line);
  background: var(--color-surface-soft);
  color: #fff;
}

html[data-theme="dark"] .accounting-nav__button:hover {
  border-color: #5b9bc2;
  background: #244f69;
  color: #fff;
}

html[data-theme="dark"] .accounting-nav__button.is-active {
  border-color: #4b9fd3;
  background: linear-gradient(180deg, #327aa7, #246b99);
  color: #fff;
}

html[data-theme="dark"] .motion-toggle {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  color: #fff;
}

html[data-theme="dark"] .motion-toggle:hover,
html[data-theme="dark"] .motion-toggle:focus-visible {
  border-color: #4f819f;
  background: rgba(40, 83, 108, 0.72);
}

html[data-theme="dark"] .accounting-brand::before {
  background: radial-gradient(ellipse at center, rgba(111, 184, 226, 0.20) 0%, rgba(63, 143, 190, 0.13) 45%, rgba(25, 94, 136, 0.07) 62%, transparent 76%);
  filter: blur(7px);
}

html[data-theme="dark"] .accounting-brand__mark {
  opacity: 0.94;
  filter: drop-shadow(0 5px 7px rgba(0, 0, 0, 0.42)) drop-shadow(0 0 8px rgba(86, 168, 215, 0.12));
}


html[data-theme="dark"] .accounting-ai-visual img {
  box-shadow: 0 20px 38px rgba(0, 0, 0, 0.58), 0 7px 16px rgba(0, 0, 0, 0.38), 0 0 18px rgba(70, 151, 198, 0.16);
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.38));
}

html[data-theme="dark"] .theme-switch__track {
  border-color: var(--color-line);
  background: var(--color-surface-soft);
}
