/* =====================================================
   LIMS - Sistema de Gerenciamento Laboratorial de Solos
   Estilos Principais
   ===================================================== */

:root {
  --primary:       #2e7d32;
  --primary-dark:  #1b5e20;
  --primary-light: #4caf50;
  --accent:        #f9a825;
  --accent-dark:   #f57f17;
  --bg:            #f4f6f4;
  --sidebar-bg:    #1b2e1c;
  --sidebar-text:  #c8e6c9;
  --white:         #ffffff;
  --card-bg:       #ffffff;
  --border:        #dde5de;
  --text-primary:  #1a2e1b;
  --text-secondary:#4a6b4c;
  --text-muted:    #7a9b7c;
  --danger:        #c62828;
  --danger-light:  #ffebee;
  --warning:       #e65100;
  --warning-light: #fff3e0;
  --info:          #01579b;
  --info-light:    #e1f5fe;
  --success:       #2e7d32;
  --success-light: #e8f5e9;
  --shadow-sm:     0 1px 4px rgba(0,0,0,0.08);
  --shadow-md:     0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg:     0 8px 32px rgba(0,0,0,0.13);
  --radius:        10px;
  --radius-sm:     6px;
  --radius-lg:     16px;
  --sidebar-w:     260px;
  --topbar-h:      64px;
  --transition:    0.22s cubic-bezier(.4,0,.2,1);
}

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

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

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
}

/* ===================== SIDEBAR ===================== */
#sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
}

#sidebar .sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

#sidebar .sidebar-logo .logo-icon {
  width: 40px; height: 40px;
  background: var(--primary-light);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}

#sidebar .sidebar-logo .logo-text {
  display: flex; flex-direction: column;
}
#sidebar .sidebar-logo .logo-text span:first-child {
  font-size: 1.05rem; font-weight: 700; color: #fff; letter-spacing: .5px;
}
#sidebar .sidebar-logo .logo-text span:last-child {
  font-size: 0.7rem; color: var(--sidebar-text); letter-spacing: .5px;
}

#sidebar nav { flex: 1; padding: 14px 0; overflow-y: auto; }

#sidebar nav .nav-group-label {
  font-size: 0.65rem; font-weight: 600; letter-spacing: 1.5px;
  color: var(--text-muted); text-transform: uppercase;
  padding: 12px 20px 4px;
}

#sidebar nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.875rem;
  border-radius: 0;
  transition: background var(--transition), color var(--transition);
  position: relative;
}
#sidebar nav a i { width: 18px; text-align: center; font-size: 0.95rem; }
#sidebar nav a:hover { background: rgba(255,255,255,0.07); color: #fff; }
#sidebar nav a.active {
  background: rgba(76,175,80,0.18);
  color: #a5d6a7;
  font-weight: 600;
}
#sidebar nav a.active::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--primary-light);
  border-radius: 0 3px 3px 0;
}

#sidebar .sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.07);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

/* ===================== MAIN LAYOUT ===================== */
#main-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

#topbar {
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow-sm);
}

#topbar .topbar-left {
  display: flex; align-items: center; gap: 16px;
}
#topbar .page-title {
  font-size: 1.1rem; font-weight: 600; color: var(--text-primary);
}
#topbar .page-subtitle {
  font-size: 0.78rem; color: var(--text-muted);
}

#topbar .topbar-right {
  display: flex; align-items: center; gap: 14px;
}

#topbar .btn-menu-toggle {
  display: none;
  background: none; border: none; cursor: pointer;
  color: var(--text-primary); font-size: 1.3rem; padding: 4px;
}

#content {
  flex: 1;
  padding: 28px;
  overflow-y: auto;
}

/* ===================== VIEWS ===================== */
.view { display: none; }
.view.active { display: block; }

/* ===================== CARDS ===================== */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin-bottom: 20px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}
.card-title {
  font-size: 1rem; font-weight: 600; color: var(--text-primary);
  display: flex; align-items: center; gap: 8px;
}
.card-title i { color: var(--primary); }

/* ===================== STAT CARDS ===================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex; align-items: center; gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-card .stat-icon {
  width: 48px; height: 48px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; flex-shrink: 0;
}
.stat-card .stat-info .stat-value {
  font-size: 1.7rem; font-weight: 700; line-height: 1;
  color: var(--text-primary);
}
.stat-card .stat-info .stat-label {
  font-size: 0.75rem; color: var(--text-muted); margin-top: 4px;
}
.stat-icon.green  { background: var(--success-light); color: var(--success); }
.stat-icon.amber  { background: var(--warning-light); color: var(--warning); }
.stat-icon.blue   { background: var(--info-light);    color: var(--info);    }
.stat-icon.red    { background: var(--danger-light);  color: var(--danger);  }

/* ===================== BUTTONS ===================== */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 18px; border-radius: var(--radius-sm);
  font-size: 0.85rem; font-weight: 500;
  border: none; cursor: pointer;
  transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }

.btn-primary   { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); box-shadow: var(--shadow-md); }

.btn-success   { background: var(--primary-light); color: #fff; }
.btn-success:hover { background: var(--primary); }

.btn-outline   { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.btn-outline:hover { background: var(--success-light); }

.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b71c1c; }

.btn-warning   { background: var(--accent); color: #fff; }
.btn-warning:hover { background: var(--accent-dark); }

.btn-ghost     { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg); }

.btn-sm { padding: 5px 12px; font-size: 0.78rem; }
.btn-lg { padding: 11px 26px; font-size: 0.95rem; }

/* ===================== TABLES ===================== */
.table-wrap { overflow-x: auto; }
table {
  width: 100%; border-collapse: collapse;
  font-size: 0.85rem;
}
thead th {
  background: var(--bg);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600; font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: .5px;
  border-bottom: 2px solid var(--border);
}
tbody tr { border-bottom: 1px solid var(--border); transition: background var(--transition); }
tbody tr:hover { background: #f0f7f0; }
tbody td { padding: 10px 14px; color: var(--text-primary); vertical-align: middle; }
tbody td .actions { display: flex; gap: 6px; }

/* ===================== BADGES ===================== */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 0.72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .4px;
}
.badge-success  { background: var(--success-light); color: var(--success); }
.badge-warning  { background: var(--warning-light); color: var(--warning); }
.badge-info     { background: var(--info-light);    color: var(--info);    }
.badge-danger   { background: var(--danger-light);  color: var(--danger);  }
.badge-gray     { background: #eceff1; color: #546e7a; }

/* ===================== FORMS ===================== */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.form-grid-3 { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.form-grid-2 { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }

.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full-width { grid-column: 1 / -1; }

label {
  font-size: 0.78rem; font-weight: 600;
  color: var(--text-secondary);
  display: flex; align-items: center; gap: 5px;
}
label .label-hint { font-weight: 400; color: var(--text-muted); font-style: italic; }

input[type="text"],
input[type="number"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="datetime-local"],
select, textarea {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--text-primary);
  background: #fff;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(46,125,50,.12);
}
input[readonly] { background: var(--bg); color: var(--text-muted); }
textarea { resize: vertical; min-height: 80px; }

.field-unit {
  display: flex; align-items: stretch; gap: 0;
}
.field-unit input { border-radius: var(--radius-sm) 0 0 var(--radius-sm); flex: 1; }
.field-unit .unit-label {
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 0 10px;
  font-size: 0.75rem; color: var(--text-muted);
  display: flex; align-items: center; white-space: nowrap;
}

.result-field {
  background: #e8f5e9 !important;
  border-color: var(--primary-light) !important;
  color: var(--primary-dark) !important;
  font-weight: 600;
}

/* ===================== SECTION BLOCKS ===================== */
.section-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  margin-bottom: 18px;
}
.section-block-title {
  font-size: 0.8rem; font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .8px;
  margin-bottom: 14px;
  display: flex; align-items: center; gap: 7px;
}
.section-block-title i { color: var(--primary); }
.section-block-title .section-badge {
  background: var(--primary); color: #fff;
  font-size: 0.65rem; padding: 2px 7px;
  border-radius: 10px; text-transform: none; letter-spacing: 0;
}

/* ===================== SEARCH BAR ===================== */
.search-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.search-input-wrap {
  position: relative; flex: 1; min-width: 200px;
}
.search-input-wrap i {
  position: absolute; left: 10px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}
.search-input-wrap input {
  padding-left: 32px;
}

/* ===================== MODAL ===================== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 720px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(30px);
  transition: transform var(--transition);
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal.modal-lg { max-width: 960px; }
.modal.modal-xl { max-width: 1200px; }

.modal-header {
  padding: 20px 24px 0;
  display: flex; align-items: flex-start; justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px; margin-bottom: 0;
}
.modal-title { font-size: 1rem; font-weight: 700; color: var(--text-primary); }
.modal-subtitle { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 1.2rem; padding: 4px;
  transition: color var(--transition);
}
.modal-close:hover { color: var(--danger); }
.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
}

/* ===================== EMPTY STATE ===================== */
.empty-state {
  text-align: center; padding: 52px 20px;
  color: var(--text-muted);
}
.empty-state i { font-size: 3rem; margin-bottom: 14px; opacity: .45; }
.empty-state h3 { font-size: 1rem; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state p  { font-size: 0.85rem; }

/* ===================== ALERTS ===================== */
.alert {
  padding: 12px 16px; border-radius: var(--radius-sm);
  font-size: 0.85rem; display: flex; gap: 10px; align-items: flex-start;
  margin-bottom: 16px;
}
.alert i { margin-top: 2px; flex-shrink: 0; }
.alert-info    { background: var(--info-light);    color: var(--info);    border-left: 3px solid var(--info); }
.alert-success { background: var(--success-light); color: var(--success); border-left: 3px solid var(--success); }
.alert-warning { background: var(--warning-light); color: var(--warning); border-left: 3px solid var(--warning); }
.alert-danger  { background: var(--danger-light);  color: var(--danger);  border-left: 3px solid var(--danger); }

/* ===================== TOAST ===================== */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 9999; display: flex; flex-direction: column; gap: 10px;
}
.toast {
  background: var(--sidebar-bg); color: #fff;
  padding: 12px 20px; border-radius: var(--radius-sm);
  font-size: 0.85rem; display: flex; align-items: center; gap: 10px;
  box-shadow: var(--shadow-lg);
  animation: toastIn .3s ease;
  min-width: 280px; max-width: 400px;
}
.toast.toast-success { border-left: 4px solid var(--primary-light); }
.toast.toast-error   { border-left: 4px solid var(--danger); }
.toast.toast-warning { border-left: 4px solid var(--accent); }
@keyframes toastIn { from { transform: translateX(60px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ===================== LAUDO ===================== */
.laudo-section { margin-bottom: 24px; }
.laudo-section-title {
  font-size: 0.85rem; font-weight: 700;
  background: var(--primary);
  color: #fff;
  padding: 7px 14px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.laudo-table { width: 100%; border-collapse: collapse; }
.laudo-table th {
  background: #e8f5e9; font-size: 0.75rem; font-weight: 600;
  color: var(--text-secondary); padding: 8px 12px; text-align: left;
  border: 1px solid var(--border);
}
.laudo-table td {
  padding: 8px 12px; font-size: 0.85rem;
  border: 1px solid var(--border);
}
.laudo-table tr:nth-child(even) td { background: #f9fbe7; }
.laudo-param { font-weight: 600; color: var(--text-primary); }
.laudo-val   { color: var(--primary-dark); font-weight: 700; }
.laudo-unit  { color: var(--text-muted); font-size: 0.75rem; }

/* ===================== BREADCRUMB ===================== */
.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.78rem; color: var(--text-muted);
  margin-bottom: 18px;
}
.breadcrumb span { color: var(--text-muted); }
.breadcrumb a { color: var(--primary); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { color: var(--border); }

/* ===================== TABS ===================== */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab-btn {
  padding: 10px 20px; background: none; border: none; cursor: pointer;
  font-size: 0.85rem; font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: color var(--transition), border-color var(--transition);
  display: flex; align-items: center; gap: 7px;
}
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 700; }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ===================== CHECKBOX GROUP ===================== */
.checkbox-group { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.checkbox-group label { font-weight: 400; cursor: pointer; gap: 6px; font-size: 0.85rem; }
.checkbox-group input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 900px) {
  #sidebar {
    transform: translateX(-100%);
  }
  #sidebar.open { transform: translateX(0); }
  #main-wrapper { margin-left: 0; }
  #topbar .btn-menu-toggle { display: block; }
  #content { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 550px) {
  .stats-grid { grid-template-columns: 1fr; }
  .form-grid, .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .modal { border-radius: var(--radius); }
}

/* ===================== UTILS ===================== */
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 8px !important; }
.mt-2 { margin-top: 16px !important; }
.mt-3 { margin-top: 24px !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 8px !important; }
.mb-2 { margin-bottom: 16px !important; }
.flex   { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1  { gap: 8px; }
.gap-2  { gap: 16px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted  { color: var(--text-muted) !important; }
.text-danger { color: var(--danger) !important; }
.text-success{ color: var(--success) !important; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.w-full { width: 100%; }
.d-none { display: none !important; }

/* ===================== SELEÇÃO DE LINHAS (AMOSTRAS) ===================== */
tr.tr-selected td {
  background: var(--success-light) !important;
}
tr.tr-selected:hover td {
  background: #d0ead2 !important;
}

/* ===================== PRINT ===================== */
@media print {
  #sidebar, #topbar, .btn, .modal-overlay, #toast-container { display: none !important; }
  #main-wrapper { margin-left: 0 !important; }
  #content { padding: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #ccc !important; }
}

/* ===================== BADGE PURPLE ===================== */
.badge-purple {
  background: #ede7f6;
  color: #512da8;
}

/* ===================== BTN SUCCESS ===================== */
.btn-success {
  background: var(--primary);
  color: #fff;
  border: none;
}
.btn-success:hover { background: var(--primary-dark); }

/* ===================== MINI-STATS (DASHBOARD QUALIDADE) ===================== */
.mini-stat {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  text-align: center;
}
.mini-stat.mini-warn { border-color: var(--warning); background: var(--warning-light); }
.mini-stat-val {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary-dark);
  line-height: 1;
  margin-bottom: 4px;
}
.mini-stat.mini-warn .mini-stat-val { color: var(--warning); }
.mini-stat-label {
  font-size: 0.73rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ===================== TECLADO (kbd) ===================== */
kbd {
  display: inline-block;
  padding: 1px 6px;
  font-size: .72rem;
  font-family: monospace;
  background: var(--bg);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* ===================== TABELA DE REGISTRO EM LOTE ===================== */
#tabela-lote-amostras input[type="text"] {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  font-size: .83rem;
  font-family: inherit;
  color: var(--text-primary);
  background: #fff;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
#tabela-lote-amostras input[type="text"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(46,125,50,.12);
}
#tabela-lote-amostras tr:hover td {
  background: var(--success-light);
}
#tabela-lote-amostras tr:hover input[type="text"] {
  background: #fff;
}

/* ===================== ALERT DANGER ===================== */
.alert-danger {
  background: var(--danger-light);
  border-left: 4px solid var(--danger);
  color: var(--danger);
}

/* ===================== ALERT SUCCESS ===================== */
.alert-success {
  background: var(--success-light);
  border-left: 4px solid var(--success);
  color: var(--success);
}

/* ===================== BADGE PURPLE (Densidade) ===================== */
.badge-purple {
  background: #ede7f6;
  color: #4527a0;
  border: 1px solid #b39ddb;
}

/* ===================== TEXT UTILITIES ===================== */
.text-success  { color: var(--success) !important; }
.text-danger   { color: var(--danger)  !important; }
.text-warning  { color: var(--warning) !important; }
.fw-700        { font-weight: 700 !important; }

/* ===================== LAUDO – MODAL BODY ===================== */
#laudo-body {
  font-size: .84rem;
  line-height: 1.6;
  color: var(--text-primary);
}

.laudo-section {
  margin-bottom: 22px;
}

.laudo-section-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--primary-dark);
  border-bottom: 2px solid var(--primary);
  padding-bottom: 5px;
  margin-bottom: 12px;
}

.laudo-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .8rem;
}
.laudo-table th,
.laudo-table td {
  border: 1px solid #dde5de;
  padding: 5px 8px;
  vertical-align: top;
}
.laudo-table thead tr {
  background: #ecf4ec;
}
.laudo-table th {
  font-weight: 600;
  color: var(--text-secondary);
  background: #f5f8f5;
  white-space: nowrap;
}
.laudo-table tr:nth-child(even) td {
  background: #fafcfa;
}
.laudo-param  { font-weight: 600; color: var(--text-primary); }
.laudo-val    { font-weight: 700; color: var(--primary-dark); text-align: right; }
.laudo-unit   { color: var(--text-muted); font-size: .75rem; text-align: center; }

/* ===================== PRINT – LAUDO ===================== */
@media print {
  #sidebar,
  #topbar,
  .modal-header button,
  #toast-container,
  .btn-success,
  .btn-outline { display: none !important; }

  body { background: #fff !important; }

  .modal-overlay {
    position: static !important;
    background: none !important;
  }
  .modal {
    box-shadow: none !important;
    max-height: none !important;
    overflow: visible !important;
    border-radius: 0 !important;
  }
  .modal-body {
    max-height: none !important;
    overflow: visible !important;
    padding: 8px !important;
  }
  .laudo-section { page-break-inside: avoid; }
  .laudo-table   { font-size: .72rem; }
}

/* ===================== DASH GRID RESPONSIVE ===================== */
@media (max-width: 700px) {
  .dash-grid { grid-template-columns: 1fr !important; }
}

/* ===================== SECTION BLOCK BADGE ===================== */
.section-badge {
  display: inline-block;
  font-size: .68rem;
  font-weight: 600;
  background: var(--success-light);
  color: var(--success);
  border: 1px solid #a5d6a7;
  border-radius: 20px;
  padding: 1px 8px;
  margin-left: 6px;
  vertical-align: middle;
}

/* ===================== LABEL HINT ===================== */
.label-hint {
  font-size: .72rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* ===================== FIELD-UNIT ===================== */
.field-unit {
  display: flex;
  align-items: center;
  gap: 0;
}
.field-unit input {
  flex: 1;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm) !important;
}
.unit-label {
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 0 9px;
  font-size: .75rem;
  color: var(--text-muted);
  height: 38px;
  display: flex;
  align-items: center;
  white-space: nowrap;
}

/* ===================== RESULT FIELD ===================== */
.result-field {
  background: #e8f5e9 !important;
  color: var(--primary-dark) !important;
  font-weight: 600 !important;
  cursor: default;
}

/* ===================== SECTION BLOCK ===================== */
.section-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 14px;
}
.section-block-title {
  font-size: .82rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ===================== CHECKBOX GROUP ===================== */
.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: .84rem;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
}
.checkbox-group input[type=checkbox] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

/* ===================== BTN SIZES ===================== */
.btn-sm {
  padding: 4px 10px;
  font-size: .75rem;
  height: auto;
}

/* ===================== FORM GRID 3 ===================== */
.form-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}
@media (max-width: 900px) {
  .form-grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .form-grid-3 { grid-template-columns: 1fr; }
}

/* ===================== MODAL LG / XL ===================== */
.modal-lg  { max-width: 760px; }
.modal-xl  { max-width: 1000px; }

/* ===================== MT / MB UTILITIES ===================== */
.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }

/* ===================== LOTES DE ANÁLISE ===================== */

/* Card de seleção de amostra no modal de lote */
.amostra-card-select {
  transition: background .15s, border-color .15s, box-shadow .15s;
  user-select: none;
}
.amostra-card-select:hover {
  box-shadow: var(--shadow-sm);
  border-color: var(--primary-light) !important;
}

/* Barra de progresso inline na tabela */
.barra-progresso-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.barra-progresso-track {
  flex: 1;
  background: var(--border);
  border-radius: 20px;
  height: 7px;
  overflow: hidden;
}
.barra-progresso-fill {
  height: 100%;
  border-radius: 20px;
  transition: width .4s ease;
}

/* Badge de prioridade no lote */
.badge-express {
  background: #ffebee;
  color: var(--danger);
  border: 1px solid #ef9a9a;
  font-weight: 700;
}
.badge-urgente {
  background: var(--warning-light);
  color: var(--warning);
  border: 1px solid #ffcc80;
  font-weight: 700;
}

/* Detalhe do lote – grid de mini-stats */
#lote-detalhe-body .mini-stat {
  padding: 14px 12px;
}

/* Grid de amostras no modal de lote – scrollbar estilizada */
#lote-amostras-grid::-webkit-scrollbar {
  width: 6px;
}
#lote-amostras-grid::-webkit-scrollbar-track {
  background: var(--bg);
  border-radius: 3px;
}
#lote-amostras-grid::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
#lote-amostras-grid::-webkit-scrollbar-thumb:hover {
  background: var(--primary-light);
}

/* Linha de amostra concluída no detalhe do lote */
tr.lote-amostra-ok td {
  background: #f1f8e9 !important;
}

/* Contador de seleção no badge do section-block */
#lote-contador-badge {
  background: var(--primary);
  color: #fff;
  border: none;
  font-size: .72rem;
  padding: 2px 10px;
  border-radius: 20px;
  transition: background .2s;
}

/* Tabela de detalhe do lote */
#lote-detalhe-body .table-wrap {
  max-height: 420px;
  overflow-y: auto;
}

/* Atalhos rápidos de bancada no detalhe do lote */
#lote-detalhe-body .card {
  border-radius: var(--radius-sm);
  background: var(--bg) !important;
}

/* Responsivo – modal xl em telas menores */
@media (max-width: 1060px) {
  .modal-xl { max-width: 98vw; }
}
@media (max-width: 700px) {
  #lote-amostras-grid {
    grid-template-columns: 1fr !important;
  }
  .modal-xl, .modal-lg { max-width: 99vw; }
}

/* ===================== LOTE DETALHE – RODAPÉ AÇÕES ===================== */
#modal-lote-detalhe .modal-body {
  padding-bottom: 20px;
}

