.account-history-layout {
  --ah-header: 68px;
  --ah-rail: 198px;
  --ah-width: min(410px, 100%);
  --ah-line: #334962;
  --ah-surface: #101e30;
  --ah-motion: cubic-bezier(.22,1,.36,1);
}
.account-history-layout .ws-header {
  height: var(--ah-header);
  padding: 0 clamp(12px, 2.4vw, 40px);
  gap: clamp(8px, 1.8vw, 28px);
  background: #081320f5;
}
.account-history-layout .ws-header-actions { margin-left: auto; gap: 9px }
.account-history-layout .ws-header .ws-nav { margin-left: auto }
.account-history-layout .ws-header .ws-nav a {
  min-height: 44px; padding-inline: 12px; border: 1px solid var(--ah-line); border-radius: 12px;
}
.ah-header-nav,.ah-rail { display: flex; gap: 8px; align-items: center }
.ah-rail { flex-direction: column; align-items: stretch; padding: 8px 10px }
.account-history-layout .ah-nav-control {
  display: inline-flex; align-items: center; justify-content: flex-start; gap: 8px;
  min-height: 44px; padding: 0 12px; border: 1px solid transparent; border-radius: 12px;
  background: transparent; color: #ebf2ff; text-decoration: none; white-space: nowrap;
  transition: background 160ms ease, border-color 160ms ease, transform 100ms ease;
}
.ah-header-nav .ah-nav-control { border-color: var(--ah-line); background: #122235 }
.ah-nav-control .icon,.ah-audio-icon .icon { width: 19px; height: 19px; flex: none }
.ah-nav-control:hover,.ah-card:hover { border-color: #8297d1; background: #203451 }
.ah-nav-control:active,.ah-close:active,.ah-more:active { transform: translateY(1px) }
.ah-nav-control[aria-expanded=true],.ah-nav-control[aria-current=page],.ah-card.is-selected {
  border-color: #a596f8; background: #223457; color: #fff; box-shadow: inset 0 0 18px #6e64c933;
}
.account-history-layout .sidebar .ah-legacy-list,.account-history-layout .sidebar .sb-step,
.account-history-layout .sidebar .sb-section:has(.sb-step) { display:none }
.ah-panel {
  position: fixed; z-index: 116; inset: var(--ah-header) 0 0 auto; width: var(--ah-width);
  display: flex; flex-direction: column; overflow: hidden; border: 1px solid #677bb1;
  border-radius: 18px 0 0 18px; background: #0c1828fa; color: #f3f6ff;
  box-shadow: -8px 8px 35px #04091b80; opacity: 0; visibility: hidden;
  transform: translateX(100%); pointer-events: none;
  transition: transform 240ms var(--ah-motion),opacity 220ms ease,visibility 0s 240ms;
}
.ah-open .ah-panel {
  opacity: 1; visibility: visible; transform: none; pointer-events: auto;
  transition: transform 280ms var(--ah-motion),opacity 220ms ease,visibility 0s;
}
.ah-panel-head,.ah-content { opacity: 0; transform: translateX(8px); transition: transform 180ms ease,opacity 150ms ease }
.ah-open :is(.ah-panel-head,.ah-content) { opacity:1; transform:none; transition-delay:55ms }
.ah-panel-head { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 10px; padding: 18px 18px 10px }
.ah-panel-head h2 { margin: 0; font-size: 23px; line-height: 1.25 }
.ah-panel-head p,.ah-search,.ah-filters,.ah-count { grid-column: 1/-1; margin: 0 }
.ah-panel-head p,.ah-count,.ah-empty,.ah-card-detail span,.ah-sync p { color: #afbdd4; font-size: 13px; line-height: 1.6 }
.ah-search,.ah-filters select,.ah-close,.ah-more,.ah-secondary,.ah-primary {
  min-height: 44px; min-width: 0; border: 1px solid var(--ah-line); border-radius: 10px;
  background: var(--ah-surface); color: #f1f5ff; padding: 0 10px;
}
.ah-search { width: 100%; font: inherit }
.ah-search::placeholder { color: #a5b4ca }
.ah-close,.ah-more { min-width: 44px; font-size: 21px!important }
.ah-filters { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 8px }
.ah-content { min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 0 18px max(18px,env(safe-area-inset-bottom)) }
.ah-account { display: grid; grid-template-rows: auto 0fr; transition: grid-template-rows 240ms var(--ah-motion) }
.ah-account[open] { grid-template-rows: auto 1fr }
.ah-account summary { display: flex; align-items: center; gap: 9px; cursor: pointer; font-weight: 650 }
.ah-account summary::before { content: '›'; font-size: 22px; transition: transform 240ms ease }
.ah-account[open] summary::before { transform: rotate(90deg) }
.ah-account[open] > .ah-list { animation: ah-appear 220ms ease both }
.ah-device { border-top: 1px solid var(--ah-line); margin-top: 14px; padding-top: 10px }
.ah-device h3 { margin: 0 0 8px; font-size: 14px }
.ah-device > button { margin-top: 10px }
.ah-list { display: grid; gap: 8px; min-width: 0 }
.ah-card {
  display: grid; grid-template-columns: minmax(0,1fr) 48px; align-items: center;
  min-height: 72px; padding: 4px; border: 1px solid var(--ah-line); border-radius: 12px;
  background: var(--ah-surface); transition: background 160ms ease,border-color 160ms ease;
}
.ah-card-open {
  min-width: 0; display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 10px;
  min-height: 60px!important; align-items: center; padding: 0 8px;
  text-align: start; border: 0; background: transparent; color: inherit;
}
.ah-card-detail,.ah-card-detail :is(strong,span) { display:block; overflow:hidden; white-space:nowrap; text-overflow:ellipsis }
.ah-audio-icon,.ah-card-arrow { color:#aebdff }
.ah-card-arrow { font-size: 22px }
.ah-more { justify-self: center; background: transparent; border-color: transparent }
.ah-menu {
  position: fixed; z-index: 125; display: grid; min-width: 130px; padding: 4px;
  border: 1px solid var(--ah-line); border-radius: 10px; background: #182940;
  box-shadow: 0 8px 20px #040a19a0; animation: ah-appear 140ms ease both;
}
.ah-menu button { padding: 0 12px; text-align: start; border: 0; background: transparent; color: #f3f6ff; border-radius: 7px }
.ah-menu button:hover,.ah-more:hover,.ah-close:hover,.ah-secondary:hover { background: #263c5b }
@keyframes ah-appear { from { opacity: 0; transform: translateY(-5px) } to { opacity: 1; transform: none } }
.ah-backdrop { position: fixed; z-index: 114; inset: 0; background: #040a15aa; opacity: 0; visibility: hidden; transition: opacity 220ms ease,visibility 0s 220ms }
.ah-secondary { display: inline-flex; align-items: center; text-decoration: none }
.ah-sync {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 12px;
  border: 1px solid var(--ah-line); border-radius: 12px; background: #102032e8; margin-bottom: 16px;
}
.ah-sync p { margin: 0; flex-basis: 100% }
.ah-primary { background:#223f76; border-color:#7095e5; font-weight: 650 }
.ah-primary:disabled { opacity:.55; cursor:wait }
.ah-preference { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 13px; cursor:pointer }
.ah-preference input { accent-color:#91a7ff; width:17px; height:17px; flex:none }
@media (min-width: 1024px) {
  .account-history-layout .ws-header #menuBtn { display: none!important }
  .studio-workspace.account-history-layout .sidebar {
    display:flex; top:var(--ah-header)!important; left:0; width:var(--ah-rail); height:calc(100dvh - var(--ah-header));
    transform:none!important; z-index:90; background:#0a1626f4; border-radius:0 18px 0 0;
  }
  .account-history-layout .sidebar :is(.ws-close-history,.lunar-drawer-nav) { display:none!important }
  .account-history-layout .sidebar .sb-brand { align-items: flex-start }
  .account-history-layout .sidebar .sb-section { padding: 14px }
  .account-history-layout .shell { padding-left:var(--ah-rail); transition: padding-right 280ms var(--ah-motion) }
  .studio-workspace.account-history-layout .main { width:calc(100% - 40px)!important; max-width:none!important }
}
@media (min-width:1360px) { .ah-open .shell { padding-right:410px } }
@media (max-width:1359px) {
  .ah-open .ah-backdrop { opacity:1; visibility:visible; transition-delay:0s }
  html:has(.ah-open) { overflow-y:hidden!important }
}
@media (max-width:767px) {
  .account-history-layout .ws-header { gap: 8px; padding-inline: 8px }
  .account-history-layout .ws-brand { font-size: 15px }
  .account-history-layout .ws-brand svg { width: 19px; height: 19px }
  .account-history-layout .ws-header-actions { gap: 5px }
  .account-history-layout .ws-header .ws-nav,.ah-header-nav .ah-nav-control:nth-child(n+2) { display:none }
  .account-history-layout .ws-header #menuBtn { flex:none; width: 44px }
  .account-history-layout .ws-header .ws-auth { min-width: 0; max-width: 74px; font-size: 11px }
  .account-history-layout .ws-header .ws-auth-label { overflow:hidden; text-overflow:ellipsis; white-space:nowrap }
  .account-history-layout .ws-header .lunar-back { display:none }
  .ah-header-nav .ah-nav-control { padding-inline:8px }
  .ah-panel-head { padding:12px 12px 8px }
  .ah-content { padding-inline:12px }
}
@media (max-width:380px) { .ah-header-nav .icon { display:none } }
@media (prefers-reduced-motion:reduce) {
  .ah-panel,.ah-panel-head,.ah-content,.ah-account,.ah-account summary::before,.ah-menu,.ah-card,.ah-nav-control,.ah-backdrop,.account-history-layout .shell {
    transition:none!important; animation:none!important;
  }
}

.ah-rename {
  width: min(420px, calc(100% - 24px)); max-height: calc(100dvh - 24px);
  padding: 20px; border: 1px solid var(--ah-line); border-radius: 14px;
  background: #101e30; color: #f3f6ff;
}
.ah-rename::backdrop { background: #050b18bb }
.ah-rename h2 { margin: 0 0 14px; font-size: 19px }
.ah-rename label { display: grid; gap: 6px }
.ah-rename input {
  min-height: 44px; width: 100%; padding: 0 10px; border: 1px solid var(--ah-line);
  border-radius: 9px; background: #081320; color: inherit; font: inherit;
}
.ah-rename p { margin: 6px 0; color: #ff9ba5 }
.ah-rename p:empty { display: none }
.ah-rename-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 14px }
.account-history-layout .adjust-card .ah-reset {
  min-height: 44px; margin-top: 4px; padding: 0 10px; border: 1px solid var(--ah-line);
  border-radius: 8px; color: var(--text); background: var(--ah-surface); font-size: 12px;
}
.ah-reset:enabled:hover { border-color: #8297d1 }
.ah-reset:disabled { opacity: .55 }
