:root {
  --bg: #f3efe7;
  --surface: #fffcf7;
  --surface-2: #f8f4ec;
  --ink: #1f2421;
  --ink-2: #575c55;
  --ink-3: #8f8a7f;
  --line: #e6dfd2;
  --brand: #2e4a3d;
  --brand-2: #4f7a64;
  --brand-soft: #e3ebe4;
  --brand-d: #233a30;
  --on-brand: #ffffff;
  --accent: #c8643b;
  --accent-soft: #f8e9e1;
  --accent-d: #b0532d;
  --ok: #3f7d4e; --ok-soft: #e4f0e4;
  --warn: #b7791f; --warn-soft: #f8eedb;
  --bad: #c0392b; --bad-soft: #f9e4e0;
  --info: #3b5f8a; --info-soft: #e5ecf4;
  --violet: #7a5a8c; --violet-soft: #efe7f2;
  --radius: 18px;
  --radius-sm: 10px;
  --shadow: none;
  --shadow-lg: 0 18px 50px rgba(40, 32, 20, .18);
  --sidebar: 248px;
  --font: 'Instrument Sans', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --display: 'Fraunces', Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 14.5px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ico.sm { width: 16px; height: 16px; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }

/* ---------- Shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--brand); color: color-mix(in srgb, var(--on-brand) 82%, transparent); display: flex; flex-direction: column; padding: 20px 14px; gap: 4px; overflow-y: auto; }
.logo { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: var(--on-brand); font-weight: 800; font-size: 16px; line-height: 1.2; letter-spacing: -.01em; }
.logo-mark { width: 40px; height: 40px; border-radius: 12px; background: var(--brand-2); display: grid; place-items: center; flex: none; }
.brand-logo { width: 40px; height: 40px; border-radius: 12px; object-fit: contain; background: #fff; padding: 3px; flex: none; }
.logo-mark.xs, .brand-logo.xs { width: 32px; height: 32px; border-radius: 10px; }
.logo-mark.xs .ico { width: 17px; height: 17px; }
.logo-mark .ico { stroke: #fff; width: 20px; height: 20px; }
.logo small { display: block; font-size: 11px; font-weight: 500; color: color-mix(in srgb, var(--on-brand) 65%, transparent); letter-spacing: 0; margin-top: 2px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: color-mix(in srgb, var(--on-brand) 55%, transparent); padding: 14px 12px 6px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; font-weight: 600; color: color-mix(in srgb, var(--on-brand) 80%, transparent); transition: background .15s, color .15s; }
.nav-item:hover { background: color-mix(in srgb, var(--on-brand) 9%, transparent); color: var(--on-brand); }
.nav-item.active { background: #fff; color: var(--brand); }
.nav-item .count { margin-left: auto; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px; }
.nav-item.active .count { background: var(--accent); }
.sidebar-foot { margin-top: auto; padding: 14px 10px 6px; border: 0; border-top: 1px solid color-mix(in srgb, var(--on-brand) 14%, transparent); display: flex; gap: 10px; align-items: center; background: none; color: inherit; cursor: pointer; border-radius: 0 0 12px 12px; width: 100%; }
.sidebar-foot:hover { background: color-mix(in srgb, var(--on-brand) 7%, transparent); }
.sf-name { color: var(--on-brand); font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plan-pill { font-size: 11px; background: color-mix(in srgb, var(--on-brand) 14%, transparent); color: var(--on-brand); padding: 2px 8px; border-radius: 99px; font-weight: 700; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 14px 28px; background: rgba(244, 246, 243, .85); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid transparent; }
.topbar h1 { font-size: 22px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .sub { color: var(--ink-3); font-size: 13px; margin-top: 2px; }
.topbar > div:first-child { flex: 1 1 auto; min-width: 0; }
.topbar .spacer { display: none; }
.topbar .spacer { flex: 1; }
.search { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; height: 40px; width: 280px; color: var(--ink-3); }
.search input { border: 0; outline: 0; background: transparent; width: 100%; color: var(--ink); }
.search-results { position: absolute; top: 46px; left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 50; max-height: 360px; overflow: auto; }
.search-wrap { position: relative; }
.avatar-btn { width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 800; display: grid; place-items: center; border: 0; cursor: pointer; }
.content { padding: 8px 28px 40px; display: flex; flex-direction: column; gap: 20px; max-width: 1400px; width: 100%; }
.mobile-only { display: none; }
@media (min-width: 761px) { .mobile-only { display: none !important; } }
.m-actions { display: none; }
.m-brand { display: none; flex: none; }

/* ---------- Bottom nav (móvil) ---------- */
.bottomnav { display: none; }

/* ---------- Componentes ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; min-width: 0; }
.card-h { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-h h3 { font-size: 16px; font-weight: 700; }
.card-h .link { margin-left: auto; color: var(--brand); font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; gap: 2px; cursor: pointer; background: none; border: 0; }
.grid { display: grid; gap: 20px; }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }

.kpi { display: flex; flex-direction: column; gap: 10px; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; }
.kpi-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; }
.kpi-val { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.kpi-lbl { color: var(--ink-2); font-weight: 600; font-size: 13px; }
.delta { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 99px; }
.t-brand { background: var(--brand-soft); color: var(--brand); }
.t-accent { background: var(--accent-soft); color: var(--accent); }
.t-ok { background: var(--ok-soft); color: var(--ok); }
.t-warn { background: var(--warn-soft); color: var(--warn); }
.t-bad { background: var(--bad-soft); color: var(--bad); }
.t-info { background: var(--info-soft); color: var(--info); }
.t-violet { background: var(--violet-soft); color: var(--violet); }
.t-mute { background: #ece6da; color: var(--ink-2); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-weight: 700; cursor: pointer; white-space: nowrap; transition: transform .08s, background .15s, box-shadow .15s; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-d); border-color: var(--brand-d); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-d); border-color: var(--accent-d); }
.btn-wsp { background: #25d366; border-color: #25d366; color: #fff; }
.btn-wsp:hover { background: #1fbd5a; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { height: 32px; padding: 0 12px; border-radius: 10px; font-size: 13px; }
.btn-icon { width: 40px; padding: 0; }
.btn-sm.btn-icon { width: 32px; }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 99px; white-space: nowrap; text-transform: capitalize; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.badge.plain { text-transform: none; }

.pet { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; font-size: 22px; flex: none; }
.pet.lg { width: 72px; height: 72px; border-radius: 22px; font-size: 38px; }
.pet.Perro { background: #fdf0e1; }
.pet.Gato { background: #ece8fe; }
.pet.Conejo { background: #fde8ef; }
.pet.Ave { background: #e3f5e9; }

.list { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); min-width: 0; }
.row:last-child { border-bottom: 0; }
.row.click { cursor: pointer; border-radius: 12px; padding-left: 8px; padding-right: 8px; }
.row.click:hover { background: var(--surface-2); }
.row .grow { flex: 1; min-width: 0; }
.row .t1 { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .t2 { color: var(--ink-3); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.time { font-weight: 800; font-size: 13px; color: var(--ink); min-width: 46px; }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.seg { display: inline-flex; background: #e9eeeb; padding: 3px; border-radius: 12px; gap: 2px; overflow-x: auto; max-width: 100%; }
.seg button { border: 0; background: transparent; padding: 7px 14px; border-radius: 9px; font-weight: 700; color: var(--ink-2); cursor: pointer; white-space: nowrap; font-size: 13px; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.input, select.input, textarea.input { width: 100%; height: 42px; border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; background: var(--surface); outline: none; transition: border .15s, box-shadow .15s; }
textarea.input { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }
.input:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-2) 20%, transparent); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }

/* tabla → tarjetas en móvil */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.click { cursor: pointer; }
.table tbody tr.click:hover td { background: var(--surface-2); }
.cell-pet { display: flex; align-items: center; gap: 12px; }

.empty { text-align: center; padding: 36px 12px; color: var(--ink-3); }
.empty .big { font-size: 36px; margin-bottom: 6px; }

/* barras */
.bars { display: flex; align-items: flex-end; gap: 10px; height: 160px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; min-width: 0; }
.bar { width: 100%; max-width: 38px; border-radius: 8px 8px 4px 4px; background: var(--brand-soft); position: relative; transition: height .4s; }
.bar.today { background: var(--brand-2); }
.bar-lbl { font-size: 11.5px; color: var(--ink-3); font-weight: 600; }
.bar:hover::after { content: attr(data-v); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; font-size: 11px; padding: 3px 7px; border-radius: 6px; white-space: nowrap; }

/* ---------- Agenda ---------- */
.week-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.day-pill { border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 8px 4px; text-align: center; cursor: pointer; transition: all .15s; }
.day-pill .dw { font-size: 11.5px; color: var(--ink-3); font-weight: 700; text-transform: uppercase; }
.day-pill .dn { font-size: 18px; font-weight: 800; }
.day-pill .dots { display: flex; gap: 3px; justify-content: center; height: 6px; margin-top: 2px; }
.day-pill .dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--brand-2); }
.day-pill.on { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.day-pill.on .dw { color: color-mix(in srgb, var(--on-brand) 70%, transparent); }
.day-pill.on .dots i { background: var(--on-brand); }

.cal-wrap { overflow-x: auto; border-radius: var(--radius); }
.cal { display: grid; min-width: 640px; position: relative; padding-bottom: 8px; }
.cal > div:nth-child(n) { }
.cal-head { position: sticky; top: 0; background: var(--surface); z-index: 2; padding: 12px 10px; font-weight: 700; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.cal-head .dot { width: 10px; height: 10px; border-radius: 50%; }
.cal-hour { font-size: 11.5px; color: var(--ink-3); text-align: right; padding: 0 8px; transform: translateY(-7px); font-weight: 600; }
.cal-col { position: relative; border-left: 1px solid var(--line); }
.cal-slot { height: 42px; border-bottom: 1px dashed #edf1ef; cursor: pointer; }
.cal-slot:nth-child(2n) { border-bottom-style: solid; border-bottom-color: var(--line); }
.cal-slot:hover { background: var(--brand-soft); }
.appt { position: absolute; left: 4px; right: 4px; border-radius: 10px; padding: 6px 8px; font-size: 12px; overflow: hidden; cursor: pointer; border-left: 4px solid; box-shadow: 0 1px 2px rgba(0, 0, 0, .05); transition: transform .1s; }
.appt:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.appt b { display: block; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt span { display: block; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--accent); z-index: 1; pointer-events: none; }
.now-line::before { content: ''; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }

/* ---------- Ficha paciente ---------- */
.hero { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.hero h2 { font-size: 26px; font-weight: 800; }
.hero .meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.hero .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.fact { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.fact .k { font-size: 11.5px; color: var(--ink-3); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.fact .v { font-weight: 700; margin-top: 2px; word-break: break-word; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs button { background: none; border: 0; padding: 12px 14px; font-weight: 700; color: var(--ink-3); border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.tabs button.on { color: var(--brand); border-bottom-color: var(--brand); }
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding-bottom: 18px; }
.tl-item::before { content: ''; position: absolute; left: -21px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 3px solid var(--brand-2); }
.tl-item h4 { font-size: 15px; }
.tl-item p { margin: 4px 0 0; color: var(--ink-2); }
.tl-item .when { font-size: 12.5px; color: var(--ink-3); font-weight: 600; }

/* hospital */
.hosp-card { display: flex; flex-direction: column; gap: 14px; }
.task { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); cursor: pointer; user-select: none; }
.task .chk { width: 22px; height: 22px; border-radius: 7px; border: 2px solid #c9d4d0; display: grid; place-items: center; flex: none; }
.task.ok .chk { background: var(--ok); border-color: var(--ok); color: #fff; }
.task.ok .tt { text-decoration: line-through; color: var(--ink-3); }
.task .th { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--ink-3); }
.progress { height: 8px; background: #edf1ef; border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--brand-2); border-radius: 99px; transition: width .3s; }

/* caja */
.pos-items { display: flex; flex-direction: column; gap: 8px; }
.pos-line { display: grid; grid-template-columns: minmax(0, 1fr) 62px 104px 96px 32px; gap: 8px; align-items: center; }
.pos-desc { display: grid; grid-template-columns: 1fr 110px 70px; gap: 8px; align-items: center; margin-top: 12px; }
.pos-desc label { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.cobro-box { border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: var(--surface-2); }
.pos-total { display: flex; justify-content: space-between; align-items: center; font-size: 20px; font-weight: 800; padding: 14px 0 4px; border-top: 1px dashed var(--line); margin-top: 6px; }
.method-bar { display: flex; height: 12px; border-radius: 99px; overflow: hidden; gap: 2px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 12px; font-size: 13px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* stock */
.stock-meter { width: 90px; height: 6px; background: #edf1ef; border-radius: 99px; overflow: hidden; }
.stock-meter i { display: block; height: 100%; border-radius: 99px; }

/* ---------- Modal / sheet ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(10, 30, 27, .45); z-index: 100; display: grid; place-items: center; padding: 20px; animation: fade .15s; }
.modal { background: var(--surface); border-radius: 20px; width: 100%; max-width: 560px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: pop .18s ease-out; }
.modal-h { display: flex; align-items: center; padding: 18px 20px 6px; gap: 10px; }
.modal-h h3 { font-size: 18px; font-weight: 800; }
.modal-b { padding: 12px 20px; overflow-y: auto; }
.modal-f { padding: 12px 20px 18px; display: flex; gap: 10px; justify-content: flex-end; border-top: 1px solid var(--line); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } }
@keyframes up { from { transform: translateY(100%); } }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 30px); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 600; opacity: 0; pointer-events: none; transition: all .25s; z-index: 200; display: flex; gap: 8px; align-items: center; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- E-carnet (vista tutor) ---------- */
.carnet-page { min-height: 100vh; background: linear-gradient(160deg, var(--brand) 0%, var(--brand-d) 45%, var(--bg) 45.1%); padding: 24px 16px 40px; }
.carnet { max-width: 420px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.carnet-top { color: var(--on-brand); display: flex; align-items: center; gap: 10px; }
.carnet-top .back { color: var(--on-brand); border-color: color-mix(in srgb, var(--on-brand) 30%, transparent); background: color-mix(in srgb, var(--on-brand) 10%, transparent); }
.carnet-id { background: var(--surface); border-radius: 24px; padding: 22px; box-shadow: var(--shadow-lg); position: relative; overflow: hidden; }
.carnet-id::after { content: ''; position: absolute; right: -40px; top: -40px; width: 140px; height: 140px; border-radius: 50%; background: var(--brand-soft); }
.carnet-id > * { position: relative; z-index: 1; }
.qr { width: 118px; height: 118px; border-radius: 12px; background: #fff; border: 1px solid var(--line); padding: 8px; flex: none; cursor: zoom-in; }
.qr svg, .qr-big svg { width: 100%; height: auto; display: block; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main { grid-template-columns: minmax(0, 1fr); }
  .search-wrap { display: none; }
  .topbar .desktop-only .btn span.lbl { display: none; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .mobile-only { display: initial; }
  .btn.mobile-only { display: inline-flex; }
  .m-actions { display: flex; gap: 8px; padding: 4px 16px 0; }
  .m-brand { display: block; }
  .m-actions .btn { flex: 1; }
  .desktop-only { display: none !important; }
  .topbar { padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top)); gap: 10px; }
  .topbar h1 { font-size: 20px; }
  .search { display: none; }
  .content { padding: 4px 16px calc(96px + env(safe-area-inset-bottom)); gap: 14px; }
  .card { padding: 16px; }
  .grid { gap: 14px; }
  .g-3, .g-2 { grid-template-columns: minmax(0, 1fr); }
  .kpi-val { font-size: 22px; }
  .kpi-ico { width: 34px; height: 34px; }
  .bottomnav { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; background: rgba(255, 255, 255, .96); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); }
  .bottomnav a, .bottomnav button { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 700; color: var(--ink-3); padding: 6px 0; border: 0; background: none; cursor: pointer; position: relative; }
  .bottomnav .on { color: var(--brand); }
  .bottomnav .fab { width: 50px; height: 50px; border-radius: 16px; background: var(--accent); color: #fff; display: grid; place-items: center; margin: -22px auto 0; box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 45%, transparent); }
  .bottomnav .dotc { position: absolute; top: 2px; right: calc(50% - 18px); width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

  /* tabla → tarjetas */
  .table.resp thead { display: none; }
  .table.resp, .table.resp tbody, .table.resp tr, .table.resp td { display: block; width: 100%; }
  .table.resp tr { padding: 12px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; }
  .table.resp tr:last-child { border-bottom: 0; }
  .table.resp td { padding: 0; border: 0; }
  .table.resp td.m-hide { display: none; }
  .table.resp td.m-full { grid-column: 1 / -1; }
  .table.resp td[data-l]::before { content: attr(data-l) ': '; color: var(--ink-3); font-size: 12px; font-weight: 600; }
  .table.resp td.m-right { text-align: right; }

  .modal-bg { place-items: end stretch; padding: 0; }
  .modal { max-width: none; border-radius: 22px 22px 0 0; max-height: 92vh; animation: up .22s ease-out; }
  .modal-f { padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
  .modal-f .btn { flex: 1; }
  .form-grid { grid-template-columns: 1fr; }
  .pos-line { grid-template-columns: minmax(0, 1fr) 52px 84px 32px; }
  .pos-line [data-sub] { display: none; }
  .hero .actions { margin-left: 0; width: 100%; }
  .hero .actions .btn { flex: 1; }
  .hero h2 { font-size: 22px; }
  .toast { bottom: calc(90px + env(safe-area-inset-bottom)); }
  .week-strip { gap: 5px; }
  .day-pill { padding: 6px 2px; border-radius: 12px; }
  .day-pill .dn { font-size: 16px; }
  .cal { min-width: 0; }
}
@media (max-width: 420px) {
  .g-4 { gap: 10px; }
  .kpi-lbl { font-size: 12px; }
}

/* "Más" drawer móvil */
.drawer-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.drawer-list a { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 6px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line); font-weight: 700; font-size: 12.5px; text-align: center; }
.drawer-list a .ico { width: 24px; height: 24px; color: var(--brand); }

.plan-card { border: 2px solid var(--line); border-radius: 18px; padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.plan-card.cur { border-color: var(--brand-2); background: var(--brand-soft); }
.plan-card .price { font-size: 26px; font-weight: 800; }
.plan-card ul { margin: 0; padding-left: 18px; color: var(--ink-2); display: flex; flex-direction: column; gap: 4px; }

/* tablas anchas en pantallas medianas */
.card:has(> .table) { overflow-x: auto; }
@media (min-width: 761px) and (max-width: 1180px) {
  .table td, .table th { padding-left: 8px; padding-right: 8px; }
  .table .btn-wsp { width: 32px; padding: 0; font-size: 0; gap: 0; }
}

/* ---------- Marca: logo, colores y vista previa ---------- */
.logo-edit { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.logo-drop { width: 104px; height: 104px; border-radius: 20px; border: 2px dashed var(--line); background: var(--surface-2); display: grid; place-items: center; cursor: pointer; color: var(--ink-3); padding: 8px; flex: none; transition: border-color .15s; }
.logo-drop:hover { border-color: var(--brand-2); color: var(--brand); }
.logo-drop > span { display: flex; flex-direction: column; align-items: center; gap: 4px; font-weight: 700; }
.logo-drop img { width: 100%; height: 100%; object-fit: contain; }
.swatches { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.swatch { border: 2px solid var(--line); background: var(--surface); border-radius: 14px; padding: 8px; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; font-size: 12px; font-weight: 700; color: var(--ink-2); transition: border-color .15s; }
.swatch .sw { display: flex; width: 100%; height: 26px; border-radius: 8px; overflow: hidden; }
.swatch .sw i:first-child { flex: 2; } .swatch .sw i:last-child { flex: 1; }
.swatch.on, .swatch:hover { border-color: var(--brand); color: var(--ink); }
.color-in { display: flex; align-items: center; gap: 10px; height: 42px; border: 1px solid var(--line); border-radius: 12px; padding: 0 10px 0 6px; cursor: pointer; }
.color-in input { width: 32px; height: 32px; border: 0; padding: 0; background: none; cursor: pointer; }
.color-in input::-webkit-color-swatch-wrapper { padding: 0; } .color-in input::-webkit-color-swatch { border: 0; border-radius: 8px; }
.color-in code { font-size: 13px; color: var(--ink-2); text-transform: uppercase; }
.brand-preview { display: flex; gap: 14px; align-items: flex-end; margin-top: 8px; padding: 16px; background: var(--surface-2); border-radius: 16px; border: 1px solid var(--line); }
.bp-desk { flex: 1; min-width: 0; height: 150px; display: flex; border-radius: 12px; overflow: hidden; background: var(--bg); box-shadow: var(--shadow); }
.bp-side { width: 64px; background: var(--brand); display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 10px 0; }
.bp-side i { width: 40px; height: 8px; border-radius: 4px; background: color-mix(in srgb, var(--on-brand) 25%, transparent); }
.bp-side i.on { background: #fff; }
.bp-main { flex: 1; min-width: 0; padding: 12px; display: flex; flex-direction: column; gap: 10px; font-size: 12px; }
.bp-main b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bp-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.bp-btn { background: var(--brand); color: var(--on-brand); font-size: 10.5px; font-weight: 700; padding: 4px 8px; border-radius: 7px; white-space: nowrap; }
.bp-chip { background: var(--brand-soft); color: var(--brand); font-size: 10.5px; font-weight: 700; padding: 3px 8px; border-radius: 99px; }
.bp-bars { display: flex; align-items: flex-end; gap: 5px; height: 44px; margin-top: auto; }
.bp-bars i { flex: 1; height: 50%; background: var(--brand-soft); border-radius: 4px 4px 2px 2px; }
.bp-bars i:nth-child(2) { height: 70%; } .bp-bars i.hi { height: 100%; background: var(--brand-2); } .bp-bars i:last-child { height: 35%; }
.bp-phone { width: 96px; height: 170px; border-radius: 18px; border: 4px solid var(--ink); background: var(--bg); display: flex; flex-direction: column; gap: 6px; padding: 6px; position: relative; flex: none; }
.bp-top { display: flex; align-items: center; gap: 4px; font-size: 10px; }
.bp-top .logo-mark.xs, .bp-top .brand-logo.xs { width: 18px; height: 18px; border-radius: 6px; padding: 1px; }
.bp-top .logo-mark.xs .ico { width: 11px; height: 11px; }
.bp-card { background: var(--surface); border-radius: 8px; height: 38px; padding: 5px; }
.bp-card .bp-btn { font-size: 8px; padding: 2px 5px; }
.bp-nav { position: absolute; left: 0; right: 0; bottom: 0; height: 26px; background: var(--surface); border-top: 1px solid var(--line); border-radius: 0 0 13px 13px; display: flex; align-items: center; justify-content: space-around; padding: 0 4px; }
.bp-nav i { width: 9px; height: 9px; border-radius: 3px; background: #cdd6d3; } .bp-nav i.on { background: var(--brand); }
.bp-fab { width: 18px; height: 18px; border-radius: 6px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 800; display: grid; place-items: center; margin-top: -10px; }

/* ---------- Usuarios y permisos ---------- */
.perm-box { border: 0; padding: 0; margin: 16px 0 0; min-width: 0; }
.perm-box[disabled] { opacity: .55; }
.perm-h { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 800; margin-bottom: 6px; }
.perm-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.perm-row.cap { cursor: pointer; flex-wrap: nowrap; }
.perm-name { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13.5px; color: var(--ink); }
.perm-name .ico { color: var(--brand); }
.perm-seg label { position: relative; }
.perm-seg input { position: absolute; opacity: 0; pointer-events: none; }
.perm-seg span { display: block; padding: 6px 11px; border-radius: 9px; font-weight: 700; color: var(--ink-2); cursor: pointer; white-space: nowrap; font-size: 12.5px; }
.perm-seg input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.perm-seg label:first-child input:checked + span { color: var(--bad); }
.perm-seg label:last-child input:checked + span { color: var(--brand); }
.perm-seg input:focus-visible + span { outline: 2px solid var(--brand-2); }
.perm-note { margin-top: 14px; padding: 10px 12px; border-radius: 12px; background: var(--accent-soft); color: var(--ink); font-weight: 600; font-size: 13px; display: flex; gap: 8px; align-items: center; }
.perm-note[hidden] { display: none; }
.switch { appearance: none; -webkit-appearance: none; width: 42px; height: 24px; border-radius: 99px; background: #cfd8d5; position: relative; cursor: pointer; flex: none; transition: background .15s; margin: 0; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform .15s; }
.switch:checked { background: var(--brand-2); }
.switch:checked::after { transform: translateX(18px); }
.switch:disabled { opacity: .5; cursor: not-allowed; }
@media (max-width: 760px) {
  .swatches { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .swatch { padding: 6px 4px; font-size: 11px; }
  .bp-desk { display: none; }
  .brand-preview { justify-content: center; }
  .perm-row:not(.cap) { flex-direction: column; align-items: stretch; gap: 6px; }
  .perm-seg { display: grid; grid-template-columns: repeat(3, 1fr); }
  .perm-seg span { text-align: center; }
}

/* ---------- Desplegable con autocompletar ---------- */
.combo-in { padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a9a97' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 18px; }
.combo-list { position: fixed; z-index: 300; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 5px; max-height: 264px; overflow-y: auto; }
.combo-list[hidden] { display: none; }
.combo-opt { padding: 9px 12px; border-radius: 8px; cursor: pointer; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.combo-opt:hover, .combo-opt.on { background: var(--brand-soft); color: var(--brand); }


/* =========================================================
   Identidad visual Huella: papel cálido, tipografía editorial,
   bordes finos en vez de sombras
   ========================================================= */
h1, h2, .kpi-val, .hero h2, .plan-card .price, .logo > div { font-family: var(--display); font-optical-sizing: auto; }
.card { border: 1px solid var(--line); box-shadow: none; }
.card-h h3 { font-size: 15px; font-weight: 700; letter-spacing: 0; }

/* barra lateral clara: la marca solo aparece en el logo y en el elemento activo */
.sidebar { background: var(--surface-2); color: var(--ink-2); border-right: 1px solid var(--line); padding: 22px 14px; }
.logo { color: var(--ink); font-size: 17px; font-weight: 600; padding: 2px 8px 20px; }
.logo small { color: var(--ink-3); font-family: var(--font); font-weight: 500; }
.logo-mark { background: var(--brand); border-radius: 50% 50% 50% 14px; }
.logo-mark .ico { stroke: var(--on-brand); }
.nav-label { color: var(--ink-3); letter-spacing: .14em; font-weight: 700; font-size: 10.5px; }
.nav-item { color: var(--ink-2); border-radius: 10px; padding: 9px 12px; font-weight: 600; }
.nav-item:hover { background: #ece5d8; color: var(--ink); }
.nav-item.active { background: var(--brand); color: var(--on-brand); }
.nav-item .count { background: var(--accent); color: #fff; border-radius: 6px; }
.sidebar-foot { border-top: 1px solid var(--line); color: var(--ink-3); border-radius: 12px; }
.sidebar-foot:hover { background: #ece5d8; }
.sf-name { color: var(--ink); }
.plan-pill { background: var(--ink); color: #f3efe7; border-radius: 5px; }

/* encabezado */
.topbar { background: color-mix(in srgb, var(--bg) 88%, transparent); padding: 18px 28px 14px; }
.topbar h1 { font-size: 30px; font-weight: 600; letter-spacing: -.02em; }
.search { background: var(--surface); border-radius: 10px; }

/* indicadores: etiqueta arriba en versalitas, cifra grande en serif */
.kpi { gap: 14px; }
.kpi-top { flex-direction: row-reverse; justify-content: flex-end; gap: 10px; }
.kpi-ico { width: 30px; height: 30px; border-radius: 8px; }
.kpi-ico .ico { width: 16px; height: 16px; }
.kpi-val { font-size: 36px; font-weight: 500; letter-spacing: -.03em; line-height: 1; }
.kpi-lbl { text-transform: uppercase; letter-spacing: .09em; font-size: 11px; font-weight: 700; color: var(--ink-3); margin-bottom: 8px; }
.kpi > div:last-child { display: flex; flex-direction: column-reverse; }
.delta { border-radius: 6px; }

/* botones, etiquetas, formularios */
.btn { border-radius: 10px; font-weight: 600; }
.btn-sm { border-radius: 8px; }
.btn:hover { background: #f1ebe0; }
.btn-primary:hover { background: var(--brand-d); }
.btn-wsp:hover { background: #1fbd5a; }
.badge { border-radius: 6px; font-weight: 600; padding: 3px 8px; }
.input { border-radius: 10px; background: var(--surface); }
.seg { background: #ebe4d7; border-radius: 10px; }
.seg button { border-radius: 8px; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); }
.fact { background: var(--surface-2); border-radius: 10px; }
.pet { border-radius: 50% 50% 50% 12px; }
.pet.lg { border-radius: 50% 50% 50% 22px; }
.pet.Perro { background: #f3e3cf; } .pet.Gato { background: #e6e0ee; } .pet.Conejo { background: #f2dfe2; } .pet.Ave { background: #dfeadb; }
.row.click:hover { background: #f4eee3; }
.table th { letter-spacing: .1em; font-size: 10.5px; }
.table tbody tr.click:hover td { background: #f6f0e6; }
.day-pill { border-radius: 12px; }
.day-pill.on { background: var(--ink); border-color: var(--ink); color: #f3efe7; }
.day-pill.on .dw { color: #b9b2a5; }
.day-pill.on .dots i { background: var(--accent); }
.bar { background: #e6dfd2; border-radius: 6px 6px 2px 2px; }
.bar.today { background: var(--accent); }
.modal-h h3 { font-family: var(--display); font-weight: 600; font-size: 21px; }
.toast { border-radius: 12px; }
.plan-card { border-width: 1px; }

/* ---------- Chat del equipo ---------- */
.content:has(> .chat) { padding-bottom: 16px; max-width: none; }
.chat { display: grid; grid-template-columns: 280px minmax(0, 1fr) 270px; height: calc(100dvh - 112px); min-height: 460px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.ch-list { border-right: 1px solid var(--line); padding: 10px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; background: var(--surface-2); }
.ch-item { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; min-width: 0; }
.ch-item:hover { background: #ede6d9; }
.ch-item.on { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.ch-item .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ch-item b { font-size: 13.5px; }
.ch-last { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-time { font-size: 11px; color: var(--ink-3); align-self: flex-start; margin-top: 2px; }
.ch-item .count { background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 6px; }
.ch-ico { width: 34px; height: 34px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; flex: none; }
.conv { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.conv-h { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.conv-h .grow { flex: 1; min-width: 0; }
.msgs { flex: 1; overflow-y: auto; padding: 8px 18px 16px; }
.day-sep { display: flex; align-items: center; gap: 12px; margin: 16px 0 8px; color: var(--ink-3); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; }
.day-sep::before, .day-sep::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.msg { display: flex; gap: 12px; padding: 8px 10px; margin: 0 -10px; border-radius: 12px; position: relative; }
.msg:hover { background: #faf5ec; }
.msg.compact { padding-top: 2px; padding-bottom: 2px; }
.msg.to-me { background: color-mix(in srgb, var(--accent-soft) 70%, transparent); }
.msg.flash { animation: flash 1.6s ease-out; }
@keyframes flash { from { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); } }
.msg-t { width: 36px; flex: none; font-size: 10.5px; color: var(--ink-3); text-align: center; padding-top: 3px; opacity: 0; }
.msg.compact:hover .msg-t { opacity: 1; }
.msg-b { flex: 1; min-width: 0; }
.msg-h { display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px; }
.msg-h b { font-size: 14px; }
.msg-txt { line-height: 1.5; overflow-wrap: anywhere; }
.msg-tools { position: absolute; right: 8px; top: -14px; display: none; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 2px; box-shadow: 0 4px 12px rgba(40, 32, 20, .1); }
.msg:hover .msg-tools { display: flex; }
.msg-tools button { border: 0; background: none; font-size: 15px; padding: 3px 6px; border-radius: 7px; cursor: pointer; }
.msg-tools button:hover { background: var(--surface-2); }
.mention { color: var(--brand); font-weight: 700; background: var(--brand-soft); border-radius: 5px; padding: 0 4px; }
.mention.me { color: var(--accent-d); background: var(--accent-soft); }
.pchip { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; background: #efe8db; border-radius: 6px; padding: 0 6px; color: var(--ink); }
.pchip:hover { background: #e6dccb; }
.mcard { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); overflow: hidden; max-width: 560px; margin-top: 4px; }
.mcard-h { display: flex; align-items: center; gap: 8px; padding: 8px 12px; font-weight: 700; font-size: 13px; }
.mcard-h .badge { margin-left: auto; }
.k-ok { background: var(--ok-soft); color: var(--ok); }
.k-info { background: var(--info-soft); color: var(--info); }
.k-violet { background: var(--violet-soft); color: var(--violet); }
.k-warn { background: var(--warn-soft); color: var(--warn); }
.pcard { display: flex; align-items: center; gap: 12px; padding: 10px 12px; }
.pcard:hover { background: var(--surface-2); }
.pcard .grow { flex: 1; min-width: 0; }
.mcard-note { margin: 0; padding: 0 12px 10px; line-height: 1.5; }
.mcard-f { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 12px; border-top: 1px dashed var(--line); }
.mcard-f .btn { margin-left: auto; }
.turno-e { padding: 10px 12px; border-top: 1px solid var(--line); }
.turno-e p { margin: 6px 0 0; line-height: 1.5; color: var(--ink-2); }
.reacts { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.react { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 1px 8px; font-size: 13px; cursor: pointer; }
.react.on { border-color: var(--brand-2); background: var(--brand-soft); }
.sug { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; padding: 6px 6px 6px 10px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); font-size: 12.5px; font-weight: 600; }
.sug .ico { flex: none; }
.composer { border-top: 1px solid var(--line); padding: 10px 14px 12px; background: var(--surface); }
.qchips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; }
.qchip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface-2); border-radius: 8px; padding: 5px 10px; font-weight: 600; font-size: 12.5px; cursor: pointer; white-space: nowrap; color: var(--ink-2); }
.qchip:hover { border-color: var(--brand-2); color: var(--brand); }
.comp-row { display: flex; gap: 8px; align-items: flex-end; }
.comp-row textarea { flex: 1; resize: none; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--bg); outline: none; min-height: 42px; max-height: 140px; line-height: 1.4; }
.comp-row textarea:focus { border-color: var(--brand-2); background: var(--surface); }
.comp-hint { font-size: 11.5px; color: var(--ink-3); margin-top: 6px; }
.ch-side { border-left: 1px solid var(--line); padding: 14px; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; background: var(--surface-2); }
.side-h { font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; font-weight: 800; color: var(--ink-3); margin-bottom: 6px; }
.side-it { display: flex; gap: 8px; align-items: flex-start; padding: 7px 8px; border-radius: 10px; font-size: 13px; line-height: 1.35; }
.side-it:hover { background: #ede6d9; }
.side-it .ico { margin-top: 1px; color: var(--accent); }
.last-turno { background: var(--violet-soft); border-radius: 12px; padding: 10px 12px; }
.last-turno p { margin: 4px 0 0; font-size: 13px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.team-log { display: flex; flex-direction: column; gap: 14px; }
.tlog .msg-tools { display: none !important; }
.fab-float { display: none; }

@media (max-width: 1180px) {
  .chat { grid-template-columns: 260px minmax(0, 1fr); }
  .ch-side { display: none; }
}
@media (max-width: 760px) {
  .topbar h1 { font-size: 24px; }
  .chat { display: block; height: auto; min-height: 0; border: 0; background: none; border-radius: 0; }
  .chat .ch-list { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
  .chat.has-conv .ch-list { display: none; }
  .conv { position: fixed; inset: 0; z-index: 30; background: var(--surface); padding-top: env(safe-area-inset-top); }
  .in-conv .topbar, .in-conv .m-actions { display: none; }
  .msgs { padding: 6px 14px 12px; }
  .msg-tools { top: auto; bottom: -12px; right: 4px; }
  .composer { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .comp-row textarea { font-size: 16px; }
  .comp-hint { display: none; }
  /* navegación inferior flotante */
  .bottomnav { left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); padding: 6px; border-radius: 20px; background: var(--ink); border: 0; box-shadow: 0 12px 30px rgba(31, 36, 33, .3); }
  .bottomnav a, .bottomnav button { color: #a9a294; font-weight: 600; }
  .bottomnav .on { color: #fff; }
  .bottomnav .on::after { content: ''; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); position: absolute; bottom: 0; }
  .dotn { position: absolute; top: 0; left: calc(50% + 4px); background: var(--accent); color: #fff; font-style: normal; font-size: 10px; font-weight: 700; padding: 0 5px; border-radius: 6px; line-height: 16px; }
  .fab-float { display: grid; place-items: center; position: fixed; right: 16px; bottom: calc(86px + env(safe-area-inset-bottom)); z-index: 41; width: 54px; height: 54px; border-radius: 50% 50% 50% 16px; border: 0; background: var(--accent); color: #fff; box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 45%, transparent); cursor: pointer; }
  .fab-float .ico { width: 24px; height: 24px; }
  .in-conv .bottomnav, .in-conv .fab-float { display: none; }
  .content { padding-bottom: calc(150px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(150px + env(safe-area-inset-bottom)); }
}

/* ---------- Pantallas medianas: menú lateral compacto (solo íconos) ---------- */
@media (min-width: 761px) and (max-width: 1100px) {
  :root { --sidebar: 84px; }
  .sidebar { padding: 18px 12px; align-items: center; }
  .logo { padding: 0 0 16px; justify-content: center; }
  .logo > div:last-child, .nav-label, .nav-item > span:not(.count), .sidebar-foot > div:last-child { display: none; }
  .nav-item { position: relative; justify-content: center; width: 56px; height: 48px; padding: 0; }
  .nav-item .count { position: absolute; top: 2px; right: 0; margin: 0; font-size: 10px; padding: 0 5px; line-height: 16px; }
  .sidebar-foot { justify-content: center; padding: 12px 0 4px; }
  .sidebar { overflow-x: hidden; }
  .topbar { padding-left: 24px; padding-right: 24px; }
  .content { padding-left: 24px; padding-right: 24px; }
}

/* ---------- Acceso: login, registro y clínicas ---------- */
.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 430px; padding: 32px; }
.auth-card h1 { font-family: var(--display); font-weight: 600; font-size: 30px; letter-spacing: -.02em; margin: 18px 0 6px; }
.auth-card > p.muted { margin: 0 0 18px; }
.auth-brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-size: 22px; }
.auth-brand .logo-mark .ico { stroke: #fff; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form .btn { height: 46px; margin-top: 4px; }
.auth-link { color: var(--brand); font-weight: 700; text-decoration: underline; }
.auth-msg { background: var(--bad-soft); color: var(--bad); border-radius: 10px; padding: 10px 12px; font-weight: 600; font-size: 13.5px; margin-bottom: 14px; }
.auth-msg.ok { background: var(--ok-soft); color: var(--ok); }
.auth-spin { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand); margin: 18px auto 6px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.trial-bar { margin: 0 28px 4px; padding: 10px 14px; border-radius: 12px; background: var(--accent-soft); color: var(--ink); font-size: 13.5px; display: flex; gap: 8px; align-items: center; }
.trial-bar.warn { background: var(--bad-soft); color: var(--bad); font-weight: 600; }
@media (max-width: 760px) { .trial-bar { margin: 0 16px 4px; } }

/* ---------- Estado de pago ---------- */
.pago-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 9px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); margin: 0 0 14px; }
