/* Shared page chrome, keyboard focus and report reading modes. */
:root {
  --shell-h: 52px;
  --focus-ring: #0669ce;
  --surface-rule: #dedee4;
}
[hidden]:not([hidden="until-found"]) {
  display: none !important;
}
.skip-content {
  position: fixed;
  top: 6px;
  left: 12px;
  z-index: 120;
  border-radius: 9px;
  padding: 9px 14px;
  background: #fff;
  color: #064d93;
  transform: translateY(-160%);
}
.skip-content:focus {
  transform: none;
}
:where(
    button,
    a,
    input,
    select,
    textarea,
    summary,
    [tabindex="0"],
    [role="button"]
  ):focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}
#main {
  scroll-margin-top: calc(var(--shell-h) + 12px);
}
#main:focus:not(:focus-visible) {
  outline: none;
}
#menu {
  display: none;
}
.sidebar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--shell-h);
  min-width: 0;
  padding-inline: clamp(12px, 2vw, 28px);
  background: rgba(250, 250, 252, 0.95);
  border-bottom: 1px solid rgba(30, 30, 43, 0.09);
  backdrop-filter: blur(16px);
}
.brand {
  min-height: 40px;
}
.brand #brand-mark {
  display: grid;
  place-items: center;
}
.sidebar nav {
  min-width: 0;
}
.nav-group a {
  min-height: var(--shell-h);
  align-items: center;
}
.nav-group a:focus-visible {
  outline-offset: -3px;
  border-radius: 6px;
}
.nav-group a.active:before {
  left: 0;
  right: 0;
  bottom: 4px;
}
.signed-out .sidebar {
  display: none;
}
.topbar {
  z-index: 15;
  min-width: 0;
  height: 45px;
}
.account-wrap,
.book-wrap {
  min-width: 0;
}
.book-switch {
  min-height: 32px;
  max-width: 100%;
}
.book-list {
  top: calc(100% + 5px);
  max-width: min(320px, calc(100vw - 24px));
  max-height: min(65vh, 380px);
  overflow: auto;
  overscroll-behavior: contain;
}
.book-list :is(button, a) {
  min-height: 39px;
  overflow-wrap: anywhere;
}
main .page-heading {
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 18px;
}
.page-heading > div:first-child,
.panel-head > div {
  min-width: 0;
}
.page-heading h1 {
  line-height: 1.16;
}
.heading-actions,
.ledger-actions,
.cat-actions,
.toolbar {
  flex-wrap: wrap;
}
.panel-head {
  flex-wrap: wrap;
  gap: 8px 15px;
}
.panel {
  min-width: 0;
}
:where(
  .btn,
  .cat-link,
  .ledger-link,
  .tab,
  .cat-tab,
  .ledger-tabs button,
  .quick-days button,
  .mo-choices button
) {
  touch-action: manipulation;
}
.btn.primary:focus-visible {
  box-shadow: 0 0 0 2px #fff;
}
input,
select,
textarea {
  max-width: 100%;
}
.cat-stat,
.ledger-metric,
.mo-shortcuts button {
  position: relative;
}
:where(.ledger-metric, .cat-stat, .mo-shortcuts button) > span {
  padding-right: 12px;
}
.dashboard-kpis .metric {
  min-width: 0;
  color: #222228;
}
.dashboard-kpis .metric-value {
  font-variant-numeric: tabular-nums;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.08;
}
.dashboard-kpis .metric-name,
.dashboard-kpis .metric-meta {
  line-height: 1.4;
}
.dashboard-kpis {
  margin-bottom: 18px;
}
.dashboard-kpis a.metric:hover,
.mo-shortcuts button:hover,
.use-card:hover {
  box-shadow: 0 3px 12px #26253012;
}
.overview .module-bar {
  column-gap: 10px;
}
.module-picture {
  flex: none;
}
.module-bar a:focus-visible {
  outline-offset: 0;
}
.use-card {
  grid-template-columns: minmax(0, 1fr) auto;
}
.use-card .use-action {
  text-align: right;
}
:where(
  .use-card,
  .ledger-strip a,
  .mo-shortcuts button,
  .off-kpis dd,
  .ledger-metric,
  .metric-meta
) {
  overflow-wrap: anywhere;
}
dialog {
  max-width: calc(100vw - 20px);
  max-height: 90dvh;
  overscroll-behavior: contain;
}
.dialog-head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
}
.dialog-head h2 {
  line-height: 1.3;
  overflow-wrap: anywhere;
}
#dialog-close {
  min-width: 36px;
  min-height: 36px;
  flex: none;
}
#toasts {
  left: 50%;
  pointer-events: none;
  z-index: 110;
}
.toast {
  text-align: center;
  max-width: min(90vw, 520px);
  overflow-wrap: anywhere;
}
.table-wrap {
  max-width: 100%;
  overscroll-behavior-inline: contain;
  scrollbar-color: #c0bec7 transparent;
}
.table-wrap[tabindex="0"]:focus-visible {
  outline-offset: -3px;
}
.report-layout {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin: 4px 0;
  padding: 3px clamp(10px, 1.3vw, 20px);
  font-size: 12px;
  color: #64646c;
}
.report-layout-options {
  display: inline-flex;
  padding: 3px;
  border-radius: 9px;
  background: #eeeef2;
  gap: 2px;
}
.report-layout-options button {
  background: transparent;
  border: 0;
  font: inherit;
  line-height: 1.3;
  border-radius: 7px;
  padding: 6px 10px;
  color: #4c4c55;
  cursor: pointer;
}
.report-layout-options button[aria-pressed="true"] {
  background: #fff;
  color: #201d24;
  box-shadow: 0 1px 4px #10101d18;
}
.table-wrap.report-as-rows {
  overflow-x: visible;
}
.report-as-rows > table,
.report-as-rows > table tbody {
  display: block;
  min-width: 0;
  width: 100%;
  border-collapse: separate;
}
.report-as-rows > table thead {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
}
.report-as-rows > table tbody tr {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr));
  gap: 10px 18px;
  padding: 14px clamp(10px, 1.4vw, 22px);
  border-top: 1px solid var(--surface-rule);
}
.report-as-rows > table tbody tr:nth-child(even) {
  background: #fafafc;
}
.report-as-rows > table tbody td {
  display: block;
  min-width: 0;
  max-width: none;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
  background: transparent;
  border: 0;
  padding: 0;
}
.report-as-rows td[data-view-label]::before {
  content: attr(data-view-label);
  display: block;
  color: #64646c;
  font-size: 12px;
  line-height: 1.35;
  font-weight: 500;
}
.report-as-rows .ledger-memo {
  min-width: 0;
}
.tariff-group th {
  background: #f0eff3;
  color: #47434a;
  padding-block: 0.55rem;
}
.trend-readable {
  margin: 0 20px 15px;
  font-size: 13px;
  color: #4d4c54;
}
.trend-readable summary {
  cursor: pointer;
  width: fit-content;
  padding: 5px 2px;
  color: #0663ae;
}
.trend-readable .table-wrap {
  max-height: 250px;
  overflow: auto;
}

@media (max-width: 1050px) {
  :root {
    --shell-h: 48px;
  }
  .sidebar {
    display: flex;
    justify-content: space-between;
    position: sticky;
    inset: 0 auto auto;
    transform: none;
    width: 100%;
    overflow: visible;
    height: var(--shell-h);
    padding: 0 4%;
  }
  .sidebar .brand strong {
    display: block;
    font-size: 15px;
  }
  #menu {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 72px;
    height: 36px;
    padding: 4px 10px;
    background: transparent;
    color: #38363d;
    font-size: 13px;
    border-radius: 8px;
  }
  #menu::after {
    content: "导航";
  }
  #menu[aria-expanded="true"] {
    background: #eeedf2;
    color: #76153d;
  }
  .sidebar #nav {
    display: none;
    position: absolute;
    height: auto;
    top: 100%;
    left: 0;
    right: 0;
    width: 100%;
    max-height: calc(85dvh - var(--shell-h));
    overflow: auto;
    overscroll-behavior: contain;
    background: #fafafc;
    box-shadow: 0 8px 15px #20202d14;
    padding: 15px 4% 20px;
    border-bottom: 1px solid #d8d7dd;
    align-items: start;
    gap: 22px;
  }
  .nav-open .sidebar #nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .sidebar .nav-group {
    display: grid;
    gap: 2px;
  }
  .sidebar .nav-group:not(:has(a)) {
    display: none;
  }
  .sidebar .nav-group + .nav-group {
    margin: 0;
  }
  .sidebar .nav-label {
    display: block;
    padding: 0 9px;
    margin: 0 0 4px;
    color: #67646f;
    font-size: 12px;
  }
  .sidebar .nav-group a {
    display: flex;
    min-width: 0;
    height: auto;
    min-height: 40px;
    padding: 6px 9px;
    border-radius: 10px;
    gap: 7px;
    font-size: 14px;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .sidebar .nav-group a.active {
    background: #f3e8ef;
    color: #77143f;
  }
  .sidebar .nav-group a.active:before {
    display: none;
  }
  .sidebar .nav-group a .ico {
    display: inline-block;
  }
  .nav-open #shade {
    display: block;
    position: fixed;
    inset: var(--shell-h) 0 0;
    width: 100%;
    height: auto;
    z-index: 40;
    background: rgba(26, 25, 37, 0.25);
    border: 0;
  }
  body.nav-open {
    overflow: hidden;
  }
}
@media (max-width: 700px) {
  .sidebar #nav {
    gap: 13px;
  }
  .overview .module-bar {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px 3px;
    overflow: visible;
    margin: 8px 0 20px;
    padding: 0;
  }
  .module-picture {
    width: clamp(44px, 9vw, 60px);
  }
  .overview .module-bar a {
    padding: 2px 0 4px;
    gap: 1px;
  }
  .module-bar b {
    font-size: 12px;
  }
  .overview-hero {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    min-height: 85px;
  }
  .hero-emblem {
    display: none;
  }
  .overview-hero .heading-actions {
    margin: 0;
  }
  .overview-hero .heading-actions a,
  .overview-hero .heading-actions button {
    min-height: 28px;
    display: flex;
    align-items: center;
  }
  .overview .filter-head {
    gap: 7px;
    margin: 10px 0;
  }
  .account-wrap .book-list {
    right: auto;
    left: 0;
  }
  .report-as-rows > table tbody tr {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px 15px;
  }
  .report-as-rows td:has(button, a) {
    min-width: 0;
  }
  .table-wrap.report-as-rows td small {
    white-space: normal;
  }
  .business-controls form .field {
    min-width: min(125px, 100%);
  }
  .ledger-tabs {
    flex-wrap: wrap;
  }
  .ledger-tabs button {
    min-height: 35px;
  }
  .mo-period {
    gap: 7px;
  }
  .mo-choices {
    gap: 4px;
  }
  .mo-choices button {
    min-height: 31px;
  }
  .book-switch .ico {
    flex: none;
  }
  .account-wrap .book-switch span {
    max-width: min(28vw, 140px);
  }
  .book-wrap .book-switch span {
    max-width: min(30vw, 150px);
  }
}
@media (max-width: 470px) {
  .nav-open .sidebar #nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .sidebar .nav-group:first-child {
    grid-row: span 2;
  }
  .sidebar #nav {
    gap: 10px;
  }
  .sidebar .nav-group a {
    min-height: 41px;
  }
  .sidebar .nav-group + .nav-group {
    margin: 0;
  }
  .topbar {
    height: 38px;
  }
  .page-heading h1 {
    font-size: clamp(26px, 8vw, 33px);
  }
  .mo-choices button {
    font-size: 0.8rem;
  }
  .dashboard-kpis .metric {
    padding: 11px;
  }
  .dashboard-kpis .metric-value {
    font-size: clamp(20px, 5.5vw, 25px);
  }
  .use-card {
    grid-template-columns: 1fr;
  }
  .use-card .use-action {
    justify-self: start;
    text-align: left;
  }
  dialog .dialog-head {
    padding: 12px 14px;
  }
  #dialog-body {
    padding: 14px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
