/* ============================================================
   TOKENS — PALETA INSTITUCIONAL FCMSCSP
   Verde escuro: #1b5e20  |  Verde médio: #2e7d32  |  Verde claro: #43a047
   Branco: #ffffff  |  Fundo: #f4f7f4
   ============================================================ */
:root {
  --sc-green-dark: #1b5e20;
  --sc-green: #2e7d32;
  --sc-green-mid: #388e3c;
  --sc-green-light: #43a047;
  --sc-green-pale: #e8f5e9;
  --sc-green-pale2: #c8e6c9;

  --navy: var(--sc-green-dark);
  --primary: var(--sc-green);
  --accent: var(--sc-green-light);

  --amber: #f59e0b;
  --red: #dc2626;
  --blue: #1e40af;
  --purple: #7c3aed;
  --green-ok: #16a34a;

  --bg: #f2f6f2;
  --surface: #ffffff;
  --border: #dde8dd;
  --border2: #b8d1b8;
  --text: #0d1f0e;
  --text2: #3d5c3e;
  --text3: #7a9c7b;

  --sidebar-w: 248px;
  --header-h: 56px;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(27, 94, 32, 0.09), 0 1px 2px rgba(27, 94, 32, 0.06);
  --shadow-md: 0 4px 14px rgba(27, 94, 32, 0.13);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  font-size: 14px;
}
body {
  font-family: "DM Sans", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
button {
  cursor: pointer;
  font-family: inherit;
}
input,
textarea,
select {
  font-family: inherit;
}
a {
  text-decoration: none;
  color: inherit;
}

/* ============================================================  UTILITY  */
.hidden {
  display: none !important;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.badge-green {
  background: #dcfce7;
  color: #166534;
}
.badge-amber {
  background: #fef3c7;
  color: #92400e;
}
.badge-red {
  background: #fee2e2;
  color: #991b1b;
}
.badge-blue {
  background: #dbeafe;
  color: #1e40af;
}
.badge-purple {
  background: #ede9fe;
  color: #6d28d9;
}
.badge-gray {
  background: #f1f5f1;
  color: var(--text2);
}
.badge-teal {
  background: var(--sc-green-pale);
  color: var(--sc-green-dark);
}

.tag {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}
.tag-teal {
  background: var(--sc-green-pale);
  color: var(--sc-green-dark);
}
.tag-blue {
  background: #dbeafe;
  color: var(--blue);
}
.tag-amber {
  background: #fef3c7;
  color: #92400e;
}
.tag-red {
  background: #fee2e2;
  color: var(--red);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 7px;
  border: none;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
}
.btn-primary {
  background: var(--sc-green);
  color: #fff;
}
.btn-primary:hover {
  background: var(--sc-green-dark);
  box-shadow: 0 2px 8px rgba(27, 94, 32, 0.28);
}
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border2);
}
.btn-secondary:hover {
  background: var(--sc-green-pale);
}
.btn-ghost {
  background: transparent;
  color: var(--text2);
}
.btn-ghost:hover {
  background: var(--sc-green-pale);
  color: var(--sc-green-dark);
}
.btn-danger {
  background: var(--red);
  color: #fff;
}
.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 7px;
}
.card-body {
  padding: 20px;
}

table {
  width: 100%;
  border-collapse: collapse;
}
th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text3);
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: #f6faf6;
}
td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
tr:last-child td {
  border-bottom: none;
}
tr:hover td {
  background: #f3f9f3;
}

.form-group {
  margin-bottom: 15px;
}
.form-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text2);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border2);
  border-radius: 7px;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  transition:
    border 0.15s,
    box-shadow 0.15s;
}
.form-control:focus {
  outline: none;
  border-color: var(--sc-green-mid);
  box-shadow: 0 0 0 3px rgba(56, 142, 60, 0.13);
}
textarea.form-control {
  resize: vertical;
  min-height: 80px;
}
.form-hint {
  font-size: 11px;
  color: var(--text3);
  margin-top: 4px;
}
.form-row {
  display: grid;
  gap: 14px;
}
.form-row-2 {
  grid-template-columns: 1fr 1fr;
}
.form-row-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

/* ============================================================  LOGIN  */
#login-page {
  display: flex;
  min-height: 100vh;
}

.login-left {
  width: 460px;
  min-height: 100vh;
  background: var(--sc-green-dark);
  display: flex;
  flex-direction: column;
  padding: 44px 48px;
  position: relative;
  overflow: hidden;
}
.login-left::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(
      ellipse 80% 60% at 10% 110%,
      rgba(67, 160, 71, 0.3) 0%,
      transparent 55%
    ),
    radial-gradient(
      ellipse 60% 50% at 90% -5%,
      rgba(46, 125, 50, 0.5) 0%,
      transparent 55%
    );
}
/* padrão geométrico sutil */
.login-left::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.04) 1px,
    transparent 1px
  );
  background-size: 28px 28px;
}
.login-left > * {
  position: relative;
  z-index: 1;
}

.login-logo-wrap {
  margin-bottom: auto;
}
.login-logo-img {
  height: 70px;
  object-fit: contain;
  object-position: left;
  filter: brightness(0) invert(1);
}
.login-logo-fallback {
  display: none;
  flex-direction: column;
  gap: 6px;
}
.login-logo-icon {
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
}
.login-logo-text {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
}
.login-logo-text small {
  display: block;
  font-size: 10px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.55);
}

.login-body {
  padding: 44px 0 36px;
}
.login-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: #a5d6a7;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(255, 255, 255, 0.08);
  padding: 5px 14px;
  border-radius: 99px;
  margin-bottom: 20px;
}
.login-headline {
  font-family: "DM Serif Display", serif;
  font-size: 42px;
  line-height: 1.15;
  color: #fff;
  margin-bottom: 20px;
}
.login-headline em {
  color: #a5d6a7;
  font-style: italic;
}
.login-desc {
  font-size: 14px;
  line-height: 1.8;
  color: rgba(255, 255, 255, 0.58);
  max-width: 310px;
}

.login-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.28);
}

.login-right {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: var(--bg);
}
.login-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 42px 44px 38px;
  width: 100%;
  max-width: 430px;
  box-shadow: 0 8px 40px rgba(27, 94, 32, 0.12);
  border: 1px solid var(--border);
}

.login-card-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--sc-green-pale);
  border-radius: 99px;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--sc-green-dark);
  margin-bottom: 22px;
}
.login-card-badge i {
  color: var(--sc-green-mid);
}
.login-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 5px;
}
.login-subtitle {
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 30px;
  line-height: 1.6;
}
.login-input-group {
  margin-bottom: 14px;
}
.login-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text2);
  margin-bottom: 5px;
}
.login-input-wrap {
  position: relative;
}
.login-input-wrap .ico {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  font-size: 15px;
}
.login-input-wrap input {
  width: 100%;
  padding: 10px 12px 10px 36px;
  border: 1.5px solid var(--border2);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  transition:
    border 0.15s,
    box-shadow 0.15s;
}
.login-input-wrap input:focus {
  outline: none;
  border-color: var(--sc-green-mid);
  box-shadow: 0 0 0 3px rgba(56, 142, 60, 0.12);
}
.toggle-pw {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  cursor: pointer;
  font-size: 15px;
}
.login-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
.login-check {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text2);
  cursor: pointer;
}
.login-check input {
  accent-color: var(--sc-green);
}
.login-forgot {
  font-size: 12px;
  color: var(--sc-green-mid);
  font-weight: 500;
}
.btn-login {
  width: 100%;
  padding: 12px;
  background: var(--sc-green);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
}
.btn-login:hover {
  background: var(--sc-green-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(27, 94, 32, 0.25);
}
.login-error {
  margin-top: 14px;
  padding: 10px 14px;
  background: #fee2e2;
  color: #991b1b;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
  display: none;
  align-items: center;
  gap: 8px;
}
.login-divider {
  margin: 26px 0 18px;
  border: none;
  border-top: 1px solid var(--border);
}
.login-hint-box {
  background: var(--sc-green-pale);
  border: 1px solid var(--sc-green-pale2);
  border-radius: 8px;
  padding: 12px 16px;
}
.login-hint-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--sc-green-dark);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.login-hint-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px solid var(--sc-green-pale2);
}
.login-hint-row:last-child {
  border-bottom: none;
}
.login-hint-row span {
  font-size: 11px;
  color: var(--sc-green-dark);
}
.login-hint-row code {
  font-size: 11px;
  background: #fff;
  padding: 2px 8px;
  border-radius: 5px;
  color: var(--sc-green-dark);
  font-family: monospace;
  cursor: pointer;
  border: 1px solid var(--sc-green-pale2);
  transition: all 0.15s;
}
.login-hint-row code:hover {
  background: var(--sc-green);
  color: #fff;
  border-color: var(--sc-green);
}

/* ============================================================  APP SHELL  */
#app {
  display: flex;
  min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--sc-green-dark);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  transition: transform 0.25s;
}
/* listra superior */
.sidebar-stripe {
  height: 4px;
  background: linear-gradient(90deg, #a5d6a7 0%, #fff 40%, #a5d6a7 100%);
  flex-shrink: 0;
  opacity: 0.25;
}

.sidebar-logo {
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  min-height: 68px;
}
.sidebar-logo-img {
  height: 46px;
  object-fit: contain;
  object-position: left;
  filter: brightness(0) invert(1);
  max-width: 190px;
}
.sidebar-logo-fallback {
  display: none;
  align-items: center;
  gap: 10px;
}
.sidebar-logo-icon {
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
  flex-shrink: 0;
}
.sidebar-logo-text {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
}
.sidebar-logo-text small {
  display: block;
  font-size: 9px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.45);
}

.sidebar-nav {
  flex: 1;
  padding: 10px 0;
  overflow-y: auto;
}
.sidebar-section {
  padding: 15px 18px 3px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: rgba(255, 255, 255, 0.28);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  margin: 1px 8px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.65);
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}
.nav-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.09);
}
.nav-item.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
}
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 5px;
  bottom: 5px;
  width: 3px;
  background: #a5d6a7;
  border-radius: 0 3px 3px 0;
}
.nav-item i {
  font-size: 15px;
  width: 20px;
  flex-shrink: 0;
}
.nav-badge {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
}

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.sidebar-user-info {
  flex: 1;
  min-width: 0;
}
.sidebar-user-name {
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.42);
}
.sidebar-logout {
  color: rgba(255, 255, 255, 0.38);
  font-size: 16px;
  cursor: pointer;
  transition: color 0.15s;
}
.sidebar-logout:hover {
  color: rgba(255, 255, 255, 0.85);
}

/* MAIN */
.main-wrap {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.topbar {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 4px rgba(27, 94, 32, 0.07);
}
/* listra verde no topo */
.topbar::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--sc-green-dark) 0%,
    var(--sc-green-light) 100%
  );
}
.topbar-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.topbar-search {
  flex: 1;
  max-width: 300px;
  margin-left: auto;
}
.topbar-search-wrap {
  position: relative;
}
.topbar-search-wrap i {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  font-size: 13px;
}
.topbar-search-wrap input {
  width: 100%;
  padding: 7px 12px 7px 30px;
  border: 1px solid var(--border2);
  border-radius: 7px;
  font-size: 12px;
  background: var(--bg);
  color: var(--text);
}
.topbar-search-wrap input:focus {
  outline: none;
  border-color: var(--sc-green-mid);
  background: #fff;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text2);
  font-size: 15px;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}
.topbar-icon-btn:hover {
  background: var(--sc-green-pale);
  color: var(--sc-green-dark);
  border-color: var(--sc-green-pale2);
}
.notif-dot {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 7px;
  height: 7px;
  background: #dc2626;
  border-radius: 50%;
  border: 1.5px solid #fff;
}
.page-content {
  flex: 1;
  padding: 24px;
}

/* ============================================================  DASHBOARD  */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 22px;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 18px 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  box-shadow: var(--shadow);
}
.stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  flex-shrink: 0;
}
.stat-icon-green {
  background: var(--sc-green-pale);
  color: var(--sc-green-dark);
}
.stat-icon-green2 {
  background: #d1fae5;
  color: #065f46;
}
.stat-icon-amber {
  background: #fef3c7;
  color: #92400e;
}
.stat-icon-blue {
  background: #dbeafe;
  color: #1e40af;
}
.stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  margin-bottom: 3px;
}
.stat-label {
  font-size: 12px;
  color: var(--text2);
}
.stat-delta {
  font-size: 11px;
  color: var(--sc-green-mid);
  font-weight: 500;
  margin-top: 3px;
}

.dash-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 20px;
}
.agenda-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.agenda-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
}
.agenda-item:hover {
  border-color: var(--sc-green-mid);
  background: var(--sc-green-pale);
}
.agenda-time {
  font-size: 13px;
  font-weight: 700;
  color: var(--sc-green-dark);
  width: 48px;
  flex-shrink: 0;
}
.agenda-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.agenda-patient {
  font-size: 13px;
  font-weight: 600;
}
.agenda-meta {
  font-size: 11px;
  color: var(--text3);
}
.activity-list {
  display: flex;
  flex-direction: column;
}
.activity-item {
  display: flex;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}
.activity-item:last-child {
  border-bottom: none;
}
.activity-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
  margin-top: 1px;
}
.activity-text {
  font-size: 12px;
  color: var(--text);
  line-height: 1.5;
}
.activity-text strong {
  font-weight: 600;
}
.activity-time {
  font-size: 11px;
  color: var(--text3);
  margin-top: 2px;
}

/* ============================================================  PACIENTES  */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.page-header-left h1 {
  font-size: 20px;
  font-weight: 700;
}
.page-header-left p {
  font-size: 13px;
  color: var(--text2);
  margin-top: 2px;
}
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.search-box {
  position: relative;
}
.search-box i {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  font-size: 13px;
}
.search-box input {
  padding: 8px 12px 8px 30px;
  border: 1px solid var(--border2);
  border-radius: 7px;
  font-size: 13px;
  width: 240px;
}
.search-box input:focus {
  outline: none;
  border-color: var(--sc-green-mid);
}
select.filter-select {
  padding: 8px 12px;
  border: 1px solid var(--border2);
  border-radius: 7px;
  font-size: 13px;
  background: var(--surface);
  cursor: pointer;
}
select.filter-select:focus {
  outline: none;
  border-color: var(--sc-green-mid);
}
.patient-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.action-btns {
  display: flex;
  gap: 6px;
}

/* ============================================================  PRONTUÁRIO  */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 18px;
  cursor: pointer;
  transition: color 0.15s;
}
.back-btn:hover {
  color: var(--sc-green-dark);
}
.patient-profile {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.patient-profile-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.patient-profile-info h2 {
  font-size: 17px;
  font-weight: 700;
}
.patient-profile-info p {
  font-size: 13px;
  color: var(--text2);
}
.patient-profile-meta {
  margin-left: auto;
  display: flex;
  gap: 24px;
}
.meta-label {
  font-size: 11px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.meta-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.prontuario-tabs {
  display: flex;
  gap: 3px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.ptab {
  padding: 7px 14px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  background: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.ptab:hover {
  color: var(--sc-green-dark);
  background: var(--sc-green-pale);
}
.ptab.active {
  background: var(--sc-green);
  color: #fff;
}
.ptab-content {
  display: none;
}
.ptab-content.active {
  display: block;
}

.anamnese-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.anamnese-section {
  padding: 14px 16px;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--border);
}
.anamnese-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text3);
  margin-bottom: 9px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.anamnese-section-title i {
  color: var(--sc-green-mid);
}
.anamnese-text {
  font-size: 13px;
  line-height: 1.75;
  color: var(--text);
}

.evolucao-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.evolucao-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.evolucao-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  background: #f6faf6;
  flex-wrap: wrap;
}
.evolucao-num {
  font-size: 11px;
  font-weight: 700;
  color: var(--text3);
}
.evolucao-date {
  margin-left: auto;
  font-size: 11px;
  color: var(--text3);
  display: flex;
  align-items: center;
  gap: 4px;
}
.evolucao-author {
  font-size: 11px;
  color: var(--text3);
  display: flex;
  align-items: center;
  gap: 4px;
}
.evolucao-body {
  padding: 14px 16px;
}
.evolucao-content {
  font-size: 13px;
  line-height: 1.8;
  color: var(--text);
}
.evolucao-tags {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.imutavel-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  color: var(--text3);
  margin-top: 8px;
}
.imutavel-badge i {
  color: #f59e0b;
}

.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.doc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  cursor: pointer;
  transition: all 0.15s;
}
.doc-card:hover {
  border-color: var(--sc-green-mid);
  box-shadow: var(--shadow-md);
}
.doc-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.doc-icon-pdf {
  background: #fee2e2;
  color: #dc2626;
}
.doc-icon-img {
  background: #dbeafe;
  color: #1e40af;
}
.doc-icon-docx {
  background: #dbeafe;
  color: #1e40af;
}
.doc-name {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}
.doc-meta {
  font-size: 11px;
  color: var(--text3);
}

/* ============================================================  AGENDA  */
.calendar-grid {
  display: grid;
  grid-template-columns: 58px repeat(5, 1fr);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}
.cal-header {
  background: var(--sc-green-dark);
  color: rgba(255, 255, 255, 0.85);
  font-size: 12px;
  font-weight: 600;
  padding: 10px 6px;
  text-align: center;
}
.cal-hour-label {
  background: #f6faf6;
  font-size: 10px;
  color: var(--text3);
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 5px 7px 0;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.cal-slot {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  min-height: 50px;
  padding: 2px;
}
.cal-event {
  border-radius: 5px;
  padding: 4px 7px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  margin: 1px 0;
  transition: filter 0.15s;
}
.cal-event:hover {
  filter: brightness(0.92);
}
.cal-event-green {
  background: var(--sc-green-pale);
  color: var(--sc-green-dark);
  border-left: 3px solid var(--sc-green);
}
.cal-event-green2 {
  background: #d1fae5;
  color: #065f46;
  border-left: 3px solid #059669;
}
.cal-event-blue {
  background: #dbeafe;
  color: #1e40af;
  border-left: 3px solid #3b82f6;
}
.cal-event-amber {
  background: #fef3c7;
  color: #92400e;
  border-left: 3px solid #f59e0b;
}
.cal-nav-btn {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 1px solid var(--border2);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text2);
}
.cal-nav-btn:hover {
  background: var(--sc-green-pale);
  color: var(--sc-green-dark);
}
.cal-month {
  font-size: 15px;
  font-weight: 700;
  min-width: 170px;
  text-align: center;
}

/* ============================================================  ACESSO & USUÁRIOS  */
.users-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.user-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.user-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.user-card-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.user-card-name {
  font-size: 14px;
  font-weight: 700;
}
.user-card-email {
  font-size: 12px;
  color: var(--text3);
}
.user-stat {
  background: var(--bg);
  border-radius: 7px;
  padding: 8px 10px;
}
.user-stat-val {
  font-size: 16px;
  font-weight: 700;
}
.user-stat-label {
  font-size: 10px;
  color: var(--text3);
}

.perm-table th,
.perm-table td {
  font-size: 12px;
}
.perm-yes {
  color: #16a34a;
  font-size: 16px;
}
.perm-no {
  color: #dc2626;
  font-size: 16px;
}
.perm-cond {
  color: #92400e;
  font-size: 11px;
  font-weight: 600;
}
.perm-never {
  color: #dc2626;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ============================================================  AUDITORIA  */
.audit-item {
  display: flex;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.audit-item:last-child {
  border-bottom: none;
}
.audit-line {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.audit-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
}
.audit-connector {
  width: 2px;
  flex: 1;
  background: var(--border);
  margin: 3px 0;
  min-height: 20px;
}
.audit-action {
  font-size: 13px;
  color: var(--text);
}
.audit-action strong {
  font-weight: 600;
}
.audit-time {
  font-size: 11px;
  color: var(--text3);
  margin-top: 2px;
}

/* ============================================================  ACESSO PACIENTE  */
.access-request-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
  margin-bottom: 10px;
}
.access-request-name {
  font-size: 14px;
  font-weight: 600;
}
.access-request-date {
  font-size: 12px;
  color: var(--text3);
}
.access-request-actions {
  display: flex;
  gap: 8px;
}

/* ============================================================  MODAL  */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 31, 14, 0.55);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(2px);
}
.modal {
  background: var(--surface);
  border-radius: 12px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(27, 94, 32, 0.22);
  border: 1px solid var(--border);
}
.modal-header {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 7px;
}
.modal-close {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: var(--bg);
  color: var(--text2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.modal-close:hover {
  background: #fee2e2;
  color: #dc2626;
}
.modal-body {
  padding: 20px 22px;
}
.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.alert-immutable {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12px;
  color: #92400e;
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-bottom: 16px;
}
.alert-immutable i {
  color: #f59e0b;
  margin-top: 1px;
  flex-shrink: 0;
}

/* ============================================================  EMPTY  */
.empty-state {
  text-align: center;
  padding: 56px 20px;
}
.empty-state-icon {
  font-size: 44px;
  color: var(--text3);
  margin-bottom: 14px;
}
.empty-state h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 6px;
}
.empty-state p {
  font-size: 13px;
  color: var(--text3);
}

/* ============================================================  TOAST  */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--sc-green-dark);
  color: #fff;
  padding: 11px 16px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 16px rgba(27, 94, 32, 0.25);
  animation: slideIn 0.25s ease;
  min-width: 260px;
  border-left: 3px solid #a5d6a7;
}
.toast i {
  font-size: 16px;
}
.toast-success i {
  color: #86efac;
}
.toast-error i {
  color: #fca5a5;
}
.toast-info i {
  color: #93c5fd;
}
@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ============================================================  RESPONSIVE  */
@media (max-width: 1100px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .dash-grid {
    grid-template-columns: 1fr;
  }
  .anamnese-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-wrap {
    margin-left: 0;
  }
  .login-left {
    display: none;
  }
  .form-row-3 {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 600px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .patient-profile-meta {
    display: none;
  }
  .form-row-2,
  .form-row-3 {
    grid-template-columns: 1fr;
  }
}
