/* HaberSolutions */
:root {
  --navy: #1e4976;
  --blue: #2d6a9f;
  --blue-hover: #245a8a;
  --blue-bg: #e8f2f8;
  --blue-border: #b8d4e8;
  --white: #fff;
  --bg: #f5f7fa;
  --surface: #fff;
  --border: #dce4ec;
  --border-light: #e8eef4;
  --text: #1f3344;
  --text-muted: #5a6c7d;
  --radius: 10px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(30, 73, 118, 0.06), 0 4px 14px rgba(30, 73, 118, 0.06);
  --shadow-md: 0 8px 24px rgba(30, 73, 118, 0.10);
  --ring: 0 0 0 3px rgba(45, 106, 159, 0.18);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: cubic-bezier(0.7, 0, 0.84, 0);
  --speed-1: 120ms;
  --speed-2: 200ms;
  --font: 'Source Sans 3', -apple-system, BlinkMacSystemFont, sans-serif;
  --header-h: 56px;
  --bottom-nav-h: 56px;
  --sidebar-w: 200px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; text-underline-offset: 0.14em; }
a:hover { text-decoration: underline; }
input, select, textarea, button { font-family: var(--font); font-size: 1rem; }
button { cursor: pointer; }

*:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-color: var(--blue);
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}

.container { max-width: 960px; margin: 0 auto; padding: 0 1rem; }

/* Auth */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 380px;
  padding: 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.auth-card h1 { font-size: 1.375rem; font-weight: 600; color: var(--navy); margin-bottom: 0.25rem; }
.auth-card .sub { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 1.5rem; }
.auth-card .form-group { margin-bottom: 1rem; }
.auth-card label { display: block; font-size: 0.875rem; font-weight: 500; color: var(--text); margin-bottom: 0.375rem; }
.auth-card input[type="text"],
.auth-card input[type="email"],
.auth-card input[type="password"] {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
}
.auth-card input:focus {
  outline: 0;
  border-color: var(--blue);
  box-shadow: var(--ring);
}
.auth-card .btn {
  width: 100%;
  padding: 0.625rem 1rem;
  margin-top: 0.25rem;
  font-weight: 600;
  font-size: 0.9375rem;
  background: var(--blue);
  color: var(--white);
  border: 0;
  border-radius: var(--radius);
}
.auth-card .btn:hover { background: var(--blue-hover); text-decoration: none; }
.auth-card .links { margin-top: 1.25rem; font-size: 0.875rem; color: var(--text-muted); text-align: center; }
.auth-card .links a { color: var(--blue); }
.auth-card .error { font-size: 0.8125rem; color: #b91c1c; margin-top: 0.25rem; }
.auth-card .role-options { display: flex; gap: 1rem; margin-top: 0.5rem; }
.auth-card .role-options label { display: flex; align-items: center; gap: 0.5rem; font-weight: 400; cursor: pointer; }
.auth-card .role-options input { width: auto; }

/* App layout */
.app-body { padding-bottom: var(--bottom-nav-h); min-height: 100vh; }
@media (min-width: 1024px) {
  .app-body { padding-bottom: 0; display: flex; flex-direction: column; }
}

.app-header {
  height: var(--header-h);
  padding: 0 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.app-header__inner {
  max-width: 1200px;
  height: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.app-header__brand {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--navy);
}
.app-header__brand:hover { text-decoration: none; color: var(--blue); }
.app-header__user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}
.app-header__name { color: var(--text); }
.app-header__logout { display: inline; }
.app-header .btn-link {
  background: 0;
  border: 0;
  padding: 0.25rem 0;
  font-size: 0.875rem;
  color: var(--blue);
}
.app-header .btn-link:hover { text-decoration: underline; color: var(--blue-hover); }
.badge-role {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: var(--blue-bg);
  color: var(--navy);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.app-wrap {
  flex: 1;
  display: flex;
  min-height: calc(100vh - var(--header-h) - var(--bottom-nav-h));
}
@media (min-width: 1024px) {
  .app-wrap { min-height: calc(100vh - var(--header-h)); }
}

.app-sidebar {
  display: none;
  width: var(--sidebar-w);
  flex-shrink: 0;
  padding: 1rem 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
}
@media (min-width: 1024px) { .app-sidebar { display: block; } }
.app-sidebar__nav { display: flex; flex-direction: column; gap: 2px; }
.app-nav__item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 1rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text);
  border-left: 3px solid transparent;
  transition: background var(--speed-1) var(--ease-out), border-color var(--speed-1) var(--ease-out), transform var(--speed-1) var(--ease-out);
}
.app-nav__item:hover { background: var(--bg); color: var(--navy); text-decoration: none; transform: translateX(1px); }
.app-nav__item.active {
  background: var(--blue-bg);
  color: var(--navy);
  border-left-color: var(--blue);
}
.app-nav__icon { display: flex; align-items: center; }
.app-nav__icon svg { flex-shrink: 0; }
.app-nav__label { white-space: nowrap; }

.app-main {
  flex: 1;
  min-width: 0;
  padding: 1.25rem 1rem;
  padding-bottom: calc(1.25rem + env(safe-area-inset-bottom, 0));
  background: var(--bg);
}
@media (min-width: 1024px) { .app-main { padding: 1.5rem 2rem; } }
.app-main__inner { max-width: 880px; margin: 0 auto; }
.app-main .page-title {
  font-size: 1.375rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 1.5rem;
}

.app-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-h);
  padding-bottom: env(safe-area-inset-bottom, 0);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  z-index: 100;
}
@media (min-width: 1024px) { .app-bottom-nav { display: none; } }
.app-bottom-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--text-muted);
  max-width: 140px;
  transition: background var(--speed-1) var(--ease-out), color var(--speed-1) var(--ease-out), transform var(--speed-1) var(--ease-out);
}
.app-bottom-nav__item:hover { background: var(--bg); color: var(--text); text-decoration: none; transform: translateY(-1px); }
.app-bottom-nav__item.active { color: var(--blue); }
.app-bottom-nav__item.active .app-bottom-nav__icon { color: var(--blue); }
.app-bottom-nav__icon { display: flex; color: var(--text-muted); }
.app-bottom-nav__item.active .app-bottom-nav__icon { color: var(--blue); }
.app-bottom-nav__label { white-space: nowrap; }

/* Dashboard */
@keyframes dashboardFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  @keyframes dashboardFadeIn { from { opacity: 0; } to { opacity: 1; } }
}

.dashboard-hero {
  margin-bottom: 1.5rem;
  padding: 1.25rem 1rem;
  background: linear-gradient(135deg, var(--blue-bg) 0%, rgba(255,255,255,0.95) 100%);
  border: 1px solid var(--blue-border);
  border-radius: var(--radius);
  animation: dashboardFadeIn 0.4s ease-out;
}
.dashboard-hero__title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--navy);
  margin: 0 0 0.25rem 0;
  letter-spacing: -0.02em;
}
.dashboard-hero__sub {
  font-size: 0.9375rem;
  color: var(--text-muted);
  margin: 0;
}

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.75rem;
  animation: dashboardFadeIn 0.45s ease-out 0.05s both;
}
@media (prefers-reduced-motion: reduce) { .dashboard-stats { animation: none; } }
.dashboard-stat {
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
  box-shadow: 0 0 0 rgba(0,0,0,0);
  transition: transform var(--speed-2) var(--ease-out), box-shadow var(--speed-2) var(--ease-out), border-color var(--speed-2) var(--ease-out);
}
.dashboard-stat:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
  border-color: var(--blue-border);
}
.dashboard-stat__value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--blue);
  line-height: 1.2;
}
.dashboard-stat__label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.dashboard-stats--tecnico { grid-template-columns: repeat(2, 1fr); }

.dashboard-section {
  margin-bottom: 2rem;
  animation: dashboardFadeIn 0.5s ease-out both;
}
.dashboard-section { animation-delay: 0.08s; }
.dashboard-section + .dashboard-section { animation-delay: 0.16s; }
.dashboard-section + .dashboard-section + .dashboard-section { animation-delay: 0.24s; }
.dashboard-section + .dashboard-section + .dashboard-section + .dashboard-section { animation-delay: 0.32s; }
.dashboard-section:last-child { margin-bottom: 0; }
@media (prefers-reduced-motion: reduce) {
  .dashboard-section { animation: none; }
  .dashboard-section + .dashboard-section,
  .dashboard-section + .dashboard-section + .dashboard-section,
  .dashboard-section + .dashboard-section + .dashboard-section + .dashboard-section { animation-delay: 0; }
}
.dashboard-section__title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-light);
}
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 640px) { .dashboard-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .dashboard-grid { grid-template-columns: repeat(3, 1fr); } }
.dashboard-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: 0 0 0 rgba(0,0,0,0);
  transition: transform var(--speed-2) var(--ease-out), box-shadow var(--speed-2) var(--ease-out), border-color var(--speed-2) var(--ease-out);
}
.dashboard-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--blue-border);
}
@media (prefers-reduced-motion: reduce) {
  .dashboard-card:hover { transform: none; }
}
.dashboard-card__title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 0.75rem;
}
.dashboard-card--full { grid-column: 1 / -1; }
.dashboard-card__action { margin-top: 1rem; }

.card-list { list-style: none; }
.card-list__item {
  padding: 0.5rem 0.5rem 0.5rem 0;
  margin: 0 -0.5rem 0 0;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.9375rem;
  border-radius: var(--radius-sm);
  transition: background var(--speed-2) var(--ease-out);
}
.card-list__item:hover { background: var(--blue-bg); }
.card-list__item:last-child { border-bottom: 0; }
.card-list__item--empty { color: var(--text-muted); font-size: 0.875rem; }
.card-list__item--empty:hover { background: transparent; }
.card-list__form { display: inline; }

/* Página do paciente (coordenadora) */
.patient-header { margin-bottom: 1.5rem; }
.patient-header__title { font-size: 1.375rem; font-weight: 700; color: var(--navy); margin: 0.5rem 0 0 0; }
.patient-section { margin-bottom: 2rem; }
.patient-section__title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border-light);
}
.patient-section__count { font-weight: 500; color: var(--blue); }
.patient-section__delete { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--border-light); }
.patient-form { margin-bottom: 1rem; }
.patient-form__row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.patient-form__input {
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9375rem;
}
.patient-form__input--sm { flex: 0 0 100px; max-width: 120px; }
.patient-form__select { padding: 0.5rem 0.75rem; border: 1px solid var(--border); border-radius: var(--radius); font-size: 0.9375rem; min-width: 180px; }
.patient-form__days { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; flex: 1; min-width: 0; }
.patient-form__days-label { font-size: 0.875rem; font-weight: 500; color: var(--text); flex: 0 0 auto; }
.patient-form__day-check { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.875rem; color: var(--text); cursor: pointer; white-space: nowrap; }
.patient-form__day-check input { margin: 0; }
.patient-form--attach { margin-top: 0.75rem; margin-bottom: 0; padding-top: 0.75rem; border-top: 1px solid var(--border-light); }
.text-muted { color: var(--text-muted); font-size: 0.875rem; }
.patient-details { margin-top: 0.5rem; }
.patient-details__summary {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--blue);
  cursor: pointer;
  padding: 0.5rem 0;
  list-style: none;
}
.patient-details__summary::-webkit-details-marker { display: none; }
.patient-details__summary:hover { text-decoration: underline; }
.patient-details[open] .patient-details__summary { margin-bottom: 0.5rem; }

.patient-details__text {
  margin: 0.25rem 0 0;
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.3;
}

.patient-details--med { margin-top: 0.25rem; }

.prescription-text {
  white-space: pre-wrap;
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.35;
}

.med-item__content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}
.card h2, .card h3 { font-size: 0.9375rem; font-weight: 600; color: var(--navy); margin-bottom: 0.75rem; }
.card ul { list-style: none; }
.card li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.9375rem;
}
.card li:last-child { border-bottom: 0; }
.card .form-group { margin-bottom: 1rem; }
.card .form-group label { display: block; font-size: 0.875rem; font-weight: 500; color: var(--text); margin-bottom: 0.375rem; }
.card .form-group input { width: 100%; max-width: 320px; padding: 0.5rem 0.75rem; border: 1px solid var(--border); border-radius: var(--radius); font-size: 0.9375rem; }
.card .sub { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 1rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: background .2s ease, transform .15s ease, box-shadow .2s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--blue); color: var(--white); }
.btn-primary:hover { background: var(--blue-hover); text-decoration: none; box-shadow: 0 4px 12px rgba(45, 106, 159, 0.25); }
.btn-outline { background: 0; color: var(--blue); border: 1px solid var(--blue-border); }
.btn-outline:hover { background: var(--blue-bg); text-decoration: none; border-color: var(--blue); }
.btn-sm { padding: 0.3125rem 0.625rem; font-size: 0.8125rem; }
@media (prefers-reduced-motion: reduce) { .btn:hover { transform: none; } .btn-primary:hover { box-shadow: none; } }
.btn-danger { background: #b91c1c; color: var(--white); }
.btn-success { background: #15803d; color: var(--white); }
.btn-success:hover { background: #166534; text-decoration: none; }

.form-inline { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: flex-end; }
.form-inline input {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
}
.form-inline label { font-size: 0.875rem; color: var(--text-muted); }

.badge {
  font-size: 0.6875rem;
  font-weight: 500;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: var(--blue-bg);
  color: var(--navy);
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }

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

.ponto-status {
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.875rem;
}
.ponto-status.entrada { background: #dcfce7; color: #166534; }
.ponto-status.saida { background: var(--border-light); color: var(--text-muted); }
.ponto-status .hora { font-weight: 600; }

.done { opacity: 0.75; }
.done .task-title { text-decoration: line-through; }

.alert {
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  border: 1px solid transparent;
}
.alert-success { background: #dcfce7; color: #166534; border-color: #86efac; }
.alert-error { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }

@media (max-width: 640px) {
  .auth-card { padding: 1.5rem; }
  .card, .dashboard-card { padding: 1rem; }
  .form-inline { flex-direction: column; align-items: stretch; }
  .form-inline input, .form-inline .btn { width: 100%; }
  .patient-form__row { flex-direction: column; align-items: stretch; }
  .patient-form__input, .patient-form__input--sm { max-width: none; }
  .patient-form__select { width: 100%; min-width: 0; }
  .patient-form__days { width: 100%; }
}
