/* Admin CMS desktop/tablet layout (≥768). Complements admin-mobile.css. */

@media (min-width: 768px) {
  .hf-spa-admin-root.hf-admin-layout--desktop {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.75rem;
  }

  .hf-spa-admin-root .hf-admin-shell-nav--tablet {
    position: sticky;
    z-index: 20;
    top: calc(env(safe-area-inset-top, 0px) + var(--hf-topbar-height, 108px));
    margin: 0;
    padding: 0.35rem 0 0.5rem;
    background: var(--wb-bg, #0a0a0a);
    border-bottom: 1px solid var(--wb-border, rgba(255, 255, 255, 0.12));
  }

  .hf-admin-primary-tabs--scroll {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.35rem;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding-bottom: 0.25rem;
  }

  .hf-admin-primary-tabs--scroll .tab {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .hf-spa-admin-root .table-wrap {
    overflow-x: auto;
    max-width: 100%;
  }

  .hf-spa-admin-root table.hf-admin-table,
  .hf-spa-admin-root table.audit-table,
  .hf-spa-admin-root table.security-table,
  .hf-spa-admin-root table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
  }

  .hf-spa-admin-root .table-wrap table.hf-admin-table thead th,
  .hf-spa-admin-root .table-wrap table.audit-table thead th,
  .hf-spa-admin-root .table-wrap table.security-table thead th,
  .hf-spa-admin-root .table-wrap table.data-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--wb-surface, #000);
    box-shadow: 0 1px 0 var(--wb-border, rgba(255, 255, 255, 0.12));
  }

  .hf-spa-admin-root .hf-admin-stack {
    gap: 1rem;
  }

  .hf-spa-admin-root .hf-admin-panel.panel {
    padding: 1rem 1.15rem;
  }

  .hf-spa-admin-root .mod-comments-list.hf-admin-card-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr));
    gap: 0.75rem;
  }

  .hf-spa-admin-root .hf-admin-chat-automsg-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr));
    gap: 0.75rem;
  }

  .hf-spa-admin-root .admin-ai-layout {
    display: grid;
    grid-template-columns: 1fr 1.4fr 1fr;
    gap: 1rem;
    align-items: start;
  }

  .hf-spa-admin-root .admin-ai-chat-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  .hf-spa-admin-root .admin-ai-chat-shell {
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-height: min(72vh, 640px);
  }

  .hf-spa-admin-root .admin-ai-chat-thread {
    flex: 1 1 auto;
    min-height: 280px;
    max-height: min(56vh, 520px);
    overflow-y: auto;
  }

  .hf-spa-admin-root .admin-ai-chat-composer {
    flex-shrink: 0;
  }

  .hf-spa-admin-root .admin-ai-attach-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
  }

  .hf-spa-admin-root .admin-ai-attach-hint {
    font-size: 0.85rem;
    margin: 0;
  }

  .hf-spa-admin-root .admin-ai-attach-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
  }

  .hf-spa-admin-root .admin-ai-attach-thumb {
    position: relative;
    width: 72px;
    height: 72px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
  }

  .hf-spa-admin-root .admin-ai-attach-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  .hf-spa-admin-root .admin-ai-attach-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 0;
    padding: 0 4px;
    font-size: 0.75rem;
    line-height: 1.2;
  }

  .hf-spa-admin-root .admin-ai-msg-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.35rem;
  }

  .hf-spa-admin-root .admin-ai-msg-attach-thumb {
    width: 56px;
    height: 56px;
    border-radius: 4px;
    object-fit: cover;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
  }

  .hf-spa-admin-root .audit-filters.hf-admin-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.65rem 0.75rem;
  }

  .hf-spa-admin-root .audit-filters .audit-filter-grow {
    flex: 1 1 200px;
  }

  .hf-spa-admin-root .hf-admin-spa-service-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.65rem;
  }
}

@media (min-width: 1024px) {
  .hf-spa-admin-root.hf-admin-layout--desktop {
    grid-template-columns: 240px minmax(0, 1fr);
    align-items: start;
    gap: 1.25rem;
  }

  .hf-admin-sidebar {
    position: sticky;
    top: calc(env(safe-area-inset-top, 0px) + var(--hf-topbar-height, 108px) + 12px);
    align-self: start;
    max-height: calc(100dvh - var(--hf-topbar-height, 108px) - 24px);
    overflow-y: auto;
    padding: 0.5rem 0;
  }

  .hf-admin-sidebar .admin-nav-group + .admin-nav-group {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--wb-border, rgba(255, 255, 255, 0.08));
  }

  .hf-admin-sidebar .admin-nav-sidebar-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0 0 12px;
    color: var(--wb-text, #fff);
  }

  .hf-admin-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
  }

  .hf-admin-subsection-title {
    margin: 16px 0 8px;
    font-size: 1rem;
    font-weight: 600;
  }

  .hf-admin-sidebar-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    min-height: 40px;
    padding: 0.45rem 0.75rem;
    border-radius: var(--wb-radius, 0.625rem);
    border: 1px solid transparent;
    color: var(--wb-muted, #9ca3af);
    text-decoration: none;
    font-size: 0.875rem;
    line-height: 1.3;
  }

  .hf-admin-sidebar-link:hover {
    background: var(--wb-elevated, #111);
    color: var(--wb-text, #fff);
  }

  .hf-admin-sidebar-link.active {
    background: var(--sp-white, #fff);
    color: var(--sp-black, #000);
    border-color: var(--sp-white, #fff);
  }

  .hf-admin-sidebar-link .tab-badge {
    flex-shrink: 0;
  }

  .hf-spa-admin-root.hf-admin-layout--desktop .hf-admin-shell-nav--sidebar-host {
    display: contents;
  }

  .hf-spa-admin-root.hf-admin-layout--desktop .hf-admin-main {
    min-width: 0;
  }

  .hf-spa-admin-root.hf-admin-layout--desktop .hf-admin-shell-nav--tablet {
    display: none;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .hf-spa-admin-root .hf-admin-sidebar {
    display: none;
  }
}
