:root {
  --bg: #ebe6dc;
  --surface: #fbf8f3;
  --ink: #1c2430;
  --muted: #5e6972;
  --line: #e3dbcf;
  --accent: #0c6e62;
  --accent-dark: #084e46;
  --soft: #e5f3ef;
  --sidebar: #17211f;
  --sun: #e3a322;
  --coral: #b64032;
  --coral-soft: #f8e4df;
  --good: #2f6b32;
  --good-soft: #e5f3df;
  --wait: #245f86;
  --wait-soft: #e3f0f8;
  --shadow: 0 16px 40px rgba(28, 36, 32, 0.08);
  --sidebar-w: 232px;
  --radius: 16px;
  --font: "Outfit", "Segoe UI", sans-serif;
  --display: "Newsreader", Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(900px 280px at 100% -10%, rgba(227, 163, 34, 0.16), transparent 50%),
    var(--bg);
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
a { color: var(--accent-dark); }

.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(280px, 1.05fr) minmax(320px, 0.95fr);
}
.login-brand {
  background:
    radial-gradient(700px 320px at 0% 0%, rgba(227, 163, 34, 0.22), transparent 55%),
    linear-gradient(165deg, #243734 0%, #121a19 72%);
  color: #f7f2e9;
  padding: 48px 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 36px;
}
.mark {
  display: flex;
  align-items: center;
  gap: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 700;
}
.mark-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #f6f1e8;
  color: var(--sidebar);
  display: grid;
  place-items: center;
}
.login-brand h1 {
  font-family: var(--display);
  font-size: clamp(44px, 5vw, 68px);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 0.95;
  max-width: 11ch;
}
.login-brand .lede {
  margin-top: 18px;
  max-width: 36ch;
  color: rgba(247, 242, 233, 0.78);
  font-size: 17px;
  line-height: 1.45;
}
.points { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 10px; }
.points li { display: flex; gap: 10px; align-items: center; }
.points i {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--sun); display: block; flex: none;
}
.fine { font-size: 13px; color: rgba(247, 242, 233, 0.62); }
.login-panel { display: grid; place-items: center; padding: 32px 24px; }
.card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 32px;
  box-shadow: var(--shadow);
}
.eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #8a6230;
}
.card h2 {
  font-family: var(--display);
  font-size: 36px;
  font-weight: 500;
  margin: 8px 0;
}
.card .sub, .sub { color: var(--muted); line-height: 1.45; margin-bottom: 18px; }
label { display: block; font-size: 13px; font-weight: 650; margin-bottom: 6px; }
.field { margin-bottom: 14px; }
input, select, textarea {
  width: 100%;
  background: #fff;
  border: 1px solid #ddd4c6;
  border-radius: 12px;
  padding: 12px 13px;
  outline: none;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(12, 110, 98, 0.14);
}
.btn {
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  background: var(--accent);
  color: white;
  font-weight: 650;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn:hover { background: var(--accent-dark); }
.btn.block { width: 100%; }
.btn.ghost {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn.ghost:hover { border-color: #cfc6b8; }
.btn.small { padding: 8px 12px; font-size: 14px; }
.btn.sun { background: #f3c15a; color: #2a2112; }
.btn.sun:hover { background: #e3a322; }
.note { margin-top: 14px; font-size: 13px; color: var(--muted); line-height: 1.4; }

.shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar-w) 1fr; }
.sidebar {
  background: var(--sidebar);
  color: #f6f1e8;
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.side-brand { padding: 6px 10px 18px; }
.side-brand strong {
  display: block;
  font-family: var(--display);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.03em;
}
.side-brand span { color: rgba(246, 241, 232, 0.58); font-size: 13px; }
.nav { display: grid; gap: 4px; }
.nav button {
  text-align: left;
  background: transparent;
  color: rgba(246, 241, 232, 0.82);
  border: 0;
  border-radius: 12px;
  padding: 11px 12px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}
.nav-label { display: inline-flex; align-items: center; gap: 8px; }
.ico { width: 18px; height: 18px; flex: none; display: block; }
.btn .ico, .status-btn .ico, .chip .ico, .with-ico .ico, .status-menu .ico { width: 16px; height: 16px; }
.with-ico { display: inline-flex; align-items: center; gap: 6px; }
.chip.with-ico { display: inline-flex; }
.search-ico {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--muted); pointer-events: none; display: flex;
}
.search-wrap input { padding-left: 38px; }
.appt-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.reason-ico {
  width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center; flex: none;
  background: var(--soft); color: var(--accent-dark);
}
.tone-heart { background: #fde8ea; color: #9d3144; }
.tone-head { background: #ece7f8; color: #5a458c; }
.tone-lab { background: #e7f1fb; color: #245f86; }
.tone-drop { background: #e5f6f8; color: #0d6e78; }
.tone-skin { background: #f8eee4; color: #a15c38; }
.tone-bone { background: #f3eee4; color: #6d5a3a; }
.tone-bandage { background: #e8f6ea; color: #2f6b32; }
.tone-user { background: #eef2f6; color: #334155; }
.tone-repeat { background: #e7f3ef; color: #0c6e62; }
.tone-pill { background: #f8e8f2; color: #8d3d6b; }
.tone-clipboard, .tone-file, .tone-eye { background: #eef3f1; color: #24564e; }
.row-item:hover, .sala-card:hover { background: rgba(255, 252, 247, 0.8); }
.status-btn, .status-menu button { display: inline-flex; align-items: center; gap: 6px; }
.status-menu button { width: 100%; }
.nav button.active, .nav button:hover { background: rgba(255, 255, 255, 0.08); color: white; }
.badge {
  background: var(--sun);
  color: #2a2112;
  border-radius: 99px;
  min-width: 22px;
  text-align: center;
  padding: 2px 7px;
  font-size: 12px;
  font-weight: 700;
}
.side-foot { margin-top: auto; display: grid; gap: 8px; padding: 12px 10px 0; }
.side-foot p { font-size: 12px; color: rgba(246, 241, 232, 0.5); line-height: 1.4; }
.linkish {
  background: transparent;
  border: 0;
  color: #f3c15a;
  padding: 0;
  text-align: left;
  font-weight: 650;
  font-size: 13px;
}
.main { min-width: 0; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 28px 0;
}
.topbar h1 {
  font-family: var(--display);
  font-size: 34px;
  font-weight: 500;
  letter-spacing: -0.03em;
}
.top-tools { display: flex; align-items: center; gap: 12px; }
.search-wrap { position: relative; width: min(280px, 42vw); }
.search-wrap input { background: rgba(255,255,255,0.72); }
.search-results {
  position: absolute;
  z-index: 12;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 6px;
  display: grid;
}
.search-results button {
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 10px;
  padding: 8px 10px;
}
.search-results button:hover { background: #f6f1e8; }
.who { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; text-align: right; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: #f3c15a; color: #2a2112;
  display: grid; place-items: center; font-weight: 750;
}
.menu-btn { display: none; }
.content { padding: 18px 28px 48px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px 12px;
}
.stat span { color: var(--muted); font-size: 13px; font-weight: 650; }
.stat strong {
  display: block;
  margin-top: 6px;
  font-family: var(--display);
  font-size: 34px;
  font-weight: 500;
  letter-spacing: -0.03em;
}
.layout { display: grid; grid-template-columns: 1.35fr 0.8fr; gap: 12px; margin-top: 12px; }
.stack { display: grid; gap: 12px; }
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 16px 8px;
}
.panel-head, .toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.panel h2, .toolbar h2 { font-size: 16px; font-weight: 680; }
.row-item {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 8px 12px;
  align-items: center;
  padding: 11px 2px;
  border-top: 1px solid var(--line);
  position: relative;
}
.row-item.open { z-index: 6; }
.time { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--accent-dark); }
.muted { color: var(--muted); font-size: 13px; }
.name-btn {
  background: transparent;
  border: 0;
  padding: 0;
  text-align: left;
  font-weight: 680;
}
.name-btn:hover { color: var(--accent); }
.dot {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px;
}
.pill, .status-btn {
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  border: 0;
  background: #efe6d6;
  color: var(--ink);
}
.pill.en-sala, .status-btn.en-sala { background: var(--wait-soft); color: var(--wait); }
.pill.atendida, .status-btn.atendida { background: var(--good-soft); color: var(--good); }
.pill.cancelada, .status-btn.cancelada { background: #eeeae4; color: #6d675f; }
.status-pop { position: relative; }
.status-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 6px;
  display: grid;
  gap: 4px;
  min-width: 168px;
  z-index: 8;
}
.status-menu button {
  border: 0;
  background: transparent;
  text-align: left;
  border-radius: 10px;
  padding: 8px 10px;
  font-weight: 650;
}
.status-menu button:hover { background: #f6f1e8; }
.quick { display: grid; gap: 8px; padding-bottom: 8px; }
.quick button { justify-content: flex-start; }

.toolbar .search { width: min(320px, 100%); }
.table-wrap { overflow-x: auto; padding-bottom: 8px; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 10px;
}
td { padding: 12px 10px; border-top: 1px solid var(--line); vertical-align: middle; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #faf6ee; }
.person { display: flex; gap: 10px; align-items: center; }
.initials {
  width: 38px; height: 38px; border-radius: 12px;
  background: var(--soft); color: var(--accent-dark);
  display: grid; place-items: center; font-weight: 750; flex: none;
}
.back { background: transparent; border: 0; color: var(--muted); padding: 0 0 8px; font-weight: 650; }
.profile-head {
  display: flex; justify-content: space-between; gap: 16px; align-items: flex-start;
  margin-bottom: 12px;
}
.profile-id { display: flex; gap: 14px; align-items: center; }
.profile-id h2 { font-family: var(--display); font-size: 36px; font-weight: 500; }
.profile-id .initials { width: 64px; height: 64px; border-radius: 18px; font-size: 22px; }
.facts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chip {
  background: #efe6d6;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 650;
}
.alert {
  background: var(--coral-soft);
  color: var(--coral);
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 700;
  margin-bottom: 12px;
}
.split { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 12px; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; font-size: 15px; padding-bottom: 8px; }
.kv span { color: var(--muted); }
.visit { border-top: 1px solid var(--line); padding: 12px 0; }
.visit strong { display: block; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.agenda-layout { display: grid; grid-template-columns: 320px 1fr; gap: 12px; align-items: start; }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.cal-head strong { font-family: var(--display); font-size: 22px; font-weight: 500; line-height: 1.15; }
.cal-grid { margin-bottom: 8px; }
.cal-nav { display: flex; gap: 6px; }
.icon-btn {
  min-width: 34px; height: 34px; border-radius: 10px; padding: 0 10px;
  border: 1px solid var(--line); background: white; font-weight: 700;
}
.weekdays, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.weekdays span {
  text-align: center; font-size: 11px; font-weight: 700;
  letter-spacing: 0.06em; color: var(--muted); padding-bottom: 4px;
}
.cal-day {
  border: 0;
  background: transparent;
  border-radius: 12px;
  min-height: 52px;
  padding: 6px 0 4px;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 4px;
  font-weight: 650;
}
.cal-day:hover { background: #f3eee4; }
.cal-day.is-out { color: #b0a89c; }
.cal-day.is-today .n {
  box-shadow: inset 0 0 0 1.5px var(--sun);
  border-radius: 999px;
  padding: 0 6px;
}
.cal-day.is-on { background: var(--ink); color: white; }
.cal-day.is-on:hover { background: var(--ink); }
.dots { display: flex; gap: 3px; min-height: 6px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); display: block; }
.cal-day.is-on .dots i { background: #f3c15a; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filters button.is-on { background: var(--ink); color: white; border-color: var(--ink); }
.slot-grid { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 0 12px; }
.slot {
  border: 1px dashed #cfc6b8;
  background: white;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 650;
}
.slot:hover { border-style: solid; border-color: var(--accent); color: var(--accent-dark); }
.slot.taken { opacity: 0.35; text-decoration: line-through; cursor: default; }
.hint { color: var(--muted); font-size: 13px; margin: 4px 0 8px; }
.detail-form { display: grid; grid-template-columns: 180px 1fr auto; gap: 8px; align-items: center; margin: 8px 0 4px; }
.detail-form input, .detail-form select { margin: 0; }
.chip button { border: 0; background: transparent; font-weight: 700; padding: 0 0 0 4px; line-height: 1; }
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.doc-card h2 { font-family: var(--display); font-size: 28px; font-weight: 500; margin-bottom: 8px; }
.doc-card .actions { margin: 8px 0 10px; }
.agenda-banner {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 12px;
}
.agenda-banner strong { font-family: var(--display); font-size: 26px; font-weight: 500; }
.reminder-banner { width: 100%; margin-bottom: 12px; text-align: left; cursor: pointer; }
.reminder-banner span { display: inline-flex; align-items: center; gap: 8px; }
.checkline { display: flex; align-items: center; gap: 8px; margin: 8px 0; font-weight: 650; }
.checkline input { width: auto; }
.token-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.preview {
  background: #f6f1e8; border-radius: 12px; padding: 12px 14px; line-height: 1.45; margin: 0 0 8px;
}
.reminder-list { display: grid; gap: 6px; padding-bottom: 10px; }
.reminder-row {
  display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center;
  width: 100%; text-align: left; border: 1px solid transparent; background: transparent;
  border-radius: 12px; padding: 8px;
}
.reminder-row strong, .reminder-row .muted { display: block; }
.reminder-row.is-on, .reminder-row:hover { background: #f6f1e8; border-color: var(--line); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.form-error {
  background: var(--coral-soft);
  color: var(--coral);
  border-radius: 10px;
  padding: 8px 10px;
  font-weight: 650;
  margin-bottom: 10px;
}
.conflict-box ul { margin: 6px 0 10px; padding-left: 18px; font-weight: 560; }
.conflict-box p { margin: 8px 0 6px; font-weight: 560; }
.conflict-box .btn { color: var(--ink); }
.trial-banner {
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 14px;
  font-weight: 650;
  line-height: 1.45;
}
.trial-banner.warn { background: #fff4d8; color: #6d4e00; }
.trial-banner.ended { background: var(--coral-soft); color: var(--coral); }
.admin-page { max-width: 800px; margin: 0 auto; padding: 28px 20px 70px; }
.admin-top { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; margin-bottom: 18px; }
.admin-top h1 { font-family: var(--display); font-weight: 500; font-size: clamp(36px, 5vw, 48px); }
.admin-grid { display: grid; gap: 16px; }
.card.wide { width: min(760px, 100%); }
.counts { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 16px; }
.counts span { background: var(--soft); color: var(--accent-dark); border-radius: 999px; padding: 6px 10px; font-size: 13px; font-weight: 700; }
.license-preview { background: var(--soft); color: var(--ink); border-radius: 12px; padding: 12px 14px; line-height: 1.45; font-weight: 560; }
.save-flag { color: rgba(246, 241, 232, 0.78) !important; }
.sala-card {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.sala-card .time { font-family: var(--display); font-size: 28px; font-weight: 500; }

.modal-back {
  position: fixed; inset: 0;
  background: rgba(18, 24, 22, 0.48);
  display: grid; place-items: center;
  padding: 20px;
  z-index: 20;
}
.modal {
  width: min(560px, 100%);
  max-height: min(90vh, 760px);
  overflow: auto;
  background: var(--surface);
  border-radius: 22px;
  padding: 22px;
  box-shadow: var(--shadow);
}
.modal h2 { font-family: var(--display); font-size: 32px; font-weight: 500; margin-bottom: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: var(--sidebar);
  color: white;
  padding: 12px 14px;
  border-radius: 12px;
  z-index: 30;
  box-shadow: var(--shadow);
}
.empty { color: var(--muted); padding: 12px 0 16px; }

@media (max-width: 980px) {
  .login { grid-template-columns: 1fr; }
  .login-brand { padding: 28px 22px; }
  .login-brand h1 { font-size: 42px; }
  .today-label { display: none; }
  .stats, .layout, .split, .form-grid, .agenda-layout, .detail-form, .reminder-row { grid-template-columns: 1fr; }
  .agenda-banner { align-items: flex-start; flex-direction: column; }
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    z-index: 15;
    transform: translateX(-105%);
    width: min(84vw, 300px);
    transition: transform 0.2s ease;
  }
  .sidebar.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .content, .topbar { padding-left: 16px; padding-right: 16px; }
  .topbar { align-items: flex-start; flex-wrap: wrap; }
  .top-tools { width: 100%; }
  .search-wrap { width: 100%; }
  .row-item, .sala-card { grid-template-columns: 64px 1fr; }
  .row-item .status-pop, .sala-card .actions { grid-column: 2; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,0.35); z-index: 14; }
}

@media print {
  body { background: white; }
  .sidebar, .topbar, .no-print, .toast, .scrim, .status-menu { display: none !important; }
  .shell { display: block; }
  .content { padding: 0; }
  .panel { border: 0; box-shadow: none; }
}
