/* ============================================================
   QMS — Quality Management System
   Global Stylesheet
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&family=Roboto+Condensed:wght@400;700&display=swap');

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

html { font-size: 16px; }

body {
  font-family: 'Roboto', sans-serif;
  font-weight: 400;
  color: #2d3748;
  background: #f0f2f5;
  min-height: 100vh;
}

a { color: #1a2e4a; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Variables ---- */
:root {
  --navy: #1a2e4a;
  --navy-light: #243d63;
  --navy-dark: #111e30;
  --accent: #2563eb;
  --green: #16a34a;
  --green-light: #dcfce7;
  --red: #dc2626;
  --red-light: #fee2e2;
  --yellow: #d97706;
  --yellow-light: #fef3c7;
  --grey-50: #f9fafb;
  --grey-100: #f3f4f6;
  --grey-200: #e5e7eb;
  --grey-300: #d1d5db;
  --grey-500: #6b7280;
  --grey-700: #374151;
  --white: #ffffff;
  --sidebar-width: 240px;
  --header-height: 64px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.10);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.14);
  --radius: 6px;
  --radius-lg: 10px;
}

/* ============================================================
   LAYOUT
   ============================================================ */

.layout {
  display: flex;
  min-height: 100vh;
}

/* ---- Top Header ---- */
.top-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--navy);
  color: var(--white);
  display: flex;
  align-items: center;
  padding: 0 24px;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.top-header .header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  width: var(--sidebar-width);
  flex-shrink: 0;
}

.top-header .header-brand .brand-icon {
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,0.15);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.top-header .brand-title {
  font-family: 'Roboto Condensed', sans-serif;
  font-weight: 700;
  font-size: 15px;
  line-height: 1.2;
  letter-spacing: 0.3px;
}

.top-header .header-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: 24px;
}

.top-header .lab-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 20px;
  padding: 4px 14px 4px 8px;
  font-size: 13px;
}

.top-header .lab-badge .badge-dot {
  width: 8px;
  height: 8px;
  background: #4ade80;
  border-radius: 50%;
  flex-shrink: 0;
}

.top-header .lab-badge .lab-name {
  font-weight: 500;
  color: #e2e8f0;
}

.top-header .lab-badge .lab-type {
  color: rgba(255,255,255,0.55);
  font-size: 12px;
}

.top-header .header-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-header .user-info {
  text-align: right;
}

.top-header .user-name {
  font-weight: 500;
  font-size: 14px;
  color: #e2e8f0;
}

.top-header .user-role {
  font-size: 12px;
  color: rgba(255,255,255,0.55);
}

.top-header .user-avatar {
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: var(--white);
  flex-shrink: 0;
}

.top-header .logout-btn {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--white);
  padding: 6px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s;
}

.top-header .logout-btn:hover {
  background: rgba(255,255,255,0.2);
  text-decoration: none;
}

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--navy-dark);
  position: fixed;
  top: var(--header-height);
  bottom: 0;
  left: 0;
  overflow-y: auto;
  z-index: 50;
  padding: 16px 0;
}

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

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
  padding: 16px 20px 6px;
}

.nav-item {
  display: block;
  padding: 9px 20px;
  color: rgba(255,255,255,0.7);
  font-size: 13.5px;
  transition: all 0.15s;
  border-left: 3px solid transparent;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-item:hover {
  background: rgba(255,255,255,0.06);
  color: var(--white);
  text-decoration: none;
  border-left-color: rgba(255,255,255,0.2);
}

.nav-item.active {
  background: rgba(37, 99, 235, 0.2);
  color: var(--white);
  border-left-color: var(--accent);
  font-weight: 500;
}

.nav-item .nav-icon {
  width: 18px;
  text-align: center;
  opacity: 0.8;
  flex-shrink: 0;
}

.nav-sub {
  padding-left: 16px;
}

.nav-sub .nav-item {
  font-size: 13px;
  padding: 7px 20px 7px 16px;
}

.nav-divider {
  height: 1px;
  background: rgba(255,255,255,0.08);
  margin: 8px 0;
}

/* ---- Main Content ---- */
.main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--header-height);
  flex: 1;
  padding: 28px 32px;
  min-height: calc(100vh - var(--header-height));
}

/* ============================================================
   PAGE ELEMENTS
   ============================================================ */

/* ---- Page Header ---- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-title {
  font-family: 'Roboto Condensed', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-title .page-icon {
  width: 36px;
  height: 36px;
  background: var(--navy);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-size: 16px;
  flex-shrink: 0;
}

.breadcrumb {
  font-size: 13px;
  color: var(--grey-500);
  margin-bottom: 4px;
}

.breadcrumb a { color: var(--accent); }

/* ---- Cards ---- */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--grey-200);
  overflow: hidden;
}

.card-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--grey-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--grey-50);
}

.card-title {
  font-family: 'Roboto Condensed', sans-serif;
  font-weight: 700;
  font-size: 15px;
  color: var(--navy);
}

.card-body {
  padding: 24px;
}

/* ---- Tables ---- */
.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead th {
  background: var(--navy);
  color: var(--white);
  font-family: 'Roboto Condensed', sans-serif;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  padding: 12px 16px;
  text-align: left;
  white-space: nowrap;
}

tbody tr:nth-child(even) { background: var(--grey-50); }
tbody tr:nth-child(odd) { background: var(--white); }
tbody tr:hover { background: #eff6ff; }

tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--grey-200);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }

.table-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--grey-500);
}

.table-empty .empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.4;
}

/* ---- Badges ---- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-green { background: var(--green-light); color: #166534; }
.badge-grey { background: var(--grey-200); color: var(--grey-700); }
.badge-red { background: var(--red-light); color: #991b1b; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
  font-family: 'Roboto', sans-serif;
}

.btn:hover { text-decoration: none; }

.btn-primary {
  background: var(--navy);
  color: var(--white);
}
.btn-primary:hover { background: var(--navy-light); color: var(--white); }

.btn-success {
  background: var(--green);
  color: var(--white);
}
.btn-success:hover { background: #15803d; color: var(--white); }

.btn-danger {
  background: var(--red);
  color: var(--white);
}
.btn-danger:hover { background: #b91c1c; color: var(--white); }

.btn-secondary {
  background: var(--grey-200);
  color: var(--grey-700);
  border: 1px solid var(--grey-300);
}
.btn-secondary:hover { background: var(--grey-300); color: var(--grey-700); }

.btn-outline {
  background: transparent;
  color: var(--navy);
  border: 1px solid var(--grey-300);
}
.btn-outline:hover { background: var(--grey-100); color: var(--navy); }

.btn-sm {
  padding: 5px 12px;
  font-size: 13px;
}

.btn-icon {
  padding: 7px 10px;
}

/* ---- Forms ---- */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.form-full {
  grid-column: 1 / -1;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--grey-700);
  letter-spacing: 0.2px;
}

.form-group label .required {
  color: var(--red);
  margin-left: 2px;
}

.form-control {
  padding: 9px 12px;
  border: 1px solid var(--grey-300);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: 'Roboto', sans-serif;
  color: var(--grey-700);
  background: var(--white);
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}

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

.form-control::placeholder { color: var(--grey-300); }

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-control.is-invalid {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.error-message {
  font-size: 12px;
  color: var(--red);
  margin-top: 2px;
}

.form-help {
  font-size: 12px;
  color: var(--grey-500);
}

/* Checkboxes (permission list) */
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px;
  margin-top: 4px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
  background: var(--grey-50);
}

.checkbox-item:hover {
  border-color: var(--accent);
  background: #eff6ff;
}

.checkbox-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--navy);
  flex-shrink: 0;
}

.checkbox-item label {
  font-size: 13.5px;
  font-weight: 400;
  color: var(--grey-700);
  cursor: pointer;
  margin: 0;
  letter-spacing: 0;
}

/* Grouped permissions grid (role form) */
.permissions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 12px;
}

.perm-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.perm-section h4 {
  color: var(--navy);
  border-bottom: 2px solid var(--navy);
  padding-bottom: 4px;
  margin: 0;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.perm-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

/* Inline form (lab types page) */
.inline-form {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.inline-form .form-group { flex: 1; }

/* Lab type info panel */
.lab-type-info {
  padding: 10px 14px;
  background: var(--grey-50);
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--grey-700);
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.lab-type-info .info-label {
  font-weight: 600;
  color: var(--grey-500);
}

/* Form actions */
.form-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  padding-top: 8px;
  margin-top: 8px;
  border-top: 1px solid var(--grey-200);
}

/* ---- Alerts / Flash Messages ---- */
.messages-container {
  margin-bottom: 20px;
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 8px;
  border-left: 4px solid transparent;
}

.alert-success {
  background: var(--green-light);
  color: #166534;
  border-left-color: var(--green);
}

.alert-error, .alert-danger {
  background: var(--red-light);
  color: #991b1b;
  border-left-color: var(--red);
}

.alert-warning {
  background: var(--yellow-light);
  color: #92400e;
  border-left-color: var(--yellow);
}

.alert-info {
  background: #dbeafe;
  color: #1e40af;
  border-left-color: var(--accent);
}

/* ---- Stats/Dashboard Cards ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--grey-200);
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-icon-navy { background: #dbeafe; color: var(--navy); }
.stat-icon-green { background: var(--green-light); color: var(--green); }
.stat-icon-purple { background: #ede9fe; color: #7c3aed; }
.stat-icon-orange { background: #ffedd5; color: #c2410c; }

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1;
}

.stat-label {
  font-size: 13px;
  color: var(--grey-500);
  margin-top: 3px;
}

/* ---- Confirm Delete ---- */
.confirm-box {
  max-width: 480px;
  margin: 0 auto;
}

.confirm-box .confirm-icon {
  width: 64px;
  height: 64px;
  background: var(--red-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin: 0 auto 16px;
}

.confirm-box h2 {
  font-family: 'Roboto Condensed', sans-serif;
  font-size: 20px;
  color: var(--navy);
  margin-bottom: 8px;
}

.confirm-box p {
  color: var(--grey-500);
  font-size: 14px;
  margin-bottom: 24px;
  line-height: 1.6;
}

/* ---- 403 Page ---- */
.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
}

.error-page .error-code {
  font-size: 96px;
  font-weight: 700;
  color: var(--grey-200);
  line-height: 1;
  font-family: 'Roboto Condensed', sans-serif;
}

.error-page h2 {
  font-size: 24px;
  color: var(--navy);
  margin-bottom: 8px;
}

.error-page p {
  color: var(--grey-500);
  margin-bottom: 24px;
}

/* ---- Action buttons in table ---- */
.action-group {
  display: flex;
  gap: 6px;
}

/* ---- Permissions display in role list ---- */
.perm-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */

.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 50%, var(--navy-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  background: var(--white);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 420px;
  overflow: hidden;
}

.login-header {
  background: var(--navy);
  padding: 32px;
  text-align: center;
  color: var(--white);
}

.login-header .login-logo {
  width: 64px;
  height: 64px;
  background: rgba(255,255,255,0.15);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin: 0 auto 16px;
}

.login-header h1 {
  font-family: 'Roboto Condensed', sans-serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.login-header p {
  font-size: 13px;
  opacity: 0.65;
}

.login-body {
  padding: 32px;
}

.login-body .form-group {
  margin-bottom: 16px;
}

.login-body .btn-primary {
  width: 100%;
  justify-content: center;
  padding: 12px;
  font-size: 15px;
  margin-top: 8px;
}

.login-error {
  background: var(--red-light);
  color: #991b1b;
  border: 1px solid #fca5a5;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13.5px;
  margin-bottom: 16px;
}

.login-footer {
  text-align: center;
  padding: 16px 32px 24px;
  font-size: 12px;
  color: var(--grey-500);
  border-top: 1px solid var(--grey-100);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

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

@media (max-width: 768px) {
  :root { --sidebar-width: 0px; }
  .sidebar { transform: translateX(-100%); }
  .main-content { margin-left: 0; padding: 20px 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-grid-3 { grid-template-columns: 1fr; }
  .top-header .lab-badge { display: none; }
}

/* ============================================================
   DOCUMENTS MODULE
   ============================================================ */

/* Status badges */
.badge-draft        { background: #e2e8f0; color: #475569; }
.badge-review       { background: #fef3c7; color: #92400e; }
.badge-approval     { background: #dbeafe; color: #1e40af; }
.badge-approved     { background: #dcfce7; color: #166534; }
.badge-rejected     { background: #fee2e2; color: #991b1b; }
.badge-acknowledged { background: #dcfce7; color: #166534; }

/* Comment thread / timeline */
.comment-thread { display: flex; flex-direction: column; gap: 16px; margin-top: 20px; }
.comment-entry  { display: flex; gap: 14px; align-items: flex-start; }
.comment-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: #1a2e4a; color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.9rem; flex-shrink: 0;
}
.comment-bubble {
  background: #f8fafc; border: 1px solid #e2e8f0;
  border-radius: 8px; padding: 12px 16px; flex: 1;
}
.comment-meta { font-size: 0.8rem; color: #64748b; margin-bottom: 6px; }
.comment-text { font-size: 0.92rem; color: #1e293b; }
.comment-entry.approver .comment-avatar { background: #065f46; }

/* Inline review/approve form row */
.inline-form-row {
  background: #f0f4f8;
  padding: 16px 20px;
  border-top: 2px solid #1a2e4a;
}
.inline-form-row.hidden { display: none; }

/* Document iframe viewer */
.doc-viewer-frame {
  width: 100%; height: 600px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  margin-bottom: 24px;
}

/* ---- Utility ---- */
.text-muted { color: var(--grey-500); }
.text-center { text-align: center; }
.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; }
.mb-3 { margin-bottom: 24px; }
.gap-2 { gap: 16px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }

/* ============================================================
   TEMPERATURE CHARTING
   ============================================================ */

.chart-container {
  width: 100%;
  overflow-x: auto;
  margin: 24px 0;
  padding: 8px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.temp-range-badge {
  display: inline-flex;
  gap: 12px;
  background: #f0f4f8;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 0.88rem;
  color: #1a2e4a;
  font-weight: 600;
  margin-bottom: 12px;
}
.temp-range-badge .upper { color: #dc2626; }
.temp-range-badge .lower { color: #2563eb; }

.chart-info-banner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  background: #1a2e4a;
  color: white;
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 20px;
}
.chart-info-banner .info-item label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
  display: block;
  margin-bottom: 2px;
}
.chart-info-banner .info-item span {
  font-size: 0.95rem;
  font-weight: 600;
}

.review-status-block {
  margin-top: 24px;
  padding: 14px 20px;
  border-radius: 8px;
  border: 2px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 14px;
}
.review-status-block.reviewed {
  border-color: #16a34a;
  background: #f0fdf4;
}
.review-status-block.not-reviewed {
  border-color: #f59e0b;
  background: #fffbeb;
}

.nav-subsection {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
  padding: 4px 16px;
  margin-top: 4px;
  display: block;
}

.badge-success { background: var(--green-light); color: #166534; }
.badge-neutral { background: var(--grey-200); color: var(--grey-700); }


/* ===== BENCH DECONTAMINATION TABLE ===== */

.bench-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    table-layout: fixed;
}

.bench-table thead tr {
    background: #1a2e4a;
    color: white;
}

.bench-table thead th {
    padding: 10px 8px;
    text-align: center;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border: 1px solid #253d5e;
    white-space: nowrap;
}

.bench-table thead th:first-child {
    width: 60px;
    text-align: center;
}

.bench-table .date-cell {
    background: #f0f4f8;
    font-weight: 700;
    text-align: center;
    color: #1a2e4a;
    border: 1px solid #e2e8f0;
    padding: 8px 4px;
}

.bench-table .has-entry {
    background: #ffffff;
    text-align: center;
    font-weight: 700;
    color: #1a2e4a;
    border: 1px solid #e2e8f0;
    padding: 8px 4px;
    letter-spacing: 0.05em;
}

.bench-table .empty-entry {
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    padding: 8px 4px;
}

.bench-table tbody tr:nth-child(even) .date-cell {
    background: #e8edf3;
}

.bench-table tbody tr:hover .has-entry,
.bench-table tbody tr:hover .empty-entry {
    background: #f0f7ff;
}

.bench-table-wrapper {
    width: 100%;
    overflow-x: auto;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    margin-bottom: 24px;
}

.bench-chart-header {
    background: #1a2e4a;
    color: white;
    padding: 12px 20px;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}

.bench-chart-header .month-label {
    font-size: 1.1rem;
}

.bench-chart-header .room-label {
    font-size: 0.9rem;
    color: #94a3b8;
}

/* ===== EQUIPMENT MODULE ===== */

.steps-three-col {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
    margin-top: 24px;
}

@media (max-width: 900px) {
    .steps-three-col {
        grid-template-columns: 1fr;
    }
}

.steps-col {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}

.steps-col-header {
    padding: 10px 16px;
    margin: 0;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
    color: white;
}

.steps-col-header.daily   { background: #1a2e4a; }
.steps-col-header.weekly  { background: #065f46; }
.steps-col-header.monthly { background: #7c2d12; }

.steps-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.steps-table th {
    background: #f8fafc;
    padding: 7px 10px;
    text-align: left;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #64748b;
    border-bottom: 1px solid #e2e8f0;
}

.steps-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: top;
    color: #1e293b;
}

.steps-table tr:last-child td { border-bottom: none; }
.steps-table tr:hover td      { background: #f8fafc; }

.steps-table td:first-child {
    font-weight: 700;
    color: #1a2e4a;
    width: 32px;
    text-align: center;
}

.empty-col-msg {
    padding: 16px;
    color: #94a3b8;
    font-size: 0.85rem;
    font-style: italic;
    text-align: center;
}

.step-count {
    font-size: 0.82rem;
    color: #94a3b8;
}

.step-count.has-steps {
    color: #166534;
    font-weight: 600;
}

.badge-running { background: #dcfce7; color: #166534; }
.badge-down    { background: #fee2e2; color: #991b1b; }

.btn-outline-danger {
    background: transparent;
    border: 1.5px solid #dc2626;
    color: #dc2626;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-outline-danger:hover {
    background: #dc2626;
    color: white;
}

.btn-outline-success {
    background: transparent;
    border: 1.5px solid #16a34a;
    color: #16a34a;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-outline-success:hover {
    background: #16a34a;
    color: white;
}

.form-row-inline {
    display: grid;
    grid-template-columns: 180px 160px 1fr;
    gap: 16px;
    align-items: start;
    margin-bottom: 12px;
}

.form-group-wide {
    grid-column: span 1;
}

.btn-xs {
    padding: 2px 7px;
    font-size: 0.78rem;
    border-radius: 3px;
    line-height: 1.4;
}

code {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #1a2e4a;
    font-family: 'Courier New', monospace;
}


/* ===== EQUIPMENT MAINTENANCE ===== */

.maint-section {
    margin-bottom: 36px;
}

.maint-section-header {
    padding: 10px 18px;
    border-radius: 6px 6px 0 0;
    margin: 0;
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: white;
}

.maint-section-header.daily   { background: #1a2e4a; }
.maint-section-header.weekly  { background: #065f46; }
.maint-section-header.monthly { background: #7c2d12; }

.maint-chart-wrapper {
    width: 100%;
    overflow-x: auto;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    margin-bottom: 8px;
}

.maint-chart-table {
    border-collapse: collapse;
    font-size: 0.82rem;
    min-width: 100%;
}

.maint-chart-table thead tr {
    background: #1a2e4a;
    color: white;
}

.maint-chart-table thead th {
    padding: 8px 6px;
    text-align: center;
    font-weight: 600;
    font-size: 0.75rem;
    border: 1px solid #253d5e;
    white-space: nowrap;
    min-width: 32px;
}

.maint-chart-table th.step-col,
.maint-chart-table td.step-col {
    min-width: 220px;
    max-width: 280px;
    text-align: left;
    white-space: normal;
    word-wrap: break-word;
}

.maint-chart-table tbody td {
    padding: 6px 5px;
    text-align: center;
    border: 1px solid #e2e8f0;
    font-size: 0.8rem;
}

.maint-chart-table .checked-cell {
    background: #f0fdf4;
    color: #16a34a;
    font-weight: 700;
    font-size: 1rem;
}

.maint-chart-table .empty-cell {
    background: #f8fafc;
}

.maint-chart-table .initials-row td {
    background: #fefce8;
    font-weight: 700;
    font-size: 0.78rem;
    color: #1a2e4a;
    border-top: 2px solid #1a2e4a;
}

.maint-chart-table .initials-label {
    font-style: italic;
    color: #64748b;
}

.maint-chart-table tbody tr:nth-child(even) td {
    background: #f8fafc;
}

.maint-chart-table tbody tr:nth-child(even) .checked-cell {
    background: #dcfce7;
}

.maint-chart-table tbody .initials-row td {
    background: #fefce8 !important;
}

.maint-checklist {
    margin: 20px 0;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}

.maint-checklist h4 {
    background: #1a2e4a;
    color: white;
    padding: 10px 16px;
    margin: 0;
    font-size: 0.9rem;
}

.checklist-table {
    width: 100%;
    border-collapse: collapse;
}

.checklist-table th {
    background: #f0f4f8;
    padding: 8px 12px;
    font-size: 0.78rem;
    text-transform: uppercase;
    color: #64748b;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
}

.checklist-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.checklist-table tr:last-child td { border-bottom: none; }
.checklist-table tr:hover td      { background: #f8fafc; }

.step-checkbox {
    width: 18px;
    height: 18px;
    accent-color: #1a2e4a;
    cursor: pointer;
}

.step-label {
    cursor: pointer;
    color: #1e293b;
    font-size: 0.9rem;
    line-height: 1.4;
}

.chart-download-bar {
    display: flex;
    justify-content: flex-end;
    padding: 8px 0 16px 0;
}

/* ===== NON-CONFORMANCE ===== */

.nc-status-registered  { background:#e0f2fe; color:#0369a1; }
.nc-status-review_1    { background:#fef3c7; color:#92400e; }
.nc-status-reviewed_1  { background:#fde68a; color:#78350f; }
.nc-status-review_2    { background:#fed7aa; color:#9a3412; }
.nc-status-reviewed_2  { background:#fca5a5; color:#7f1d1d; }
.nc-status-closure     { background:#ddd6fe; color:#4c1d95; }
.nc-status-closed      { background:#dcfce7; color:#166534; }
.nc-status-declined    { background:#fee2e2; color:#991b1b; }

.nc-info-section {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px 24px;
    margin-bottom: 20px;
}

.nc-info-section h4 {
    color: #1a2e4a;
    font-size: 0.88rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
    margin: 0 0 16px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #1a2e4a;
}

.nc-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.nc-info-full { grid-column: 1 / -1; }

.nc-info-item label {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    margin-bottom: 3px;
    font-weight: 600;
}

.nc-info-item span {
    font-size: 0.92rem;
    color: #1e293b;
    line-height: 1.5;
}

.nc-section-header {
    padding: 8px 16px;
    border-radius: 6px;
    margin: 24px 0 8px;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.nc-section-header.pending { background:#fef3c7; color:#92400e; border-left:4px solid #f59e0b; }
.nc-section-header.done    { background:#dcfce7; color:#166534; border-left:4px solid #16a34a; }

.comment-count-link {
    color: #1a2e4a;
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: none;
}
.comment-count-link:hover { text-decoration: underline; }

.action-badge        { display:inline-block; padding:1px 7px; border-radius:10px; font-size:0.72rem; font-weight:600; }
.action-registered   { background:#e0f2fe; color:#0369a1; }
.action-review_1_submitted { background:#fef3c7; color:#92400e; }
.action-review_2_submitted { background:#fed7aa; color:#9a3412; }
.action-accepted     { background:#dcfce7; color:#166534; }
.action-declined     { background:#fee2e2; color:#991b1b; }

.closure-decision .form-actions { display:flex; gap:16px; margin-top:16px; }

.btn-success { background:#16a34a; color:white; border:none; padding:10px 24px; border-radius:6px; font-weight:600; cursor:pointer; font-size:0.95rem; }
.btn-success:hover { background:#15803d; }
.btn-danger  { background:#dc2626; color:white; border:none; padding:10px 24px; border-radius:6px; font-weight:600; cursor:pointer; font-size:0.95rem; }
.btn-danger:hover  { background:#b91c1c; }
.btn-lg { padding:12px 28px; font-size:1rem; }
