:root {
  --ink: #232620;
  --forest: #1F3A34;
  --forest-light: #2F4F47;
  --sage: #8FA998;
  --sage-pale: #E7EEE7;
  --sand: #FAFAF7;
  --coral: #C9603F;
  --line: #DDE3DC;
  --white: #FFFFFF;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'IBM Plex Sans', sans-serif;
  background: var(--sand);
  color: var(--ink);
}

h1, h2, h3, .brand-name { font-family: 'Fraunces', serif; }

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

.sidenav {
  width: 220px;
  background: var(--forest);
  color: var(--sage-pale);
  display: flex;
  flex-direction: column;
  padding: 28px 20px;
  flex-shrink: 0;
}
.brand { display: flex; align-items: center; gap: 8px; margin-bottom: 36px; }
.brand-mark { color: var(--coral); font-size: 18px; }
.brand-name { font-size: 14px; font-weight: 600; color: var(--white); line-height: 1.25; }
.sidenav a {
  color: var(--sage-pale);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 4px;
  font-size: 14.5px;
}
.sidenav a.active, .sidenav a:hover { background: var(--forest-light); color: var(--white); }
.sidenav .spacer { flex: 1; }
.sidenav .logout { opacity: 0.7; font-size: 13px; }

.content { flex: 1; padding: 40px 48px; max-width: 1180px; }

.flash {
  background: #FFF3EC;
  border: 1px solid var(--coral);
  color: var(--coral);
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 14px;
}

.page-title { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 28px; }
.page-title h1 { font-size: 26px; margin: 0; font-weight: 600; }
.page-title .subtitle { color: #6B776E; font-size: 14px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px 22px;
}
.stat-card .value { font-family: 'Fraunces', serif; font-size: 32px; color: var(--forest); }
.stat-card .label { font-size: 13px; color: #6B776E; margin-top: 4px; }

.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
}
.panel h2 { font-size: 16px; margin: 0 0 16px 0; font-weight: 600; color: var(--forest); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: #6B776E; font-weight: 500; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.03em; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 10px 10px; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--sage-pale); }
a.row-link { color: var(--forest); text-decoration: none; font-weight: 500; }
a.row-link:hover { text-decoration: underline; }

.search-box { margin-bottom: 20px; }
.search-box input {
  width: 100%; max-width: 360px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
}

.tag { display: inline-block; background: var(--sage-pale); color: var(--forest); padding: 2px 10px; border-radius: 100px; font-size: 12px; }

.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .charts-grid { grid-template-columns: 1fr; } }

/* Diagrama de composição corporal (boneco) */
.body-diagram-wrap {
  position: relative;
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
.body-diagram { width: 100%; max-width: 240px; }
.body-diagram .body-part { fill: var(--sage-pale); stroke: var(--forest); stroke-width: 2; }
.body-label {
  position: absolute;
  display: flex;
  flex-direction: column;
  font-size: 12px;
  line-height: 1.3;
}
.body-label .label-title { color: #6B776E; }
.body-label .label-value { font-family: 'Fraunces', serif; font-size: 16px; color: var(--forest); font-weight: 600; }
.label-trunk { left: 50%; top: 38%; transform: translate(-50%, -50%); text-align: center; }
.label-arm-r { left: 2%; top: 22%; text-align: left; }
.label-arm-l { right: 2%; top: 22%; text-align: right; }
.label-leg-r { left: 8%; bottom: 4%; text-align: left; }
.label-leg-l { right: 8%; bottom: 4%; text-align: right; }
.diagram-note { font-size: 12px; color: #6B776E; text-align: center; margin: 16px 0 0 0; }

.boneco-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.boneco-header h2 { margin: 0; }
.boneco-nav { display: flex; align-items: center; gap: 10px; }
.nav-btn {
  width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--white); color: var(--forest); font-size: 16px; cursor: pointer; line-height: 1;
}
.nav-btn:hover { background: var(--sage-pale); }
.boneco-date { font-family: 'Fraunces', serif; font-size: 15px; color: var(--forest); min-width: 90px; text-align: center; }
.body-limb { transition: fill 0.2s ease; }
.body-diagram .body-part { fill: url(#bodyGrad); stroke: var(--forest); stroke-width: 2; }

.brand-logo { height: 34px; width: auto; }

.about-panel { display: flex; gap: 28px; align-items: flex-start; background: var(--forest); border: none; }
.about-logo { width: 130px; height: auto; flex-shrink: 0; }
.about-body h2 { color: var(--white); font-size: 19px; margin: 4px 0 12px 0; }
.about-links { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-bottom: 18px; }
.about-links a { color: var(--sage); font-size: 13.5px; text-decoration: none; }
.about-links a:hover { color: var(--white); text-decoration: underline; }
.pro-profile {
  background: var(--coral);
  color: var(--white) !important;
  padding: 5px 14px;
  border-radius: 100px;
  font-weight: 500;
}
.pro-profile:hover { background: #B85436; text-decoration: none !important; }
.pro-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.04em; opacity: 0.85; margin-right: 4px; }
.about-locations { display: flex; flex-wrap: wrap; gap: 18px; }
.location-item { display: flex; flex-direction: column; background: rgba(255,255,255,0.06); border-radius: 8px; padding: 12px 16px; min-width: 220px; }
.location-name { color: var(--white); font-weight: 600; font-size: 13.5px; margin-bottom: 4px; }
.location-address { color: var(--sage-pale); font-size: 12.5px; line-height: 1.4; }
.location-ig { color: var(--coral); font-size: 12px; text-decoration: none; margin-top: 4px; }
.location-ig:hover { text-decoration: underline; }
.location-note { color: var(--sage); font-size: 11.5px; margin-top: 4px; font-style: italic; }
@media (max-width: 700px) { .about-panel { flex-direction: column; align-items: center; text-align: center; } .about-links, .about-locations { justify-content: center; } }

/* Financeiro */
.finance-form { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.finance-form .field { display: flex; flex-direction: column; gap: 5px; min-width: 160px; }
.finance-form .field-wide { flex: 1; min-width: 220px; }
.finance-form label { font-size: 12px; color: #6B776E; }
.finance-form input, .finance-form select {
  padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 13.5px; font-family: inherit; min-width: 160px;
}
.finance-form-compact input, .finance-form-compact select { min-width: 140px; }
.btn-primary, .btn-secondary {
  padding: 9px 18px; border: none; border-radius: 8px; font-size: 13.5px; font-weight: 500; cursor: pointer;
}
.btn-primary { background: var(--forest); color: white; }
.btn-primary:hover { background: var(--forest-light); }
.btn-secondary { background: var(--sage-pale); color: var(--forest); }
.btn-secondary:hover { background: var(--sage); color: white; }

.tipos-list { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.tipo-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--sage-pale); color: var(--forest);
  padding: 6px 12px; border-radius: 100px; font-size: 13px;
}
.inline-form { display: inline; }
.chip-remove {
  background: none; border: none; color: var(--coral); font-size: 15px; cursor: pointer; line-height: 1; padding: 0;
}
.chip-remove:hover { color: #8f3f26; }

.link-box { display: flex; gap: 10px; }
.link-box input {
  flex: 1; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 13px; font-family: monospace; background: var(--sand); color: var(--ink);
}

/* Portal público do paciente */
.portal-public { min-height: 100vh; background: var(--sand); }
.portal-public-header {
  display: flex; align-items: center; gap: 16px;
  background: var(--forest); padding: 24px 32px; margin-bottom: 32px;
}
.portal-public-logo { height: 48px; width: auto; }
.portal-public-brand { color: var(--white); font-family: 'Fraunces', serif; font-size: 17px; }
.portal-public-sub { color: var(--sage); font-size: 12.5px; margin-top: 2px; }
.portal-public-footer {
  text-align: center; padding: 24px; color: #6B776E; font-size: 12.5px;
}
.portal-public-footer a { color: var(--forest); text-decoration: none; }
.portal-public-footer a:hover { text-decoration: underline; }

/* Marcação de consulta */
.day-list { display: flex; flex-direction: column; gap: 16px; }
.day-block { border-bottom: 1px solid var(--line); padding-bottom: 14px; }
.day-block:last-child { border-bottom: none; padding-bottom: 0; }
.day-label { font-family: 'Fraunces', serif; font-size: 15px; color: var(--forest); margin-bottom: 8px; }
.slot-list { display: flex; flex-wrap: wrap; gap: 8px; }
.slot-btn {
  padding: 7px 14px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--white); color: var(--forest); font-size: 13px; cursor: pointer; font-family: inherit;
}
.slot-btn:hover { background: var(--sage-pale); }
.slot-selected { background: var(--forest) !important; color: var(--white) !important; border-color: var(--forest) !important; }

/* Login */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--forest);
}
.login-card {
  background: var(--white);
  border-radius: 14px;
  padding: 40px 36px;
  width: 340px;
}
.login-card h1 { font-size: 18px; margin: 0 0 6px 0; color: var(--forest); line-height: 1.3; }
.login-card p.sub { font-size: 13px; color: #6B776E; margin: 0 0 24px 0; }
.login-card label { display: block; font-size: 13px; margin-bottom: 6px; color: var(--ink); }
.login-card input {
  width: 100%; padding: 10px 12px; margin-bottom: 16px;
  border: 1px solid var(--line); border-radius: 8px; font-size: 14px; font-family: inherit;
}
.login-card button {
  width: 100%; padding: 11px; border: none; border-radius: 8px;
  background: var(--forest); color: white; font-size: 14px; font-weight: 500; cursor: pointer;
}
.login-card button:hover { background: var(--forest-light); }
