/* ============================================================
   TEXGAUGE IQ - INDUSTRIAL DASHBOARD SYSTEM
   Refined UI — polished spacing, alignment, typography
   ============================================================ */

/* ---------- CSS Variables ---------- */
:root {
  --sidebar-width: 240px;
  --sidebar-collapsed: 60px;
  --header-height: 64px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  /* Light Theme (default) */
  --bg-body: #f0f2f5;
  --bg-card: #ffffff;
  --bg-sidebar: #1a1d29;
  --bg-sidebar-hover: #2a2d3a;
  --bg-sidebar-active: #2d6cdf;
  --bg-header: #ffffff;
  --bg-input: #f8f9fa;
  --bg-input-focus: #ffffff;

  --text-primary: #1a1d29;
  --text-secondary: #5a6072;
  --text-muted: #8a8fa8;
  --text-sidebar: #b0b5c8;
  --text-sidebar-active: #ffffff;
  --text-white: #ffffff;

  --border-color: #e4e6ed;
  --border-focus: #2d6cdf;

  --accent: #2d6cdf;
  --accent-hover: #1b4fb5;
  --accent-light: rgba(45, 108, 223, 0.1);
  --success: #2f9c4d;
  --success-light: rgba(47, 156, 77, 0.12);
  --danger: #d23f3f;
  --danger-light: rgba(210, 63, 63, 0.12);
  --warning: #e8a838;
  --warning-light: rgba(232, 168, 56, 0.12);

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --shadow-xl: 0 16px 48px rgba(0,0,0,0.15);

  --transition: all 0.25s ease;
}

/* ---------- Dark Theme ---------- */
.theme-dark {
  --bg-body: #0f1119;
  --bg-card: #1a1d29;
  --bg-sidebar: #0f1119;
  --bg-sidebar-hover: #252836;
  --bg-sidebar-active: #2d6cdf;
  --bg-header: #1a1d29;
  --bg-input: #252836;
  --bg-input-focus: #2a2d3a;

  --text-primary: #e8eaed;
  --text-secondary: #9ca0b0;
  --text-muted: #6b7084;
  --text-sidebar: #7c81a0;
  --text-sidebar-active: #ffffff;

  --border-color: #2a2d3a;
  --border-focus: #4a8af4;

  --accent: #4a8af4;
  --accent-hover: #6ba0f0;
  --accent-light: rgba(74, 138, 244, 0.15);
  --success-light: rgba(47, 156, 77, 0.18);
  --danger-light: rgba(210, 63, 63, 0.18);
  --warning-light: rgba(232, 168, 56, 0.18);

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.4);
}

/* ---------- Base Reset ---------- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 15px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.5;
  transition: background 0.3s ease, color 0.3s ease;
  min-height: 100vh;
}

/* ---------- Page Shell Layout ---------- */
.page-shell {
  display: flex;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 1000;
  transition: var(--transition);
  box-shadow: 2px 0 12px rgba(0,0,0,0.15);
  overflow-y: auto;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-white);
  text-decoration: none;
  letter-spacing: 0.3px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.logo::before {
  content: "🏭";
  font-size: 1.5rem;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  padding: 8px 10px;
  gap: 2px;
  flex: 1;
}

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  color: var(--text-sidebar);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
  position: relative;
}

.sidebar nav a:hover {
  background: var(--bg-sidebar-hover);
  color: var(--text-white);
  padding-left: 18px;
}

.sidebar nav a.active {
  background: var(--bg-sidebar-active);
  color: var(--text-sidebar-active);
  font-weight: 600;
}

.sidebar nav a.active::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

/* Department icons for sidebar — using inline icons in HTML, keep for fallback */
.sidebar nav a[href*="carding"]::before,
.sidebar nav a[href*="breaker"]::before,
.sidebar nav a[href*="finisher"]::before,
.sidebar nav a[href*="simplex"]::before,
.sidebar nav a[href*="index"]::before,
.sidebar nav a[href*="Dashboard"]::before {
  display: none;
}

/* Theme Toggle Button */
#themeToggle {
  margin: 4px 14px 16px;
  padding: 10px 16px;
  background: rgba(255,255,255,0.08);
  color: var(--text-sidebar);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.theme-dark #themeToggle::before {
  content: "☀️";
}

#themeToggle:hover {
  background: rgba(255,255,255,0.15);
  color: var(--text-white);
}

/* ---------- Main Content ---------- */
main {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 22px 26px 32px;
  max-width: 100%;
  overflow-x: hidden;
}

/* ---------- Page Header ---------- */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 12px;
}

.page-header h1 {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.page-header p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 4px;
}

/* ---------- Buttons ---------- */
button, .btn {
  padding: 9px 20px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

button.primary, .btn-primary {
  background: var(--accent);
  color: var(--text-white);
  box-shadow: 0 2px 8px rgba(45, 108, 223, 0.3);
}

button.primary:hover, .btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 12px rgba(45, 108, 223, 0.4);
  transform: translateY(-1px);
}

button.secondary, .btn-secondary {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

button.secondary:hover, .btn-secondary:hover {
  background: var(--border-color);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ---------- Card Component ---------- */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 18px 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card h2 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card h3 {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ---------- Metrics Grid (Dashboard Summary Cards) ---------- */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.metric-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent);
  transition: var(--transition);
}

.metric-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.metric-card h3 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  font-size: 0.88rem;
}

.metric-row span {
  color: var(--text-secondary);
}

.metric-row strong {
  color: var(--text-primary);
  font-size: 1rem;
}

/* KPI Status Indicators */
.kpi-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.kpi-green { background: var(--success-light); color: var(--success); }
.kpi-yellow { background: var(--warning-light); color: var(--warning); }
.kpi-red { background: var(--danger-light); color: var(--danger); }

/* ---------- Form Styles ---------- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px 14px;
  margin-bottom: 14px;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.form-grid input,
.form-grid select {
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 500;
  background: var(--bg-input);
  color: var(--text-primary);
  transition: var(--transition);
  width: 100%;
  outline: none;
  height: 42px;
  -webkit-appearance: none;
  appearance: none;
}

.form-grid input:focus,
.form-grid select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-light);
  background: var(--bg-input-focus);
}

.form-grid input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

.form-grid input[type="number"] {
  text-align: center;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.form-grid select {
  cursor: pointer;
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238a8fa8'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

/* Sample grid — cleaner card-based layout */
.sample-grid {
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  background: var(--accent-light);
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  gap: 10px;
}

.sample-grid label {
  background: var(--bg-card);
  padding: 10px 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  transition: var(--transition);
  gap: 6px;
}

.sample-grid label:hover {
  border-color: var(--accent);
  box-shadow: 0 1px 4px rgba(45, 108, 223, 0.1);
}

.sample-grid label:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px var(--accent-light);
}

.sample-grid input {
  text-align: center;
  font-size: 1rem;
  font-weight: 600;
  padding: 8px 8px;
  height: 38px;
}

/* ---------- Calculation Results Row — Professional Cards ---------- */
.calc-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.calc-row div {
  background: var(--bg-card);
  padding: 14px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent);
  box-shadow: var(--shadow-sm);
  text-align: center;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.calc-row div:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* Result labels — small, uppercase, muted */
.calc-row div small,
.calc-row div::before {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.calc-row div strong {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 0;
}

/* Result values — large, bold, colored */
.calc-row div span {
  display: block;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
  letter-spacing: -0.5px;
}

/* Color-code each result card border */
.calc-row div:nth-child(1) { border-left-color: var(--accent); }
.calc-row div:nth-child(1) span { color: var(--accent); }
.calc-row div:nth-child(2) { border-left-color: var(--warning); }
.calc-row div:nth-child(2) span { color: var(--warning); }
.calc-row div:nth-child(3) { border-left-color: var(--danger); }
.calc-row div:nth-child(3) span { color: var(--danger); }
.calc-row div:nth-child(4) { border-left-color: var(--success); }
.calc-row div:nth-child(4) span { color: var(--success); }

/* ---------- Status Message ---------- */
.status-message {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 600;
  text-align: center;
  margin: 10px 0;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.status-message[data-status="ACCEPTED"] {
  background: var(--success-light);
  color: var(--success);
  border: 1px solid var(--success);
}

.status-message[data-status="REJECTED"] {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid var(--danger);
}

/* ---------- Action Row ---------- */
.action-row {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

/* ---------- Filters Row ---------- */
.filters-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  align-items: center;
}

.filters-row input,
.filters-row select {
  padding: 9px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  background: var(--bg-input);
  color: var(--text-primary);
  outline: none;
  min-width: 140px;
  transition: var(--transition);
  height: 40px;
}

.filters-row input:focus,
.filters-row select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* ---------- Table Styles ---------- */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  min-width: 700px;
}

thead {
  position: sticky;
  top: 0;
  z-index: 5;
}

th {
  background: var(--bg-sidebar);
  color: var(--text-sidebar-active);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 0.7rem;
  padding: 12px 10px;
  border-bottom: 2px solid rgba(255,255,255,0.1);
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: var(--transition);
}

th:hover {
  background: var(--bg-sidebar-hover);
  color: var(--text-white);
}

th::after {
  content: " ↕";
  font-size: 0.65rem;
  opacity: 0.5;
  margin-left: 2px;
}

th.sort-asc::after {
  content: " ↑";
  opacity: 1;
  color: var(--accent);
}

th.sort-desc::after {
  content: " ↓";
  opacity: 1;
  color: var(--accent);
}

td {
  padding: 10px 10px;
  border-bottom: 1px solid var(--border-color);
  text-align: center;
  color: var(--text-primary);
  font-size: 0.85rem;
  vertical-align: middle;
}

/* Numeric cells - monospace for alignment */
td:nth-child(6),
td:nth-child(7),
td:nth-child(8),
td:nth-child(9) {
  font-family: 'SF Mono', 'Consolas', 'Liberation Mono', monospace;
  font-weight: 600;
  letter-spacing: 0.2px;
}

tbody tr {
  transition: background 0.15s ease;
}

tbody tr:hover {
  background: var(--accent-light) !important;
}

tbody tr:nth-child(even) {
  background: rgba(0,0,0,0.02);
}

.theme-dark tbody tr:nth-child(even) {
  background: rgba(255,255,255,0.03);
}

/* Empty state */
tbody tr.empty-state td {
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  text-align: center;
  border-bottom: none;
}

tbody tr.empty-state td::before {
  content: "📋 ";
  font-size: 1.4rem;
  display: block;
  margin-bottom: 8px;
}

/* Status badge in table */
.status-badge {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-white);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  min-width: 80px;
}

/* ---------- Charts ---------- */
.chart-card {
  padding: 18px 20px;
}

.chart-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
  margin-top: 10px;
}

.chart-item {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 12px;
  min-height: 320px;
  position: relative;
}

.chart-item h3 {
  margin: 0 0 10px;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.chart-item canvas {
  width: 100% !important;
  height: 260px !important;
}

/* ---------- Reports Section ---------- */
.report-card {
  padding: 18px 22px;
}

.entry-card {
  padding: 20px 22px;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ---------- Mobile Hamburger ---------- */
.mobile-toggle {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1100;
  background: var(--bg-sidebar);
  color: var(--text-white);
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: var(--shadow-md);
}

/* ---------- Responsive Design ---------- */
@media (max-width: 1024px) {
  main {
    padding: 18px;
  }

  .chart-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .mobile-toggle {
    display: block;
  }

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

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

  main {
    margin-left: 0;
    padding: 14px;
    padding-top: 56px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .page-header h1 {
    font-size: 1.3rem;
  }

  .form-grid {
    grid-template-columns: 1fr 1fr;
  }

  .sample-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .metrics-grid {
    grid-template-columns: 1fr 1fr;
  }

  .calc-row {
    grid-template-columns: 1fr 1fr;
  }

  .filters-row {
    flex-direction: column;
  }

  .filters-row input,
  .filters-row select {
    width: 100%;
    min-width: unset;
  }

  table {
    font-size: 0.78rem;
  }

  th, td {
    padding: 8px 6px;
  }
}

@media (max-width: 480px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

  .sample-grid {
    grid-template-columns: 1fr 1fr;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .calc-row {
    grid-template-columns: 1fr;
  }

  main {
    padding: 12px;
    padding-top: 52px;
  }

  .card {
    padding: 14px;
  }
}

/* ---------- Validation Error Styling ---------- */
.validation-error {
  border-color: var(--danger) !important;
  background: var(--danger-light) !important;
  animation: shake 0.3s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.validation-error-message {
  color: var(--danger);
  font-size: 0.75rem;
  margin-top: 4px;
  display: block;
  font-weight: 600;
  animation: fadeIn 0.2s ease-in;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Scale Status Panel ---------- */
.scale-status-card {
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--accent-light) 100%);
  border: 2px solid var(--border-color);
  padding: 16px 20px;
}

.scale-status-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.scale-status-header h3 {
  margin: 0;
  font-size: 1rem;
}

.scale-status-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  position: relative;
}

.status-dot.disconnected {
  background: var(--danger);
  box-shadow: 0 0 0 0 rgba(210, 63, 63, 0.7);
  animation: pulse-red 2s infinite;
}

.status-dot.connected {
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(47, 156, 77, 0.7);
  animation: pulse-green 2s infinite;
}

@keyframes pulse-red {
  0% {
    box-shadow: 0 0 0 0 rgba(210, 63, 63, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(210, 63, 63, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(210, 63, 63, 0);
  }
}

@keyframes pulse-green {
  0% {
    box-shadow: 0 0 0 0 rgba(47, 156, 77, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(47, 156, 77, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(47, 156, 77, 0);
  }
}

.status-text {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-text.disconnected {
  color: var(--danger);
}

.status-text.connected {
  color: var(--success);
}

.scale-status-details {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.scale-port-info {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.scale-port-info::before {
  content: "🔌";
  font-size: 1rem;
}

#scaleConnectBtn {
  min-width: 160px;
}

#scaleConnectBtn.connected {
  background: var(--danger);
  box-shadow: 0 2px 8px rgba(210, 63, 63, 0.3);
}

#scaleConnectBtn.connected:hover {
  background: #b83535;
  box-shadow: 0 4px 12px rgba(210, 63, 63, 0.4);
}

/* ---------- Sample Input Groups ---------- */
.sample-input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sample-input-group label {
  margin-bottom: 0;
}

.sample-buttons {
  display: flex;
  gap: 4px;
}

.sample-btn {
  flex: 1;
  padding: 5px 6px;
  font-size: 0.68rem;
  font-weight: 600;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  background: var(--bg-card);
  color: var(--text-primary);
  text-align: center;
  line-height: 1.2;
}

.sample-btn:hover {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
}

.sample-btn:active {
  transform: scale(0.97);
}

.add-weight-btn {
  background: var(--success-light);
  color: var(--success);
  border-color: var(--success);
}

.add-weight-btn:hover {
  background: var(--success);
  color: var(--text-white);
}

.start-stop-btn {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent);
}

.start-stop-btn:hover {
  background: var(--accent);
  color: var(--text-white);
}

.start-stop-btn.reading {
  background: var(--warning);
  color: var(--text-white);
  border-color: var(--warning);
  animation: pulse-warning 1.5s infinite;
}

@keyframes pulse-warning {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(232, 168, 56, 0.7);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(232, 168, 56, 0);
  }
}

/* ---------- Utility Classes ---------- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
