/* 平板 (<=1024px) */
@media (max-width: 1024px) {
  .venue-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 900px) {
  .venue-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* 手机端 (<=768px) */
@media (max-width: 768px) {

  /* -- 侧边栏：固定浮层，左侧滑入 -- */
  .az-sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    z-index: 200;
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    transform: translateX(-100%);
    transition: transform .25s cubic-bezier(.4,0,.2,1);
    box-shadow: none;
  }

  .az-sidebar--mobile-open {
    transform: translateX(0);
    box-shadow: var(--shadow-16);
  }

  /* 折叠态在移动端同样隐藏 */
  .az-sidebar--collapsed {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    transform: translateX(-100%);
  }
  .az-sidebar--collapsed.az-sidebar--mobile-open {
    transform: translateX(0);
  }
  .az-sidebar--collapsed .az-nav-item__label,
  .az-sidebar--collapsed .az-nav-item__badge {
    display: inline;
  }
  .az-sidebar--collapsed .az-sidebar__section-title {
    opacity: 1;
    height: auto;
    padding: 0 16px;
    margin-bottom: 4px;
  }
  .az-sidebar--collapsed .az-sidebar__divider {
    margin: 8px 16px;
  }
  .az-sidebar--collapsed .az-nav-item {
    padding: 0 16px;
    justify-content: flex-start;
  }

  /* 遮罩层 */
  .az-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    top: var(--header-height);
    z-index: 199;
    background: rgba(0,0,0,.4);
  }
  .az-sidebar-backdrop--visible {
    display: block;
  }

  /* -- 顶栏适配 -- */
  .az-header {
    padding: 0 12px;
    gap: 8px;
  }

  .az-header__brand {
    font-size: var(--font-size-lg);
  }

  .az-header__brand-sub {
    display: none;
  }

  .az-header__right {
    gap: 6px;
    overflow: hidden;
  }

  .az-header__status {
    font-size: var(--font-size-xs);
    padding: 3px 8px;
    gap: 4px;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .az-header__user {
    display: none;
  }

  .az-header__logout {
    width: 32px;
    height: 32px;
    margin-left: 4px;
  }

  /* -- 工具栏 -- */
  .az-toolbar {
    padding: 0 12px;
    height: 40px;
  }

  .az-breadcrumb {
    font-size: var(--font-size-xs);
  }

  /* -- 页面区域 -- */
  .az-page {
    padding: 16px 12px;
  }

  .az-page-title {
    font-size: var(--font-size-xl);
    gap: 8px;
    flex-wrap: wrap;
  }

  .az-page-desc {
    margin: -8px 0 16px 0;
  }

  /* -- 指标网格单列 -- */
  .az-metrics {
    grid-template-columns: 1fr;
  }

  /* -- 卡片紧凑 -- */
  .az-card__body {
    padding: 14px 12px;
  }

  .az-card__header {
    padding: 12px 12px 10px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .az-card__header > .az-subtabs {
    width: 100%;
    min-width: 0;
    margin-bottom: 0;
  }

  .az-card__header > .el-button {
    width: 100%;
    margin-left: 0;
    justify-content: center;
  }

  .az-card__footer {
    padding: 10px 12px;
    flex-wrap: wrap;
  }

  /* -- 场馆网格单列 -- */
  .venue-grid,
  .venue-grid--3col,
  .venue-grid--2col {
    grid-template-columns: 1fr;
  }

  /* -- 场馆详情堆叠 -- */
  .venue-detail__hero {
    flex-direction: column;
  }

  .venue-detail__image {
    width: 100%;
    height: 200px;
  }

  .venue-detail__name {
    font-size: var(--font-size-xl);
  }

  /* -- 排期表横向滚动 -- */
  .schedule-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -12px;
    padding: 0 12px;
  }

  .schedule-table {
    table-layout: auto;
    min-width: 0;
    width: max-content;
  }

  .schedule-table th:not(:first-child),
  .schedule-table td:not(:first-child) {
    min-width: 80px;
  }

  .schedule-table th:first-child,
  .schedule-table td:first-child {
    min-width: 90px;
    position: sticky;
    left: 0;
    z-index: 3;
    background: var(--color-bg-alt);
  }

  .schedule-cell__label {
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
  }

  /* -- 排期图例换行 -- */
  .schedule-legend {
    gap: 10px;
  }

  /* -- 日期行换行 -- */
  .az-date-row {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* -- 预约摘要不再悬浮 -- */
  .booking-summary {
    position: static;
  }

  /* -- 子标签页横向滚动 -- */
  .az-subtabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    overflow: visible;
    border-bottom: none;
  }

  .az-subtab {
    min-width: 0;
    padding: 10px 12px;
    text-align: center;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    margin-bottom: 0;
    background: var(--color-surface);
  }

  .az-subtab--active {
    background: var(--azure-blue-lighter);
    border-color: var(--azure-blue);
  }

  /* -- 登录卡片 -- */
  .login-card {
    width: 100%;
    max-width: 92vw;
    padding: 32px 20px 24px;
  }

  .login-card__title {
    font-size: 18px;
  }

  /* -- 表单 -- */
  .az-form {
    max-width: 100%;
  }

  .az-form-inline {
    flex-direction: column;
    gap: 12px;
  }

  .az-form-inline .az-form-inline__item {
    min-width: auto;
    flex-wrap: wrap;
  }

  .az-form-inline__label {
    min-width: 100px;
  }

  .az-helper {
    margin-left: 0;
    margin-top: 4px;
    white-space: normal;
    line-height: 1.4;
  }

  .az-form .el-form-item__content {
    flex-wrap: wrap;
  }

  /* -- 底部保存栏 -- */
  .az-save-bar {
    padding: 0 12px;
  }

  /* -- 日志终端行 -- */
  .az-terminal__row {
    padding: 6px 10px;
    gap: 6px;
    flex-wrap: wrap;
  }

  .az-terminal__time {
    min-width: auto;
    font-size: 10px;
  }

  .az-terminal__role {
    min-width: 36px;
  }

  .az-terminal__msg {
    width: 100%;
    word-break: break-word;
  }

  /* -- 好友管理表 -- */
  .az-card__body--flush {
    overflow: hidden;
  }

  .az-friend-table-wrap {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0 8px 8px;
    box-sizing: border-box;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
  }

  .az-friend-table {
    width: max-content;
    min-width: 100%;
    max-width: none;
    table-layout: auto;
  }

  .az-friend-table th,
  .az-friend-table td {
    white-space: nowrap;
    word-break: normal;
  }

  .az-friend-table th,
  .az-friend-table td {
    padding: 8px 6px;
    font-size: 12px;
    vertical-align: middle;
    box-sizing: border-box;
  }

  .az-friend-table th:first-child,
  .az-friend-table td:first-child {
    width: 28px;
    min-width: 28px;
    text-align: center;
    padding-left: 4px;
    padding-right: 4px;
  }

  .az-friend-table th:nth-child(2),
  .az-friend-table td:nth-child(2) {
    width: 26px;
    min-width: 26px;
    text-align: center;
  }

  .az-friend-table th:nth-child(3),
  .az-friend-table td:nth-child(3) {
    display: none;
  }

  .az-friend-table th:nth-child(4),
  .az-friend-table td:nth-child(4) {
    min-width: 56px;
  }

  .az-friend-table th:nth-child(5),
  .az-friend-table td:nth-child(5) {
    min-width: 84px;
  }

  .az-friend-table th:nth-child(6),
  .az-friend-table td:nth-child(6) {
    min-width: 108px;
  }

  .az-friend-table th:last-child,
  .az-friend-table td:last-child {
    min-width: 76px;
    text-align: center;
  }

  .task-drag-handle {
    width: 16px;
    height: 20px;
  }

  .task-attempt-badge {
    min-width: 20px;
    padding: 1px 6px;
  }

  .az-friend-table .el-button--small {
    padding: 6px 8px;
    min-height: 30px;
  }

  /* -- 任务项 -- */
  .task-item {
    padding: 10px 10px;
    gap: 8px;
  }

  /* -- 状态横幅 -- */
  .az-status-banner {
    padding: 12px 14px;
    gap: 10px;
  }

  /* -- 弹窗移动端全宽 -- */
  .el-dialog {
    width: 92vw !important;
    margin: 0 auto;
  }

  /* -- 指标值字号缩小 -- */
  .az-metric__value {
    font-size: 20px;
  }
}

/* 小屏手机 (<=480px) */
@media (max-width: 480px) {
  .az-header__status {
    max-width: 100px;
    font-size: 11px;
    padding: 2px 6px;
  }

  .az-page {
    padding: 12px 10px;
  }

  .az-card__body {
    padding: 12px 10px;
  }

  .az-card__header {
    padding: 10px 10px 8px;
  }

  .login-card {
    padding: 24px 16px 20px;
  }

  .venue-card__body {
    padding: 10px 12px;
  }

  .venue-card__image {
    height: 120px;
  }

  .az-terminal__time {
    display: none;
  }
}

/* 打印样式 */
@media print {
  .az-header,
  .az-sidebar,
  .az-sidebar-backdrop,
  .az-toolbar,
  .az-save-bar {
    display: none !important;
  }

  .az-body {
    height: auto;
    overflow: visible;
  }

  .az-content {
    overflow: visible;
  }

  .az-page {
    overflow: visible;
    padding: 0;
  }

  .az-card {
    box-shadow: none;
    border: 1px solid #ccc;
    break-inside: avoid;
  }

  .schedule-cell--available { background: #eee !important; }
  .schedule-cell--booked { background: #ddd !important; }
  .schedule-cell--closed { background: #fdd !important; }
}
