/* 桌面端工作台皮肤：只在宽屏生效，由后端按 UA 决定是否下发。 */
@media (min-width: 760px) {
  :root {
    --rail-w: 216px;
    --desk-gap: 16px;
  }

  body {
    padding-left: 0;
  }

  /* 左侧固定工作台 */
  header {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 80;
    width: var(--rail-w);
    height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 22px 14px 18px;
    border-right: 1px solid var(--hair);
    border-bottom: 0;
    background: color-mix(in srgb, var(--panel) 86%, transparent);
    backdrop-filter: saturate(150%) blur(22px);
    -webkit-backdrop-filter: saturate(150%) blur(22px);
  }

  header .logo {
    gap: 10px;
    padding: 0 6px;
    font-size: 15px;
  }

  header .logo .dot {
    width: 9px;
    height: 9px;
  }

  header .logo small {
    display: block;
    margin-top: 3px;
    font-size: 10px;
    letter-spacing: .08em;
  }

  header .spacer {
    flex: 1;
  }

  header .hdr-set {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 9px;
  }

  #btnTheme {
    width: 64px;
    height: 34px;
    margin: 0 0 2px 4px;
  }

  #accountTop {
    width: 100%;
    max-width: none !important;
    height: 38px;
    padding: 0 11px;
    border-radius: 10px;
    font-size: 12.5px;
  }

  #btnPanelOut {
    width: 100%;
    height: 38px;
    padding: 0 12px;
    border-radius: 10px;
    font-size: 12.5px;
  }

  /* 导航从顶栏变成左侧栏，底部 tabbar 的 DOM 不动 */
  .tabbar {
    position: fixed;
    top: 104px;
    bottom: auto;
    left: 10px;
    right: auto;
    transform: none;
    z-index: 85;
    width: calc(var(--rail-w) - 20px);
    max-width: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    padding: 8px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    max-height: calc(100dvh - 268px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: none;
  }

  .tabbar::-webkit-scrollbar {
    width: 0;
    height: 0;
  }

  .tabbar::before {
    content: "工作台";
    display: block;
    padding: 0 10px 7px;
    color: var(--dim);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .14em;
  }

  .tabbar .tb {
    flex: 0 0 auto;
    flex-direction: row;
    justify-content: flex-start;
    gap: 9px;
    min-height: 40px;
    padding: 0 10px;
    border-radius: 10px;
    color: var(--sub);
    font-size: 12.5px;
    font-weight: 500;
    letter-spacing: .01em;
  }

  .tabbar .tb:hover {
    background: var(--acc-soft);
    color: var(--txt);
  }

  .tabbar .tb.act {
    background: var(--acc-soft);
    color: var(--acc);
    font-weight: 650;
  }

  .tb-ic {
    width: 21px;
    height: 21px;
    flex: none;
    justify-content: flex-start;
    border-radius: 6px;
  }

  .tb-ic svg {
    width: 19px;
    height: 19px;
  }

  .tabbar .tb .tb-badge {
    position: static;
    margin: 0 0 0 auto;
    box-shadow: 0 0 0 2px var(--panel);
  }

  /* 主内容区 */
  main {
    width: auto;
    max-width: none;
    min-height: 100dvh;
    margin: 0 0 0 var(--rail-w);
    padding: 26px clamp(18px, 2.4vw, 36px) 56px;
    display: block;
  }

  .page-head {
    margin: 0 0 20px;
    padding: 0;
  }

  .page-head h1 {
    font-size: 24px;
    letter-spacing: -.4px;
  }

  .page-head p {
    margin-top: 4px;
    font-size: 13px;
  }

  /* 桌面端把原本隐藏的页标题放出来，避免进页面就是一堆卡片 */
  #tab-autos > h2,
  #tab-groups > h2,
  #tab-rules > h2,
  #tab-logs > h2,
  #tab-settings > h2 {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0 0 4px;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -.4px;
  }

  #tab-autos > h2 svg,
  #tab-groups > h2 svg,
  #tab-rules > h2 svg,
  #tab-logs > h2 svg,
  #tab-settings > h2 svg {
    width: 21px;
    height: 21px;
    color: var(--acc);
  }

  #tab-autos > .sub,
  #tab-groups > .sub,
  #tab-rules > .sub,
  #tab-logs > .sub,
  #tab-settings > .sub {
    display: block;
    margin: 0 0 18px;
    color: var(--sub);
    font-size: 13px;
  }

  /* 卡片瀑布流：桌面端不再把内容挤在一条窄列里 */
  #tab-overview.act,
  #tab-autos.act {
    display: block;
    columns: 1;
    column-gap: var(--desk-gap);
  }

  #tab-settings.act {
    display: grid;
    columns: auto;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: var(--desk-gap);
  }

  #tab-overview > .page-head,
  #tab-overview > #floodBar,
  #tab-overview > #featureDemo,
  #tab-autos > h2,
  #tab-autos > .sub,
  #tab-autos > .seg.auto-cats,
  #tab-settings > h2,
  #tab-settings > .sub {
    column-span: all;
    grid-column: 1 / -1;
  }

  #tab-overview .card,
  #tab-autos > .card,
  #tab-settings > .card {
    margin: 0 0 var(--desk-gap);
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    page-break-inside: avoid;
  }

  #tab-settings > .card {
    margin-bottom: 0;
  }

  /* 设置页：系统设置和出口 IP 都需要横向空间，占满整行 */
  #tab-settings > #sysHubCard,
  #tab-settings > #proxyCard,
  #tab-settings > #learnHubCard {
    grid-column: 1 / -1;
  }

  /* 出口 IP 卡片内部再分两栏：内核 / 本地节点 / 按账号 / 添加 / 订阅 */
  #proxyCard .pxy-pro {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    align-items: start;
  }

  #proxyCard .pxy-pro > .pxy-pro-head {
    grid-column: 1 / -1;
    margin-bottom: 0;
  }

  #proxyCard .pxy-pro > .fold {
    margin: 0;
  }

  #proxyCard #proFoldSubs {
    grid-column: 1 / -1;
  }

  #proxyCard .pxy-list {
    max-height: 340px;
    overflow: auto;
  }

  #proxyCard #subCandidates .pxy-cand {
    max-height: 420px;
    overflow: auto;
  }

  /* 群组、规则、日志保持单列阅读宽度 */
  #tab-groups.act,
  #tab-rules.act,
  #tab-logs.act {
    columns: 1;
    column-count: 1;
    max-width: 980px;
    margin: 0;
  }

  #tab-groups > .card,
  #tab-rules > .card,
  #tab-logs > .card {
    margin-left: 0;
    margin-right: 0;
  }

  /* 桌面密度：比手机略松，字号略大 */
  .card {
    padding: 15px;
    border-radius: 16px;
  }

  .card h3 {
    font-size: 14.5px;
  }

  .hint {
    font-size: 11.5px;
    line-height: 1.6;
  }

  .fold .fold-h {
    min-height: 28px;
  }

  /* 浮层与提示避开左侧栏 */
  .toast {
    left: calc(var(--rail-w) + (100vw - var(--rail-w)) / 2);
    top: 24px;
  }

  .float-top {
    display: none !important;
  }

  .log-toolbar {
    top: 24px;
  }

  .autof-card {
    max-width: 700px;
  }
}

@media (min-width: 1200px) {
  :root {
    --rail-w: 244px;
  }

  header {
    padding: 26px 18px 20px;
  }

  header .logo {
    padding: 0 8px;
    font-size: 16px;
  }

  .tabbar {
    top: 112px;
    left: 12px;
    width: calc(var(--rail-w) - 24px);
  }

  .tabbar::before {
    padding: 0 12px 8px;
  }

  .tabbar .tb {
    gap: 11px;
    min-height: 42px;
    padding: 0 12px;
    font-size: 13px;
  }

  main {
    padding: 34px clamp(24px, 3vw, 46px) 64px;
  }

  .page-head h1 {
    font-size: 26px;
  }

  #tab-autos > h2,
  #tab-groups > h2,
  #tab-rules > h2,
  #tab-logs > h2,
  #tab-settings > h2 {
    font-size: 25px;
  }

  #tab-overview.act,
  #tab-autos.act {
    columns: 2;
  }

  #tab-settings.act {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #proxyCard .pxy-pro {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .card {
    padding: 16px;
  }
}

@media (min-width: 1600px) {
  #tab-overview.act,
  #tab-autos.act {
    columns: 3;
  }
}
