/* OlaMat Admin Panel Surface
   Sidebar layout, dashboard, process steps, orders table, database inspector.
   Components (btn, badge, modal, form, table, card) are in components.css. */

@layer surfaces {

  #payments-view a.tab-btn {
    color: var(--color-text);
    text-decoration: none;
    font-size: var(--text-sm);
  }

  .receipt-summary {
    max-width: 34rem;
    margin: 0 0 var(--space-6);
    font-size: var(--text-sm);
  }

  .receipt-summary-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
    align-items: baseline;
    gap: var(--space-4);
    padding: var(--space-2) 0;
  }

  .receipt-summary-row dt {
    font-weight: 400;
    color: var(--color-text-light);
  }

  .receipt-summary-row dd {
    margin: 0;
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
  }

  .receipt-summary-subtotal,
  .receipt-summary-total {
    margin-top: var(--space-2);
    border-top: 1px solid var(--color-border);
    padding-top: var(--space-3);
    font-weight: 600;
  }

  .receipt-summary-subtotal dt,
  .receipt-summary-total dt {
    color: var(--color-text);
    font-weight: inherit;
  }

  .receipt-summary-total {
    border-top: 3px double var(--color-primary);
    font-size: var(--text-lg);
    font-weight: 700;
  }

  .group-report-panel {
    margin-bottom: var(--space-4);
    padding: var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
  }

  .group-report-panel summary {
    cursor: pointer;
    font-weight: 600;
  }

  .group-report-groups {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-2);
    max-height: 240px;
    overflow-y: auto;
    margin-top: var(--space-3);
  }

  .group-report-groups label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
  }

  .group-report-filters {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    margin-top: var(--space-4);
  }

  .group-report-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin-top: var(--space-4);
  }

  .group-report-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 160px;
    min-height: 44px;
    padding: var(--space-3) var(--space-5);
    border: 2px solid var(--color-primary);
    border-radius: var(--radius-md);
    font: inherit;
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--duration) var(--ease);
  }

  .group-report-actions button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
  }

  .group-report-actions button:active:not(:disabled) {
    transform: translateY(0);
  }

  .group-report-actions button:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
  }

  .group-report-actions #groupReportGenerate {
    background: var(--color-primary);
    color: var(--color-surface);
    box-shadow: var(--shadow-sm);
  }

  .group-report-actions #groupReportGenerate:hover:not(:disabled) {
    background: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
    box-shadow: var(--shadow-md);
  }

  .group-report-actions #groupReportPrint {
    background: var(--color-surface);
    color: var(--color-primary);
    border-color: var(--color-primary);
  }

  .group-report-actions #groupReportPrint:hover:not(:disabled) {
    background: var(--color-primary-bg);
  }

  .group-report-actions button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
  }

  .group-report-preview {
    width: 100%;
    height: 550px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
  }

  /* ============================================
     LOGIN MODAL (admin-specific overrides)
     ============================================ */

  .modal {
    backdrop-filter: blur(8px);
  }

  .modal-content {
    max-width: 440px;
    border: 1px solid var(--color-border);
  }

  #createRoundModal .modal-content {
    border-radius: var(--radius-lg);
    clip-path: inset(0 round var(--radius-lg));
  }

  .modal-content h2 {
    text-align: left;
    font-size: 1.75rem;
    letter-spacing: -0.5px;
    position: sticky;
    top: 0;
    background: var(--color-surface);
    padding-bottom: var(--space-4);
    z-index: 1;
  }

  /* Runde-modaler skal scrolle naturlig med overskrift og ha robust knapperad på mobil. */
  #createRoundModal .modal-content h2,
  #editRoundModal .modal-content h2 {
    position: static;
    top: auto;
    z-index: auto;
    background: transparent;
  }

  .round-modal-actions {
    flex-wrap: wrap;
  }

  .round-modal-actions > .btn,
  .round-modal-actions > .btn-secondary {
    flex: 1 1 220px;
    min-height: 44px;
  }

  .print-round-modal-close {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
  }

  .group-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--color-surface);
    padding-bottom: var(--space-4);
  }

  .group-modal-header h2 {
    position: static;
    margin: 0;
    padding: 0;
    min-width: 0;
    overflow-wrap: anywhere;
    letter-spacing: 0;
  }

  .group-modal-close {
    float: none;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 1.75rem;
    cursor: pointer;
  }

  #groupDetailsModal .group-details-content {
    max-width: 1000px;
    padding: var(--space-6);
    border-radius: 8px;
  }

  #editGroupModal,
  #editMemberModal {
    z-index: 1001;
  }

  .group-details-actions,
  .group-members-filters {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
  }

  .group-details-actions {
    justify-content: space-between;
  }

  .group-info-section,
  .group-members-section {
    border-top: 1px solid var(--color-border);
    padding-top: var(--space-4);
    margin-top: var(--space-4);
  }

  .group-supplier-status-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-4);
    list-style: none;
  }

  .group-supplier-status-list li {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
  }

  .group-supplier-status {
    font-weight: 600;
    white-space: nowrap;
  }

  .group-supplier-status.is-configured {
    color: var(--color-success);
  }

  .group-supplier-status.is-missing {
    color: var(--color-text-light);
  }

  .group-info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3) var(--space-6);
    margin: var(--space-4) 0;
  }

  #groupDetailsInfo {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr 1fr;
    gap: var(--space-6);
  }

  .group-info-section h3,
  .group-members-section h3 {
    font-size: 1.125rem;
    margin-bottom: var(--space-3);
  }

  #groupDetailsInfo .group-info-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-3);
  }

  .group-info-grid > div {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
    gap: var(--space-2);
    align-items: baseline;
  }

  .group-info-grid dt {
    color: var(--color-text-light);
    font-size: 0.875rem;
  }

  .group-info-grid dd {
    margin: 0;
    font-size: 0.875rem;
    overflow-wrap: anywhere;
    white-space: pre-line;
  }

  .group-members-filters input {
    flex: 1 1 240px;
    min-width: 0;
  }

  .group-members-filters select {
    flex: 0 1 180px;
    max-width: 100%;
  }

  .group-members-table {
    overflow-x: auto;
  }

  .group-members-table table {
    width: 100%;
    min-width: 700px;
  }

  .group-row {
    cursor: pointer;
  }

  .group-row:hover {
    background: var(--color-primary-bg);
  }

  .group-name-button {
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--color-primary);
    font: inherit;
    font-weight: 600;
    text-align: left;
    text-decoration: underline;
    cursor: pointer;
  }

  @media (max-width: 850px) {
    #groupDetailsInfo {
      grid-template-columns: minmax(0, 1fr);
      gap: 0;
    }
  }

  @media (max-width: 600px) {
    .group-report-actions button {
      width: 100%;
    }

    .group-info-grid {
      grid-template-columns: minmax(0, 1fr);
    }

    #groupDetailsModal .group-details-content,
    #editGroupModal .modal-content {
      padding: var(--space-4);
    }

    .group-modal-header h2 {
      font-size: 1.375rem;
    }
  }

  .print-round-modal-actions .btn-secondary {
    min-width: 96px;
  }

  /* ============================================
     ADMIN PANEL LAYOUT
     ============================================ */

  .admin-panel {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
  }

  .admin-panel.hidden {
    display: none;
  }

  .admin-header {
    background: var(--color-primary-bg);
    color: var(--color-text);
    padding: var(--space-6) var(--space-12);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid var(--color-border);
  }

  .admin-header h1 {
    font-size: 1.375rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin: 0;
  }

  .admin-portal-switch {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    flex: 0 0 auto;
    padding: var(--space-2) var(--space-3);
    color: var(--color-primary);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 600;
    text-decoration: none;
  }

  .admin-portal-switch:hover {
    background: var(--color-bg);
  }


  .admin-container {
    display: flex;
    flex: 1;
    overflow: hidden;
  }

  /* ============================================
     SIDEBAR
     ============================================ */

  .sidebar {
    width: 200px;
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-6) 0;
  }

  .sidebar-bottom {
    flex-shrink: 0;
    border-top: 1px solid var(--color-border);
    padding: var(--space-2) 0;
  }

  .sidebar-bottom .menu-separator {
    display: none;
  }

  .menu-header {
    padding: var(--space-3) var(--space-6);
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-light);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: var(--space-1);
  }

  .menu-item {
    width: 100%;
    padding: 14px var(--space-6);
    background: transparent;
    border: none;
    color: var(--color-text-light);
    text-align: left;
    font-size: var(--text-sm);
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    border-left: 3px solid transparent;
    font-weight: 500;
  }

  .menu-item:hover {
    background: var(--color-primary-bg);
    color: var(--color-primary);
  }

  .menu-item.active {
    background: var(--color-primary-bg);
    color: var(--color-primary);
    border-left-color: var(--color-primary);
    font-weight: 600;
  }

  /* ============================================
     MAIN CONTENT
     ============================================ */

  .main-content {
    flex: 1;
    padding: var(--space-8) var(--space-6);
    overflow-y: auto;
    background: var(--color-surface);
    max-width: none;
    margin: 0;
    min-width: 0;
  }

  .view {
    display: none;
    animation: adminFadeIn 0.2s ease;
  }

  .view.active {
    display: block;
  }

  @keyframes adminFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  .view h2 {
    font-size: var(--text-3xl);
    margin-bottom: var(--space-12);
    font-weight: 700;
    letter-spacing: -1px;
  }

  .admin-view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-6);
  }

  .admin-workflow-title {
    margin: 0;
    letter-spacing: 0;
  }

  .round-progress-tracker {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 12px 0 8px;
    font-size: 11px;
  }

  .round-progress-step {
    color: #94a3b8;
    font-weight: 500;
    white-space: nowrap;
  }

  .round-progress-step.is-complete {
    color: var(--color-primary);
  }

  .round-progress-step.is-active {
    color: var(--color-primary);
    font-weight: 700;
    border-bottom: 2px solid var(--color-primary);
    padding-bottom: 1px;
  }

  .round-progress-separator {
    color: #cbd5e1;
    font-weight: 600;
    line-height: 1;
  }

  /* ============================================
     STAT CARDS (admin overrides)
     ============================================ */

  .stat-card {
    padding: 40px var(--space-8);
    border-radius: 16px;
    border: 1px solid var(--color-border);
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
  }

  .stat-card:hover {
    border-color: var(--color-primary);
    background: var(--color-primary-bg);
  }

  .stat-card h3 {
    color: var(--color-text-light);
    font-size: var(--text-xs);
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    margin-bottom: var(--space-4);
  }

  .stat-value {
    font-size: 3.5rem;
    letter-spacing: -2px;
  }

  .stats-grid {
    gap: var(--space-8);
    margin-bottom: var(--space-16);
  }

  /* ============================================
     TABLES (admin overrides)
     ============================================ */

  table {
    width: 100%;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border-collapse: collapse;
    border: 1px solid var(--color-border);
  }

  thead {
    background: var(--color-primary-bg) !important;
    color: var(--color-text) !important;
  }

  thead th {
    padding: var(--space-5) var(--space-4);
    text-align: left;
    font-weight: 600;
    font-size: var(--text-xs);
    background: var(--color-primary-bg) !important;
    color: var(--color-text) !important;
    border-bottom: 1px solid var(--color-border);
  }

  /* Override inline styles on table headers */
  table thead tr[style*="background"] th,
  table thead tr[style*="background"] {
    background: var(--color-primary-bg) !important;
    color: var(--color-text) !important;
  }

  tbody tr {
    border-bottom: 1px solid var(--color-border);
    transition: background 150ms ease;
  }

  tbody tr:hover {
    background: var(--color-primary-bg);
  }

  tbody td {
    padding: var(--space-5) var(--space-4);
    font-size: var(--text-sm);
  }

  tbody td code {
    background: var(--color-primary-bg);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--color-primary-light);
    border: 1px solid var(--color-border);
  }

  /* ============================================
     BUTTONS (admin overrides)
     ============================================ */

  .btn {
    background: transparent;
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
  }

  .btn:hover {
    background: var(--color-primary);
    color: var(--color-surface);
    box-shadow: var(--shadow-lg);
  }

  .btn-secondary {
    color: var(--color-text);
    border: 1px solid var(--color-border);
  }

  .btn-secondary:hover {
    background: var(--color-primary-bg);
    border-color: var(--color-primary);
    color: var(--color-primary);
  }

  /* ============================================
     CARDS (admin overrides)
     ============================================ */

  .card {
    border-radius: 16px;
  }

  .card h3 {
    font-size: var(--text-xl);
    letter-spacing: -0.3px;
  }

  /* ============================================
     CONTENT SECTIONS
     ============================================ */

  .content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: var(--space-8);
    margin-top: var(--space-8);
  }

  .content-section {
    background: var(--color-surface);
    padding: var(--space-8);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
  }

  .content-section h3 {
    font-size: var(--text-lg);
    font-weight: 600;
    margin-bottom: var(--space-6);
    letter-spacing: -0.3px;
  }

  .content-section.activity {
    background: var(--color-primary-bg);
  }

  /* ============================================
     STATUS BADGES (admin palette)
     ============================================ */

  .status-badge.open,
  .badge.open,
  .badge.aapen {
    background: #E3F2FD;
    color: #0D47A1;
  }

  .status-badge.closed,
  .badge.closed,
  .badge.lukket {
    background: #F3E5F5;
    color: #6A1B9A;
  }

  .status-badge.sent,
  .badge.sent,
  .badge.sendt {
    background: var(--color-success-bg);
    color: var(--color-success);
  }

  .status-badge.pending,
  .badge.pending {
    background: var(--color-warning-bg);
    color: var(--color-warning);
  }

  /* ============================================
     FILTERS (admin)
     ============================================ */

  .filters input,
  .filters select {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
    background: var(--color-surface);
    transition: all var(--duration) var(--ease);
  }

  .filters input:focus,
  .filters select:focus {
    outline: none;
    border-color: var(--color-text);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
  }

  /* ============================================
     BULK ACTIONS
     ============================================ */

  #bulkActionsPanel {
    background: #FFFEF0 !important;
    border: 1px solid #E8E6D0 !important;
    border-radius: var(--radius-lg) !important;
    padding: var(--space-5) !important;
  }

  /* ============================================
     ACTION BUTTONS
     ============================================ */

  .action-button,
  button.small {
    padding: var(--space-2) 14px;
    font-size: var(--text-xs);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    font-weight: 500;
  }

  .action-button:hover,
  button.small:hover {
    background: var(--color-primary-bg);
    border-color: var(--color-text);
  }

  /* ============================================
     ROUNDS & GROUPS
     ============================================ */

  #roundsList,
  #groupsList {
    display: grid;
    gap: var(--space-6);
  }

  .round-card,
  .group-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    padding: var(--space-8);
    box-shadow: var(--shadow-sm);
    transition: all var(--duration) var(--ease);
  }

  .round-card:hover,
  .group-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--color-text);
  }

  .round-card h3,
  .group-card h3 {
    font-size: var(--text-xl);
    font-weight: 600;
    margin-bottom: var(--space-4);
    letter-spacing: -0.5px;
  }

  .round-card p,
  .group-card p {
    color: var(--color-text-light);
    font-size: var(--text-sm);
    line-height: 1.6;
  }

  /* ============================================
     ACTIVITY FEED
     ============================================ */

  #activityFeed,
  #activityLogTable {
    font-size: var(--text-sm);
  }

  .activity-item {
    padding: var(--space-4) 0;
    border-bottom: 1px solid var(--color-border);
  }

  .activity-item:last-child {
    border-bottom: none;
  }

  .activity-item .time {
    color: var(--color-text-light);
    font-size: var(--text-xs);
  }

  /* ============================================
     EMAIL HISTORY
     ============================================ */

  #emailHistoryList {
    max-height: 400px;
    overflow-y: auto;
  }

  .email-history-item {
    padding: var(--space-4);
    border-bottom: 1px solid var(--color-border);
    transition: background var(--duration) var(--ease);
  }

  .email-history-item:hover {
    background: var(--color-primary-bg);
  }

  .email-history-item .timestamp {
    color: var(--color-text-light);
    font-size: var(--text-xs);
  }

  /* ============================================
     CHECKBOXES
     ============================================ */

  input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--color-text);
  }

  /* ============================================
     DATABASE INSPECTOR
     ============================================ */

  #databaseTableContainer {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
  }

  .db-controls select {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    font-size: var(--text-sm);
    background: var(--color-surface);
  }

  #ordersCount,
  #membersCount,
  #paymentsCount,
  #tableMetadata {
    color: var(--color-text-light);
    font-size: var(--text-sm);
  }

  /* ============================================
     LINKS
     ============================================ */

  a {
    color: var(--color-text);
    text-decoration: none;
    transition: opacity var(--duration) var(--ease);
  }

  a:hover {
    opacity: 0.7;
  }

  /* ============================================
     ALERTS
     ============================================ */

  #loginError {
    margin-top: var(--space-5);
    padding: var(--space-4);
    border-radius: var(--radius-md);
    display: none;
    background: var(--color-danger-bg);
    color: var(--color-danger);
    font-weight: 500;
    font-size: var(--text-sm);
    border: 1px solid var(--color-danger);
  }

  #loginError:not(:empty) {
    display: block;
  }

  /* ============================================
     PROCESS STEPS
     ============================================ */

  .process-step {
    min-width: 0;
    transition: all 0.3s var(--ease);
    box-shadow: var(--shadow-sm);
  }

  .admin-workflow-grid {
    --responsive-grid-gap: var(--space-5);
  }

  .process-step:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
  }

  .process-step div[style*="border-radius: 50%"] {
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
  }

  .process-step:hover div[style*="border-radius: 50%"] {
    transform: scale(1.05);
  }

  .process-step [id*="-content"] {
    animation: adminFadeIn 0.4s ease-in-out;
  }

  .process-step button {
    transition: all var(--duration) var(--ease);
    font-weight: 500;
    box-shadow: var(--shadow-sm);
  }

  .process-step button:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
  }

  .process-step button:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
  }

  .process-step span[id*="-status"] {
    display: inline-block;
    transition: all 0.3s ease;
  }

  .process-step:hover span[id*="-status"] {
    transform: scale(1.2) rotate(10deg);
  }

  .process-step div[style*="border-left"] {
    transition: all var(--duration) var(--ease);
  }

  .process-step div[style*="border-left"]:hover {
    box-shadow: var(--shadow-sm);
  }

  /* ============================================
     ORDERS VIEW
     ============================================ */

  #orders-view .filters {
    grid-template-columns: minmax(220px, 2fr) repeat(4, minmax(150px, 1fr)) !important;
  }

  #ordersTable {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }

  #ordersTable table {
    width: 100% !important;
    min-width: 1180px;
  }

  #ordersTable .orders-compact-table th,
  #ordersTable .orders-compact-table td {
    font-size: var(--text-xs);
    vertical-align: top;
  }

  #ordersTable .orders-compact-table .orders-sticky-sharing,
  #ordersTable .orders-compact-table .orders-sticky-date,
  #ordersTable .orders-compact-table .orders-sticky-status {
    position: sticky;
    z-index: 3;
    box-shadow: -1px 0 0 rgba(15, 23, 42, 0.08);
  }

  #ordersTable .orders-compact-table .orders-sticky-sharing {
    right: 0;
    min-width: 128px;
    background: var(--color-surface);
  }

  #ordersTable .orders-compact-table .orders-sticky-date {
    right: 128px;
    min-width: 96px;
    background: var(--color-surface);
  }

  #ordersTable .orders-compact-table .orders-sticky-status {
    right: 224px;
    min-width: 126px;
    background: var(--color-surface);
  }

  #ordersTable .orders-compact-table thead .orders-sticky-sharing,
  #ordersTable .orders-compact-table thead .orders-sticky-date,
  #ordersTable .orders-compact-table thead .orders-sticky-status {
    z-index: 4;
    background: var(--color-primary);
  }

  /* ============================================
     SCROLLBAR
     ============================================ */

  ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
  }

  ::-webkit-scrollbar-track {
    background: var(--color-primary-bg);
  }

  ::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: var(--radius-sm);
  }

  ::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-light);
  }

  /* ============================================
     RESPONSIVE
     ============================================ */

  @media (max-width: 1200px) {
    .main-content {
      padding: var(--space-6) var(--space-4);
    }

    #ordersTable table {
      min-width: 1120px;
    }
  }

  @media (max-width: 900px) {
    #orders-view .filters {
      grid-template-columns: 1fr 1fr !important;
    }

    #ordersTable table {
      min-width: 980px;
    }
  }

  @media (max-width: 768px) {
    /* --- Mobile nav drawer (left-slide) --- */
    .mobile-nav-toggle {
      display: flex;
      margin-left: auto;
    }

    .sidebar {
      position: fixed;
      top: 0;
      right: -280px;
      width: 280px;
      height: 100vh;
      border-left: 1px solid var(--color-border);
      border-right: none;
      box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
      transition: right 0.3s ease;
      z-index: 1000;
    }

    .sidebar.active {
      right: 0;
    }

    .sidebar-bottom .menu-separator {
      display: block;
    }

    .drawer-user {
      display: block;
    }

    .main-content {
      padding: var(--space-6);
    }

    /* --- Header responsive --- */
    .admin-header {
      gap: var(--space-4);
      padding: var(--space-5) var(--space-6);
    }

    .admin-header h1 {
      font-size: var(--text-base);
      flex: 1;
      min-width: 0;
    }

    .admin-portal-switch {
      padding: var(--space-2);
    }

    .admin-portal-switch span {
      position: absolute;
      width: 1px;
      height: 1px;
      padding: 0;
      margin: -1px;
      overflow: hidden;
      clip: rect(0, 0, 0, 0);
      white-space: nowrap;
      border: 0;
    }

    .user-menu {
      display: none;
    }

    /* --- Content responsive --- */
    .stats-grid {
      grid-template-columns: 1fr;
    }

    .admin-view-header {
      align-items: flex-start;
      margin-bottom: var(--space-5);
    }

    .admin-workflow-title {
      font-size: var(--text-2xl);
      line-height: 1.1;
    }

    .admin-workflow-grid {
      --responsive-grid-gap: var(--space-3);
    }

    table {
      font-size: var(--text-sm);
    }

    thead th, tbody td {
      padding: var(--space-4) var(--space-3);
    }

    .process-step {
      flex-direction: column !important;
      gap: 15px !important;
    }

    .process-step div[style*="flex: 0 0"] {
      flex: 1 !important;
      text-align: left !important;
    }

    .round-modal-actions {
      flex-direction: column;
      gap: var(--space-3);
    }

    .round-modal-actions > .btn,
    .round-modal-actions > .btn-secondary {
      width: 100%;
      flex: 1 1 auto;
    }
  }

  @media (max-width: 480px) {
    .main-content {
      padding: var(--space-4) var(--space-3);
    }

    .admin-view-header {
      margin-bottom: var(--space-4);
    }

    .admin-workflow-title {
      font-size: var(--text-lg);
      line-height: 1.15;
    }

    .admin-workflow-grid {
      --responsive-grid-gap: var(--space-2);
    }

    .admin-workflow-grid .process-step {
      padding: var(--space-3) var(--space-2) !important;
      border-left-width: 3px !important;
      border-radius: var(--radius-md) !important;
    }

    .admin-workflow-grid .process-step > div[style*="display: flex"] {
      gap: var(--space-2) !important;
      margin-bottom: var(--space-2) !important;
    }

    .admin-workflow-grid .process-step div[style*="border-radius: 50%"] {
      width: 28px !important;
      height: 28px !important;
      font-size: var(--text-sm) !important;
      box-shadow: none;
    }

    .admin-workflow-grid .process-step h3 {
      font-size: 0.8125rem;
      line-height: 1.15;
      margin-bottom: 2px !important;
      letter-spacing: 0;
    }

    .admin-workflow-grid .process-step p {
      font-size: 0.6875rem !important;
      line-height: 1.25;
    }

    .admin-workflow-grid .process-step [id*="-content"] {
      margin-top: var(--space-2) !important;
    }

    .admin-workflow-grid .process-step [id*="-content"] > div {
      padding: var(--space-2) !important;
      font-size: var(--text-xs) !important;
    }

    .admin-workflow-grid .process-step label {
      font-size: var(--text-xs) !important;
      margin-bottom: var(--space-1) !important;
    }

    .admin-workflow-grid .process-step select,
    .admin-workflow-grid .process-step button {
      min-height: 34px;
      padding: var(--space-2) !important;
      font-size: var(--text-xs) !important;
    }
  }
}
