/* HYDRA Enterprise polish
   UX-only pass: density, hierarchy, palette, timeline, table/modal polish.
*/

:root {
  --density-gap: 10px;
  --density-panel-pad: 14px;
  --density-row-height: 48px;
  --density-toolbar-height: 36px;
  --density-kpi-scale: 1;
  --hydra-calm-bg: #edf2f8;
}

body.use-new-ui {
  background: linear-gradient(180deg, #f3f7fc 0%, var(--hydra-calm-bg) 100%);
}

body.use-new-ui.ui-density-compact {
  --density-gap: 8px;
  --density-panel-pad: 11px;
  --density-row-height: 40px;
  --density-toolbar-height: 32px;
  --density-kpi-scale: 0.86;
}

body.use-new-ui.ui-density-comfortable {
  --density-gap: 11px;
  --density-panel-pad: 15px;
  --density-row-height: 48px;
  --density-toolbar-height: 36px;
  --density-kpi-scale: 1;
}

@media (min-width: 769px) {
  body.use-new-ui .panel,
  body.use-new-ui .card,
  body.use-new-ui .table-wrap {
    padding: var(--density-panel-pad);
  }

  body.use-new-ui .toolbar {
    gap: var(--density-gap);
  }

  body.use-new-ui .toolbar input,
  body.use-new-ui .toolbar select,
  body.use-new-ui .toolbar .btn {
    min-height: var(--density-toolbar-height) !important;
  }

  body.use-new-ui .dashboard-kpi-grid .premium-kpi-card {
    transform-origin: top left;
    transition: transform 120ms ease, box-shadow 180ms ease, border-color 120ms ease;
  }

  body.use-new-ui.ui-density-compact .dashboard-kpi-grid .premium-kpi-card {
    transform: scale(var(--density-kpi-scale));
  }

  body.use-new-ui .dashboard-kpi-grid .premium-kpi-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
  }

  body.use-new-ui.ui-density-compact .dashboard-kpi-grid .premium-kpi-card:hover {
    transform: scale(var(--density-kpi-scale)) translateY(-1px);
  }

  body.use-new-ui .dashboard-kpi-grid .premium-kpi-card .kpi-anim-inner {
    transition: opacity 180ms ease;
  }

  body.use-new-ui .dashboard-kpi-grid .premium-kpi-card.kpi-tone-revenue,
  body.use-new-ui .dashboard-kpi-grid .premium-kpi-card.kpi-tone-profit,
  body.use-new-ui .dashboard-kpi-grid .premium-kpi-card.kpi-tone-cod {
    border-color: rgba(59, 130, 246, 0.22);
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.08);
  }

  body.use-new-ui .dashboard-kpi-grid .premium-kpi-card.premium-kpi-card--secondary {
    background: #ffffff;
  }
}

/* Enterprise table polish */
@media (min-width: 769px) {
  body.use-new-ui .table-wrap {
    position: relative;
    overflow: auto;
  }

  body.use-new-ui .table-wrap::before,
  body.use-new-ui .table-wrap::after {
    content: "";
    position: sticky;
    top: 0;
    width: 12px;
    height: 100%;
    z-index: 4;
    pointer-events: none;
  }

  body.use-new-ui .table-wrap::before {
    left: 0;
    background: linear-gradient(90deg, rgba(15, 23, 42, 0.08), rgba(15, 23, 42, 0));
  }

  body.use-new-ui .table-wrap::after {
    float: right;
    right: 0;
    background: linear-gradient(270deg, rgba(15, 23, 42, 0.08), rgba(15, 23, 42, 0));
  }

  body.use-new-ui table tbody td {
    min-height: var(--density-row-height) !important;
  }

  body.use-new-ui table tbody tr {
    transition: background-color 120ms ease;
  }

  body.use-new-ui table tbody tr:focus-within td {
    background: #eff6ff !important;
  }

  body.use-new-ui .order-actions .btn:not(.order-more-trigger),
  body.use-new-ui .customer-actions-cell .btn,
  body.use-new-ui .finance-actions-cell .btn {
    opacity: 0;
    transform: translateY(2px);
    transition: opacity 120ms ease, transform 120ms ease;
  }

  body.use-new-ui tr:hover .order-actions .btn:not(.order-more-trigger),
  body.use-new-ui tr:hover .customer-actions-cell .btn,
  body.use-new-ui tr:hover .finance-actions-cell .btn,
  body.use-new-ui tr:focus-within .order-actions .btn:not(.order-more-trigger),
  body.use-new-ui tr:focus-within .customer-actions-cell .btn,
  body.use-new-ui tr:focus-within .finance-actions-cell .btn {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Command palette */
body.use-new-ui .spotlight-section {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
  padding: 10px 10px 6px;
}

body.use-new-ui .spotlight-item {
  min-height: 50px;
}

/* Activity timeline */
body.use-new-ui .activity-timeline {
  display: grid;
  gap: 8px;
}

body.use-new-ui .timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 10px 22px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
}

body.use-new-ui .timeline-item .activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #94a3b8;
}

body.use-new-ui .timeline-item.tone-good .activity-dot { background: #16a34a; }
body.use-new-ui .timeline-item.tone-warn .activity-dot { background: #a855f7; }
body.use-new-ui .timeline-item.tone-info .activity-dot { background: #2563eb; }

body.use-new-ui .timeline-item .activity-when {
  font-size: 11px;
  white-space: nowrap;
}

/* Modal polish */
body.use-new-ui #modal .modal-card .modal-head {
  border-bottom: 1px solid #e2e8f0;
}

body.use-new-ui #modal .modal-card .modal-actions {
  position: sticky;
  bottom: 0;
  background: #fff;
  border-top: 1px solid #e2e8f0;
}

/* Unified empty states */
body.use-new-ui .empty-state {
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  background: linear-gradient(180deg, #fbfdff 0%, #f8fafc 100%);
}

body.use-new-ui .empty-state .empty-state-icon {
  font-size: 20px;
  opacity: 0.9;
}

