/* =========================
   GLOBAL RESET & BASE
========================= */
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --primary: #2E7D32;
  --primary-dark: #1B5E20;
  --primary-light: #4CAF50;
  --primary-lighter: #E8F5E9;
  --accent: #388E3C;
  --danger: #C62828;
  --danger-dark: #B71C1C;
  --warning: #F57C00;
  --info: #1976D2;
  --success: #2E7D32;
  --text: #2c2c2c;
  --text-muted: #6f6f6f;
  --bg: #f4f6f8;
  --card-bg: #ffffff;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-hover: 0 8px 24px rgba(46, 125, 50, 0.15);
  --radius: 16px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  font-family: "Segoe UI", "Roboto", -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  background: linear-gradient(135deg, #f4f6f8 0%, #e8f5e9 100%);
  margin: 0;
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

.container {
  padding: 20px 16px;
  max-width: 1200px;
  margin: 0 auto;
}

.page-title {
  margin-bottom: 20px;
  font-weight: 700;
  font-size: 1.75rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-align: center;
}

h2 {
  color: var(--primary);
  text-align: center;
  margin-bottom: 24px;
  font-weight: 700;
  font-size: 1.5rem;
  position: relative;
  padding-bottom: 12px;
}

h2::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: 2px;
}

/* =========================
   TOP NAVIGATION
========================= */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  box-shadow: 0 4px 20px rgba(46, 125, 50, 0.2);
  position: relative;
  overflow: hidden;
}

.top-nav::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #4CAF50, #81C784, #4CAF50);
  animation: shimmer 3s infinite linear;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.top-nav a {
  color: white;
  margin-left: 20px;
  text-decoration: none;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 8px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.top-nav a::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.top-nav a:hover::before {
  left: 100%;
}

.top-nav a:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* =========================
   CARDS & LISTS
========================= */
.card-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
  transition: var(--transition);
  border: 1px solid rgba(46, 125, 50, 0.1);
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  opacity: 0;
  transition: opacity 0.3s;
}

.card:hover::before {
  opacity: 1;
}

.card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-hover);
  border-color: rgba(46, 125, 50, 0.3);
}

.card:active {
  transform: translateY(-3px);
  transition: transform 0.1s;
}

/* FIX: Hardware title with dot - KEEP ON SAME LINE */
.card h3 {
  margin: 0 0 12px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  white-space: nowrap; /* Prevent wrapping */
  overflow: hidden;
}

/* FIX: Dot styling */
.card h3::before {
  content: '';
  width: 10px;
  height: 10px;
  background: var(--primary);
  border-radius: 50%;
  display: inline-block;
  margin-right: 10px;
  flex-shrink: 0; /* Prevent dot from shrinking */
}

/* Hardware ID styling */
.card h3 span.id {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: normal;
  margin-left: 8px;
  white-space: nowrap;
}

.card p {
  margin: 8px 0;
  font-size: 0.95rem;
  line-height: 1.5;
}

.card p strong {
  font-weight: 600;
  color: var(--primary);
}

.card.empty {
  text-align: center;
  color: var(--text-muted);
  padding: 48px 24px;
  background: rgba(76, 175, 80, 0.05);
  border: 2px dashed rgba(46, 125, 50, 0.3);
}

.card.empty::before {
  content: '💧';
  font-size: 2rem;
  display: block;
  margin-bottom: 12px;
}

/* =========================
   STATUS INDICATORS
========================= */
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  margin: 4px 0;
}

.status.online {
  background: rgba(46, 125, 50, 0.1);
  color: var(--primary);
}

.status.offline {
  background: rgba(198, 40, 40, 0.1);
  color: var(--danger);
}

.status::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* =========================
   TEXT HELPERS
========================= */
.muted {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* =========================
   DECISION BLOCKS
========================= */
.decision {
  background: linear-gradient(135deg, var(--primary-lighter) 0%, #ffffff 100%);
  border-left: 8px solid var(--primary);
  position: relative;
  overflow: hidden;
}

.decision::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transform: translateX(-100%);
}

.decision:hover::after {
  animation: shine 1s;
}

@keyframes shine {
  100% { transform: translateX(100%); }
}

.decision.on {
  background: linear-gradient(135deg, #FFEBEE 0%, #ffffff 100%);
  border-left: 8px solid var(--danger);
}

.decision.off {
  background: linear-gradient(135deg, var(--primary-lighter) 0%, #ffffff 100%);
  border-left: 8px solid var(--primary);
}

/* =========================
   ALERTS
========================= */
.alert {
  padding: 20px;
  margin-bottom: 20px;
  border-radius: 12px;
  font-size: 0.95rem;
  line-height: 1.6;
  position: relative;
  overflow: hidden;
  border: none;
  box-shadow: var(--shadow);
  animation: slideIn 0.3s ease-out;
}

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

.alert::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 6px;
}

.alert.danger {
  background: linear-gradient(135deg, #FFEBEE 0%, #ffffff 100%);
  border-left: 6px solid var(--danger);
}

.alert.warning {
  background: linear-gradient(135deg, #FFF8E1 0%, #ffffff 100%);
  border-left: 6px solid var(--warning);
}

.alert.info {
  background: linear-gradient(135deg, #E3F2FD 0%, #ffffff 100%);
  border-left: 6px solid var(--info);
}

.alert.success {
  background: linear-gradient(135deg, #E8F5E9 0%, #ffffff 100%);
  border-left: 6px solid var(--success);
}

.alert strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1rem;
}

/* =========================
   BUTTONS
========================= */
.btn {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(46, 125, 50, 0.3);
}

.btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn:active::after {
  width: 300px;
  height: 300px;
}

.btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(46, 125, 50, 0.4);
}

.btn:active {
  transform: translateY(-1px);
}

.btn.danger {
  background: linear-gradient(135deg, var(--danger) 0%, var(--danger-dark) 100%);
  box-shadow: 0 4px 15px rgba(198, 40, 40, 0.3);
}

.btn.danger:hover {
  box-shadow: 0 8px 25px rgba(198, 40, 40, 0.4);
}

.btn-secondary {
  background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
  color: var(--text);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.btn-secondary:hover {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* =========================
   FORMS & INPUTS
========================= */
.form-group {
  margin-bottom: 24px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--primary);
  font-size: 0.95rem;
}

input, select, textarea {
  width: 100%;
  padding: 14px 16px;
  margin-top: 4px;
  border-radius: 12px;
  border: 2px solid #e0e0e0;
  font-size: 1rem;
  transition: var(--transition);
  background: white;
  font-family: inherit;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.1);
  transform: translateY(-2px);
}

input::placeholder {
  color: #bdbdbd;
}

/* =========================
   SETTINGS
========================= */
.settings-section {
  margin-top: 32px;
  padding: 24px;
  background: linear-gradient(135deg, #f1f8f4 0%, #ffffff 100%);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(46, 125, 50, 0.1);
}

.settings-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 24px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 600;
  transition: var(--transition);
  box-shadow: 0 4px 15px rgba(46, 125, 50, 0.3);
}

.settings-link:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(46, 125, 50, 0.4);
  gap: 12px;
}

/* =========================
   AUTH LINKS
========================= */
.auth-links {
  margin-top: 32px;
  text-align: center;
  padding: 20px;
  background: rgba(76, 175, 80, 0.05);
  border-radius: var(--radius);
}

.auth-links a {
  text-decoration: none;
  color: var(--primary);
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 8px;
  transition: var(--transition);
  display: inline-block;
}

.auth-links a:hover {
  background: rgba(46, 125, 50, 0.1);
  transform: translateY(-2px);
}

/* =========================
   OFFLINE BANNER
========================= */
.offline {
  background: linear-gradient(135deg, #ffcc00 0%, #ffb300 100%);
  padding: 16px;
  text-align: center;
  font-weight: 700;
  color: #5d4037;
  box-shadow: 0 4px 12px rgba(255, 193, 7, 0.3);
  animation: pulse-banner 2s infinite;
  position: relative;
  overflow: hidden;
}

@keyframes pulse-banner {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.9; }
}

/* =========================
   MODAL
========================= */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.3s ease-out;
  backdrop-filter: blur(4px);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal.hidden {
  display: none;
}

.modal-box {
  background: white;
  padding: 32px;
  border-radius: var(--radius);
  width: 100%;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: scaleIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border: 1px solid rgba(46, 125, 50, 0.2);
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-actions {
  display: flex;
  gap: 16px;
  margin-top: 32px;
}

.modal-actions .btn {
  flex: 1;
}

/* =========================
   MOBILE NAVIGATION
========================= */
.bottom-nav {
  display: none;
}

.hidden {
  display: none;
}

/* ============================= */
/* ✅ FARMER TOOLTIP SYSTEM (FIXED)
/* ============================= */
.tooltip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 6px;
  width: 22px;
  height: 22px;
  cursor: pointer;
}

.tooltip-icon {
  border: 2px solid var(--primary);
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 14px;
  font-weight: bold;
  background: #fff;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Tooltip bubble */
.tooltip-text {
  position: absolute;
  bottom: 140%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary-dark);
  color: #fff;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 0.85rem;
  line-height: 1.4;
  max-width: min(280px, 90vw);
  word-break: break-word;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  z-index: 9999;

  /* 🔥 critical fix */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

/* Arrow */
.tooltip-text::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: var(--primary-dark) transparent transparent transparent;
}

/* Show tooltip */
.tooltip:hover .tooltip-text,
.tooltip.active .tooltip-text {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* ============================= */
/* ✅ MOBILE TOOLTIP BEHAVIOR */
/* ============================= */
@media (max-width: 640px) {
  .tooltip {
    position: static;
  }

  .tooltip-text {
    position: fixed !important;
    left: 50% !important;
    bottom: 20px !important;
    transform: translateX(-50%) !important;
    width: calc(100vw - 32px);
    max-width: none;
    border-radius: 12px;
  }

  .tooltip-text::after {
    display: none;
  }
}

/* ============================= */
/* AI Feedback Card */
/* ============================= */
.ai-feedback-card {
    background: linear-gradient(135deg, #fff8f1 0%, #ffffff 100%);
    border-left: 6px solid #c96a1b;
    padding: 20px;
    margin-top: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.ai-feedback-card::before {
    content: '🤖';
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 1.5rem;
    opacity: 0.2;
}

.ai-feedback-header {
    font-weight: 700;
    font-size: 1rem;
    color: #5a2d0c;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-feedback-sub {
    font-size: 0.85rem;
    font-weight: normal;
    color: var(--text-muted);
    margin-left: auto;
}

.ai-feedback-body {
    font-size: 0.95rem;
    color: var(--text);
    line-height: 1.6;
    margin-top: 12px;
}

/* ============================= */
/* Grid Layout for Dashboard */
/* ============================= */
.grid {
  display: grid;
  gap: 20px;
  margin-top: 24px;
}

@media (min-width: 640px) {
  .grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ============================= */
/* Loading States */
/* ============================= */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(46, 125, 50, 0.3);
  border-radius: 50%;
  border-top-color: var(--primary);
  animation: spin 1s ease-in-out infinite;
  margin: 0 auto;
}

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

/* ============================= */
/* Badges */
/* ============================= */
.badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  margin: 4px;
}

.badge.success {
  background: rgba(46, 125, 50, 0.1);
  color: var(--primary);
}

.badge.warning {
  background: rgba(245, 124, 0, 0.1);
  color: var(--warning);
}

.badge.danger {
  background: rgba(198, 40, 40, 0.1);
  color: var(--danger);
}

/* ============================= */
/* Toggle Switch */
/* ============================= */
.toggle {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: var(--transition);
  border-radius: 34px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: var(--transition);
  border-radius: 50%;
}

input:checked + .toggle-slider {
  background-color: var(--primary);
}

input:checked + .toggle-slider:before {
  transform: translateX(26px);
}

/* ============================= */
/* Scrollbar Styling */
/* ============================= */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(46, 125, 50, 0.1);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-dark);
}

/* ============================= */
/* Print Styles */
/* ============================= */
@media print {
  .bottom-nav,
  .top-nav,
  .btn {
    display: none !important;
  }
  
  .container {
    padding: 0;
  }
}

/* ============================= */
/* MOBILE RESPONSIVE FIXES */
/* ============================= */

@media (max-width: 768px) {
  .top-nav {
    display: none;
  }

  .bottom-nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
    position: fixed;
    bottom: 0;
    width: 100%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 12px 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    z-index: 100;
  }

  .bottom-nav a {
    color: rgba(255, 255, 255, 0.7);
    font-size: 20px;
    text-decoration: none;
    padding: 8px;
    border-radius: 12px;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: 1;
    max-width: 80px;
  }

  .bottom-nav a span {
    font-size: 11px;
    font-weight: 600;
  }

  .bottom-nav a.active {
    color: white;
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-6px);
  }

  .bottom-nav a.active::before {
    content: '';
    position: absolute;
    top: -6px;
    width: 20px;
    height: 3px;
    background: white;
    border-radius: 2px;
  }

  body {
    overflow-x: hidden;
    width: 100%;
  }
  
  .container {
    padding: 16px 12px;
    width: 100%;
    max-width: 100%;
  }
  
  .page-container {
    padding-bottom: 80px;
    min-height: calc(100vh - 80px);
  }
  
  /* FIX: Page title centered on mobile */
  .page-title {
    font-size: 1.4rem;
    text-align: center; /* Keep centered */
    padding: 0 4px;
    margin-bottom: 16px;
    position: relative;
    padding-bottom: 12px;
  }
  
  .page-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px; /* Reasonable width for mobile */
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 2px;
  }
  
  /* FIX: h2 styling */
  h2 {
    font-size: 1.3rem;
    margin-bottom: 18px;
    padding-bottom: 10px;
    text-align: center; /* Keep centered */
  }
  
  h2::after {
    left: 50%;
    transform: translateX(-50%);
    width: 60px; /* Keep original width */
  }
  
  .card {
    padding: 18px 14px;
    width: 100%;
    margin: 0 0 16px 0;
  }
  
  /* FIX: Hardware title - dot and text on same line */
  .card h3 {
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    white-space: nowrap; /* Force on one line */
    overflow: hidden;
    text-overflow: ellipsis; /* Add ... if too long */
  }
  
  /* FIX: Active crop text */
  .card p {
    display: block;
    line-height: 1.5;
  }
  
  .card p strong {
    display: inline;
    font-weight: 600;
    color: var(--primary);
  }
  
  .decision {
    padding: 16px 12px;
  }
  
  .alert {
    padding: 16px;
    margin: 12px 0;
    font-size: 0.9rem;
  }
  
  .btn {
    padding: 14px;
    font-size: 0.95rem;
  }
  
  input, select, textarea {
    padding: 13px 14px;
    font-size: 16px;
  }
  
  .modal-box {
    padding: 24px 16px;
    margin: 12px;
    max-width: calc(100vw - 24px);
  }
  
  .modal-actions {
    flex-direction: column;
    gap: 10px;
  }
  
  .grid-2, .grid-3 {
    grid-template-columns: 1fr !important;
  }
  
  .status {
    padding: 5px 10px;
    font-size: 0.8rem;
    white-space: nowrap;
  }
}

/* Extra small devices (phones under 400px) */
@media (max-width: 400px) {
  .container {
    padding: 14px 10px;
  }
  
  .page-title {
    font-size: 1.3rem;
    margin-bottom: 14px;
    padding-bottom: 10px;
  }
  
  h2 {
    font-size: 1.2rem;
    margin-bottom: 16px;
    padding-bottom: 8px;
  }
  
  .card {
    padding: 16px 12px;
  }
  
  /* FIX: Hardware title on very small screens */
  .card h3 {
    font-size: 1rem;
  }
  
  /* Allow very long names to wrap but keep dot on same line */
  .card h3 {
    white-space: normal; /* Allow wrapping */
    flex-wrap: wrap;
    align-items: center;
  }
  
  .card h3::before {
    align-self: flex-start; /* Keep dot at top when wrapped */
    margin-top: 4px;
  }
  
  .card p {
    font-size: 0.9rem;
  }
  
  .card.empty {
    padding: 32px 16px;
  }
  
  .bottom-nav a {
    font-size: 18px;
    padding: 6px;
  }
  
  .bottom-nav a span {
    font-size: 10px;
  }
  
  .bottom-nav a.active {
    transform: translateY(-4px);
  }
  
  .muted {
    font-size: 0.85rem;
  }
  
  .settings-section {
    padding: 18px 14px;
  }
}

/* Fix for very small text overflow */
@media (max-width: 640px) {
  .card, .decision, .alert, .btn {
    word-break: break-word;
    overflow-wrap: break-word;
  }
  
  .ai-feedback-card {
    padding: 16px 12px;
  }
  
  .ai-feedback-header {
    flex-wrap: wrap;
  }
  
  .ai-feedback-sub {
    margin-left: 0;
    margin-top: 4px;
    width: 100%;
  }
}