:root {
  --dx-primary: #0b5f78;
  --dx-primary-dark: #084a5e;
  --dx-accent: #14b8a6;
  --dx-surface: #f4f8fa;
  --dx-card-border: #d7e5ec;
  --dx-text-muted: #5f7380;
}

html {
  font-size: 14px;
  position: relative;
  min-height: 100%;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

body.dx-body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #eef5f8 0%, #f8fbfc 240px, #ffffff 240px);
  color: #1f2d36;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

.dx-header {
  background: linear-gradient(90deg, var(--dx-primary-dark), var(--dx-primary));
}

.dx-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.dx-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.15);
  font-size: 0.85rem;
}

.dx-main {
  min-height: calc(100vh - 140px);
}

.dx-footer {
  background: #fff;
}

.dx-hero {
  background: linear-gradient(135deg, var(--dx-primary-dark), var(--dx-primary) 55%, #0e7490);
  color: #fff;
  border-radius: 1rem;
  padding: 2rem;
  box-shadow: 0 1rem 2rem rgba(11, 95, 120, 0.18);
}

.dx-hero-kicker {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  opacity: 0.85;
}

.dx-hero-title {
  font-weight: 700;
}

.dx-hero-text {
  opacity: 0.92;
  max-width: 42rem;
}

.dx-badge-live {
  background: var(--dx-accent);
  color: #063a35;
  font-weight: 600;
}

.dx-stat-card,
.dx-panel {
  border: 1px solid var(--dx-card-border);
  border-radius: 0.85rem;
  box-shadow: 0 0.25rem 1rem rgba(15, 45, 60, 0.04);
}

.dx-stat-label {
  color: var(--dx-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  margin-bottom: 0.35rem;
}

.dx-stat-value {
  color: var(--dx-primary);
  font-weight: 700;
  margin: 0;
}

.dx-panel .card-header {
  background: var(--dx-surface);
  border-bottom: 1px solid var(--dx-card-border);
  font-weight: 600;
}

.dx-checklist li {
  position: relative;
  padding-inline-start: 1.35rem;
  margin-bottom: 0.65rem;
}

.dx-checklist li::before {
  content: "✓";
  position: absolute;
  inset-inline-start: 0;
  color: var(--dx-accent);
  font-weight: 700;
}

.dx-role-badge {
  background: #e0f2f7;
  color: var(--dx-primary-dark);
  border: 1px solid #b9d8e4;
  font-weight: 600;
}

/* RTL-ready: flip checklist marker when dir=rtl */
[dir="rtl"] .dx-checklist li {
  padding-inline-start: 0;
  padding-inline-end: 1.35rem;
}

[dir="rtl"] .dx-checklist li::before {
  inset-inline-start: auto;
  inset-inline-end: 0;
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem var(--dx-accent);
}

/* Tables */
.dx-table thead th {
  background: var(--dx-surface);
  color: var(--dx-text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--dx-card-border);
  white-space: nowrap;
}

.dx-table tbody tr:hover {
  background: rgba(11, 95, 120, 0.04);
}

.dx-study-number {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--dx-primary-dark);
  background: #e8f4f8;
  padding: 0.15rem 0.5rem;
  border-radius: 0.35rem;
}

/* Empty state */
.dx-empty-state {
  background: var(--dx-surface);
  border-radius: 0.75rem;
}

.dx-empty-icon {
  font-size: 2rem;
  opacity: 0.6;
}

/* Forms */
.dx-form-card .form-label {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--dx-text-muted);
}

.dx-form-card .form-control,
.dx-form-card .form-select {
  border-color: var(--dx-card-border);
}

/* Sticky actions */
.dx-sticky-actions {
  position: sticky;
  bottom: 1rem;
  z-index: 20;
}

/* Tabs */
.dx-tabs .nav-link {
  font-weight: 500;
  color: var(--dx-text-muted);
}

.dx-tabs .nav-link.active {
  color: var(--dx-primary);
  font-weight: 600;
}

/* Timeline */
.dx-timeline-item {
  display: flex;
  gap: 1rem;
  padding-bottom: 1.25rem;
  position: relative;
}

.dx-timeline-item:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 0.45rem;
  top: 1.25rem;
  bottom: 0;
  width: 2px;
  background: var(--dx-card-border);
}

.dx-timeline-dot {
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 0.25rem;
}

.dx-dot-primary { background: #0b5f78; }
.dx-dot-warning { background: #f59e0b; }
.dx-dot-success { background: #14b8a6; }
.dx-dot-muted { background: #94a3b8; }

.dx-imaging-history-current {
  background: rgba(13, 110, 253, 0.06);
  border-radius: 0.35rem;
}

.dx-imaging-history-timeline .dx-timeline-content {
  min-width: 0;
}

/* Upload dropzone */
.dx-dropzone {
  border: 2px dashed var(--dx-card-border);
  border-radius: 0.75rem;
  padding: 2rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.dx-dropzone:hover,
.dx-dropzone-active {
  border-color: var(--dx-accent);
  background: rgba(20, 184, 166, 0.08);
}

.dx-file-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.5rem;
  background: var(--dx-surface);
  border: 1px solid var(--dx-card-border);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--dx-primary);
}

.dx-pending-badge {
  font-size: 0.85rem;
}

/* Dashboard system health */
.dx-health-tile {
  border: 1px solid var(--dx-card-border);
  border-radius: 0.65rem;
  padding: 0.65rem 0.75rem;
  background: #fff;
  min-height: 4.25rem;
}

.dx-health-tile.dx-health-ok {
  border-left: 3px solid #14b8a6;
}

.dx-health-tile.dx-health-bad {
  border-left: 3px solid #dc3545;
  background: #fff8f8;
}

/* Worklist — remote / mobile */
@media (max-width: 767.98px) {
  .dx-worklist-table .table {
    font-size: 0.85rem;
  }

  .dx-worklist-table .btn-sm {
    min-height: 2.5rem;
    padding: 0.375rem 0.75rem;
  }

  .dx-worklist-filters .col-md-2,
  .dx-worklist-filters .col-md-3,
  .dx-worklist-filters .col-md-4,
  .dx-worklist-filters .col-md-5 {
    flex: 0 0 100%;
    max-width: 100%;
  }
}

html,
body.dx-body {
  overflow-x: hidden;
}
