/* ==================== DESIGN SYSTEM & VARS ==================== */
:root {
  --bg-primary: #F8FAFC;     /* Slate-based premium background */
  --bg-secondary: #FFFFFF;   /* White card background */
  --bg-dark: #0F172A;        /* Slate 900 */
  --primary-color: #2563EB;  /* Primary Blue accent */
  --accent-color: #D97706;   /* Warning Amber */
  --text-dark: #111827;      /* Primary dark text */
  --text-muted: #6B7280;     /* Secondary muted text */
  --border-color: #E5E7EB;   /* Border color */
  --border-focus: #2563EB;   /* Blue focus border */
  --error-color: #DC2626;    /* Red danger */
  --success-color: #16A34A;  /* Green success */
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06); /* Stripe/Linear subtle shadow */
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.04), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
  --font-main: 'Inter', system-ui, -apple-system, sans-serif;
  --font-timer: 'Share Tech Mono', monospace;
  --transition-fast: 0.15s ease;
}

/* ==================== GLOBAL STYLES ==================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  color: var(--text-dark);
  font-size: 14px;
  line-height: 1.5;
  height: 100vh;
  overflow: hidden;
}

button {
  font-family: var(--font-main);
  cursor: pointer;
  border: none;
  outline: none;
  background: none;
}

/* Scrollbar customizations */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: #d8d6b9;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #c5c3a4;
}

/* ==================== LOGIN COMPONENT ==================== */
.login-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  background: radial-gradient(circle at center, #fffdf2 0%, #eae7ce 100%);
}

.login-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 40px;
  border-radius: 16px;
  width: 400px;
  box-shadow: var(--shadow-lg);
  animation: fadeIn 0.4s ease-out;
  text-align: center;
}

.login-box h2 {
  font-weight: 700;
  color: #3730a3;
  margin-bottom: 8px;
}

.login-box p {
  color: var(--text-muted);
  margin-bottom: 24px;
}

.form-group {
  margin-bottom: 20px;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 6px;
  color: var(--text-dark);
}

.form-group input {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 14px;
  background-color: #fff;
  transition: var(--transition-fast);
}

.form-group input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
  outline: none;
}

.btn-primary {
  display: block;
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
  color: white;
  font-weight: 600;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(79, 70, 229, 0.2);
  transition: var(--transition-fast);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(79, 70, 229, 0.3);
}

.login-error {
  color: var(--error-color);
  margin-top: 15px;
  font-size: 13px;
}

.login-info {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
  font-size: 12px;
  color: var(--text-muted);
  text-align: left;
}

/* ==================== WORKSPACE STYLING ==================== */
#app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Header styling - Modern SaaS Navigation Bar */
.main-header {
  background-color: #FFFFFF;
  color: var(--text-dark);
  height: 56px;
  padding: 0 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #E5E7EB;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
  position: sticky;
  top: 0;
  z-index: 100;
}

.main-header .header-logo {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-dark);
}

.header-nav-center {
  display: none; /* Controlled by admin-or-organizer-only */
  align-items: center;
  gap: 8px;
  height: 100%;
}

.nav-tab-btn {
  font-weight: 500;
  font-size: 13px;
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 6px;
  background: transparent;
  transition: var(--transition-fast);
  height: 38px;
  display: inline-flex;
  align-items: center;
}

.nav-tab-btn:hover {
  color: var(--text-dark);
  background-color: #F1F5F9;
}

.nav-tab-btn.active {
  color: var(--primary-color);
  background-color: #EEF2FF;
  font-weight: 600;
}

.header-user-info {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
}

.username-display {
  font-weight: 600;
  color: var(--text-dark);
}

/* User pill role badges */
.user-role-badge-pill {
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* badge colors by role */
.is-admin .user-role-badge-pill {
  background-color: #F3E8FF;
  color: #7E22CE;
}

.is-organizer .user-role-badge-pill {
  background-color: #FEF3C7;
  color: #D97706;
}

.is-operator .user-role-badge-pill {
  background-color: #DBEAFE;
  color: #1D4ED8;
}

.is-qc .user-role-badge-pill {
  background-color: #D1FAE5;
  color: #047857;
}

.user-badge-records {
  background-color: #F1F5F9;
  color: var(--text-dark);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}

.btn-logout {
  color: #EF4444;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  transition: var(--transition-fast);
}

.btn-logout:hover {
  background-color: #FEF2F2;
}

/* Action Toolbar */
.action-toolbar {
  background-color: #f6f5df;
  border-bottom: 1px solid var(--border-color);
  padding: 4px 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
}

.toolbar-left {
  display: flex;
  gap: 4px;
  align-items: center;
}

#image-loader {
  display: none;
}

.btn-toolbar {
  padding: 3px 10px;
  font-size: 12px;
  border-radius: 2px;
  font-weight: 500;
  transition: var(--transition-fast);
}

.btn-retro {
  background-color: #eae5cd;
  border: 1px solid #9e9a83;
  color: #000;
}

.btn-retro:hover {
  background-color: #dfdac2;
}

.btn-retro-select {
  background-color: #eae5cd;
  border: 2px solid #8e7c4f;
  font-weight: 700;
  color: #000;
}

.btn-retro-select:hover {
  background-color: #dfdac2;
}

.btn-retro-exit {
  background-color: #000;
  color: #ff3333;
  border: 1px solid #ff3333;
  font-weight: 700;
}

.btn-retro-exit:hover {
  background-color: #220000;
}

.led-spacer {
  width: 40px;
  height: 20px;
  background-color: #000;
  border: 1px solid #3f3f46;
  margin: 0 4px;
}

.timer-display-retro {
  font-size: 12px;
  font-weight: 600;
  color: #000;
}

.timer-display-retro strong {
  background-color: #000;
  color: #ff3333;
  padding: 2px 6px;
  font-family: var(--font-timer);
  font-size: 14px;
  border-radius: 2px;
  margin-left: 4px;
  box-shadow: inset 0 0 4px rgba(255, 51, 51, 0.4);
}

/* Workspace Layout Horizontal Split */
.horizontal-layout {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

/* Top Pane: Data Entry Form */
.form-pane.top-pane {
  width: 100%;
  height: 400px;
  max-height: 52vh;
  display: flex;
  flex-direction: column;
  background-color: #fffac9; /* Pale yellow backdrop as in client screenshot */
  border-bottom: 2px solid var(--border-color);
  overflow: hidden;
}

.panel-header {
  background-color: #e8e3bd;
  border-bottom: 1px solid var(--border-color);
  padding: 4px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-header h3 {
  font-size: 12px;
  font-weight: 700;
  color: #4b472e;
}

.viewer-debug-status {
  font-size: 10px;
  font-weight: 500;
  color: #7c775d;
  background-color: #f7f3dc;
  border: 1px solid #d1d0b5;
  padding: 1px 6px;
  border-radius: 3px;
  font-family: monospace;
}

.record-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
}

.badge-edit-mode {
  background-color: #f59e0b;
  color: #fff;
  padding: 1px 4px;
  border-radius: 2px;
  font-weight: 600;
  font-size: 9px;
}

.form-wrapper {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
}

/* Form compact rows with labels above inputs */
.form-row {
  display: grid;
  gap: 8px;
  margin-bottom: 8px;
}

.col-1 { grid-template-columns: 1fr; }
.col-2 { grid-template-columns: 1fr 1fr; }
.col-3 { grid-template-columns: 1fr 1fr 1fr; }
.col-4 { grid-template-columns: repeat(4, 1fr); }
.col-5 { grid-template-columns: repeat(5, 1fr); }
.col-6 { grid-template-columns: repeat(6, 1fr); }
.col-7 { grid-template-columns: repeat(7, 1fr); }

/* Field Group vertical layout */
.field-group {
  display: flex;
  flex-direction: column;
  position: relative;
}

.field-group label {
  font-size: 11px;
  font-weight: 600;
  color: #625f46;
  margin-bottom: 3px;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  text-align: left;
}

.field-group input {
  padding: 6px 8px;
  font-size: 12px;
  border: 1px solid #d1d0b5;
  border-radius: 4px;
  background-color: #ffffe8; /* Retro pale white-yellow input */
  transition: var(--transition-fast);
  color: var(--text-dark);
}

.field-group input:focus {
  background-color: #fff;
  border-color: var(--border-focus);
  outline: none;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.field-group input[readonly] {
  background-color: #eae9ce;
  border-color: #d1d0b5;
  cursor: not-allowed;
  color: #7d7a5b;
}

.field-group .req {
  color: var(--error-color);
}

/* Invalid highlight */
.field-group.invalid input {
  border-color: var(--error-color);
  background-color: #fef2f2;
}

/* Validation Help Text Tooltip style */
.field-error-tooltip {
  color: var(--error-color);
  font-size: 10px;
  margin-top: 2px;
  display: block;
}

/* Remarks block override button */
.remarks-input-wrapper {
  display: flex;
  gap: 8px;
}

.remarks-input-wrapper input {
  flex: 1;
}


.btn-override {
  padding: 6px 12px;
  font-size: 11px;
  background-color: #3b82f6;
  color: white;
  border-radius: 4px;
  font-weight: 600;
}

.btn-override:hover {
  background-color: #2563eb;
}

/* Live validation summary line */
.validation-summary-line {
  background-color: #fff;
  border-top: 1px solid var(--border-color);
  padding: 4px 12px;
  height: 26px;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: center;
}


/* Bottom Pane: Image Viewer */
.image-viewer-pane.bottom-pane {
  width: 100%;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background-color: #3f3f46;
  position: relative;
}

.viewer-controls {
  display: flex;
  gap: 4px;
}

.viewer-controls button {
  background-color: #eae5cd;
  border: 1px solid #9e9a83;
  padding: 2px 8px;
  font-size: 11px;
  border-radius: 2px;
}

.viewer-controls button:hover {
  background-color: #dfdac2;
}

.image-viewport {
  position: absolute;
  top: 32px;
  bottom: 0;
  left: 0;
  right: 0;
  overflow: auto;
  background-color: #18181b;
  padding: 10px;
  display: block;
  touch-action: none;
}

.image-viewport img {
  display: block;
  max-width: none !important;
  max-height: none !important;
  transform-origin: 0 0;
  transition: transform 0.15s ease-out;
  cursor: grab;
  user-select: none;
  -webkit-user-drag: none;
  touch-action: none;
}

.image-viewport img:active {
  cursor: grabbing;
}

.placeholder-text {
  color: #a1a1aa;
  text-align: center;
  padding: 40px;
  width: 100%;
}

/* ==================== MODAL AND OVERLAY SYSTEM ==================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(18, 18, 20, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  animation: fadeIn 0.25s ease-out;
}

.modal-content {
  background-color: #fff;
  border-radius: 12px;
  width: 600px;
  max-width: 90%;
  max-height: 90vh;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}


.modal-content.modal-large {
  width: 1000px;
}

.modal-header {
  background-color: var(--bg-dark);
  color: white;
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  font-size: 16px;
  font-weight: 600;
}

.modal-close {
  color: #9ca3af;
  font-size: 24px;
  font-weight: 300;
}

.modal-close:hover {
  color: white;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

/* Grid controls inside modals */
.grid-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e5e7eb;
}

.control-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.control-row input[type="text"] {
  flex: 1;
  padding: 8px 12px;
  font-size: 13px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
}

.btn-action {
  padding: 8px 14px;
  background-color: #4f46e5;
  color: white;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  transition: var(--transition-fast);
}

.btn-action:hover {
  background-color: #4338ca;
}

.xml-export-section {
  background-color: #f9fafb;
  padding: 10px;
  border-radius: 6px;
  border: 1px dashed #d1d5db;
}

.export-path-indicator {
  font-size: 11px;
  color: var(--text-muted);
}

.export-path-indicator code {
  background-color: #e5e7eb;
  padding: 2px 6px;
  border-radius: 4px;
  color: #1f2937;
}

.import-status-text {
  font-size: 12px;
  color: var(--success-color);
  font-weight: 500;
}

/* Spreadsheet Grid Table */
.grid-table-container {
  overflow-x: auto;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}

.data-grid-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: left;
}

.data-grid-table th, .data-grid-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #e5e7eb;
}

.data-grid-table th {
  background-color: #f9fafb;
  font-weight: 600;
  color: #374151;
}

.data-grid-table tbody tr:hover {
  background-color: #fefce8;
}

/* Badges for status */
.badge {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-valid { background-color: #d1fae5; color: #065f46; }
.badge-invalid { background-color: #fee2e2; color: #991b1b; }
.badge-exported { background-color: #dbeafe; color: #1e40af; }
.badge-pending { background-color: #fef3c7; color: #92400e; }

/* Grid Actions */
.btn-grid-action {
  padding: 4px 8px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 11px;
  background-color: white;
  margin-right: 4px;
  transition: var(--transition-fast);
}

.btn-grid-action:hover {
  background-color: #f3f4f6;
}

.btn-delete {
  color: var(--error-color);
}
.btn-delete:hover {
  background-color: #fee2e2;
  border-color: #fca5a5;
}

/* ==================== SETTINGS FORM ==================== */
.setting-group {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
}

.setting-group label {
  font-weight: 600;
  font-size: 12px;
  margin-bottom: 4px;
}

.setting-group input[type="text"], .setting-group input[type="number"] {
  padding: 10px;
  font-size: 13px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
}

.setting-group.checkbox-row {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.setting-group.checkbox-row input {
  width: 16px;
  height: 16px;
}

/* ==================== REPORTS MODAL ==================== */
.reports-summary-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.reports-summary-cards .card {
  background-color: #f3f4f6;
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  border: 1px solid #e5e7eb;
}

.reports-summary-cards .card-num {
  display: block;
  font-size: 28px;
  font-weight: 700;
  color: #111827;
}

.reports-summary-cards .card-label {
  font-size: 12px;
  color: var(--text-muted);
}

.reports-summary-cards .card-valid { background-color: #ecfdf5; border-color: #a7f3d0; }
.reports-summary-cards .card-valid .card-num { color: #059669; }

.reports-summary-cards .card-invalid { background-color: #fdf2f2; border-color: #fca5a5; }
.reports-summary-cards .card-invalid .card-num { color: #dc2626; }

.reports-summary-cards .card-pending { background-color: #fffbeb; border-color: #fde68a; }
.reports-summary-cards .card-pending .card-num { color: #d97706; }

.report-split-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.report-block h3 {
  font-size: 14px;
  margin-bottom: 12px;
  color: #374151;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.report-table th, .report-table td {
  padding: 8px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
}

.report-table th {
  background-color: #f9fafb;
}

.db-actions-block {
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
}

.db-actions-block h3 {
  font-size: 14px;
  margin-bottom: 10px;
}

/* ==================== ANIMATIONS ==================== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* Visibility classes */
.admin-only, .organizer-only, .qc-only, .admin-or-organizer-only {
  display: none !important;
}

/* Inline elements visibility */
.is-admin button.admin-only,
.is-admin span.admin-only,
.is-admin a.admin-only {
  display: inline-flex !important;
}

.is-admin .admin-or-organizer-only,
.is-organizer .admin-or-organizer-only {
  display: inline-flex !important;
}

.is-organizer button.organizer-only,
.is-organizer span.organizer-only,
.is-organizer a.organizer-only {
  display: inline-flex !important;
}

.is-qc .qc-only,
.is-admin .qc-only,
.is-organizer .qc-only {
  display: inline-flex !important;
}

/* Block/flex structural containers visibility */
.is-admin div.admin-only,
.is-admin form.admin-only,
.is-admin section.admin-only {
  display: flex !important;
  flex-direction: column;
}

.is-organizer div.organizer-only,
.is-organizer form.organizer-only {
  display: flex !important;
  flex-direction: column;
}

/* ==================== ENTERPRISE DASHBOARD REDESIGN ==================== */

.dashboard-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.dashboard-page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-dark);
  letter-spacing: -0.02em;
}

.dashboard-page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.dashboard-action-buttons {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* Consistent Buttons */
.btn-primary, .btn-primary-compact {
  background-color: var(--primary-color);
  color: #FFFFFF;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid var(--primary-color);
  transition: var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-primary {
  padding: 10px 20px;
  font-size: 14px;
}
.btn-primary-compact {
  padding: 6px 12px;
  font-size: 12px;
}
.btn-primary:hover, .btn-primary-compact:hover {
  background-color: #1D4ED8;
  border-color: #1D4ED8;
}

.btn-success {
  background-color: var(--success-color);
  color: #FFFFFF;
  font-weight: 600;
  padding: 10px 18px;
  font-size: 14px;
  border-radius: 8px;
  border: 1px solid var(--success-color);
  transition: var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-success:hover {
  background-color: #15803D;
  border-color: #15803D;
}

/* Dashboard View Shell */
.dashboard-container {
  max-width: 1440px;
  margin: 0 auto !important;
  padding: 28px 32px !important;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-primary);
  width: 100%;
  box-sizing: border-box;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

/* Page Header & Actions Layout */
.dashboard-page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 16px;
}

.dashboard-header-text {
  flex: 1;
  min-width: 300px;
}

.dashboard-page-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}

.dashboard-page-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
}

.dashboard-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Compact Buttons specs */
.dashboard-actions button, .btn-primary-compact {
  height: 38px;
  border-radius: 8px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.btn-primary-compact {
  background-color: var(--primary-color);
  color: #FFFFFF;
  border: 1px solid var(--primary-color);
}
.btn-primary-compact:hover {
  background-color: #1D4ED8;
  border-color: #1D4ED8;
}

.btn-success-subtle {
  background-color: #F0FDF4;
  color: #16A34A;
  border: 1px solid #DCFCE7;
}
.btn-success-subtle:hover {
  background-color: #DCFCE7;
  border-color: #BBF7D0;
}

.btn-danger-outline {
  background-color: #FFFFFF;
  color: var(--error-color);
  border: 1px solid #FCA5A5;
}
.btn-danger-outline:hover {
  background-color: #FEF2F2;
  border-color: #EF4444;
}

/* KPI Cards Layout */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.kpi-card {
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 10px;
  padding: 12px 16px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 84px;
  box-sizing: border-box;
  position: relative;
  transition: var(--transition-fast);
}

.kpi-card:hover {
  border-color: #D1D5DB;
  box-shadow: 0 4px 6px -1px rgba(16, 24, 40, 0.04), 0 2px 4px -1px rgba(16, 24, 40, 0.02);
}

.kpi-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.kpi-card__label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.kpi-card-icon {
  font-size: 12px;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 12px;
  right: 16px;
}

.icon-blue { background-color: #EFF6FF; color: #3B82F6; }
.icon-green { background-color: #F0FDF4; color: #16A34A; }
.icon-red { background-color: #FEF2F2; color: #DC2626; }
.icon-amber { background-color: #FFFBEB; color: #D97706; }

.kpi-card__value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.1;
  margin-top: auto;
}

.kpi-card__helper {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Main Grid structure */
.dashboard-layout-grid {
  display: grid;
  grid-template-columns: 35% 65%;
  gap: 20px;
  margin-top: 20px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  align-items: stretch;
}

.dashboard-grid-column-left {
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  padding-right: 4px;
  min-height: 0;
}

.dashboard-panel {
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
}

/* Left panel form elements */
.user-creation-form {
  margin-bottom: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.user-creation-form select {
  grid-column: span 1;
}

.user-creation-form button {
  grid-column: span 2;
  height: 36px;
  border-radius: 8px;
}

.form-input-compact, .form-select-compact {
  height: 36px;
  padding: 0 12px;
  border: 1px solid #D1D5DB;
  border-radius: 8px;
  font-size: 13px;
  background-color: #FFFFFF;
  color: var(--text-dark);
  width: 100%;
  transition: var(--transition-fast);
  box-sizing: border-box;
}

.form-input-compact:focus, .form-select-compact:focus {
  border-color: var(--primary-color);
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-label-compact {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.form-status-msg {
  font-size: 12px;
  margin-bottom: 8px;
  text-align: center;
}

.panel-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid #E5E7EB;
}

.panel-title-compact {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0;
}

.table-scroll-container, .records-table-scroll, .users-list-scroll, .table-wrapper {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: #FFFFFF;
  overflow: hidden;
}
.users-list-scroll {
  max-height: 130px;
  overflow-y: auto;
}
.table-scroll-container {
  max-height: 180px;
  overflow-y: auto;
}

/* Modern Analytics Table */
.analytics-table, .modern-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.analytics-table th, .modern-table th {
  background-color: #F9FAFB;
  font-weight: 600;
  color: var(--text-muted);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-color);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.analytics-table td, .modern-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-dark);
}

.analytics-table tbody tr:last-child td, .modern-table tbody tr:last-child td {
  border-bottom: none;
}

.analytics-table tbody tr:hover, .modern-table tbody tr:hover {
  background-color: #F8FAFC;
}

.analytics-table.text-left-table th, .modern-table.text-left-table th,
.analytics-table.text-left-table td, .modern-table.text-left-table td {
  text-align: left;
}

/* Right Panel with Tabs */
.dashboard-panel-right-tabs {
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
  display: flex;
  flex-direction: column;
  min-height: 360px; /* Sensible minimum height */
  overflow: hidden;
  box-sizing: border-box;
}

.dashboard-panel-right-tabs .dash-tabs, .dashboard-panel-right-tabs .dashboard-tabs {
  display: flex;
  gap: 16px;
  border-bottom: 1px solid #E5E7EB;
  padding-bottom: 0px;
  margin-bottom: 16px;
}

.dashboard-panel-right-tabs .tab-link, .dashboard-panel-right-tabs .dashboard-tab {
  font-weight: 600;
  font-size: 13px; /* Standard navigation text size */
  color: var(--text-muted);
  padding: 8px 4px 12px 4px;
  background: transparent;
  border-bottom: 2px solid transparent;
  transition: var(--transition-fast);
  border-radius: 0;
}

.dashboard-panel-right-tabs .tab-link:hover, .dashboard-panel-right-tabs .dashboard-tab:hover {
  color: var(--text-dark);
}

.dashboard-panel-right-tabs .tab-link.active, .dashboard-panel-right-tabs .dashboard-tab.active {
  color: var(--primary-color);
  border-bottom: 2px solid var(--primary-color);
}

.records-filter-row, .inspector-filter-row, .filter-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}

.records-table-scroll {
  flex: 1;
  overflow-y: auto;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  background: #FFFFFF;
  min-height: 0;
}

.records-table-scroll table {
  table-layout: auto;
}

/* Modern Status Badge Pills */
.badge-status-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-status-valid {
  background-color: #D1FAE5;
  color: #065F46;
}

.badge-status-invalid {
  background-color: #FEE2E2;
  color: #991B1B;
}

/* Action button items */
.btn-action-inspect, .btn-action-delete {
  height: 30px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  background: #FFFFFF;
  transition: var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-action-inspect {
  color: var(--primary-color);
  border: 1px solid rgba(37, 99, 235, 0.3);
}
.btn-action-inspect:hover {
  background-color: #EFF6FF;
  border-color: var(--primary-color);
}

.btn-action-delete {
  color: var(--error-color);
  border: 1px solid rgba(220, 38, 38, 0.3);
}
.btn-action-delete:hover {
  background-color: #FEF2F2;
  border-color: var(--error-color);
}

/* Code Inspector Styles */
.code-viewer-container {
  flex: 1;
  min-height: 0;
  position: relative;
  border-radius: 10px;
  overflow: hidden;
}

.code-viewer-textarea {
  width: 100%;
  height: 100%;
  font-family: SFMono-Regular, Consolas, Monaco, monospace;
  font-size: 13px;
  background-color: #0F172A; /* Slate 900 developer look */
  color: #38BDF8; /* Sky blue text */
  border: 1px solid #334155;
  padding: 16px;
  resize: none;
  outline: none;
  line-height: 1.5;
  border-radius: 10px;
  box-sizing: border-box;
}

/* Responsive Grid collapsing rules */
@media (max-width: 1100px) {
  .dashboard-layout-grid {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }
  
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }
  
  .dashboard-page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  
  .dashboard-actions {
    width: 100%;
    flex-wrap: wrap;
  }
  
  .dashboard-actions button {
    flex: 1;
    min-width: 120px;
  }

  .main-header {
    height: auto;
    flex-direction: column;
    padding: 12px;
    gap: 8px;
  }

  .header-nav-center {
    margin: 8px 0;
    flex-wrap: wrap;
    justify-content: center;
  }

  .table-scroll-container, .records-table-scroll, .users-list-scroll {
    overflow-x: auto;
  }
}
