/**
 * Custom Styles for G2 Nutri Platform
 */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

/* ==========================================================================
   Variables
   ========================================================================== */

:root {
  --primary-color: #2563eb;
  --secondary-color: #64748b;
  --success-color: #16a34a;
  --danger-color: #dc2626;
  --warning-color: #d97706;
  --info-color: #0284c7;
  --light-color: #f8fafc;
  --dark-color: #0f172a;

  --sidebar-width: 260px;
  --header-height: 64px;
  --transition-speed: 0.3s;
}

/* ==========================================================================
   Layout
   ========================================================================== */

body {
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    "Helvetica Neue",
    Arial,
    sans-serif;
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--dark-color);
  background-color: #f1f5f9;
}

.app-layout {
  width: 100%;
  min-height: 100vh;
  overflow-x: hidden;
}

.app-main {
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  min-height: 100vh;
  padding: 0 1.5rem 1.5rem;
  background: linear-gradient(180deg, #f8fafc 0%, #eef2ff 100%);
  overflow-x: hidden;
  position: relative;
}

.wrapper {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* ==========================================================================
   Sidebar
   ========================================================================== */

.sidebar {
  width: var(--sidebar-width);
  background: #1f2937;
  color: white;
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  transition:
    transform var(--transition-speed),
    box-shadow var(--transition-speed);
  z-index: 1030;
  box-shadow: 8px 0 30px rgba(15, 23, 42, 0.25);
}

.sidebar.sidebar-partner {
  background: #111827;
}

.sidebar.collapsed {
  transform: translateX(-100%);
}

.sidebar-backdrop {
  display: none;
}

.brand-text {
  font-size: 1.1rem;
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: 0.01em;
}

.mobile-header {
  display: none;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.mobile-header-title {
  font-weight: 600;
  color: #0f172a;
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand {
  font-size: 1.5rem;
  font-weight: 700;
  color: white;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sidebar-nav {
  padding: 1rem 0;
}

.sidebar .nav-item {
  margin: 0.1rem 0;
}

.sidebar .nav-link {
  color: #cbd5e1;
  padding: 0.55rem 0.8rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: all var(--transition-speed);
  text-decoration: none;
  border-left: 3px solid transparent;
  font-size: 0.9rem;
  font-weight: 500;
}

.sidebar .nav-link:hover {
  color: #f8fafc;
  background: #374151;
  border-left-color: #64748b;
}

.sidebar .nav-link.active {
  color: #ffffff;
  background: #0f172a;
  border-left-color: #3b82f6;
  font-weight: 600;
}

.sidebar .nav-link i {
  width: 18px;
  text-align: center;
  opacity: 0.95;
}

.sidebar-section-label {
  margin: 0.85rem 0 0.35rem;
  padding: 0 0.8rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
  font-weight: 700;
}

.sidebar-brand-meta {
  font-size: 0.78rem;
  color: #94a3b8;
  margin-top: -0.5rem;
  margin-bottom: 0.9rem;
  padding-left: 0.1rem;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid #e2e8f0;
  border-radius: 0 0 14px 14px;
  padding: 0.9rem 1.1rem;
  margin-bottom: 1.1rem;
}

.app-topbar-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
}

.app-topbar-subtitle {
  font-size: 0.78rem;
  color: #64748b;
}

.app-user-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid #d1d5db;
  background: #f8fafc;
  color: #1f2937;
  border-radius: 999px;
  padding: 0.28rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 500;
}

.app-company-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid #d1d5db;
  background: #f8fafc;
  color: #1f2937;
  border-radius: 999px;
  padding: 0.28rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 600;
}

.app-content {
  max-width: 1600px;
}

/* ==========================================================================
   Main Content
   ========================================================================== */

.content {
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  min-height: 100vh;
  transition:
    margin-left var(--transition-speed),
    width var(--transition-speed);
}

.content.expanded {
  margin-left: 0;
  width: 100%;
}

/* Header */
.page-header {
  background: white;
  padding: 1rem 2rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.page-title {
  font-size: 1.75rem;
  font-weight: 600;
  margin: 0;
  color: var(--dark-color);
}

.page-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* Main content area */
.main-content {
  padding: 2rem;
}

/* Page hero */
.page-hero {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  padding: 1.1rem 1.25rem;
  margin-bottom: 1rem;
  color: #0f172a;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.page-hero.partner {
  background: #ffffff;
}

.page-hero h1,
.page-hero h2 {
  margin-bottom: 0.25rem;
  color: #0f172a;
}

.page-hero .text-white-50 {
  color: #64748b !important;
}

.metric-tile {
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

.metric-tile .metric-value {
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1.2;
}

/* ==========================================================================
   Cards
   ========================================================================== */

.card {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
  margin-bottom: 1.5rem;
  transition: box-shadow var(--transition-speed);
}

.card:hover {
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.card-header {
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  padding: 0.9rem 1.2rem;
  font-weight: 600;
  border-radius: 12px 12px 0 0;
}

.card-body {
  padding: 1.2rem;
}

.card-footer {
  background: #f8f9fa;
  border-top: 1px solid #e9ecef;
  padding: 1rem 1.5rem;
}

/* Stats cards */
.stats-card {
  background: linear-gradient(135deg, var(--primary-color) 0%, #0a58ca 100%);
  color: white;
  padding: 1.5rem;
  border-radius: 8px;
  position: relative;
  overflow: hidden;
}

.stats-card::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 100px;
  height: 100px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  transform: translate(30px, -30px);
}

.stats-card .stats-icon {
  font-size: 2.5rem;
  opacity: 0.3;
  position: absolute;
  right: 1rem;
  bottom: 1rem;
}

.stats-card .stats-value {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.stats-card .stats-label {
  font-size: 0.9rem;
  opacity: 0.9;
}

/* ==========================================================================
   Tables
   ========================================================================== */

.table-responsive {
  border-radius: 8px;
  overflow: hidden;
}

.table {
  margin-bottom: 0;
}

.table thead th {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.78rem;
  color: #64748b;
  padding: 0.85rem 1rem;
}

.table tbody td {
  padding: 1rem;
  vertical-align: middle;
}

.table tbody tr {
  transition: background var(--transition-speed);
}

.table tbody tr:hover {
  background: #f8f9fa;
}

.table tbody tr[data-row-href],
.table tbody tr.table-row-link {
  cursor: pointer;
}

.table tbody tr[data-row-href]:focus-visible,
.table tbody tr.table-row-link:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: -2px;
}

.table-striped tbody tr:nth-of-type(odd) {
  background: rgba(0, 0, 0, 0.02);
}

.table-bordered {
  border: 1px solid #dee2e6;
}

/* Sortable columns */
th[data-sort-column] {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 2rem !important;
}

th[data-sort-column]::after {
  content: "⇅";
  position: absolute;
  right: 0.75rem;
  opacity: 0.3;
}

th[data-sort-column].sorted-asc::after {
  content: "↑";
  opacity: 1;
}

th[data-sort-column].sorted-desc::after {
  content: "↓";
  opacity: 1;
}

/* ==========================================================================
   Forms
   ========================================================================== */

.form-label {
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: #495057;
}

.form-control,
.form-select {
  border-radius: 6px;
  border: 1px solid #ced4da;
  padding: 0.625rem 0.875rem;
  transition:
    border-color var(--transition-speed),
    box-shadow var(--transition-speed);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

.form-control.is-invalid,
.form-select.is-invalid {
  border-color: var(--danger-color);
}

.invalid-feedback {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.875rem;
  color: var(--danger-color);
}

.form-text {
  font-size: 0.875rem;
  color: #6c757d;
  margin-top: 0.25rem;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  border-radius: 6px;
  padding: 0.625rem 1.25rem;
  font-weight: 500;
  transition: all var(--transition-speed);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-sm {
  padding: 0.375rem 0.875rem;
  font-size: 0.875rem;
}

.btn-lg {
  padding: 0.875rem 1.75rem;
  font-size: 1.125rem;
}

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

.btn-primary:hover {
  background: #0b5ed7;
  border-color: #0a58ca;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(13, 110, 253, 0.3);
}

/* ==========================================================================
   Badges
   ========================================================================== */

.badge {
  padding: 0.375rem 0.75rem;
  font-weight: 500;
  border-radius: 4px;
  font-size: 0.85rem;
}

/* Status badges */
.badge.status-pending {
  background: var(--warning-color);
  color: #000;
}

.badge.status-processing {
  background: var(--info-color);
  color: #000;
}

.badge.status-completed {
  background: var(--success-color);
}

.badge.status-cancelled {
  background: var(--danger-color);
}

/* ==========================================================================
   Modals
   ========================================================================== */

.modal-content {
  border: none;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
  border-bottom: 1px solid #e9ecef;
  padding: 1.25rem 1.5rem;
}

.modal-title {
  font-weight: 600;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  border-top: 1px solid #e9ecef;
  padding: 1rem 1.5rem;
}

.route-form-modal .modal-dialog {
  max-width: min(980px, 95vw);
}

.route-form-modal-body {
  max-height: calc(90vh - 120px);
  overflow: auto;
  background: #fff;
  padding: 1.25rem;
}

.route-form-modal-body .card {
  border: 0;
  box-shadow: none;
  margin-bottom: 0;
}

.route-form-modal-body .card-body {
  padding: 0;
}

.route-form-modal .modal-footer {
  border-top: 1px solid #e2e8f0;
}

.route-form-loading {
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================================================
   Alerts & Toasts
   ========================================================================== */

.alert {
  border-radius: 6px;
  border: none;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}

.alert-dismissible .btn-close {
  padding: 1.25rem;
}

.toast {
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ==========================================================================
   Loading Overlay
   ========================================================================== */

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  z-index: 9999;
  color: white;
}

.loading-overlay .spinner-border {
  width: 3rem;
  height: 3rem;
}

/* ==========================================================================
   Utilities
   ========================================================================== */

.text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cursor-pointer {
  cursor: pointer;
}

.hover-shadow {
  transition: box-shadow var(--transition-speed);
}

.hover-shadow:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   AGIS Visual Refinement
   ========================================================================== */

body.app-body {
  background: #f8fafc;
  color: #0f172a;
  font-size: 1rem;
}

.app-main {
  background: linear-gradient(180deg, #f8fafc 0%, #eef2f8 100%);
}

.app-content {
  max-width: 1340px;
  margin: 0 auto;
  padding: 0 0.25rem;
}

.sidebar {
  background: #111827;
}

.sidebar.sidebar-partner {
  background: #0f172a;
}

.sidebar-brand-meta {
  color: #94a3b8;
}

.sidebar .nav-link {
  color: #d1d5db;
  font-size: 0.92rem;
}

.sidebar .nav-link:hover {
  background: #1f2937;
  border-left-color: #334155;
}

.sidebar .nav-link.active {
  background: #1d4ed8;
  border-left-color: #93c5fd;
  color: #ffffff;
}

.app-topbar {
  border: 1px solid #e2e8f0;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.06);
}

.app-topbar-title {
  font-size: 1.05rem;
}

.app-topbar-subtitle {
  font-size: 0.8rem;
  color: #64748b;
}

.app-user-pill {
  background: #ffffff;
  border-color: #cbd5e1;
}

.app-company-pill {
  background: #ffffff;
  border-color: #cbd5e1;
}

.breadcrumb {
  margin-bottom: 0.85rem;
  font-size: 0.82rem;
}

h2 {
  font-size: 2.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.btn {
  border-radius: 10px;
  font-weight: 600;
}

.btn-primary {
  background: #2563eb;
  border-color: #2563eb;
}

.btn-primary:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

.btn-outline-primary {
  color: #1d4ed8;
  border-color: #93c5fd;
}

.btn-outline-primary:hover {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #60a5fa;
}

.card {
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
}

.card-header {
  border-bottom: 1px solid #e5e7eb;
  font-size: 1.03rem;
  font-weight: 700;
}

dl.row dt {
  font-size: 0.84rem;
  font-weight: 700;
  color: #64748b;
}

dl.row dd {
  font-size: 0.95rem;
  color: #111827;
}

.badge {
  border-radius: 8px;
  font-size: 0.74rem;
  padding: 0.32rem 0.55rem;
}

.nav-tabs {
  border-bottom: 1px solid #dbe3ef;
  gap: 0.25rem;
}

.nav-tabs .nav-link {
  border: 1px solid transparent;
  border-radius: 10px 10px 0 0;
  font-weight: 600;
  color: #64748b;
  padding: 0.5rem 0.85rem;
}

.nav-tabs .nav-link:hover {
  color: #1e40af;
  border-color: #dbe3ef #dbe3ef transparent;
  background: #f8fafc;
}

.nav-tabs .nav-link.active,
.nav-tabs .nav-item.show .nav-link {
  color: #1d4ed8;
  background: #ffffff;
  border-color: #dbe3ef #dbe3ef #ffffff;
}

.table thead th {
  letter-spacing: 0.06em;
}

.table tbody td {
  font-size: 0.93rem;
}

.text-muted {
  color: #64748b !important;
}

.ag-page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.ag-page-title {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: #0f172a;
}

.ag-subline {
  margin-top: 0.35rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.ag-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.73rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.2rem 0.62rem;
  border: 1px solid #dbeafe;
  background: #eff6ff;
  color: #1d4ed8;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.ag-pill.muted {
  border-color: #e2e8f0;
  background: #f8fafc;
  color: #475569;
}

.ag-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 1rem;
}

.ag-col-4 {
  grid-column: span 4;
}

.ag-card {
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
}

.ag-card-head {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid #e2e8f0;
  font-size: 0.93rem;
  font-weight: 700;
  color: #334155;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ag-card-body {
  padding: 1rem;
}

.ag-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.ag-kpi {
  border: 1px solid #dbe3ef;
  border-radius: 12px;
  background: #ffffff;
  padding: 0.75rem 0.8rem;
}

.ag-kpi-label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  font-weight: 700;
}

.ag-kpi-value {
  margin-top: 0.22rem;
  font-size: 1.2rem;
  font-weight: 700;
  color: #0f172a;
}

.ag-tabs {
  border-bottom: 1px solid #dbe3ef;
  margin-bottom: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.ag-tabs .nav-link {
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  background: transparent;
  color: #64748b;
  font-size: 0.86rem;
  font-weight: 600;
  padding: 0.48rem 0.78rem;
}

.ag-tabs .nav-link.active {
  background: #ffffff;
  color: #1d4ed8;
  border-color: #dbe3ef #dbe3ef #ffffff;
}

.ag-table-wrap {
  border: 1px solid #dbe3ef;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.ag-table {
  margin: 0;
}

.ag-table thead th {
  background: #f8fafc;
  border-bottom: 1px solid #dbe3ef;
  color: #64748b;
  font-size: 0.73rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
  padding: 0.72rem 0.85rem;
}

.ag-table tbody td {
  padding: 0.8rem 0.85rem;
  border-top: 1px solid #eef2f7;
  font-size: 0.9rem;
}

.ag-table tbody tr:hover {
  background: #f8fafc;
}

/* Patient detail: refined orders table */
.patient-orders-card .card-header {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.patient-orders-wrap {
  padding: 0.8rem 0.5rem 0.55rem;
  background: #f8fafc;
}

.patient-orders-table {
  border-collapse: separate;
  border-spacing: 0 0.42rem;
}

.patient-orders-table thead th {
  border-bottom: 0;
  background: transparent;
  color: #64748b;
  text-transform: none;
  letter-spacing: 0.01em;
  font-size: 0.78rem;
  padding: 0.12rem 0.85rem 0.28rem;
}

.patient-orders-table tbody td {
  background: #ffffff;
  border-top: 0;
  padding: 0.78rem 0.85rem;
}

.patient-orders-table tbody tr td:first-child {
  border-radius: 10px 0 0 10px;
  padding-left: 0.95rem;
}

.patient-orders-table tbody tr td:last-child {
  border-radius: 0 10px 10px 0;
  text-align: center;
}

.patient-orders-table tbody tr:hover td {
  background: #f8fbff;
}

.order-code {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.5rem;
  border-radius: 8px;
  border: 1px solid #dbeafe;
  background: #eff6ff;
  color: #1e3a8a;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.2;
}

.order-product-cell {
  color: #0f172a;
  font-weight: 500;
}

.order-amount {
  font-weight: 700;
  color: #111827;
  white-space: nowrap;
}

.order-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.28rem 0.62rem;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  border: 1px solid transparent;
}

.order-status-pill.status-created {
  color: #334155;
  background: #e2e8f0;
  border-color: #cbd5e1;
}

.order-status-pill.status-kit-sent,
.order-status-pill.status-sample-received,
.order-status-pill.status-in-analysis,
.order-status-pill.status-questionnaire-pending,
.order-status-pill.status-pnem-calculated,
.order-status-pill.status-pnem-approved {
  color: #92400e;
  background: #fef3c7;
  border-color: #fde68a;
}

.order-status-pill.status-dispatched,
.order-status-pill.status-completed {
  color: #065f46;
  background: #d1fae5;
  border-color: #a7f3d0;
}

.order-status-pill.status-cancelled,
.order-status-pill.status-faulty {
  color: #991b1b;
  background: #fee2e2;
  border-color: #fecaca;
}

.order-view-btn {
  width: 2.15rem;
  height: 2.15rem;
  padding: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Partner orders list */
.partner-orders-filters .card-body {
  padding: 0.95rem 1.05rem;
}

.partner-orders-filters .form-label {
  font-size: 0.78rem;
  color: #64748b;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.partner-orders-card .card-header {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.partner-orders-wrap {
  padding: 0.8rem 0.5rem 0.55rem;
  background: #f8fafc;
}

.partner-orders-table {
  border-collapse: separate;
  border-spacing: 0 0.42rem;
}

.partner-orders-table thead th {
  border-bottom: 0;
  background: transparent;
  color: #64748b;
  text-transform: none;
  letter-spacing: 0.01em;
  font-size: 0.78rem;
  padding: 0.12rem 0.85rem 0.28rem;
}

.partner-orders-table tbody td {
  background: #ffffff;
  border-top: 0;
  padding: 0.78rem 0.85rem;
}

.partner-orders-table tbody tr td:first-child {
  border-radius: 10px 0 0 10px;
  padding-left: 0.95rem;
}

.partner-orders-table tbody tr td:last-child {
  border-radius: 0 10px 10px 0;
}

.partner-orders-table tbody tr:hover td {
  background: #f8fbff;
}

.partner-orders-patient {
  color: #1d4ed8;
  font-weight: 600;
  text-decoration: none;
}

.partner-orders-patient:hover {
  color: #1e3a8a;
  text-decoration: underline;
}

/* Partner order detail: workflow tracks */
.order-workflows-card .card-header {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.order-workflow-list {
  display: grid;
  gap: 0.8rem;
}

.order-workflow-track {
  border: 1px solid #dbe3ef;
  border-radius: 12px;
  background: #ffffff;
  padding: 0.65rem 0.75rem;
}

.order-workflow-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: #334155;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.48rem;
}

.order-workflow-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.order-workflow-step {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border-radius: 999px;
  border: 1px solid #dbe3ef;
  background: #f8fafc;
  padding: 0.2rem 0.55rem 0.2rem 0.22rem;
}

.order-workflow-dot {
  width: 1.3rem;
  height: 1.3rem;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  color: #64748b;
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  line-height: 1;
}

.order-workflow-label {
  font-size: 0.82rem;
  color: #334155;
  font-weight: 600;
}

.order-workflow-step.state-done {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.order-workflow-step.state-done .order-workflow-dot {
  border-color: #22c55e;
  background: #22c55e;
  color: #ffffff;
}

.order-workflow-step.state-current {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.order-workflow-step.state-current .order-workflow-dot {
  border-color: #2563eb;
  background: #2563eb;
  color: #ffffff;
}

.order-workflow-connector {
  width: 1rem;
  height: 1px;
  background: #cbd5e1;
}

@media (max-width: 768px) {
  .order-workflow-track {
    padding: 0.62rem 0.62rem;
  }

  .order-workflow-connector {
    display: none;
  }
}

.ag-dl {
  margin: 0;
}

.ag-dl dt {
  font-size: 0.78rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 700;
}

.ag-dl dd {
  margin-bottom: 0.62rem;
  font-size: 0.92rem;
  color: #0f172a;
  font-weight: 500;
}

/* ==========================================================================
   Partner Onboarding
   ========================================================================== */

.onboarding-summary-card .ag-card-body {
  padding: 1rem 1.1rem;
}

.onboarding-summary-title {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  font-weight: 700;
}

.onboarding-summary-stage {
  margin-top: 0.35rem;
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.onboarding-summary-progress .progress-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  color: #475569;
  margin-bottom: 0.35rem;
}

.onboarding-summary-progress .progress {
  height: 10px;
  border-radius: 999px;
  background: #e2e8f0;
}

.onboarding-summary-progress .progress-bar {
  border-radius: 999px;
  background: linear-gradient(90deg, #2563eb 0%, #1d4ed8 100%);
}

.onboarding-summary-gate {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.onboarding-summary-gate .gate-item {
  font-size: 0.8rem;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.onboarding-summary-gate .gate-item.ready {
  color: #15803d;
}

.onboarding-workflow .ag-card-body {
  padding: 1rem;
}

.onboarding-stepper {
  display: grid;
  gap: 0.65rem;
}

.onboarding-step {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 0.7rem;
  align-items: start;
  padding: 0.65rem 0.7rem;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}

.onboarding-step-marker {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  color: #64748b;
  background: #e2e8f0;
}

.onboarding-step-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 0.08rem;
}

.onboarding-step-description {
  font-size: 0.81rem;
  color: #64748b;
}

.onboarding-step.done {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.onboarding-step.done .onboarding-step-marker {
  background: #22c55e;
  color: #ffffff;
}

.onboarding-step.current {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.onboarding-step.current .onboarding-step-marker {
  background: #2563eb;
  color: #ffffff;
}

.onboarding-actions {
  border-top: 1px dashed #dbe3ef;
  padding-top: 0.9rem;
}

.onboarding-next-action .btn {
  width: 100%;
  justify-content: center;
}

.onboarding-stage-actions {
  margin-top: 0.55rem;
  display: flex;
  gap: 0.42rem;
  flex-wrap: wrap;
}

.onboarding-stage-actions form {
  margin: 0;
}

.onboarding-gate-box {
  margin: 0.9rem;
  padding: 0.9rem;
  border: 1px solid #dbe3ef;
  border-radius: 12px;
  background: #f8fafc;
}

.onboarding-gate-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #334155;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.6rem;
}

.onboarding-gate-list {
  display: grid;
  gap: 0.55rem;
}

.onboarding-gate-item {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 0.55rem;
  align-items: start;
  padding: 0.55rem 0.6rem;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
}

.onboarding-gate-item.ok {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.onboarding-gate-icon {
  color: #f59e0b;
  font-size: 0.95rem;
  line-height: 1;
  margin-top: 0.1rem;
}

.onboarding-gate-item.ok .onboarding-gate-icon {
  color: #16a34a;
}

.onboarding-gate-text strong {
  display: block;
  font-size: 0.85rem;
  color: #0f172a;
}

.onboarding-gate-text span {
  display: block;
  margin-top: 0.08rem;
  font-size: 0.8rem;
  color: #64748b;
}

@media (max-width: 1200px) {
  .ag-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 992px) {
  .ag-page-header {
    flex-direction: column;
  }

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

  .ag-col-4 {
    grid-column: span 1;
  }

  .ag-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .onboarding-summary-gate {
    flex-direction: row;
    flex-wrap: wrap;
  }
}

@media (max-width: 640px) {
  .ag-kpi-grid {
    grid-template-columns: repeat(1, minmax(0, 1fr));
  }

  .onboarding-step {
    grid-template-columns: 30px 1fr;
    gap: 0.55rem;
    padding: 0.5rem 0.55rem;
  }

  .onboarding-step-marker {
    width: 26px;
    height: 26px;
    font-size: 0.82rem;
  }

  .onboarding-stage-actions .btn {
    width: 100%;
  }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 991px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    box-shadow: 8px 0 30px rgba(15, 23, 42, 0.2);
  }

  .sidebar.show {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 1010;
  }

  .sidebar-backdrop.show {
    display: block;
  }

  .mobile-header {
    display: flex;
  }

  body.sidebar-open {
    overflow: hidden;
  }

  .app-main {
    margin-left: 0;
    width: 100%;
    padding: 0.85rem;
  }

  .page-header {
    padding: 1rem;
  }

  .main-content {
    padding: 1rem;
  }

  .app-topbar {
    padding: 0.75rem 0.85rem;
    margin-bottom: 0.9rem;
  }

  .app-user-pill {
    display: none;
  }

  .app-company-pill {
    display: none;
  }
}

@media (min-width: 992px) {
  .sidebar {
    transform: none !important;
  }

  .sidebar-backdrop {
    display: none !important;
  }

  .mobile-header {
    display: none !important;
  }
}

@media (max-width: 767px) {
  .page-title {
    font-size: 1.25rem;
  }

  .stats-card {
    margin-bottom: 1rem;
  }

  .table thead {
    display: none;
  }

  .table tbody tr {
    display: block;
    margin-bottom: 1rem;
    border: 1px solid #dee2e6;
    border-radius: 6px;
  }

  .table tbody td {
    display: block;
    text-align: right;
    padding: 0.75rem;
    border-bottom: 1px solid #f0f0f0;
  }

  .table tbody td:last-child {
    border-bottom: none;
  }

  .table tbody td::before {
    content: attr(data-label);
    float: left;
    font-weight: 600;
    color: #6c757d;
  }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
  .sidebar,
  .sidebar-backdrop,
  .mobile-header,
  .page-header,
  .btn,
  .no-print {
    display: none !important;
  }

  .content {
    margin-left: 0;
    width: 100%;
  }

  .app-main {
    margin-left: 0 !important;
    width: 100% !important;
    padding: 0 !important;
  }

  .card {
    box-shadow: none;
    border: 1px solid #dee2e6;
  }
}
/* ==========================================================================
   Action Buttons (Tabellen-Aktionen)
   ========================================================================== */

.action-buttons {
  display: flex;
  gap: 0.5rem;
}

.action-buttons .btn {
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  border-radius: 0.375rem;
  transition: all 0.2s ease;
  border: none;
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.action-buttons .btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.action-buttons .btn-light {
  background-color: #e2e8f0;
  color: #334155;
}

.action-buttons .btn-light:hover {
  background-color: #cbd5e1;
  color: #1e293b;
}

.action-buttons .btn-warning {
  background-color: #fbbf24;
  color: #78350f;
}

.action-buttons .btn-warning:hover {
  background-color: #f59e0b;
  color: #451a03;
}

.action-buttons .btn-info {
  background-color: #06b6d4;
  color: #fff;
}

.action-buttons .btn-info:hover {
  background-color: #0891b2;
  color: #fff;
}

.action-buttons .btn-success {
  background-color: #10b981;
  color: #fff;
}

.action-buttons .btn-success:hover {
  background-color: #059669;
  color: #fff;
}

.action-buttons .btn-danger {
  background-color: #ef4444;
  color: #fff;
}

.action-buttons .btn-danger:hover {
  background-color: #dc2626;
  color: #fff;
}

.action-buttons .btn i {
  margin-right: 0.25rem;
}

/* Tooltip Styling */
.tooltip-inner {
  background-color: #1e293b;
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.tooltip-arrow::before {
  border-top-color: #1e293b;
}
