:root {
  /* Cores Oficiais - Hospital Jaraguá */
  --primary: #00583C;
  --primary-hover: #00452F;
  --primary-light: #007A54;
  --primary-soft: #E8F5E9;
  --primary-border: #A3D9C9;

  /* Status */
  --accent-red: #DC2626;
  --accent-red-bg: #FEE2E2;
  --accent-red-border: #F87171;
  --accent-green: #16A34A;
  --accent-green-bg: #DCFCE7;
  --accent-green-border: #86EFAC;
  --accent-blue: #0284C7;
  --accent-blue-bg: #E0F2FE;
  --accent-amber: #D97706;
  --accent-amber-bg: #FEF3C7;

  /* Superfícies - Modo Claro Padrão */
  --bg-body: #F1F5F9;
  --bg-card: #FFFFFF;
  --bg-header: linear-gradient(135deg, #00583C 0%, #00452F 100%);
  --bg-hover: #F8FAFC;
  --text-main: #0F172A;
  --text-muted: #64748B;
  --border-color: #E2E8F0;

  /* Geometria e Efeitos */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 10px -2px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.12);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Modo Escuro */
[data-theme="dark"] {
  --bg-body: #0B1120;
  --bg-card: #1E293B;
  --bg-header: linear-gradient(135deg, #064E3B 0%, #022C22 100%);
  --bg-hover: #334155;
  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  --border-color: #334155;
  --primary-soft: #064E3B;
  --primary-border: #047857;
  --accent-red-bg: rgba(220, 38, 38, 0.2);
  --accent-green-bg: rgba(22, 163, 74, 0.2);
  --accent-amber-bg: rgba(217, 119, 6, 0.2);
  --accent-blue-bg: rgba(2, 132, 199, 0.2);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  font-size: 15px;
  line-height: 1.5;
}

/* ===================================================
   HEADER & TOPBAR MOBILE
=================================================== */
.app-header {
  background: var(--bg-header);
  color: #FFFFFF;
  padding: 12px 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-md);
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo-wrap {
  background: #FFFFFF;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.brand-logo {
  height: 26px;
  width: auto;
  object-fit: contain;
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.3px;
  display: flex;
  flex-direction: column;
}

.brand-subtitle {
  font-size: 0.72rem;
  font-weight: 500;
  opacity: 0.85;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #FFFFFF;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition);
}

.icon-btn:hover, .icon-btn:active {
  background: rgba(255, 255, 255, 0.28);
  transform: scale(0.96);
}

.icon-btn-danger {
  background: var(--accent-red-bg);
  color: var(--accent-red);
  border: 1px solid var(--accent-red-border);
}

.icon-btn-danger:hover, .icon-btn-danger:active {
  background: var(--accent-red);
  color: #FFFFFF;
}

/* User Pill in Header */
.user-info-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 0.8rem;
}

.user-name-role {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.role-badge {
  background: rgba(255,255,255,0.22);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

/* ===================================================
   NAVIGATION TABS
=================================================== */
.tabs-nav {
  display: flex;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 6px 12px;
  gap: 6px;
  position: sticky;
  top: 73px;
  z-index: 40;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs-nav::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  flex: 1;
  min-width: fit-content;
  background: transparent;
  border: 1px solid transparent;
  padding: 8px 12px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: var(--transition);
  white-space: nowrap;
}

.tab-btn.active {
  background: var(--primary);
  color: #FFFFFF;
  box-shadow: 0 2px 6px rgba(0, 88, 60, 0.3);
}

.tab-badge {
  background: rgba(0, 0, 0, 0.15);
  color: inherit;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
}

.tab-btn.active .tab-badge {
  background: rgba(255, 255, 255, 0.28);
}

/* ===================================================
   MAIN CONTENT & CONTAINERS
=================================================== */
.main-content {
  flex: 1;
  padding: 12px;
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
}

/* Banner de Meta Diária */
.meta-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 12px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.meta-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--primary);
}

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

.meta-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.meta-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.meta-numbers {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin: 10px 0;
  text-align: center;
}

.meta-kpi {
  background: var(--bg-body);
  padding: 8px 4px;
  border-radius: var(--radius-sm);
}

.meta-kpi-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-muted);
}

.meta-kpi-value {
  font-size: 0.95rem;
  font-weight: 800;
}

.meta-kpi-value.green {
  color: var(--accent-green);
}

.meta-kpi-value.red {
  color: var(--accent-red);
}

.meta-progress-bar {
  width: 100%;
  height: 8px;
  background: #E2E8F0;
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 6px;
}

[data-theme="dark"] .meta-progress-bar {
  background: #334155;
}

.meta-progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
  background: var(--accent-green);
}

.meta-progress-fill.warn {
  background: var(--accent-amber);
}

.meta-progress-fill.danger {
  background: var(--accent-red);
}

/* ===================================================
   APPROVAL CARDS (SC & OC)
=================================================== */
.approval-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.approval-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.approval-card:active {
  transform: scale(0.985);
  box-shadow: none;
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.card-doc-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.type-pill {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}

.type-pill.sc {
  background: var(--accent-blue-bg);
  color: var(--accent-blue);
  border: 1px solid rgba(2, 132, 199, 0.3);
}

.type-pill.oc {
  background: var(--accent-amber-bg);
  color: var(--accent-amber);
  border: 1px solid rgba(217, 119, 6, 0.3);
}

.doc-number {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.2px;
}

.urgent-badge {
  background: var(--accent-red-bg);
  color: var(--accent-red);
  border: 1px solid var(--accent-red-border);
  padding: 2px 7px;
  border-radius: var(--radius-full);
  font-size: 0.68rem;
  font-weight: 800;
  animation: pulseUrgent 1.8s infinite;
}

@keyframes pulseUrgent {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.75; transform: scale(1.05); }
}

.card-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.card-body-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.card-desc {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
}

.card-details-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.card-footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 8px;
  border-top: 1px dashed var(--border-color);
  margin-top: 2px;
}

.total-value {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--primary);
}

[data-theme="dark"] .total-value {
  color: #34D399;
}

.cc-status-pill {
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-weight: 700;
}

.cc-status-pill.ok {
  background: var(--accent-green-bg);
  color: var(--accent-green);
}

.cc-status-pill.danger {
  background: var(--accent-red-bg);
  color: var(--accent-red);
}

/* ===================================================
   RESPONSIVE TABLE (CENTROS DE CUSTO)
=================================================== */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
}

.cc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
}

.cc-table thead th {
  background: var(--bg-body);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.cc-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
  color: var(--text-main);
}

.cc-table tbody tr:hover {
  background: var(--bg-hover);
}

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

/* ===================================================
   METAS BADGES & ACTIONS
=================================================== */
.meta-badge {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
}

.meta-badge.vigente {
  background: var(--accent-green-bg);
  color: var(--accent-green);
  border: 1px solid var(--accent-green-border);
}

.meta-badge.finalizada {
  background: var(--bg-body);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

.meta-badge.futura {
  background: var(--accent-blue-bg);
  color: var(--accent-blue);
  border: 1px solid rgba(2, 132, 199, 0.3);
}

/* ===================================================
   MODAL / BOTTOM SHEET
=================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.bottom-sheet {
  background: var(--bg-card);
  width: 100%;
  max-width: 760px;
  max-height: 88vh;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-lg);
}

.modal-overlay.open .bottom-sheet {
  transform: translateY(0);
}

.sheet-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

.sheet-handle {
  width: 38px;
  height: 4px;
  background: var(--border-color);
  border-radius: var(--radius-full);
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
}

.sheet-title {
  font-size: 1.1rem;
  font-weight: 800;
}

.sheet-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sheet-subtabs {
  display: flex;
  gap: 6px;
  background: var(--bg-body);
  padding: 4px;
  border-radius: var(--radius-sm);
}

.sheet-subtab-btn {
  flex: 1;
  border: none;
  background: transparent;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
}

.sheet-subtab-btn.active {
  background: var(--bg-card);
  color: var(--text-main);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

/* Item List in Sheet */
.item-card {
  background: var(--bg-body);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.item-name {
  font-size: 0.85rem;
  font-weight: 700;
}

.item-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.item-price {
  font-weight: 700;
  color: var(--text-main);
}

/* Sheet Footer Fixed Action Buttons */
.sheet-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border-color);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  background: var(--bg-card);
}

.btn-action {
  padding: 12px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 800;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-approve {
  background: var(--primary);
  color: #FFFFFF;
}

.btn-approve:hover, .btn-approve:active {
  background: var(--primary-hover);
  transform: scale(0.98);
}

.btn-reject {
  background: var(--accent-red-bg);
  color: var(--accent-red);
  border: 1px solid var(--accent-red-border);
}

.btn-reject:hover, .btn-reject:active {
  background: #F87171;
  color: #FFFFFF;
  transform: scale(0.98);
}

/* ===================================================
   LOGIN SCREEN
=================================================== */
.login-wrap {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 24px 16px;
  background: radial-gradient(circle at top, #00583C 0%, #0F172A 70%);
}

.login-card {
  background: var(--bg-card);
  width: 100%;
  max-width: 380px;
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: center;
}

.login-logo {
  height: 48px;
  object-fit: contain;
  margin: 0 auto 4px auto;
}

.login-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
}

.login-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

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

.form-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.form-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border-color);
  background: var(--bg-body);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition);
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 88, 60, 0.15);
}

.btn-login {
  background: var(--primary);
  color: #FFFFFF;
  padding: 13px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 6px;
}

.btn-login:active {
  transform: scale(0.98);
}

/* ===================================================
   SETTINGS / CONFIG PANELS
=================================================== */
.config-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.config-box {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

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

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #CBD5E1;
  transition: .3s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

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

input:checked + .slider:before {
  transform: translateX(20px);
}

/* Toasts */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 90%;
  max-width: 420px;
  pointer-events: none;
}

.toast {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  animation: slideToast 0.3s ease;
  pointer-events: auto;
}

.toast.success {
  background: var(--primary);
  color: #FFFFFF;
}

.toast.error {
  background: var(--accent-red);
  color: #FFFFFF;
}

@keyframes slideToast {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===================================================
   AUTOCOMPLETE DROPDOWN (ADMIN CADASTRO)
=================================================== */
.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  max-height: 220px;
  overflow-y: auto;
  z-index: 99;
  margin-top: 4px;
}

.autocomplete-item {
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
  transition: background var(--transition);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:hover, .autocomplete-item.active {
  background: rgba(0, 82, 155, 0.08);
}

.autocomplete-login {
  font-weight: 800;
  color: var(--primary);
  font-size: 0.85rem;
}

.autocomplete-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
}

.autocomplete-role {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Parecer Técnico */
.btn-parecer {
  background: #0284c7;
  color: #FFFFFF;
}

.btn-parecer:hover {
  background: #0369a1;
}

.parecer-quote-box {
  background: rgba(2, 132, 199, 0.08);
  border-left: 3px solid #0284c7;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.82rem;
  line-height: 1.45;
}

.badge-parecer-pendente {
  background: rgba(217, 119, 6, 0.12);
  color: #d97706;
  border: 1px solid rgba(217, 119, 6, 0.3);
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
}

.badge-parecer-respondido {
  background: rgba(2, 132, 199, 0.12);
  color: #0284c7;
  border: 1px solid rgba(2, 132, 199, 0.3);
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
}


