/* ============================================
   richStudio Modern Theme
   Custom CSS overhaul for shinydashboard
   ============================================ */

/* --- 1. Design Tokens --- */
:root {
  --rs-primary: #0f6fc5;
  --rs-primary-dark: #0a5a9e;
  --rs-primary-light: #e8f4fd;
  --rs-primary-lighter: #f0f7ff;
  --rs-accent: #21c4b6;
  --rs-accent-dark: #1aad9f;
  --rs-accent-light: #e6f9f7;
  --rs-danger: #dc3545;
  --rs-danger-light: #fdf0f1;
  --rs-warning: #e6a817;
  --rs-success: #28a745;
  --rs-success-light: #edf7ee;
  --rs-info: #17a2b8;
  --rs-text: #1e293b;
  --rs-text-secondary: #64748b;
  --rs-text-muted: #94a3b8;
  --rs-bg: #f1f5f9;
  --rs-bg-card: #ffffff;
  --rs-border: #e2e8f0;
  --rs-border-light: #f1f5f9;
  --rs-shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --rs-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --rs-shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -2px rgba(0,0,0,0.05);
  --rs-shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.05);
  --rs-radius: 8px;
  --rs-radius-sm: 6px;
  --rs-radius-lg: 12px;
  --rs-radius-xl: 16px;
  --rs-font: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  --rs-font-mono: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  --rs-sidebar-width: 250px;
  --rs-sidebar-bg: #1e293b;
  --rs-sidebar-text: #cbd5e1;
  --rs-sidebar-hover: #334155;
  --rs-sidebar-active: #0f6fc5;
  --rs-transition: 0.2s ease;
}

/* --- 2. Global --- */
body {
  font-family: var(--rs-font) !important;
  color: var(--rs-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.wrapper {
  background: var(--rs-bg);
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  color: var(--rs-text);
}

a {
  color: var(--rs-primary);
  transition: color var(--rs-transition);
}
a:hover {
  color: var(--rs-primary-dark);
}

hr {
  border-top-color: var(--rs-border);
}

/* --- 3. Header --- */
.skin-blue .main-header .logo {
  background: var(--rs-sidebar-bg) !important;
  font-family: var(--rs-font) !important;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.3px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  color: #ffffff;
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.skin-blue .main-header .logo::before {
  content: '';
  display: inline-block;
  width: 20px;
  height: 20px;
  background: url('favicon.svg') no-repeat center/contain;
  flex-shrink: 0;
}

.skin-blue .main-header .logo:hover {
  background: var(--rs-sidebar-bg) !important;
}

.skin-blue .main-header .navbar {
  background: #ffffff !important;
  border-bottom: 1px solid var(--rs-border);
  box-shadow: var(--rs-shadow-sm);
}

.skin-blue .main-header .navbar .sidebar-toggle {
  color: var(--rs-text) !important;
}
.skin-blue .main-header .navbar .sidebar-toggle:hover {
  background: var(--rs-bg) !important;
  color: var(--rs-primary) !important;
}

/* Navbar breadcrumb */
.navbar-breadcrumb {
  display: inline-flex;
  align-items: center;
  height: 50px;
  padding: 0 16px;
  color: var(--rs-text-secondary);
  font-size: 14px;
  font-weight: 500;
}

.navbar-breadcrumb .bc-icon::before {
  content: '';
  display: inline-block;
  width: 18px;
  height: 18px;
  background: url('favicon.svg') no-repeat center/contain;
  margin-right: 10px;
  vertical-align: middle;
}

.navbar-breadcrumb .bc-text {
  color: var(--rs-text);
  font-weight: 600;
}

/* --- 4. Sidebar --- */
.skin-blue .main-sidebar,
.skin-blue .left-side {
  background: var(--rs-sidebar-bg) !important;
}

.skin-blue .sidebar-menu > li > a {
  color: var(--rs-sidebar-text) !important;
  border-left: 3px solid transparent;
  padding: 12px 16px 12px 18px;
  font-size: 14px;
  font-weight: 500;
  transition: color var(--rs-transition), background-color var(--rs-transition), border-color var(--rs-transition), box-shadow var(--rs-transition);
}

.skin-blue .sidebar-menu > li > a:hover {
  background: var(--rs-sidebar-hover) !important;
  color: #ffffff !important;
  border-left-color: var(--rs-accent);
}

.skin-blue .sidebar-menu > li.active > a {
  background: rgba(15, 111, 197, 0.15) !important;
  color: #ffffff !important;
  border-left-color: var(--rs-primary) !important;
  font-weight: 600;
}

.skin-blue .sidebar-menu > li > a > .fa,
.skin-blue .sidebar-menu > li > a > .fas,
.skin-blue .sidebar-menu > li > a > .far,
.skin-blue .sidebar-menu > li > a > .glyphicon {
  width: 22px;
  text-align: center;
  margin-right: 8px;
  font-size: 15px;
}

/* Submenu items */
.skin-blue .sidebar-menu > li > .treeview-menu {
  background: rgba(0,0,0,0.15) !important;
  padding: 4px 0;
}

.skin-blue .sidebar-menu .treeview-menu > li > a {
  color: var(--rs-sidebar-text) !important;
  padding: 10px 16px 10px 46px;
  font-size: 13px;
  transition: color var(--rs-transition), background-color var(--rs-transition), border-color var(--rs-transition), box-shadow var(--rs-transition);
}

.skin-blue .sidebar-menu .treeview-menu > li > a:hover {
  color: #ffffff !important;
  background: var(--rs-sidebar-hover) !important;
}

.skin-blue .sidebar-menu .treeview-menu > li.active > a {
  color: var(--rs-accent) !important;
  font-weight: 600;
}

/* Sidebar section headers */
.sidebar-menu .header {
  color: var(--rs-text-muted) !important;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 16px 20px 8px;
  background: transparent !important;
}

/* Sidebar HR */
.main-sidebar hr {
  border-color: rgba(255,255,255,0.08);
  margin: 8px 16px;
}

/* Sidebar flex layout for sticky footer */
.main-sidebar .sidebar {
  display: flex !important;
  flex-direction: column !important;
  height: calc(100vh - 50px) !important;
  overflow: hidden !important;
}

/* Sidebar footer */
.sidebar-footer {
  flex-shrink: 0;
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.15);
  text-align: center;
}

.sidebar-footer a {
  color: var(--rs-sidebar-text) !important;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  transition: color var(--rs-transition);
}

.sidebar-footer a:hover {
  color: var(--rs-accent) !important;
}

.sidebar-footer .lab-name {
  font-weight: 600;
  font-size: 13px;
  color: #e2e8f0;
}

.sidebar-footer .lab-dept {
  font-size: 11px;
  color: var(--rs-text-muted);
}

.sidebar-footer .lab-icon {
  font-size: 16px;
  color: var(--rs-accent);
}

/* Sidebar menu scrollable area */
.sidebar-menu {
  flex: 1 1 auto;
  overflow-y: auto;
  padding-bottom: 8px;
}

/* --- 5. Content Area --- */
.skin-blue .content-wrapper {
  background: var(--rs-bg) !important;
  overflow: auto;
}

.content {
  padding: 20px 24px;
}

/* Page headings */
.content > h2,
.content > h3,
.tab-pane > h2,
.tab-pane > .row > .col-sm-12 > h2 {
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 22px;
  font-weight: 700;
  color: var(--rs-text);
}

.content > p {
  color: var(--rs-text-secondary);
  margin-bottom: 20px;
}

/* --- 6. Cards / Boxes --- */
.box {
  border: 1px solid var(--rs-border) !important;
  border-radius: var(--rs-radius) !important;
  box-shadow: var(--rs-shadow) !important;
  background: var(--rs-bg-card) !important;
  margin-bottom: 20px;
  transition: box-shadow var(--rs-transition);
}

.box:hover {
  box-shadow: var(--rs-shadow-md) !important;
}

.box-header {
  border-bottom: 1px solid var(--rs-border) !important;
  border-radius: var(--rs-radius) var(--rs-radius) 0 0 !important;
  padding: 14px 16px !important;
}

.box-header .box-title {
  font-size: 15px !important;
  font-weight: 600 !important;
  color: var(--rs-text);
}

.box-body {
  padding: 16px !important;
}

/* Consistent section headings inside boxes */
.box-body h4 {
  font-size: 16px;
  font-weight: 600;
  color: var(--rs-text);
  margin-top: 8px;
  margin-bottom: 12px;
}

/* Box status colors - headers only */
.box.box-primary > .box-header {
  background: var(--rs-primary-lighter) !important;
  border-bottom-color: var(--rs-primary-light) !important;
}
.box.box-primary > .box-header .box-title {
  color: var(--rs-primary-dark) !important;
}
.box.box-primary {
  border-top: 3px solid var(--rs-primary) !important;
}

.box.box-info > .box-header {
  background: #f0fafb !important;
}
.box.box-info > .box-header .box-title {
  color: #0e7c8c !important;
}
.box.box-info {
  border-top: 3px solid var(--rs-info) !important;
}

.box.box-success > .box-header {
  background: var(--rs-success-light) !important;
}
.box.box-success > .box-header .box-title {
  color: #1e7a33 !important;
}
.box.box-success {
  border-top: 3px solid var(--rs-success) !important;
}

.box.box-danger > .box-header {
  background: var(--rs-danger-light) !important;
}
.box.box-danger > .box-header .box-title {
  color: var(--rs-danger) !important;
}
.box.box-danger {
  border-top: 3px solid var(--rs-danger) !important;
}

.box.box-warning > .box-header {
  background: #fef9ec !important;
}
.box.box-warning {
  border-top: 3px solid var(--rs-warning) !important;
}

/* Solid header overrides - keep text white on dark bg */
.box.box-solid.box-primary > .box-header {
  background: var(--rs-primary) !important;
}
.box.box-solid.box-primary > .box-header .box-title {
  color: #ffffff !important;
}

.box.box-solid.box-info > .box-header {
  background: var(--rs-info) !important;
}
.box.box-solid.box-info > .box-header .box-title {
  color: #ffffff !important;
}

.box.box-solid.box-success > .box-header {
  background: var(--rs-success) !important;
}
.box.box-solid.box-success > .box-header .box-title {
  color: #ffffff !important;
}

.box.box-solid.box-danger > .box-header {
  background: var(--rs-danger) !important;
}
.box.box-solid.box-danger > .box-header .box-title {
  color: #ffffff !important;
}

/* Collapsible box toggle */
.box-header > .box-tools .btn {
  color: var(--rs-text-secondary);
}

/* --- 7. Tab Boxes --- */
.nav-tabs-custom {
  border: 1px solid var(--rs-border) !important;
  border-radius: var(--rs-radius) !important;
  box-shadow: var(--rs-shadow) !important;
  background: var(--rs-bg-card);
  overflow: hidden;
}

.nav-tabs-custom > .nav-tabs {
  background: var(--rs-bg) !important;
  border-bottom: 1px solid var(--rs-border) !important;
}

.nav-tabs-custom > .nav-tabs > li > a {
  color: var(--rs-text-secondary) !important;
  font-weight: 500;
  font-size: 13px;
  padding: 10px 16px;
  border: none !important;
  transition: color var(--rs-transition), background-color var(--rs-transition), border-color var(--rs-transition), box-shadow var(--rs-transition);
}

.nav-tabs-custom > .nav-tabs > li > a:hover {
  color: var(--rs-primary) !important;
  background: transparent !important;
}

.nav-tabs-custom > .nav-tabs > li.active > a {
  color: var(--rs-primary) !important;
  font-weight: 600;
  background: var(--rs-bg-card) !important;
}

.nav-tabs-custom > .nav-tabs > li.active {
  border-top: 3px solid var(--rs-primary) !important;
}

.nav-tabs-custom > .tab-content {
  padding: 16px;
}

/* Regular tabsetPanel tabs */
.nav-tabs {
  border-bottom: 2px solid var(--rs-border) !important;
  margin-bottom: 16px;
}

.nav-tabs > li > a {
  border: none !important;
  border-bottom: 2px solid transparent !important;
  margin-bottom: -2px;
  color: var(--rs-text-secondary) !important;
  font-weight: 500;
  padding: 10px 16px;
  transition: color var(--rs-transition), background-color var(--rs-transition), border-color var(--rs-transition), box-shadow var(--rs-transition);
}

.nav-tabs > li > a:hover {
  border-bottom-color: var(--rs-primary-light) !important;
  background: transparent !important;
  color: var(--rs-primary) !important;
}

.nav-tabs > li.active > a,
.nav-tabs > li.active > a:hover,
.nav-tabs > li.active > a:focus {
  border: none !important;
  border-bottom: 2px solid var(--rs-primary) !important;
  color: var(--rs-primary) !important;
  font-weight: 600;
  background: transparent !important;
}

/* --- 8. Forms --- */
.form-control {
  border: 1px solid var(--rs-border) !important;
  border-radius: var(--rs-radius-sm) !important;
  padding: 8px 12px !important;
  font-size: 14px !important;
  color: var(--rs-text) !important;
  background: var(--rs-bg-card) !important;
  transition: border-color var(--rs-transition), box-shadow var(--rs-transition);
  height: auto !important;
  min-height: 38px;
}

.form-control:focus {
  border-color: var(--rs-primary) !important;
  box-shadow: 0 0 0 3px rgba(15, 111, 197, 0.12) !important;
  outline: none;
}

.form-group label,
.control-label {
  font-weight: 600;
  font-size: 13px;
  color: var(--rs-text);
  margin-bottom: 4px;
}

.help-block {
  font-size: 12px !important;
  color: var(--rs-text-muted) !important;
  margin-top: 4px;
  line-height: 1.4;
}

/* File input */
.btn-file {
  border-radius: var(--rs-radius-sm) !important;
}

/* Selectize inputs */
.selectize-input {
  border: 1px solid var(--rs-border) !important;
  border-radius: var(--rs-radius-sm) !important;
  padding: 6px 10px !important;
  min-height: 38px !important;
  box-shadow: none !important;
  transition: border-color var(--rs-transition);
}

.selectize-input.focus {
  border-color: var(--rs-primary) !important;
  box-shadow: 0 0 0 3px rgba(15, 111, 197, 0.12) !important;
}

.selectize-dropdown {
  border: 1px solid var(--rs-border) !important;
  border-radius: 0 0 var(--rs-radius-sm) var(--rs-radius-sm) !important;
  box-shadow: var(--rs-shadow-md) !important;
}

.selectize-dropdown .active {
  background: var(--rs-primary-light) !important;
  color: var(--rs-primary-dark) !important;
}

/* Numeric inputs */
input[type="number"].form-control {
  padding-right: 4px !important;
}

/* Slider inputs */
.irs--shiny .irs-bar {
  background: var(--rs-primary) !important;
  border-color: var(--rs-primary) !important;
}

.irs--shiny .irs-handle {
  border-color: var(--rs-primary) !important;
}

.irs--shiny .irs-from,
.irs--shiny .irs-to,
.irs--shiny .irs-single {
  background: var(--rs-primary) !important;
}

/* Radio buttons */
.radio label,
.checkbox label {
  font-weight: 400;
  color: var(--rs-text);
}

/* --- 9. Buttons --- */
.btn {
  border-radius: var(--rs-radius-sm) !important;
  font-weight: 600;
  font-size: 13px;
  padding: 8px 16px;
  transition: color var(--rs-transition), background-color var(--rs-transition), border-color var(--rs-transition), box-shadow var(--rs-transition);
  border: 1px solid transparent;
  letter-spacing: 0.2px;
}

.btn-primary {
  background: var(--rs-primary) !important;
  border-color: var(--rs-primary) !important;
  color: #ffffff !important;
  margin-right: 8px;
}

.btn-primary:hover,
.btn-primary:focus {
  background: var(--rs-primary-dark) !important;
  border-color: var(--rs-primary-dark) !important;
  box-shadow: var(--rs-shadow-md) !important;
  transform: translateY(-1px);
}

.btn-default {
  background: var(--rs-bg-card) !important;
  border-color: var(--rs-border) !important;
  color: var(--rs-text-secondary) !important;
}

.btn-default:hover {
  background: var(--rs-bg) !important;
  border-color: #cbd5e1 !important;
  color: var(--rs-text) !important;
}

.btn-danger {
  background: var(--rs-danger) !important;
  border-color: var(--rs-danger) !important;
  color: #ffffff !important;
}

.btn-danger:hover {
  background: #c82333 !important;
  box-shadow: var(--rs-shadow-md) !important;
  transform: translateY(-1px);
}

.btn-success {
  background: var(--rs-success) !important;
  border-color: var(--rs-success) !important;
  color: #ffffff !important;
}

.btn-success:hover {
  background: #218838 !important;
  box-shadow: var(--rs-shadow-md) !important;
  transform: translateY(-1px);
}

.btn-lg {
  padding: 12px 28px !important;
  font-size: 15px !important;
  border-radius: var(--rs-radius) !important;
}

/* Primary action button - extra emphasis */
.btn-action-hero {
  background: linear-gradient(135deg, var(--rs-primary), var(--rs-accent)) !important;
  border: none !important;
  color: #ffffff !important;
  padding: 12px 32px !important;
  font-size: 15px !important;
  font-weight: 700 !important;
  border-radius: var(--rs-radius) !important;
  box-shadow: 0 4px 14px rgba(15, 111, 197, 0.3) !important;
  letter-spacing: 0.3px;
}

.btn-action-hero:hover {
  box-shadow: 0 6px 20px rgba(15, 111, 197, 0.4) !important;
  transform: translateY(-2px);
  color: #ffffff !important;
}

/* Download buttons */
.btn .fa-download {
  margin-right: 4px;
}

/* --- 10. Tables (DT) --- */
.dataTables_wrapper {
  overflow-x: auto;
}

.dataTable thead th {
  background: var(--rs-bg) !important;
  color: var(--rs-text) !important;
  font-weight: 600;
  font-size: 13px;
  border-bottom: 2px solid var(--rs-border) !important;
  padding: 10px 12px !important;
}

.dataTable tbody td {
  padding: 8px 12px !important;
  font-size: 13px;
  vertical-align: middle;
  border-color: var(--rs-border-light) !important;
}

.dataTable tbody tr:hover {
  background: var(--rs-primary-lighter) !important;
}

.dataTable tbody tr.selected {
  background: var(--rs-primary-light) !important;
}

.dataTables_filter input {
  border: 1px solid var(--rs-border) !important;
  border-radius: var(--rs-radius-sm) !important;
  padding: 6px 10px !important;
}

.dataTables_length select {
  border: 1px solid var(--rs-border) !important;
  border-radius: var(--rs-radius-sm) !important;
}

.dataTables_info {
  color: var(--rs-text-muted) !important;
  font-size: 12px;
}

.dataTables_paginate .paginate_button {
  border-radius: var(--rs-radius-sm) !important;
}

.dataTables_paginate .paginate_button.current {
  background: var(--rs-primary) !important;
  color: #ffffff !important;
  border-color: var(--rs-primary) !important;
}

/* --- 11. Notifications --- */
.shiny-notification {
  border-radius: var(--rs-radius) !important;
  box-shadow: var(--rs-shadow-lg) !important;
  border: 1px solid var(--rs-border);
  font-family: var(--rs-font);
}

/* --- 12. Modals --- */
.modal-content {
  border-radius: var(--rs-radius-lg) !important;
  border: none !important;
  box-shadow: var(--rs-shadow-lg) !important;
}

.modal-header {
  border-bottom: 1px solid var(--rs-border);
  padding: 16px 20px;
}

.modal-title {
  font-weight: 700;
  font-size: 18px;
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  border-top: 1px solid var(--rs-border);
  padding: 12px 20px;
}

/* Confirmation modal */
.modal-confirm .modal-body {
  font-size: 15px;
  color: var(--rs-text-secondary);
}

.modal-confirm .modal-body .fa-exclamation-triangle {
  color: var(--rs-warning);
  font-size: 24px;
  margin-right: 12px;
}

/* --- 13. Home Page --- */
.home-hero {
  display: flex;
  align-items: center;
  gap: 20px;
  background: linear-gradient(135deg, var(--rs-primary-lighter), #f0fafb);
  border: 1px solid var(--rs-border);
  border-radius: var(--rs-radius-lg);
  padding: 24px 28px;
  margin-bottom: 24px;
}

.home-title {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  color: var(--rs-text);
}

.home-subtitle {
  margin: 6px 0 10px;
  color: var(--rs-text-secondary);
  font-size: 15px;
  line-height: 1.5;
}

.version-pill {
  background: var(--rs-primary);
  color: #ffffff;
  border-radius: 20px;
  padding: 4px 14px;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.5px;
  display: inline-block;
  text-transform: uppercase;
}

.home-logo {
  height: 80px;
  width: auto;
  flex-shrink: 0;
}

.home-section .box-body {
  line-height: 1.7;
}

.home-list {
  padding-left: 0;
  margin: 0;
  list-style: none;
}

.home-list li {
  margin-bottom: 10px;
  padding-left: 24px;
  position: relative;
  color: var(--rs-text);
  font-size: 14px;
  line-height: 1.5;
}

.home-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--rs-accent);
}

/* Workflow Stepper */
.workflow-stepper {
  margin-bottom: 16px;
}

.workflow-stepper h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--rs-text);
  margin: 0 0 10px;
}

.stepper-container {
  display: flex;
  gap: 0;
  align-items: stretch;
}

.step-card {
  flex: 1;
  background: var(--rs-bg-card);
  border: 1px solid var(--rs-border);
  padding: 20px 18px;
  position: relative;
  transition: color var(--rs-transition), background-color var(--rs-transition), border-color var(--rs-transition), box-shadow var(--rs-transition);
}

.step-card:first-child {
  border-radius: var(--rs-radius-lg) 0 0 var(--rs-radius-lg);
}

.step-card:last-child {
  border-radius: 0 var(--rs-radius-lg) var(--rs-radius-lg) 0;
}

.step-card:hover {
  background: var(--rs-primary-lighter);
  border-color: var(--rs-primary);
  z-index: 1;
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--rs-primary);
  color: #ffffff;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 10px;
}

.step-card:nth-child(2) .step-number {
  background: var(--rs-accent);
}

.step-card:nth-child(3) .step-number {
  background: #6366f1;
}

.step-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--rs-text);
  margin-bottom: 4px;
}

.step-desc {
  font-size: 13px;
  color: var(--rs-text-secondary);
  line-height: 1.5;
  margin: 0;
}

.step-arrow {
  position: absolute;
  right: -12px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  color: var(--rs-text-muted);
  font-size: 18px;
  background: var(--rs-bg-card);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--rs-border);
}

/* Links list with icons */
.link-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.link-list li {
  margin-bottom: 12px;
}

.link-list a {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--rs-border);
  border-radius: var(--rs-radius);
  text-decoration: none;
  color: var(--rs-text);
  transition: color var(--rs-transition), background-color var(--rs-transition), border-color var(--rs-transition), box-shadow var(--rs-transition);
  background: var(--rs-bg-card);
}

.link-list a:hover {
  border-color: var(--rs-primary);
  background: var(--rs-primary-lighter);
  box-shadow: var(--rs-shadow-sm);
  transform: translateX(2px);
}

.link-icon {
  color: var(--rs-primary);
  font-size: 16px;
  margin-top: 2px;
  flex-shrink: 0;
}

.link-text {
  font-weight: 600;
  font-size: 14px;
}

.link-desc {
  font-size: 12px;
  color: var(--rs-text-secondary);
  margin-top: 2px;
}

/* About section */
.about-section {
  font-size: 14px;
  line-height: 1.6;
}

.about-section .citation-block {
  background: var(--rs-bg);
  border-left: 3px solid var(--rs-primary);
  padding: 12px 16px;
  border-radius: 0 var(--rs-radius-sm) var(--rs-radius-sm) 0;
  font-size: 13px;
  color: var(--rs-text-secondary);
  margin: 12px 0;
}

/* --- 14. Workflow Page Headers --- */
.tab-page-header {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--rs-border);
}

.tab-page-header h2 {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 4px;
  color: var(--rs-text);
}

.tab-page-header p {
  color: var(--rs-text-secondary);
  margin: 0;
  font-size: 14px;
}

/* --- 15. Empty States --- */
.empty-state {
  text-align: center;
  padding: 24px 16px;
  color: var(--rs-text-muted);
}

.empty-state .empty-icon {
  font-size: 36px;
  margin-bottom: 16px;
  color: var(--rs-border);
}

.empty-state h4 {
  font-weight: 600;
  color: var(--rs-text-secondary);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 14px;
  max-width: 360px;
  margin: 0 auto;
  line-height: 1.5;
}

/* --- 16. Tooltip Icons --- */
.tooltip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--rs-text-muted);
  color: #ffffff;
  font-size: 10px;
  cursor: help;
  margin-left: 4px;
  vertical-align: middle;
}

.tooltip-icon:hover {
  background: var(--rs-primary);
}

/* --- 17. Verbatim / Code Output --- */
pre, .shiny-text-output {
  font-family: var(--rs-font-mono);
  font-size: 13px;
  background: var(--rs-bg) !important;
  border: 1px solid var(--rs-border) !important;
  border-radius: var(--rs-radius-sm) !important;
  padding: 12px !important;
  color: var(--rs-text);
}

/* --- 18. Plotly Improvements --- */
.plotly {
  border-radius: var(--rs-radius);
}

.js-plotly-plot .plotly .modebar {
  top: 4px !important;
  right: 4px !important;
}

/* --- 19. Progress / Busy Indicators --- */
.progress {
  border-radius: var(--rs-radius-sm);
  background: var(--rs-bg);
  height: 8px;
}

.progress-bar {
  background: linear-gradient(90deg, var(--rs-primary), var(--rs-accent));
  border-radius: var(--rs-radius-sm);
}

/* Shiny busy indicator styling */
.shiny-busy-panel-overlay {
  background: rgba(255,255,255,0.7) !important;
  backdrop-filter: blur(2px);
}

/* --- 20. Bookmark Button --- */
#ss-bookmark-btn,
[id$="bookmark-btn"] {
  background: transparent !important;
  border: none !important;
  color: var(--rs-sidebar-text) !important;
  border-radius: 0 !important;
  border-left: 3px solid transparent !important;
  margin: 0;
  width: 100%;
  font-size: 13px;
  font-weight: 500;
  padding: 12px 16px 12px 18px;
  text-align: left;
  transition: color var(--rs-transition), background-color var(--rs-transition), border-color var(--rs-transition), box-shadow var(--rs-transition);
}

#ss-bookmark-btn:hover,
[id$="bookmark-btn"]:hover {
  background: var(--rs-sidebar-hover) !important;
  color: #ffffff !important;
  border-left-color: var(--rs-accent) !important;
}

/* Compact home hero */
.home-hero-compact {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(135deg, var(--rs-primary-lighter), #f0fafb);
  border: 1px solid var(--rs-border);
  border-radius: var(--rs-radius-lg);
  padding: 16px 24px;
  margin-bottom: 16px;
}

.home-hero-compact .home-title {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  color: var(--rs-text);
}

.home-hero-compact .home-subtitle {
  margin: 4px 0 6px;
  color: var(--rs-text-secondary);
  font-size: 13px;
  line-height: 1.4;
}

.home-hero-compact .home-logo {
  height: 60px;
  width: auto;
  flex-shrink: 0;
}

/* Compact link list */
.link-list-compact {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.link-list-compact li {
  margin-bottom: 0;
}

.link-list-compact a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--rs-radius-sm);
  text-decoration: none;
  color: var(--rs-text);
  font-size: 13px;
  font-weight: 500;
  transition: color var(--rs-transition), background-color var(--rs-transition), border-color var(--rs-transition), box-shadow var(--rs-transition);
}

.link-list-compact a:hover {
  background: var(--rs-primary-lighter);
  color: var(--rs-primary);
}

.link-list-compact .fa, .link-list-compact .fas, .link-list-compact .fab {
  color: var(--rs-primary);
  width: 16px;
  text-align: center;
}

/* --- 21. Responsive --- */
@media (max-width: 767px) {
  .home-hero {
    flex-direction: column;
    text-align: center;
    padding: 20px;
  }

  .home-hero-compact {
    flex-direction: column;
    text-align: center;
    padding: 14px;
  }

  .stepper-container {
    flex-direction: column;
    gap: 8px;
  }

  .step-card,
  .step-card:first-child,
  .step-card:last-child {
    border-radius: var(--rs-radius);
  }

  .step-arrow {
    display: none;
  }

  .content {
    padding: 12px;
  }
}

/* --- 22. Print --- */
@media print {
  .main-sidebar,
  .main-header,
  .sidebar-footer,
  .btn,
  .dataTables_filter,
  .dataTables_length,
  .dataTables_paginate {
    display: none !important;
  }

  .content-wrapper {
    margin-left: 0 !important;
  }

  .box {
    break-inside: avoid;
    box-shadow: none !important;
    border: 1px solid #ccc !important;
  }
}

/* --- 23. Optgroup Styling (grouped dropdowns) --- */
.selectize-dropdown .optgroup-header {
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--rs-text-muted);
  padding: 8px 12px 4px;
  border-top: 1px solid var(--rs-border-light);
}

/* --- 24. ActionBttn (shinyWidgets) --- */
.bttn-material-circle {
  box-shadow: var(--rs-shadow) !important;
}

.bttn-material-circle:hover {
  box-shadow: var(--rs-shadow-md) !important;
}

/* --- 25. Tighten home page bottom --- */
.tab-content > .tab-pane > .row:last-child {
  margin-bottom: 0;
}

.home-section .box {
  margin-bottom: 12px;
}

/* --- 26. Loading Overlay --- */
#loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--rs-bg, #f1f5f9);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease;
}

#loading-overlay.loaded {
  opacity: 0;
  pointer-events: none;
}

.loading-content {
  text-align: center;
}

.loading-logo {
  margin-bottom: 16px;
  animation: pulse 2s ease-in-out infinite;
}

.loading-title {
  font-family: var(--rs-font, 'Segoe UI', system-ui, sans-serif);
  font-size: 24px;
  font-weight: 700;
  color: var(--rs-primary, #0f6fc5);
  margin: 0 0 20px;
}

.loading-spinner {
  width: 36px;
  height: 36px;
  margin: 0 auto 12px;
  border: 3px solid var(--rs-border, #e2e8f0);
  border-top-color: var(--rs-primary, #0f6fc5);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-text {
  font-family: var(--rs-font, 'Segoe UI', system-ui, sans-serif);
  font-size: 14px;
  color: var(--rs-text-secondary, #64748b);
  margin: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(0.95); }
}
/* Workspace presentation primitives (SPEC-WS-002). */
.rs-workspace {
  --rs-workspace-text-subtle: var(--rs-text);
  --rs-workspace-control-border: var(--rs-text-secondary);
  --rs-workspace-focus: var(--rs-primary-dark);
  --rs-workspace-focus-gap: #ffffff;
  --rs-workspace-success-text: #1e7a33;
  --rs-workspace-warning-text: #92400e;
  --rs-workspace-error-text: #b91c1c;
  --rs-workspace-info-text: #0e7c8c;
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
  color: var(--rs-text);
  font-family: var(--rs-font);
  font-size: 1.4rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}
.rs-workspace *, .rs-workspace *::before, .rs-workspace *::after {
  box-sizing: border-box;
}
.rs-workspace h3 {
  margin: 0 0 1.2rem;
  font-size: 1.6rem;
  line-height: 1.4;
  font-weight: 600;
}
.rs-workspace-card {
  padding: 1.6rem;
  margin-bottom: 2rem;
  background: var(--rs-bg-card);
  border: 1px solid var(--rs-border);
  border-radius: var(--rs-radius);
  box-shadow: var(--rs-shadow-sm);
}
.rs-workspace dl, .rs-workspace dd { margin: 0; }
.rs-workspace dt { margin-top: 1.2rem; font-weight: 600; }
.rs-workspace-kind { font-weight: 600; }
.rs-workspace-action-group, .rs-workspace-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8rem;
}
.rs-workspace-action, .rs-workspace button {
  min-width: 44px;
  min-height: 44px;
  max-width: 100%;
  padding: 0.8rem 1.6rem;
  border: 1px solid var(--rs-workspace-control-border);
  border-radius: var(--rs-radius-sm);
  background: var(--rs-bg-card);
  color: var(--rs-text);
  font: inherit;
  font-weight: 600;
  white-space: normal;
  overflow-wrap: anywhere;
  cursor: pointer;
  transition: color .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.rs-workspace-action:not(:disabled):hover, .rs-workspace button:not(:disabled):hover {
  background: var(--rs-primary-light);
  border-color: var(--rs-primary-dark);
}
.rs-workspace-action:disabled { cursor: not-allowed; }
.rs-workspace-action:focus-visible, .rs-workspace :focus-visible {
  outline: 3px solid var(--rs-workspace-focus);
  outline-offset: 2px;
  box-shadow: 0 0 0 2px var(--rs-workspace-focus-gap);
}
.rs-workspace-field { margin-bottom: 1.2rem; }
.rs-workspace-field label { display: block; margin-bottom: 0.4rem; }
.rs-workspace-field .form-control {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 44px;
  height: auto;
  font: inherit;
  color: var(--rs-text);
  border-color: var(--rs-workspace-control-border) !important;
}
.rs-workspace-field p { font-size: 1.3rem; margin: 0.4rem 0 0; }
.rs-workspace-results > p, .rs-workspace-action-group > span { font-size: 1.3rem; }
.rs-workspace-error { color: var(--rs-workspace-error-text); font-weight: 600; }
.rs-workspace-status { padding: 1.2rem; margin-bottom: 1.2rem; background: var(--rs-bg-card); }
.rs-workspace-status-failed { color: var(--rs-workspace-error-text); background: var(--rs-danger-light); }
.rs-workspace-status-succeeded { color: var(--rs-workspace-success-text); background: var(--rs-success-light); }
.rs-workspace-status-stop-requested, .rs-workspace-status-interrupted {
  color: var(--rs-workspace-warning-text); background: #fef9ec;
}
.rs-workspace-results { width: 100%; }
.rs-workspace-table-scroll { overflow-x: auto; max-width: 100%; margin: 0.8rem 0; padding: 0.4rem; }
.rs-workspace table { border-collapse: collapse; font-size: 1.3rem; width: 100%; }
.rs-workspace caption { color: var(--rs-text); text-align: left; }
.rs-workspace th { padding: 1rem 1.2rem; text-align: left; background: var(--rs-bg); }
.rs-workspace td { padding: 0.8rem 1.2rem; border-bottom: 1px solid var(--rs-border); }
.rs-workspace-dataset { display: inline-block; padding: 0.4rem 0.8rem; background: var(--rs-primary-light); }
.rs-workspace-dataset-square { background: var(--rs-accent-light); }
.rs-workspace-dataset-triangle { border-bottom: 3px solid #6366f1; }
.rs-workspace-confirmation {
  width: min(57.6rem, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  padding: 1.6rem;
  border: 1px solid var(--rs-workspace-control-border);
  border-radius: var(--rs-radius);
  background: var(--rs-bg-card);
}
@media (max-width: 767px) {
  .rs-workspace-actions { align-items: stretch; }
  .rs-workspace-actions button { flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .rs-workspace, .rs-workspace *, .rs-workspace *::before, .rs-workspace *::after {
    animation: none !important;
    transition: none !important;
    transform: none !important;
    scroll-behavior: auto !important;
  }
  #loading-overlay, #loading-overlay .loading-logo, #loading-overlay .loading-spinner {
    animation: none !important;
    transition: none !important;
    transform: none !important;
  }
}


/* Compact workflow layout (SPEC-COMPACTUI-001): structural spacing only. */
.rs-compact-workflow .box,
.rs-compact-workflow .nav-tabs-custom {
  margin-bottom: 12px;
}
.rs-compact-workflow .box > .box-header {
  padding: 10px 12px !important;
}
.rs-compact-workflow .box > .box-body,
.rs-compact-workflow .nav-tabs-custom > .tab-content {
  padding: 12px !important;
}
.rs-compact-workflow .form-group {
  margin-bottom: 10px;
}
.rs-compact-workflow hr {
  margin-top: 12px;
  margin-bottom: 12px;
}
.rs-compact-workflow .shiny-input-container:not(.shiny-input-container-inline) {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
.rs-compact-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0 16px;
}
.rs-compact-fields > * {
  min-width: 0;
}
.rs-compact-review li {
  overflow-wrap: anywhere;
}
@media (min-width: 992px) {
  .rs-compact-fields,
  .rs-compact-review .review-card-entry > ul {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 20px;
  }
}


/* --- SPEC-WS-013 M1: presentation quick wins --- */
/* Overrides of earlier rules, placed after them (the original rules above are
   pinned byte-for-byte by test-workspace-components.R). */
:root {
  --rs-text-secondary-strong: #475569;
  --rs-focus: #0a4f8a;
  --rs-focus-on-dark: #ffffff;
}
.help-block {
  font-size: 13px !important;
  color: var(--rs-text-secondary-strong) !important;
}
.main-sidebar .sidebar-menu > li.header,
.sidebar-menu .header {
  color: #cbd5e1 !important;
  font-size: 13px !important;
}
.sidebar-footer a {
  font-size: 13px;
}
.sidebar-footer .lab-dept {
  font-size: 13px;
  color: #cbd5e1;
}
.form-control:focus {
  outline: 3px solid var(--rs-focus) !important;
  outline-offset: 0;
}
.shiny-notification {
  opacity: 1 !important;
  background-color: #ffffff;
  color: var(--rs-text);
}
.shiny-notification-message { border-left: 4px solid var(--rs-info); }
.shiny-notification-warning { border-left: 4px solid var(--rs-warning); background-color: #fef9ec; }
.shiny-notification-error { border-left: 4px solid var(--rs-danger); background-color: #fdf0f1; color: #7f1d1d; }
@media (max-width: 767px) {
  #shiny-notification-panel { left: 8px; right: 8px; bottom: 8px; width: auto; }
  .shiny-notification { width: 100%; }
}


/* F10: visible focus on every focusable control. The outline colour is chosen
   against the surface the control sits on (dark sidebar vs light content). */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible,
.selectize-input.focus {
  outline: 3px solid var(--rs-focus) !important;
  outline-offset: 2px;
  /* Earlier rules transition "all"; the focus indicator must be there at once. */
  transition: none !important;
}
.main-sidebar a:focus-visible,
.main-sidebar button:focus-visible,
.main-sidebar .btn:focus-visible,
.main-sidebar summary:focus-visible {
  outline-color: var(--rs-focus-on-dark) !important;
}
.form-control:focus-visible {
  outline-offset: 0;
}

/* F4: a disabled control looks disabled through explicit colours, never through opacity (the
   SPEC-WS-002 contrast guard refuses opacity): muted neutral surface and border, secondary text,
   not-allowed cursor, and no hover or active change. */
button:disabled,
.btn:disabled,
.btn.disabled,
.btn[disabled],
input:disabled,
select:disabled,
textarea:disabled,
[aria-disabled="true"],
.rs-workspace-action:disabled {
  opacity: 1 !important;
  cursor: not-allowed !important;
  color: var(--rs-text-secondary-strong) !important;
  background-color: var(--rs-border) !important;
  border: 1px solid var(--rs-text-secondary) !important;
  box-shadow: none !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
  cursor: not-allowed !important;
}
.rs-workspace-actions > span {
  flex: 1 1 100%;
  font-size: 13px;
  color: var(--rs-text-secondary-strong);
}
.rs-workspace-unrecorded {
  margin-top: 0.8rem;
}
.rs-workspace-unrecorded > summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--rs-text-secondary-strong);
}

/* F1/N1: the job panel is one disclosure line while collapsed, compact rows when open. */
.rs-workspace-jobs {
  margin: 0 0 10px;
}
.rs-jobs-disclosure {
  background: var(--rs-bg-card);
  border: 1px solid var(--rs-border);
  border-radius: var(--rs-radius-sm);
  padding: 0 12px;
}
.rs-jobs-disclosure:not(:has(.rs-job)) {
  display: none;
}
.rs-jobs-summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  line-height: 40px;
  min-height: 40px;
  color: var(--rs-text);
}
.rs-jobs-disclosure[open] > .rs-jobs-summary {
  border-bottom: 1px solid var(--rs-border);
  margin-bottom: 6px;
}
.rs-job-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.rs-job {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--rs-border-light);
  font-size: 13px;
}
.rs-job .rs-job-id,
.rs-workspace-jobs code {
  color: inherit;
  background: transparent;
  padding: 0;
  font-family: var(--rs-font-mono);
  font-size: 12px;
}
.rs-job-kind {
  font-weight: 600;
}
.rs-job-state {
  font-weight: 600;
  color: var(--rs-text-secondary-strong);
}
.rs-job-details {
  flex: 1 1 100%;
}
.rs-job-details > summary {
  cursor: pointer;
  color: var(--rs-text-secondary-strong);
  font-size: 13px;
}
.rs-job-settings {
  margin: 4px 0 0;
  padding-left: 18px;
  font-size: 13px;
}
.rs-workspace-jobs .btn {
  padding: 2px 10px;
  font-size: 13px;
}
.rs-job-status,
.rs-job-time {
  margin: 0 0 4px;
  font-size: 13px;
  color: var(--rs-text-secondary-strong);
}
.rs-job-status code {
  color: inherit;
}

/* F12: on a narrow screen the slide-in menu closes at once (a destination was chosen) and
   keeps its slide when it opens. */
@media (max-width: 767px) {
  .main-sidebar,
  .left-side {
    transition: none !important;
  }
  body.sidebar-open .main-sidebar,
  body.sidebar-open .left-side {
    transition: transform 0.3s ease-in-out !important;
  }
}

/* --- SPEC-WS-013 M2: data tables fit their container --- */
table.rs-display-table td,
table.rs-display-table th {
  max-width: 28em;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.rs-job-command {
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
  white-space: normal;
  user-select: all;
  background: var(--rs-bg);
  color: var(--rs-text);
  padding: 2px 6px;
}
.rs-refusal-steps > summary {
  cursor: pointer;
  font-weight: 600;
}

/* --- SPEC-WS-013 M3: one visual system --- */

/* One box style: every box (whatever status or solidHeader it was built with) gets the same
   neutral surface, the same header and the one primary accent. Red and green are reserved for
   destructive/error and success states, which are not boxes. */
.box,
.box.box-primary,
.box.box-info,
.box.box-success,
.box.box-danger,
.box.box-warning,
.box.box-default,
.box.box-solid {
  border-top: 3px solid var(--rs-primary) !important;
}
.box > .box-header,
.box.box-primary > .box-header,
.box.box-info > .box-header,
.box.box-success > .box-header,
.box.box-danger > .box-header,
.box.box-warning > .box-header,
.box.box-default > .box-header,
.box.box-solid > .box-header,
.box.box-solid.box-primary > .box-header,
.box.box-solid.box-info > .box-header,
.box.box-solid.box-success > .box-header,
.box.box-solid.box-danger > .box-header {
  background: var(--rs-primary-lighter) !important;
  border-bottom: 1px solid var(--rs-primary-light) !important;
}
.box > .box-header .box-title,
.box.box-primary > .box-header .box-title,
.box.box-info > .box-header .box-title,
.box.box-success > .box-header .box-title,
.box.box-danger > .box-header .box-title,
.box.box-warning > .box-header .box-title,
.box.box-default > .box-header .box-title,
.box.box-solid > .box-header .box-title,
.box.box-solid.box-primary > .box-header .box-title,
.box.box-solid.box-info > .box-header .box-title,
.box.box-solid.box-success > .box-header .box-title,
.box.box-solid.box-danger > .box-header .box-title {
  color: var(--rs-primary-dark) !important;
  font-size: 15px !important;
  font-weight: 600 !important;
}

/* One accent: the primary action carries the primary blue, not a blue-to-teal gradient. */
.btn-action-hero {
  background: var(--rs-primary) !important;
  box-shadow: var(--rs-shadow-md) !important;
}
.btn-action-hero:hover {
  background: var(--rs-primary-dark) !important;
}

/* Home: the result message is plain text and takes no visible space while empty. */
.home-status .shiny-text-output {
  font-family: inherit;
  font-size: 14px;
  background: transparent !important;
  border: 0 !important;
  padding: 0 !important;
}
/* An empty text output shows nothing but must stay rendered (Shiny does not render hidden outputs). */
.shiny-text-output:empty {
  border: 0 !important;
  padding: 0 !important;
  min-height: 0;
}

/* Submenu icons line up with the top-level icons. */
.skin-blue .sidebar-menu .treeview-menu > li > a > .fa,
.skin-blue .sidebar-menu .treeview-menu > li > a > .fas,
.skin-blue .sidebar-menu .treeview-menu > li > a > .far {
  display: inline-block;
  width: 22px;
  margin-right: 8px;
  text-align: center;
}

/* F16: reduced motion removes the menu, content and notification transitions. */
@media (prefers-reduced-motion: reduce) {
  body .main-sidebar,
  body .left-side,
  body.sidebar-open .main-sidebar,
  body.sidebar-open .left-side,
  .content-wrapper,
  .main-footer,
  .main-header,
  .main-header .logo,
  .main-header .navbar,
  .sidebar-menu a,
  .sidebar-menu > li > a,
  .sidebar-menu .treeview-menu > li > a,
  .shiny-notification,
  .shiny-notification-panel,
  .box,
  .btn {
    transition: none !important;
  }
}

/* --- SPEC-WS-013 M5: context bar and job tray --- */

/* The context bar shows on the Data, Enrich, Results and Cluster pages only. */
#workspace-container {
  display: none;
}
body:has(#shiny-tab-update_tab.active, #shiny-tab-enrich_tab.active, #shiny-tab-rr_visualize_tab.active, #shiny-tab-cluster_tab.active) #workspace-container {
  display: block;
}
.rs-context-bar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px 12px;
  min-height: 0;
  margin: 0 0 12px;
  padding: 4px 12px;
  background: var(--rs-bg-card);
  border: 1px solid var(--rs-border);
  border-radius: var(--rs-radius);
  box-shadow: var(--rs-shadow-sm);
  position: relative;
}
.rs-context-bar .form-group {
  margin: 0;
  flex: 0 1 220px;
  min-width: 140px;
}
.rs-context-bar .control-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.rs-context-bar select.form-control {
  min-height: 36px;
  padding-top: 4px !important;
  padding-bottom: 4px !important;
}
.rs-context-more {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px 12px;
  min-width: 0;
}
.rs-context-more > .shiny-html-output {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px 12px;
  min-width: 0;
}
.rs-context-bar p {
  margin: 0;
  white-space: nowrap;
}
.rs-context-bar dl {
  display: flex;
  flex-wrap: nowrap;
  align-items: baseline;
  gap: 4px 10px;
  margin: 0;
}
.rs-context-bar dt {
  margin: 0;
  font-weight: 400;
  font-size: 13px;
  color: var(--rs-text-secondary-strong);
}
.rs-context-bar dd {
  margin: 0 6px 0 0;
  font-weight: 600;
}
.rs-context-bar .rs-context-note {
  font-size: 12px;
  color: var(--rs-text-secondary-strong);
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 16em;
}
.rs-context-bar .rs-workspace-unrecorded {
  margin: 0;
  position: relative;
}
.rs-context-bar .rs-workspace-unrecorded[open] > dl {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 20;
  flex-direction: column;
  padding: 8px 12px;
  background: var(--rs-bg-card);
  border: 1px solid var(--rs-border);
  border-radius: var(--rs-radius-sm);
  box-shadow: var(--rs-shadow-md);
  white-space: nowrap;
}
.rs-context-bar .rs-workspace-actions {
  flex-wrap: nowrap;
  gap: 8px;
}
.rs-context-bar .rs-workspace-actions > span {
  flex: 0 1 auto;
  font-size: 12px;
  max-width: 14em;
  line-height: 1.2;
}
.rs-context-bar .rs-workspace-action,
.rs-context-bar .rs-workspace button {
  min-height: 40px;
  padding: 4px 12px;
}
.rs-context-toggle {
  display: none;
}
.rs-job-badge {
  margin-left: auto;
  min-height: 36px;
  padding: 4px 12px;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
  color: var(--rs-text);
  background: var(--rs-bg-card);
  border: 1px solid var(--rs-text-secondary);
  border-radius: var(--rs-radius-sm);
  cursor: pointer;
}
.rs-job-badge[data-running]:not([data-running="0"]) {
  border-color: var(--rs-primary);
  background: var(--rs-primary-light);
  color: var(--rs-primary-dark);
}
@media (max-width: 767px) {
  .rs-context-bar {
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px 8px;
  }
  .rs-context-bar .form-group {
    flex: 1 1 140px;
  }
  .rs-context-toggle {
    display: inline-block;
    min-height: 36px;
    min-width: 36px;
    padding: 4px 6px;
    font-size: 12px;
    color: var(--rs-text);
    background: var(--rs-bg-card);
    border: 1px solid var(--rs-text-secondary);
    border-radius: var(--rs-radius-sm);
  }
  /* Collapsed: the switcher, the "not recorded" trigger, the job badge and the toggle stay in
     one row; the name, the chips, the note and the actions appear when the toggle is opened. */
  .rs-context-more,
  .rs-context-more > .shiny-html-output {
    display: contents;
  }
  .rs-context-bar .rs-context-name,
  .rs-context-bar dl,
  .rs-context-bar .rs-context-note,
  .rs-context-bar #workspace-actions {
    display: none;
  }
  .rs-context-bar.rs-context-open .rs-context-name,
  .rs-context-bar.rs-context-open > .rs-context-more dl,
  .rs-context-bar.rs-context-open #workspace-actions {
    display: flex;
  }
  .rs-context-bar.rs-context-open .rs-workspace-unrecorded dl {
    display: flex;
  }
  .rs-context-bar .rs-workspace-unrecorded dl {
    display: none;
  }
  .rs-context-bar .rs-workspace-unrecorded[open] dl {
    display: flex;
  }
  .rs-context-bar .rs-workspace-unrecorded > summary {
    min-height: 36px;
    line-height: 36px;
    white-space: nowrap;
    font-size: 12px;
  }
  .rs-context-bar .form-group {
    flex: 1 1 64px;
    min-width: 64px;
  }
  /* These two carry the bar's own button rule (min-height 40, 12 px side padding), so they repeat the bar scope. */
  .rs-context-bar .rs-job-badge,
  .rs-context-bar .rs-context-toggle {
    min-height: 36px;
    padding: 4px 5px;
    font-size: 12px;
  }
  .rs-context-bar .rs-context-toggle {
    color: var(--rs-text);
    background: var(--rs-bg-card);
    border-color: var(--rs-text-secondary);
  }
  .rs-job-badge {
    margin-left: 0;
  }
}

/* The job tray: a slide-over below the navbar, opened by the job badge. */
.rs-job-tray {
  position: fixed;
  top: 50px;
  right: 0;
  bottom: 0;
  width: min(420px, 100vw);
  margin: 0;
  padding: 8px 16px 16px;
  overflow-y: auto;
  background: var(--rs-bg-card);
  border-left: 1px solid var(--rs-border);
  box-shadow: var(--rs-shadow-lg);
  z-index: 1040;
  transform: translateX(100%);
  visibility: hidden;
  /* Hidden only after it has slid out; visible at once on opening, so focus can move in. */
  transition: transform var(--rs-transition), visibility 0s linear 0.2s;
}
.rs-job-tray.rs-job-tray-open {
  transform: translateX(0);
  visibility: visible;
  transition: transform var(--rs-transition), visibility 0s;
}
.rs-job-tray:focus {
  outline: none;
}
.rs-job-tray-header {
  display: flex;
  justify-content: flex-end;
  padding-bottom: 4px;
}
.rs-job-tray .rs-jobs-disclosure {
  border: 0;
  padding: 0;
  background: transparent;
}
.rs-job-tray .rs-jobs-summary {
  pointer-events: none;
  list-style: none;
}
.rs-job-tray .rs-jobs-summary::-webkit-details-marker {
  display: none;
}
@media (max-width: 767px) {
  .rs-job-tray {
    width: 100vw;
  }
}
@media (prefers-reduced-motion: reduce) {
  .rs-job-tray {
    transition: none !important;
  }
}

/* Visually hidden, still read by assistive technology (not display: none). */
.rs-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --- SPEC-WS-013 M6: task stepper, flat navigation, page footer --- */

.rs-stepper-bar {
  margin: 0 0 8px;
}
.rs-stepper {
  display: flex;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.rs-step {
  flex: 1 1 0;
  min-width: 0;
  margin: 0;
}
.rs-step-button {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 8px;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 4px 10px;
  text-align: left;
  color: var(--rs-text);
  background: var(--rs-bg-card);
  border: 1px solid var(--rs-border);
  border-radius: var(--rs-radius-sm);
  cursor: pointer;
}
.rs-step-button:hover {
  background: var(--rs-primary-light);
  border-color: var(--rs-primary-dark);
}
.rs-step-current .rs-step-button {
  border-color: var(--rs-primary);
  background: var(--rs-primary-light);
  box-shadow: inset 0 -3px 0 var(--rs-primary);
}
.rs-step-number {
  grid-row: 1 / span 2;
  width: 22px;
  height: 22px;
  line-height: 22px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--rs-text);
  border: 1px solid var(--rs-text-secondary);
  border-radius: 50%;
}
.rs-step-name {
  font-size: 13px;
  font-weight: 600;
}
.rs-step-status {
  font-size: 12px;
  color: var(--rs-text-secondary-strong);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* The next action is read by assistive technology for every step and shown for the current one. */
.rs-step-next {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.rs-stepper-compact {
  display: none;
}
.rs-stepper-compact > summary {
  min-height: 44px;
  line-height: 36px;
  padding: 4px 12px;
  font-weight: 600;
  color: var(--rs-text);
  background: var(--rs-bg-card);
  border: 1px solid var(--rs-border);
  border-radius: var(--rs-radius-sm);
  cursor: pointer;
}
.rs-stepper-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}
.rs-step-link {
  min-height: 44px;
  padding: 4px 12px;
  text-align: left;
  color: var(--rs-text);
  background: var(--rs-bg-card);
  border: 1px solid var(--rs-border);
  border-radius: var(--rs-radius-sm);
}
@media (max-width: 767px) {
  .rs-stepper {
    display: none;
  }
  .rs-stepper-compact {
    display: block;
  }
}

/* The importer route is the sub-route of Data: indented in the flat list. */
.sidebar-menu a[data-value="cluster_upload_tab"] {
  padding-left: 42px;
  font-size: 13px;
}

.rs-page-footer {
  margin: 24px 0 8px;
  padding-top: 8px;
  border-top: 1px solid var(--rs-border);
  text-align: right;
}
.rs-advanced {
  margin: 0 0 12px;
}
.rs-advanced > summary {
  min-height: 36px;
  line-height: 36px;
  font-weight: 600;
  cursor: pointer;
  color: var(--rs-text);
}

/* The Data step keeps its upload controls near the top of the page. */
#shiny-tab-update_tab > h2 {
  margin: 0 0 4px;
  font-size: 18px;
  line-height: 1.1;
}
#shiny-tab-update_tab .nav-tabs-custom > .tab-content {
  padding-top: 6px;
  padding-bottom: 6px;
}
#shiny-tab-update_tab h3 {
  margin: 8px 0 6px;
}
.rs-context-bar {
  margin-bottom: 8px;
}
.rs-stepper-bar {
  margin-bottom: 6px;
}
.rs-step-button {
  min-height: 40px;
  padding-top: 2px;
  padding-bottom: 2px;
}
/* Headroom for the Data step's upload control (AC-019). */
.rs-step-button {
  min-height: 38px;
}
#shiny-tab-update_tab > h2 {
  margin-bottom: 2px;
}
#shiny-tab-update_tab .nav-tabs-custom {
  margin-bottom: 10px;
}

/* btn-primary wins over the global btn-default rule wherever both classes are present. */
.btn.btn-default.btn-primary {
  background: var(--rs-primary) !important;
  border-color: var(--rs-primary-dark) !important;
  color: #ffffff !important;
}
.btn.btn-default.btn-primary:hover,
.btn.btn-default.btn-primary:focus {
  background: var(--rs-primary-dark) !important;
}

/* The Advanced disclosure shows an open/closed marker. */
.rs-advanced > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
}
.rs-advanced > summary::-webkit-details-marker {
  display: none;
}
.rs-advanced > summary::before {
  content: "\25B8";
  font-size: 14px;
}
.rs-advanced[open] > summary::before {
  content: "\25BE";
}

/* --- SPEC-WS-013 M7: Enrich in three parts with a sticky Run bar --- */
.rs-run-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 0 0 8px;
  padding: 6px 12px;
  background: var(--rs-bg-card);
  border: 1px solid var(--rs-border);
  border-radius: var(--rs-radius);
  box-shadow: var(--rs-shadow-sm);
}
.rs-run-bar .btn-action-hero {
  flex: 0 0 auto;
  margin: 0;
}
.rs-run-bar-text {
  flex: 1 1 240px;
  min-width: 0;
  font-size: 12px;
  line-height: 1.35;
  color: var(--rs-text-secondary-strong);
}
.rs-run-bar-text .shiny-html-output {
  margin: 0;
}
.rs-enrich-part {
  margin: 0 0 12px;
  padding: 8px 12px 4px;
  background: var(--rs-bg-card);
  border: 1px solid var(--rs-border);
  border-radius: var(--rs-radius);
}
.rs-enrich-part > h3 {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 600;
  color: var(--rs-primary-dark);
}
.rs-enrich-part .rs-settings-summary,
.rs-enrich-part .rs-plain-preview {
  margin: 0 0 6px;
  font-size: 13px;
}
.rs-adjust,
.rs-enrich-part .rs-advanced {
  margin: 0 0 8px;
}
.rs-adjust > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  font-weight: 600;
  list-style: none;
  cursor: pointer;
  color: var(--rs-text);
}
.rs-adjust > summary::-webkit-details-marker {
  display: none;
}
.rs-adjust > summary::before {
  content: "\25B8";
  font-size: 14px;
}
.rs-adjust[open] > summary::before {
  content: "\25BE";
}
.rs-review-plain p {
  margin: 0 0 4px;
  font-size: 13px;
}
/* A clipping box (not a scroll container) keeps the Run bar sticky to the viewport at every width. */
.wrapper,
body.skin-blue .wrapper .content-wrapper {
  overflow: clip !important;
}


/* --- SPEC-WS-013 M8: Results master-detail --- */
.rs-figure-toggle {
  display: none;
}
.rs-fig-check {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
.rs-results-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin: 0 0 8px;
}
.rs-results-bar .shiny-input-container {
  margin: 0;
}
.rs-results-bar .shiny-options-group {
  display: inline-flex;
  flex-wrap: wrap;
}
.rs-segmented label.radio-inline {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  margin: 0;
  padding: 4px 16px;
  font-weight: 600;
  color: var(--rs-text);
  background: var(--rs-bg-card);
  border: 1px solid var(--rs-text-secondary);
  cursor: pointer;
}
.rs-segmented label.radio-inline + label.radio-inline {
  margin-left: -1px;
}
.rs-segmented label.radio-inline:first-of-type {
  border-radius: var(--rs-radius-sm) 0 0 var(--rs-radius-sm);
}
.rs-segmented label.radio-inline:last-of-type {
  border-radius: 0 var(--rs-radius-sm) var(--rs-radius-sm) 0;
}
.rs-segmented label.radio-inline input[type="radio"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}
.rs-segmented label.radio-inline:has(input:checked) {
  color: #ffffff;
  background: var(--rs-primary);
  border-color: var(--rs-primary-dark);
}
.rs-segmented label.radio-inline:has(input:focus-visible) {
  outline: 3px solid var(--rs-primary-dark);
  outline-offset: 2px;
  z-index: 1;
}
.rs-figure-settings {
  margin: 0 0 12px;
}
.rs-figure-settings > summary,
.rs-details > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  font-weight: 600;
  list-style: none;
  cursor: pointer;
  color: var(--rs-text);
}
.rs-figure-settings > summary::-webkit-details-marker,
.rs-details > summary::-webkit-details-marker {
  display: none;
}
.rs-figure-settings > summary::before,
.rs-details > summary::before {
  content: "\25B8";
  font-size: 14px;
}
.rs-figure-settings[open] > summary::before,
.rs-details[open] > summary::before {
  content: "\25BE";
}
.rs-master-detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas: "master figure" "master panel";
  grid-template-rows: auto 1fr;
  gap: 8px 16px;
  align-items: start;
}
.rs-figure {
  grid-area: figure;
  min-width: 0;
}
.rs-master {
  grid-area: master;
  min-width: 0;
}
.rs-panel {
  grid-area: panel;
  min-width: 0;
}
.rs-panel > div,
.rs-panel > section {
  margin-bottom: 12px;
}
.rs-panel h3 {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 600;
}
.rs-panel .rs-workspace-actions > span {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}
@media (max-width: 767px) {
  .rs-master-detail {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "figure" "master" "panel";
    grid-template-rows: auto;
  }
  /* The figure is a closed disclosure above the term table, so the table stays in reach. */
  .rs-figure-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    margin: 0;
    font-weight: 600;
    cursor: pointer;
    color: var(--rs-text);
  }
  .rs-figure-toggle::before {
    content: "\25B8";
    font-size: 14px;
  }
  .rs-figure-toggle:has(.rs-fig-check:checked)::before {
    content: "\25BE";
  }
  .rs-figure-toggle:has(.rs-fig-check:focus-visible) {
    outline: 3px solid var(--rs-primary-dark);
    outline-offset: 2px;
  }
  .rs-figure-body {
    display: none;
  }
  .rs-figure:has(.rs-fig-check:checked) .rs-figure-body {
    display: block;
  }
  .rs-results-bar {
    margin-bottom: 4px;
  }
  .rs-figure-settings {
    margin-bottom: 4px;
  }
}

/* Term table: header words wrap at spaces only; long cells (gene lists) are bounded, so the table fits. */
#rr_visualize-ex_table table.dataTable thead th {
  white-space: normal;
  overflow-wrap: normal;
  word-break: normal;
  padding: 6px 8px;
}
#rr_visualize-ex_table table.dataTable tbody td {
  max-width: 14em;
  padding: 6px 8px;
  overflow-wrap: break-word;
  word-break: normal;
}
@media (min-width: 768px) {
  .rs-master-detail {
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  }
}

/* The Data step's status text is the longest, so that step gets more of the row. */
.rs-stepper > .rs-step:first-child {
  flex: 1.7 1 0;
}

/* Data step: tab-box titles and the plain box header share one title style. */
#shiny-tab-update_tab .nav-tabs-custom > .nav-tabs > li.header {
  font-size: 15px;
  font-weight: 600;
  line-height: 34px;
  color: var(--rs-primary-dark);
}
#shiny-tab-update_tab .box > .box-header .box-title {
  font-size: 15px;
  font-weight: 600;
}
