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

:root {
  --red: #dc2626;
  --red-dark: #b91c1c;
  --red-light: #fee2e2;
  --bg: #f8fafc;
  --sidebar-bg: #1e293b;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-light: #64748b;
  --border: #e2e8f0;
  --green: #16a34a;
  --yellow: #ca8a04;
  --blue: #2563eb;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* Auth Page */
.auth-page {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}

.auth-card {
  background: white;
  border-radius: 20px;
  padding: 40px;
  width: 420px;
  max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 32px;
}

.auth-logo .logo-icon { font-size: 36px; }
.auth-logo h1 { font-size: 24px; font-weight: 700; color: var(--text); }

.auth-card h2 {
  font-size: 20px;
  margin-bottom: 20px;
  text-align: center;
  color: var(--text);
}

.app-version {
  text-align: center;
  margin-top: 20px;
  font-size: 11px;
  color: #b0b8c4;
  letter-spacing: 0.5px;
}

.auth-switch {
  text-align: center;
  margin-top: 16px;
  font-size: 14px;
  color: var(--text-light);
}

.auth-switch a {
  color: var(--red);
  text-decoration: none;
  font-weight: 600;
}

.form-error {
  color: #ef4444;
  font-size: 13px;
  margin-bottom: 12px;
  min-height: 18px;
}
.form-success {
  color: #16a34a;
  font-size: 14px;
  margin-bottom: 12px;
  padding: 12px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  text-align: center;
  line-height: 1.5;
}

/* Main App */
.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  background: var(--sidebar-bg);
  color: white;
  padding: 24px 0;
  flex-shrink: 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 24px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.logo-icon { font-size: 28px; }
.logo h1 { font-size: 20px; font-weight: 700; }

.user-info {
  padding: 16px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.user-name {
  font-size: 14px;
  font-weight: 600;
  color: white;
}

.user-role {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 2px;
  text-transform: capitalize;
}

.nav-links {
  list-style: none;
  margin-top: 8px;
  flex: 1;
}

.nav-link {
  display: block;
  padding: 12px 24px;
  color: #94a3b8;
  text-decoration: none;
  transition: all 0.2s;
  font-size: 15px;
}

.nav-link { position: relative; }
.nav-link:hover { color: white; background: rgba(255,255,255,0.05); }
.nav-link:focus { outline: none; }
.nav-link:focus-visible { outline: 2px solid rgba(255,255,255,0.3); outline-offset: -2px; }
.nav-link:active { opacity: 0.85; }
.nav-link.active { color: white; background: var(--red); border-right: 3px solid white; }

.nav-badge {
  display: none;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
  margin-left: 6px;
  vertical-align: middle;
}
.nav-badge.visible { display: inline-block; }
.nav-link.active .nav-badge { background: #fff; color: #dc2626; }

.sidebar-bottom {
  padding: 12px 0 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
  margin-top: auto;
}
.sidebar-bottom > .nav-links { padding: 0; margin: 0; flex: none; }
.sidebar-bottom > .lang-switch, .sidebar-bottom > .btn-logout { margin: 0 24px; }
.sidebar-bottom-row { display: flex; align-items: center; justify-content: space-between; padding: 0 24px; gap: 8px; }

.btn-logout {
  background: rgba(255,255,255,0.1);
  color: #94a3b8;
  border: 1px solid rgba(255,255,255,0.1);
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}

.btn-logout:hover { background: rgba(239,68,68,0.2); color: white; }

.content {
  flex: 1;
  margin-left: 240px;
  padding: 32px;
}

.page { display: none; }
.page.active { display: block; }

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

h2 { font-size: 24px; margin-bottom: 24px; }
h3 { font-size: 18px; margin-bottom: 16px; color: var(--text); }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  border-left: 4px solid var(--red);
}

.stat-card.urgent { border-left-color: var(--yellow); }
.stat-card.stat-clickable { cursor: pointer; transition: transform 0.15s, box-shadow 0.15s; }
.stat-card.stat-clickable:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.stat-value { font-size: 36px; font-weight: 700; color: var(--red); }
.stat-card.urgent .stat-value { color: var(--yellow); }
.stat-label { font-size: 14px; color: var(--text-light); margin-top: 4px; }

.inventory-grid, .inventory-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
}

.inventory-detail-grid {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.blood-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  border-top: 3px solid var(--red);
}

.blood-card .blood-type { font-size: 28px; font-weight: 700; color: var(--red); }
.blood-card .blood-units { font-size: 18px; margin-top: 8px; color: var(--text); }
.blood-card .blood-label { font-size: 12px; color: var(--text-light); margin-top: 4px; }
.blood-card.low { border-top-color: var(--yellow); }
.blood-card.low .blood-type { color: var(--yellow); }
.blood-card.critical { border-top-color: #dc2626; background: var(--red-light); }

.data-table {
  width: 100%;
  background: var(--card-bg);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  border-collapse: collapse;
}

.data-table th {
  background: #f1f5f9;
  padding: 12px 16px;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
}

.data-table td {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 14px;
}

.data-table tr:hover td { background: #f8fafc; }

.btn {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}
.btn:focus { outline: none; }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn:active { opacity: 0.85; transform: scale(0.98); }

.btn-primary { background: var(--red); color: white; }
.btn-primary:hover { background: var(--red-dark); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-success { background: var(--green); color: white; }
.btn-danger { background: #ef4444; color: white; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-full { width: 100%; padding: 12px; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 600;
}

.badge-pending { background: #fef3c7; color: #92400e; }
.badge-verified { background: #dbeafe; color: #1e40af; }
.badge-fulfilled { background: #d1fae5; color: #065f46; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }
.badge-urgent { background: #fed7aa; color: #9a3412; }
.badge-critical { background: #fee2e2; color: #991b1b; }
.badge-normal { background: #e0e7ff; color: #3730a3; }
.badge-active { background: #d1fae5; color: #065f46; }
.badge-inactive { background: #fee2e2; color: #991b1b; }
.badge-transfusion { background: #ede9fe; color: #5b21b6; }
.badge-sale { background: #fce7f3; color: #9d174d; }

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 100;
  justify-content: center;
  align-items: center;
}

.modal-overlay.active { display: flex; }

.modal {
  background: white;
  border-radius: 16px;
  width: 480px;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-light);
}

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

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

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  padding: 4px;
  opacity: 0.5;
  line-height: 1;
}
.password-toggle:hover { opacity: 1; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 24px;
  border-radius: 8px;
  color: white;
  font-weight: 500;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s;
  z-index: 200;
}

.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { background: var(--green); }
.toast.error { background: #ef4444; }

.empty-state {
  text-align: center;
  padding: 48px;
  color: var(--text-light);
}

.animal-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.animal-tab {
  padding: 12px 28px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: white;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-light);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.animal-tab:hover { border-color: var(--red); color: var(--red); }
.animal-tab.active { background: var(--red); border-color: var(--red); color: white; }

.platform-tabs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin: 20px 0;
}
.platform-tab-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 16px;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: white;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.platform-tab-card:hover {
  border-color: var(--red);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.platform-tab-card.active {
  background: var(--red);
  border-color: var(--red);
  color: white;
}
.platform-tab-icon {
  font-size: 36px;
  line-height: 1;
}
.platform-tab-label {
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}

.admin-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.admin-tab {
  padding: 10px 28px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: white;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-light);
  transition: all 0.2s;
}

.admin-tab:hover { border-color: var(--blue); color: var(--blue); }
.admin-tab.active { background: var(--sidebar-bg); border-color: var(--sidebar-bg); color: white; }

.admin-section { margin-top: 8px; }

.finance-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.finance-tab {
  padding: 10px 28px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: white;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-light);
  transition: all 0.2s;
}

.finance-tab:hover { border-color: var(--green); color: var(--green); }
.finance-tab.active { background: var(--green); border-color: var(--green); color: white; }

.finance-section { margin-top: 8px; }

.pipeline-mode-btn {
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-light);
  transition: all 0.2s;
}
.pipeline-mode-btn:hover { border-color: var(--green); color: var(--green); }
.pipeline-mode-btn.active { background: var(--green); border-color: var(--green); color: white; }

.finance-hint {
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: 16px;
}

.price-input {
  width: 100px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  text-align: right;
}

.price-input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.15);
}

.service-checks {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.service-check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: #f8fafc;
  border-radius: 8px;
}

.service-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
  flex: 1;
  min-width: 0;
}

.service-check .service-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.service-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: var(--green);
}

.service-price-input {
  width: 90px;
  flex-shrink: 0;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  text-align: right;
}

.service-price-input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.15);
}

.service-price-input:disabled {
  background: #f1f5f9;
  color: #94a3b8;
}

.category-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.category-analysis { background: #dbeafe; color: #1e40af; }
.category-transfusion { background: #fce7f3; color: #9d174d; }
.category-service { background: #fef3c7; color: #92400e; }
.category-donor_exam { background: #e0e7ff; color: #3730a3; }
.category-donor_bonus { background: #d1fae5; color: #065f46; }
.category-bonus { background: #d1fae5; color: #065f46; }

.category-header-row td {
  background: #f1f5f9;
  padding: 10px 16px;
  font-size: 14px;
  color: var(--text);
  border-top: 2px solid var(--border);
}

.form-link-bar {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  padding: 10px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.form-link-display {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
}
.form-link-url {
  color: var(--blue);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.form-link-url:hover { text-decoration: underline; }
.form-link-edit {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 10px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.priority-notice {
  background: #fef3c7;
  border: 2px solid #f59e0b;
  color: #92400e;
  padding: 14px 20px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 16px;
  letter-spacing: 0.5px;
}

.donor-exam-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
}
.donor-exam-header {
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}
.donor-exam-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.exam-stage-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: #e0e7ff;
  color: #3730a3;
}
.exam-stage-badge.stage-completed { background: #d1fae5; color: #065f46; }
.exam-stages { padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.exam-stage {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  transition: all 0.2s;
}
.exam-stage.current { border-color: var(--blue); background: #eff6ff; }
.exam-stage.done { border-color: var(--green); background: #f0fdf4; }
.exam-stage.locked { opacity: 0.5; pointer-events: none; }
.exam-stage-title { font-weight: 700; font-size: 14px; margin-bottom: 10px; }
.exam-checks { display: flex; flex-wrap: wrap; gap: 6px; }
.exam-check {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}
.exam-check.checked { background: #d1fae5; border-color: var(--green); }
.exam-check input { accent-color: var(--green); }

.donation-section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
}
.donation-ready-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 12px;
}
.donation-ready-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.donation-form { border-top: 1px solid #f1f5f9; padding-top: 12px; }
.donation-select { padding: 8px; border: 2px solid var(--border); border-radius: 8px; font-size: 14px; }

.inventory-group {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
}
.inventory-group-header {
  padding: 12px 20px;
  background: #f1f5f9;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
}
.inventory-unit {
  padding: 10px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #f8fafc;
  font-size: 14px;
}
.inventory-unit:last-child { border-bottom: none; }
.unit-urgent { background: #fef2f2; }
.unit-warning { background: #fffbeb; }
.unit-expired { background: #fecaca; opacity: 0.7; }
.unit-quarantine { background: #fef3c7; border-left: 4px solid #f59e0b; }
.unit-info { display: flex; gap: 12px; align-items: center; }
.unit-volume { font-weight: 700; }
.unit-donor { color: var(--text-light); font-size: 13px; }
.unit-expiry { display: flex; gap: 10px; align-items: center; }
.unit-expiry-date { font-weight: 600; font-size: 13px; }
.unit-days-left { color: var(--text-light); font-size: 12px; }
.expiry-critical { color: var(--red); font-weight: 700; }
.expiry-warning { color: var(--yellow); font-weight: 600; }

.candidate-owner-group {
  background: white;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-bottom: 16px;
  overflow: hidden;
}
.candidate-owner-header {
  padding: 14px 20px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
}
.candidate-card {
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid #f1f5f9;
  transition: all 0.2s;
}
.candidate-card:last-child { border-bottom: none; }
.candidate-rejected {
  background: #fef2f2;
  opacity: 0.7;
}
.candidate-approved {
  background: #f0fdf4;
}
.candidate-animal {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.candidate-details {
  display: block;
  font-size: 13px;
  color: var(--text-light);
}
.candidate-health, .candidate-time {
  font-size: 13px;
  color: var(--text-light);
  margin-top: 4px;
}
.candidate-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}
.candidate-status {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.candidate-info { flex: 1; min-width: 0; }

.btn-lang {
  background: rgba(255,255,255,0.1);
  color: white;
  border: 1px solid rgba(255,255,255,0.2);
  padding: 6px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1px;
  transition: all 0.2s;
}

.btn-lang:hover { background: rgba(255,255,255,0.2); }

.permissions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.perm-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  font-size: 14px;
}
.perm-check:hover { background: #f1f5f9; }
.perm-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #dc2626;
}
.perm-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: #f8fafc;
}
.perm-disabled:hover { background: #f8fafc; }
.permissions-grid { display: flex; flex-direction: column; gap: 12px; }
.perm-category { border: 1px solid #e2e8f0; border-radius: 10px; overflow: hidden; }
.perm-category-label { background: #f8fafc; padding: 8px 14px; font-size: 12px; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid #e2e8f0; }
.perm-category-items { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px; }
.perm-category-items .perm-check { border: 1px solid #e2e8f0; border-radius: 6px; padding: 6px 10px; font-size: 13px; }

/* Guide / Instruction */
.guide-container { max-width: 900px; display: flex; flex-direction: column; gap: 16px; padding: 8px 0; }
.guide-block { background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.guide-block-title { background: linear-gradient(135deg, #1e293b, #334155); color: #fff; padding: 14px 20px; font-size: 15px; font-weight: 700; letter-spacing: 0.2px; }
.guide-block-content { padding: 18px 20px; font-size: 14px; line-height: 1.7; color: var(--text); }
.guide-block-content p { margin: 0 0 10px; }
.guide-block-content p:last-child { margin-bottom: 0; }
.guide-table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 13px; }
.guide-table th { background: #f1f5f9; padding: 10px 14px; text-align: left; font-weight: 600; color: #475569; border-bottom: 2px solid #e2e8f0; }
.guide-table td { padding: 10px 14px; border-bottom: 1px solid #f1f5f9; vertical-align: top; }
.guide-table tr:hover td { background: #f8fafc; }
/* Request Cards */
.request-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 12px;
  overflow: hidden;
  transition: box-shadow 0.2s;
}
.request-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.request-card.status-pending { border-left: 4px solid var(--yellow); }
.request-card.status-unit_assigned { border-left: 4px solid var(--blue); }
.request-card.status-verified { border-left: 4px solid #7c3aed; }
.request-card.status-fulfilled { border-left: 4px solid var(--green); }
.request-card.status-cancelled { border-left: 4px solid #94a3b8; opacity: 0.7; }
.req-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.req-patient { font-size: 15px; }
.req-badges { display: flex; gap: 6px; }
.req-body { padding: 12px 16px; }
.req-clinic { color: var(--text-light); margin-bottom: 8px; font-size: 14px; }
.req-unit-info { margin-bottom: 8px; font-size: 14px; }
.req-checks { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.req-check-label { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.req-check-label.done { color: var(--green); cursor: default; }
.req-check-label input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--green); }
.req-finance { margin-top: 12px; padding: 10px 12px; background: #f0fdf4; border-radius: 8px; font-size: 13px; }
.req-finance ul { margin: 6px 0 6px 16px; }
.req-finance li { margin-bottom: 2px; }
.req-total { margin-top: 6px; text-align: right; font-size: 14px; }
.req-owner { font-size: 14px; margin-bottom: 6px; color: var(--text); }
.req-notes { font-size: 13px; color: var(--text-light); margin-bottom: 6px; font-style: italic; }
.badge-public { background: #dbeafe; color: #1d4ed8; }
.req-actions { padding: 10px 16px; border-top: 1px solid var(--border); display: flex; gap: 8px; }

/* Unit Selection */
.unit-select-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.unit-select-item:last-child { border-bottom: none; }
.unit-select-info { font-size: 14px; }
.expiry-red { color: var(--red); }
.expiry-yellow { color: var(--yellow); }
.expiry-green { color: var(--green); }

/* Price List Inputs */
.price-input {
  width: 110px; padding: 4px 8px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 14px; text-align: right;
}
.price-input:focus { outline: none; border-color: var(--blue); }
.text-muted { color: var(--text-light); }

.nav-icon { display: none; }

.mobile-header {
  display: none;
  position: fixed; top: 0; left: 0; right: 0;
  height: 52px; background: var(--sidebar-bg); color: white;
  z-index: 1001;
  align-items: center; justify-content: space-between;
  padding: 0 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.mobile-back-btn, .mobile-menu-btn {
  background: none; border: none; color: white;
  font-size: 22px; padding: 8px; cursor: pointer;
  border-radius: 8px; line-height: 1;
}
.mobile-back-btn:active, .mobile-menu-btn:active { background: rgba(255,255,255,0.15); }
.mobile-header-title {
  font-size: 16px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex: 1; text-align: center;
}
.sidebar-overlay {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5); z-index: 1009;
}
.sidebar-overlay.active { display: block; }

@media (max-width: 768px) {
  .mobile-header { display: flex; }
  .sidebar {
    width: 56px; z-index: 1010;
    padding-top: 60px;
    transition: width 0.25s ease;
  }
  .sidebar .logo { display: none; }
  .sidebar .user-info { display: none; }
  .sidebar .nav-text { display: none; }
  .sidebar .nav-icon { display: block; font-size: 20px; text-align: center; line-height: 1; }
  .sidebar .nav-link {
    display: flex; align-items: center; justify-content: center;
    padding: 12px 0; font-size: 0;
  }
  .sidebar .nav-badge { position: absolute; top: 2px; right: 2px; font-size: 9px; min-width: 16px; height: 16px; line-height: 16px; padding: 0 3px; }
  .sidebar .sidebar-bottom-row { flex-direction: column; padding: 4px; gap: 4px; }
  .sidebar .sidebar-bottom-row .lang-switch { margin: 0; }
  .sidebar .btn-lang { font-size: 10px; padding: 4px 8px; }
  .sidebar .btn-logout { font-size: 10px; padding: 4px 6px; margin: 0; white-space: nowrap; }
  .sidebar.expanded {
    width: 240px;
  }
  .sidebar.expanded .logo { display: flex; }
  .sidebar.expanded .user-info { display: block; }
  .sidebar.expanded .nav-text { display: inline; }
  .sidebar.expanded .nav-link {
    justify-content: flex-start;
    padding: 12px 16px; font-size: 15px; gap: 10px;
  }
  .sidebar.expanded .nav-icon { font-size: 18px; }
  .sidebar.expanded .sidebar-bottom-row { flex-direction: row; padding: 0 24px; }
  .sidebar.expanded .btn-logout { font-size: 14px; padding: 6px 12px; }
  .sidebar.expanded .btn-lang { font-size: 14px; padding: 6px 12px; }
  .content { margin-left: 56px; padding: 16px; padding-top: 64px; }
  .form-row { grid-template-columns: 1fr; }
  .permissions-grid { grid-template-columns: 1fr; }
  .req-header { flex-direction: column; align-items: flex-start; gap: 8px; }
}

.patient-card-header:hover { background: #f8fafc; }
.patient-card { transition: box-shadow 0.2s; }
.patient-card:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.06); }

.cal-container { background: white; border-radius: 12px; border: 1px solid var(--border); overflow: hidden; }
.cal-header { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; background: #f8fafc; border-bottom: 1px solid var(--border); flex-wrap: wrap; gap: 8px; }
.cal-header h3 { margin: 0; font-size: 18px; white-space: nowrap; }
.cal-nav { display: flex; gap: 6px; align-items: center; }
.cal-nav button { background: white; border: 1px solid var(--border); border-radius: 8px; padding: 6px 14px; cursor: pointer; font-size: 14px; transition: all 0.15s; }
.cal-nav button:hover { background: var(--primary); color: white; border-color: var(--primary); }
.cal-view-modes { display: flex; gap: 4px; align-items: center; }
.cal-view-btn { background: white; border: 1px solid var(--border); border-radius: 6px; padding: 5px 12px; cursor: pointer; font-size: 12px; font-weight: 600; transition: all 0.15s; color: var(--text); }
.cal-view-btn:hover { border-color: var(--primary); color: var(--primary); }
.cal-view-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-day-header { padding: 10px 4px; text-align: center; font-size: 12px; font-weight: 700; color: var(--text-light); background: #f8fafc; border-bottom: 1px solid var(--border); text-transform: uppercase; }
.cal-day { min-height: 110px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 4px; position: relative; background: white; transition: background 0.15s; }
.cal-day:nth-child(7n) { border-right: none; }
.cal-day:hover { background: #f8fafc; }
.cal-day.other-month { background: #fafafa; }
.cal-day.other-month .cal-day-num { color: #d1d5db; }
.cal-day.today { background: #eff6ff; }
.cal-day.today .cal-day-num { background: var(--primary); color: white; border-radius: 50%; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; }
.cal-day-num { font-size: 13px; font-weight: 600; color: var(--text); padding: 4px 6px; display: inline-block; }
.cal-event { display: block; margin: 2px 2px; padding: 3px 6px; border-radius: 4px; font-size: 11px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: white; font-weight: 600; transition: opacity 0.15s; line-height: 1.4; }
.cal-event:hover { opacity: 0.85; }
.cal-event.first-time { background: #f59e0b; }
.cal-event.repeat { background: #22c55e; }
.cal-event.permanent { background: #3b82f6; }
.cal-event.candidate-entry { border: 2px dashed rgba(255,255,255,0.6); }
.cal-legend { display: flex; gap: 16px; padding: 12px 20px; background: #f8fafc; border-top: 1px solid var(--border); font-size: 12px; align-items: center; flex-wrap: wrap; }
.cal-legend-item { display: flex; align-items: center; gap: 6px; }
.cal-legend-dot { width: 12px; height: 12px; border-radius: 3px; }
.cal-legend-dot.dashed { border: 2px dashed #666; background: transparent !important; }
.cal-today-section { background: white; border: 1px solid var(--border); border-radius: 12px; padding: 16px 20px; margin-bottom: 16px; }
.cal-today-section h4 { margin: 0 0 12px; font-size: 15px; }
.cal-today-item { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 8px; margin-bottom: 6px; font-size: 13px; cursor: pointer; }
.cal-today-item:last-child { margin-bottom: 0; }
.candidates-subtab { padding: 8px 18px; border-radius: 8px; cursor: pointer; font-size: 14px; border: 2px solid var(--border); background: white; color: var(--text); transition: all 0.15s; font-weight: 600; }
.candidates-subtab:hover { background: #f1f5f9; border-color: #cbd5e1; }
.candidates-subtab.active { background: var(--primary); color: white !important; border-color: var(--primary); box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3); }
.cal-time-grid { display: grid; background: white; }
.cal-time-grid.day-view { grid-template-columns: 60px 1fr; }
.cal-time-grid.week-view { grid-template-columns: 60px repeat(7, 1fr); }
.cal-time-grid.two-week-view { grid-template-columns: 60px repeat(7, 1fr); }
.cal-time-col-header { padding: 10px 4px; text-align: center; font-size: 12px; font-weight: 700; color: var(--text-light); background: #f8fafc; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); text-transform: uppercase; }
.cal-time-label { font-size: 11px; color: var(--text-light); text-align: right; padding: 2px 8px 0 0; border-right: 1px solid var(--border); height: 60px; box-sizing: border-box; }
.cal-time-slot { border-bottom: 1px solid #f1f5f9; border-right: 1px solid var(--border); height: 60px; position: relative; box-sizing: border-box; }
.cal-time-slot:last-child { border-right: none; }
.cal-time-slot.hour-line { border-bottom: 1px solid var(--border); }
.cal-time-slot:hover { background: #fafbff; }
.cal-time-event { position: absolute; left: 2px; right: 2px; border-radius: 4px; padding: 3px 6px; font-size: 11px; font-weight: 600; color: white; cursor: pointer; overflow: hidden; z-index: 2; line-height: 1.3; box-shadow: 0 1px 3px rgba(0,0,0,0.15); }
.cal-time-event:hover { opacity: 0.9; box-shadow: 0 2px 6px rgba(0,0,0,0.2); }
.cal-time-event.candidate-entry { border: 2px dashed rgba(255,255,255,0.6); }
.cal-now-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--red); z-index: 3; }
.cal-now-line::before { content: ''; position: absolute; left: -4px; top: -4px; width: 10px; height: 10px; background: var(--red); border-radius: 50%; }
.cal-time-header-row { display: contents; }
.cal-two-week-separator { padding: 8px 20px; background: #f1f5f9; font-size: 13px; font-weight: 600; color: var(--text-light); border-bottom: 1px solid var(--border); }

.toggle-switch { position: relative; display: inline-block; width: 48px; height: 26px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background: #cbd5e1; border-radius: 26px; transition: 0.2s; }
.toggle-slider::before { content: ''; position: absolute; height: 20px; width: 20px; left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: 0.2s; }
.toggle-switch input:checked + .toggle-slider { background: var(--green, #16a34a); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(22px); }
.exam-price-input { width: 80px; padding: 2px 6px; border: 1px solid #e2e8f0; border-radius: 4px; font-size: 12px; text-align: right; background: #f8fafc; }
.exam-price-input:focus { outline: none; border-color: var(--primary); background: white; }
.exam-price-input:disabled { background: transparent; border-color: transparent; color: var(--text); cursor: default; }

@media (display-mode: standalone) {
  body { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
  .mobile-header { padding-top: env(safe-area-inset-top); height: calc(52px + env(safe-area-inset-top)); }
  .sidebar { padding-top: calc(60px + env(safe-area-inset-top)); padding-bottom: env(safe-area-inset-bottom); }
  .content { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .auth-page { padding-top: env(safe-area-inset-top); }
}

@media (max-width: 480px) {
  .auth-card { margin: 8px; padding: 24px 16px; border-radius: 16px; }
  .content { padding: 10px; margin-left: 48px; padding-top: 62px; }
  .sidebar { width: 48px; }
  .sidebar .nav-icon { font-size: 18px; }
  .sidebar .nav-link { padding: 10px 0; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .page-header h2 { font-size: 18px; }
  .stats-grid { grid-template-columns: 1fr; }
  .stat-card { padding: 12px; }
  .stat-value { font-size: 20px; }
  .animal-tabs { gap: 4px; }
  .animal-tab { padding: 6px 12px; font-size: 13px; }
  .data-table { font-size: 12px; }
  .data-table th, .data-table td { padding: 6px 8px; }
  .modal-content { width: 95%; margin: 10px auto; max-height: 90vh; }
  .btn { padding: 6px 12px; font-size: 13px; }
  .btn-primary { padding: 8px 16px; }
  .form-row { grid-template-columns: 1fr; }
  .inventory-unit { flex-direction: column; align-items: flex-start; gap: 6px; }
  .unit-expiry { flex-wrap: wrap; }
  .request-card { padding: 12px; }
  .cal-day { min-height: 70px; }
  .cal-day-num { font-size: 11px; }
  .cal-event { font-size: 10px; padding: 2px 4px; }
  .finance-tabs { flex-wrap: wrap; gap: 4px; }
  .finance-tab { padding: 6px 10px; font-size: 12px; }
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: white;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.report-table thead th {
  background: var(--sidebar-bg, #1e293b);
  color: white;
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
  position: sticky;
  top: 0;
}
.report-table tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.report-table tbody tr:hover {
  background: #f1f5f9;
}
.report-table tbody tr:nth-child(even) {
  background: #f8fafc;
}
.report-table tbody tr:nth-child(even):hover {
  background: #e2e8f0;
}

@media (max-width: 768px) {
  .sidebar .nav-link .badge { position: absolute; top: 2px; right: 2px; font-size: 9px; min-width: 16px; height: 16px; line-height: 16px; padding: 0 3px; }
  .sidebar .nav-link { position: relative; }
}

.lang-switcher-wrapper { position: relative; }
.lang-switcher-btn {
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2);
  color: #cbd5e1; font-size: 12px; padding: 5px 10px; border-radius: 6px;
  cursor: pointer; white-space: nowrap; transition: background 0.2s;
}
.lang-switcher-btn:hover { background: rgba(255,255,255,0.2); }
.lang-dropdown {
  display: none; position: absolute; bottom: 100%; left: 0; margin-bottom: 6px;
  background: #1e293b; border: 1px solid #334155; border-radius: 10px;
  min-width: 180px; max-height: 320px; overflow-y: auto; z-index: 9999;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.4); padding: 6px 0;
}
.lang-dropdown.open { display: block; }
.lang-group-label {
  font-size: 10px; color: #64748b; text-transform: uppercase; letter-spacing: 0.5px;
  padding: 6px 14px 2px; font-weight: 600;
}
.lang-option {
  padding: 7px 14px; font-size: 13px; color: #e2e8f0; cursor: pointer;
  transition: background 0.15s;
}
.lang-option:hover { background: #334155; }
.lang-option.active { color: #60a5fa; font-weight: 600; }
