/* Kina Salud · App de gestión · v2 */
:root {
  --g950: #1d2518;
  --g900: #26301f;
  --g800: #3A4733;
  --g700: #344C2D;
  --g600: #55724B;
  --g500: #6f8f63;
  --g400: #A4BE98;
  --g300: #c3d5b9;
  --g200: #D3E0CC;
  --g100: #E7EFE4;
  --g50:  #f2f6ef;
  --cream: #F8F8F5;
  --sand: #F4F3E1;
  --line: #E8E7DE;
  --line-2: #D9D8CC;
  --text: #1f261b;
  --muted: #7a8274;
  --white: #fff;
  --ok: #2f7d4f;    --ok-bg: #e2f3e8;
  --warn: #a06a00;  --warn-bg: #fdf1d3;
  --bad: #c0362c;   --bad-bg: #fde6e3;
  --info: #2a6491;  --info-bg: #e1eef9;
  --t-green: #55724B; --t-green-bg: #e4eedf;
  --t-amber: #c98a12; --t-amber-bg: #fdf0d2;
  --t-sky:   #2f7fb5; --t-sky-bg:   #e0eefa;
  --t-rose:  #c94f5f; --t-rose-bg:  #fbe4e7;
  --t-violet:#7b5ea7; --t-violet-bg:#eee7f8;
  --t-teal:  #2d8a7c; --t-teal-bg:  #dcf2ee;
  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(38,48,31,.04), 0 8px 24px rgba(38,48,31,.06);
  --shadow-lg: 0 18px 50px rgba(38,48,31,.14);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-round: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--text);
  background: var(--cream); }
a { color: var(--g600); text-decoration: none; }
a:hover { color: var(--g800); }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.2; color: var(--g900); font-family: var(--font-round); letter-spacing: -.01em; }
h2 { font-size: 1.12rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 1em; }
code { background: var(--g100); padding: 1px 6px; border-radius: 6px; font-size: .88em; }
small, .muted { color: var(--muted); }
.icon { width: 20px; height: 20px; flex: none; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }

/* ---------- Shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 252px; flex: none; background: linear-gradient(180deg, #2c3726 0%, #3A4733 100%); color: #e9efe5; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 40; }
.brand { display: flex; gap: 12px; align-items: center; padding: 24px 22px 20px; color: #fff; font-weight: 800; font-size: 1.15rem; font-family: var(--font-round); }
.brand:hover { color: #fff; }
.brand small { display: block; font-weight: 500; font-size: .74rem; color: var(--g400); font-family: var(--font); letter-spacing: .02em; }
.logo-mark { width: 40px; height: 40px; border-radius: 13px; background: linear-gradient(135deg, #c3d5b9, #A4BE98); color: var(--g900); display: inline-grid; place-items: center; font-weight: 900; font-size: 1.2rem; flex: none; box-shadow: 0 4px 12px rgba(0,0,0,.18); font-family: var(--font-round); }
.sidebar nav { flex: 1; overflow-y: auto; padding: 4px 12px; }
.sidebar nav a { display: flex; align-items: center; gap: 12px; color: #d5dfcf; padding: 7px 10px; border-radius: 14px; margin-bottom: 3px; font-size: .93rem; font-weight: 500; transition: background .15s; }
.sidebar nav a .nav-ico { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: rgba(255,255,255,.06); }
.sidebar nav a .icon { width: 18px; height: 18px; }
.sidebar nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar nav a.active { background: #fff; color: var(--g800); font-weight: 700; box-shadow: 0 6px 18px rgba(0,0,0,.18); }
.sidebar nav a.active .nav-ico { background: var(--g100); color: var(--g600); }
.nav-badge { margin-left: auto; background: #f0a63c; color: #2b1d00; border-radius: 99px; font-size: .72rem; padding: 1px 8px; font-weight: 800; }
.sidebar-foot { border-top: 1px solid rgba(255,255,255,.08); padding: 12px; display: flex; align-items: center; gap: 6px; }
.sidebar-foot .me { flex: 1; display: flex; gap: 10px; align-items: center; color: #fff; padding: 6px; border-radius: 14px; min-width: 0; font-size: .9rem; font-weight: 600; }
.sidebar-foot .me span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-foot .me small { display: block; color: var(--g400); font-size: .74rem; font-weight: 400; }
.sidebar-foot .me:hover, .sidebar-foot .me.active { background: rgba(255,255,255,.07); }
.sidebar-foot .logout { color: #d9e3d3; padding: 9px; border-radius: 12px; }
.sidebar-foot .logout:hover { background: rgba(255,255,255,.08); color: #fff; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-size: .78rem; font-weight: 800; flex: none; font-family: var(--font-round); }
.sidebar .avatar { box-shadow: 0 0 0 2px rgba(255,255,255,.35); }
.avatar.lg { width: 60px; height: 60px; font-size: 1.2rem; }
.avatar.sm { width: 28px; height: 28px; font-size: .68rem; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 22px 32px 14px; position: sticky; top: 0; z-index: 20; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); background: rgba(248,248,245,.85); }
.topbar h1 { font-size: 1.55rem; margin: 0; flex: 1; min-width: 0; font-weight: 800; }
.topbar h1 small { display: block; font-size: .85rem; font-weight: 500; color: var(--muted); font-family: var(--font); letter-spacing: 0; margin-top: 2px; }
.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.content { padding: 8px 32px 48px; max-width: 1400px; width: 100%; }
.hamburger { display: none; background: #fff; border: 0; padding: 9px; cursor: pointer; border-radius: 12px; box-shadow: var(--shadow); }
.hamburger span { display: block; width: 18px; height: 2px; background: var(--g800); margin: 3px 0; border-radius: 2px; }
.sidebar-backdrop { display: none; }
.bottom-nav { display: none; }

@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow-lg); }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(20,26,17,.4); z-index: 30; }
  .hamburger { display: block; }
  .topbar { padding: 12px 16px; }
  .topbar h1 { font-size: 1.2rem; }
  .topbar h1 small { font-size: .78rem; }
  .content { padding: 8px 16px 40px; }
  body.has-bottom-nav .content { padding-bottom: 110px; }
  body.has-bottom-nav .hamburger { display: none; }
  .bottom-nav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); background: rgba(255,255,255,.96); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-radius: 22px; box-shadow: var(--shadow-lg); z-index: 25; padding: 6px; }
  .bottom-nav a, .bottom-nav button { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .68rem; font-weight: 650; color: var(--muted); padding: 6px 0; border-radius: 16px; background: none; border: 0; font-family: inherit; cursor: pointer; }
  .bottom-nav .icon { width: 22px; height: 22px; }
  .bottom-nav a.active { color: var(--g700); background: var(--g100); }
  .bottom-nav a.door { margin-top: -28px; background: none; }
  .bottom-nav .door span.ico { width: 60px; height: 60px; border-radius: 50%; background: linear-gradient(135deg, #6f8f63, #3A4733); color: #fff; display: grid; place-items: center; box-shadow: 0 8px 20px rgba(58,71,51,.4); border: 4px solid #fff; }
  .bottom-nav .door span.ico .icon { width: 26px; height: 26px; }
}

/* ---------- Cards / grid ---------- */
.card { background: var(--white); border: 1px solid rgba(232,231,222,.7); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); margin-bottom: 20px; }
.card > h2:first-child, .card-head h2 { margin-bottom: 14px; }
.card > h2:first-child { display: flex; align-items: center; gap: 10px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head h2 { margin: 0; display: flex; align-items: center; gap: 10px; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush .card-head { padding: 18px 22px 0; }
.card.tinted { background: linear-gradient(135deg, #f7faf5, #eef4ea); }
.grid { display: grid; gap: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.cols { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.cols-even { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.mb { margin-bottom: 20px; }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cols, .cols-even { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .card { padding: 18px; border-radius: 18px; } }

/* ---------- Stat (KPI con icono) ---------- */
.stat { background: #fff; border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); display: flex; gap: 14px; align-items: center; border: 1px solid rgba(232,231,222,.7); color: inherit; min-width: 0; transition: transform .15s, box-shadow .15s; }
a.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); color: inherit; }
.stat .value { font-size: 1.55rem; font-weight: 800; color: var(--g900); letter-spacing: -.02em; line-height: 1.1; font-family: var(--font-round); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .label { color: var(--muted); font-size: .8rem; font-weight: 600; }
.stat .sub { font-size: .75rem; color: var(--muted); }
.stat > div { min-width: 0; }
.stat.dark { background: linear-gradient(135deg, #4b6342, #2f3b29); border: 0; }
.stat.dark .value { color: #fff; } .stat.dark .label, .stat.dark .sub { color: var(--g300); }
.ico { width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; flex: none; }
.ico .icon { width: 22px; height: 22px; }
.ico.sm { width: 36px; height: 36px; border-radius: 12px; } .ico.sm .icon { width: 18px; height: 18px; }
.ico.lg { width: 60px; height: 60px; border-radius: 19px; } .ico.lg .icon { width: 28px; height: 28px; }
.tone-green { background: var(--t-green-bg); color: var(--t-green); }
.tone-amber { background: var(--t-amber-bg); color: var(--t-amber); }
.tone-sky { background: var(--t-sky-bg); color: var(--t-sky); }
.tone-rose { background: var(--t-rose-bg); color: var(--t-rose); }
.tone-violet { background: var(--t-violet-bg); color: var(--t-violet); }
.tone-teal { background: var(--t-teal-bg); color: var(--t-teal); }
.tone-white { background: rgba(255,255,255,.14); color: #fff; }
@media (max-width: 640px) { .stat { padding: 14px; gap: 10px; flex-direction: column; align-items: flex-start; } .stat .value { font-size: 1.3rem; } .ico { width: 40px; height: 40px; border-radius: 13px; } }

/* ---------- Tiles (acciones) ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; margin-bottom: 20px; }
.tile { background: #fff; border-radius: 18px; padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; color: var(--g900); border: 1px solid rgba(232,231,222,.7); position: relative; transition: transform .15s, box-shadow .15s; }
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); color: var(--g900); }
.tile b { font-size: .9rem; line-height: 1.25; }
.tile .count { position: absolute; top: 14px; right: 16px; font-family: var(--font-round); font-weight: 900; font-size: 1.5rem; }
.all-good { display: flex; align-items: center; gap: 14px; padding: 14px 18px; background: linear-gradient(135deg, #eef6ea, #e3efdd); border-radius: 18px; margin-bottom: 20px; color: var(--g700); font-weight: 700; }

/* ---------- Ring ---------- */
.ring { position: relative; display: inline-grid; place-items: center; flex: none; }
.ring svg { transform: rotate(-90deg); display: block; }
.ring .ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.05; }
.ring .ring-label b { display: block; font-family: var(--font-round); font-size: 1.15rem; font-weight: 900; color: var(--g900); }
.ring .ring-label small { font-size: .64rem; font-weight: 600; }
.stat.dark .ring .ring-label b, .hero .ring .ring-label b { color: #fff; }
.hero .ring .ring-label small { color: var(--g200); }

/* ---------- Hero ---------- */
.hero { background: linear-gradient(135deg, #5f8053 0%, #3A4733 62%, #2c3726 100%); color: #fff; border-radius: 26px; padding: 26px; margin-bottom: 20px; box-shadow: 0 16px 40px rgba(58,71,51,.28); position: relative; overflow: hidden; }
.hero::after { content: ''; position: absolute; right: -70px; top: -70px; width: 240px; height: 240px; border-radius: 50%; background: rgba(164,190,152,.16); }
.hero::before { content: ''; position: absolute; right: 60px; bottom: -90px; width: 180px; height: 180px; border-radius: 50%; background: rgba(164,190,152,.1); }
.hero h2 { color: #fff; font-size: 1.4rem; margin-bottom: 4px; }
.hero p { color: var(--g200); margin-bottom: 0; }
.hero .btn { position: relative; z-index: 1; }
.hero-row { display: flex; align-items: center; gap: 18px; position: relative; z-index: 1; flex-wrap: wrap; }
.hero-row .grow { flex: 1; min-width: 200px; }
.hero .pill { margin-bottom: 10px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--white); color: var(--g800); font: inherit; font-weight: 650; font-size: .9rem; cursor: pointer; white-space: nowrap; text-decoration: none !important; line-height: 1.2; transition: background .15s, transform .1s, box-shadow .15s; }
.btn .icon { width: 17px; height: 17px; }
.btn:hover { background: var(--g50); color: var(--g800); }
.btn:active { transform: scale(.98); }
.btn-primary { background: linear-gradient(135deg, #64835a, #4b6642); border-color: transparent; color: #fff; box-shadow: 0 4px 14px rgba(85,114,75,.3); }
.btn-primary:hover { background: linear-gradient(135deg, #5a7a4f, #3f5737); color: #fff; }
.btn-dark { background: var(--g800); border-color: var(--g800); color: #fff; }
.btn-dark:hover { background: var(--g900); color: #fff; }
.btn-light { background: #fff; border-color: transparent; color: var(--g800); box-shadow: 0 4px 14px rgba(0,0,0,.12); }
.btn-light:hover { background: var(--g50); }
.btn-danger { color: var(--bad); border-color: #f1c9c4; }
.btn-danger:hover { background: var(--bad-bg); color: var(--bad); }
.btn-sm { padding: 6px 11px; font-size: .82rem; border-radius: 10px; }
.btn-lg { padding: 14px 22px; font-size: 1rem; border-radius: 14px; }
.btn-block { width: 100%; }
.btn-link { background: none; border: 0; padding: 0; color: var(--g600); font: inherit; cursor: pointer; font-weight: 650; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.inline { display: inline; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* ---------- Forms ---------- */
.form label, label.field { display: block; font-size: .82rem; font-weight: 650; color: var(--g800); margin-bottom: 14px; }
.form label > small { font-weight: 400; }
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=tel], input[type=month], input[type=search], input[type=color], input[type=file], select, textarea {
  display: block; width: 100%; margin-top: 6px; padding: 10px 13px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); font: inherit; font-weight: 400; background: #fcfcfa; color: var(--text); min-height: 44px; transition: border .15s, box-shadow .15s, background .15s;
}
textarea { min-height: 96px; resize: vertical; }
input[type=color] { padding: 4px; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--g500); box-shadow: 0 0 0 4px rgba(164,190,152,.35); background: #fff; }
label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
label.check input { margin-top: 2px; width: 18px; height: 18px; accent-color: var(--g600); flex: none; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.filters label { margin: 0; font-size: .76rem; font-weight: 700; color: var(--muted); }
.filters input, .filters select { margin-top: 3px; padding: 8px 12px; min-width: 150px; background: #fff; }
.help { font-size: .78rem; color: var(--muted); font-weight: 400; margin-top: 4px; display: block; }
fieldset { border: 0; border-radius: 16px; padding: 16px 16px 4px; margin: 0 0 16px; background: var(--g50); }
legend { font-weight: 800; color: var(--g800); padding: 0; font-size: .92rem; float: left; width: 100%; margin-bottom: 12px; font-family: var(--font-round); display: flex; align-items: center; gap: 8px; }
legend + * { clear: both; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 800; padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fafbf8; }
.table .num, .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tfoot td { font-weight: 800; border-top: 2px solid var(--line); }
.who { display: flex; align-items: center; gap: 10px; color: inherit; }
.who .avatar { width: 34px; height: 34px; font-size: .72rem; }
.who small { display: block; }
.who b { color: var(--g900); }

/* ---------- Badges / alerts ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 99px; font-size: .73rem; font-weight: 750; white-space: nowrap; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-bad { background: var(--bad-bg); color: var(--bad); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-neutral { background: #efeee7; color: #626858; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; }
.alert { display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-radius: 14px; margin-bottom: 16px; font-size: .92rem; font-weight: 550; }
.alert .icon { flex: none; }
.alert-ok { background: var(--ok-bg); color: #1d5434; }
.alert-bad { background: var(--bad-bg); color: #7d1a14; }
.alert-warn { background: var(--warn-bg); color: #6b4a00; }
.alert-info { background: var(--info-bg); color: #1d4767; }
.alert a { font-weight: 750; color: inherit; text-decoration: underline; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.empty .ico { margin: 0 auto 10px; }

/* ---------- Lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .title { font-weight: 700; color: var(--g900); }
.list small { display: block; }
.date-chip { width: 52px; flex: none; text-align: center; border-radius: 14px; background: var(--g100); color: var(--g800); padding: 6px 0; line-height: 1.1; font-family: var(--font-round); }
.date-chip b { display: block; font-size: 1.25rem; }
.date-chip span { font-size: .64rem; text-transform: uppercase; font-weight: 800; letter-spacing: .04em; }
.date-chip.today { background: var(--g600); color: #fff; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 6px; margin-bottom: 20px; overflow-x: auto; padding-bottom: 2px; }
.tabs a { padding: 8px 14px; color: var(--muted); font-weight: 650; font-size: .87rem; border-radius: 99px; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; background: rgba(255,255,255,.65); }
.tabs a .icon { width: 16px; height: 16px; }
.tabs a.active { color: #fff; background: var(--g800); }
.tabs a:hover:not(.active) { background: #fff; color: var(--g800); }
.seg { display: inline-flex; border-radius: 12px; overflow: hidden; background: #fff; padding: 3px; box-shadow: var(--shadow); }
.seg a { padding: 6px 14px; font-size: .84rem; font-weight: 650; color: var(--muted); border-radius: 9px; }
.seg a.active { background: var(--g800); color: #fff; }

/* ---------- Agenda ---------- */
.agenda-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.agenda-nav .period { font-weight: 800; font-size: 1.05rem; color: var(--g900); font-family: var(--font-round); }
.agenda { overflow-x: auto; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid rgba(232,231,222,.7); }
.agenda-grid { display: grid; position: relative; }
.agenda-grid .ag-head { position: sticky; top: 0; background: #fff; border-bottom: 1px solid var(--line); padding: 12px 8px; font-weight: 800; font-size: .86rem; text-align: center; color: var(--g800); z-index: 2; font-family: var(--font-round); }
.agenda-grid .ag-head small { display: block; font-weight: 500; font-family: var(--font); font-size: .72rem; }
.agenda-grid .ag-head.today { color: var(--g600); }
.agenda-grid .ag-head.today::after { content: ''; display: block; width: 6px; height: 6px; background: var(--g600); border-radius: 50%; margin: 4px auto 0; }
.agenda-grid .ag-hour { font-size: .72rem; color: var(--muted); text-align: right; padding: 2px 8px 0 4px; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.agenda-grid .ag-hour.now { color: #d1495b; font-weight: 800; }
.agenda-grid .ag-cell { border-top: 1px solid var(--line); border-left: 1px solid var(--line); position: relative; }
.agenda-grid .ag-cell.closed { background: repeating-linear-gradient(-45deg, #f7f7f2, #f7f7f2 6px, #f0f0ea 6px, #f0f0ea 12px); }
.agenda-grid .ag-cell.free:hover { background: var(--g100); cursor: pointer; }
.agenda-grid .ag-cell.past { background: #fbfbf9; }
.agenda-grid .ag-cell.free a.slot-link { position: absolute; inset: 0; }
.agenda-grid .ag-cell.free:hover a.slot-link::after { content: '+'; position: absolute; inset: 0; display: grid; place-items: center; color: var(--g600); font-weight: 800; font-size: 1.1rem; }
.ag-event { position: relative; margin: 2px 3px; border-radius: 10px; padding: 5px 8px; font-size: .75rem; line-height: 1.25; color: #fff; overflow: hidden; z-index: 1; box-shadow: 0 2px 6px rgba(0,0,0,.12); display: block; }
.ag-event:hover { filter: brightness(1.08); color: #fff; }
.ag-event b { display: block; font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-event.busy { background: #e6e5dd !important; color: #6d7166; box-shadow: none; }
.ag-event.mine { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--g700); }
.ag-event.pendiente { opacity: .6; background-image: repeating-linear-gradient(-45deg, rgba(255,255,255,.28) 0 6px, transparent 6px 12px) !important; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: .8rem; color: var(--muted); margin-top: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* timeline de hoy */
.timeline { display: grid; gap: 10px; }
.tl-row { display: grid; grid-template-columns: 96px 1fr; gap: 10px; align-items: center; }
.tl-row .tl-name { font-size: .84rem; font-weight: 700; color: var(--g800); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-track { position: relative; height: 34px; background: var(--g50); border-radius: 11px; overflow: hidden; }
.tl-block { position: absolute; top: 4px; bottom: 4px; border-radius: 8px; color: #fff; font-size: .72rem; font-weight: 650; padding: 0 8px; display: flex; align-items: center; white-space: nowrap; overflow: hidden; }
.tl-block:hover { color: #fff; filter: brightness(1.08); }
.tl-scale { display: grid; grid-template-columns: 96px 1fr; gap: 10px; font-size: .68rem; color: var(--muted); }
.tl-scale div { display: flex; justify-content: space-between; }
@media (max-width: 640px) { .tl-row, .tl-scale { grid-template-columns: 70px 1fr; } }

/* ---------- Domótica ---------- */
.rooms { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.room { background: #fff; border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); border: 1px solid rgba(232,231,222,.7); }
.room.busy { background: linear-gradient(180deg, #fff8ea, #fff 45%); }
.room-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.room-head h3 { margin: 0; }
.room .occupant { font-size: .8rem; color: var(--muted); margin-bottom: 10px; min-height: 1.3em; display: flex; align-items: center; gap: 6px; }
.device { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.device .grow { flex: 1; font-size: .88rem; font-weight: 650; min-width: 0; }
.device small { display: block; font-weight: 400; }
.device-icon { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; background: #f1f1ec; color: #9aa094; flex: none; transition: all .2s; }
.device-icon.on { background: #fff1c9; color: #c98a12; box-shadow: 0 0 0 4px rgba(255,214,102,.25); }
.device-icon.clima.on { background: var(--t-sky-bg); color: var(--t-sky); box-shadow: 0 0 0 4px rgba(47,127,181,.12); }
.device-icon.puerta { background: var(--t-green-bg); color: var(--t-green); }
.toggle { position: relative; display: inline-block; vertical-align: middle; width: 48px; height: 28px; flex: none; margin: 0; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle span { position: absolute; inset: 0; background: #d6d9d0; border-radius: 99px; cursor: pointer; transition: background .2s; }
.toggle span::before { content: ''; position: absolute; width: 22px; height: 22px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.toggle input:checked + span { background: var(--g600); }
.toggle input:checked + span::before { transform: translateX(20px); }
.big-action { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 34px 16px; text-align: center; }
.door-btn { width: 184px; height: 184px; border-radius: 50%; border: 0; background: radial-gradient(circle at 30% 25%, #85a676, #3A4733 75%); color: #fff; font: inherit; font-weight: 800; font-size: 1.05rem; cursor: pointer; box-shadow: 0 18px 40px rgba(58,71,51,.4), inset 0 -6px 16px rgba(0,0,0,.18); display: grid; place-items: center; transition: transform .12s; position: relative; font-family: var(--font-round); margin: 10px 0; }
.door-btn::before { content: ''; position: absolute; inset: -12px; border-radius: 50%; border: 3px solid rgba(85,114,75,.3); animation: pulse 2.4s infinite; }
@keyframes pulse { 0% { transform: scale(.94); opacity: 1; } 100% { transform: scale(1.14); opacity: 0; } }
.door-btn:active { transform: scale(.95); }
.door-btn .icon { width: 52px; height: 52px; }
.door-btn[disabled] { background: radial-gradient(circle at 30% 25%, #dcdfd6, #b3b7ac 75%); box-shadow: none; cursor: not-allowed; }
.door-btn[disabled]::before { display: none; }
.code-box { font-size: 1.9rem; font-weight: 900; letter-spacing: .32em; color: var(--g900); font-variant-numeric: tabular-nums; background: var(--sand); border-radius: 14px; padding: 10px 18px; display: inline-block; font-family: var(--font-round); }
.hidden-code { filter: blur(8px); cursor: pointer; user-select: none; }
.temp { font-family: var(--font-round); font-weight: 900; font-size: 1.05rem; min-width: 48px; text-align: center; }

/* ---------- Charts ---------- */
.bars { display: flex; align-items: flex-end; gap: 8px; height: 210px; padding-top: 18px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.bars .bar i { display: block; width: 100%; max-width: 22px; background: linear-gradient(180deg, #6f8f63, #4b6642); border-radius: 8px 8px 3px 3px; min-height: 3px; }
.bars .bar i.light { background: linear-gradient(180deg, #c3d5b9, #A4BE98); }
.bars .bar em { font-style: normal; font-size: .68rem; color: var(--muted); margin-top: 6px; white-space: nowrap; font-weight: 650; }
.bars .bar b { font-size: .64rem; color: var(--g800); margin-bottom: 3px; white-space: nowrap; }
.heat { display: grid; gap: 4px; font-size: .7rem; }
.heat div { padding: 7px 2px; text-align: center; border-radius: 7px; font-weight: 650; }
.heat .h { color: var(--muted); font-weight: 750; background: none; }
.hbar { display: grid; grid-template-columns: 110px 1fr 54px; gap: 10px; align-items: center; margin-bottom: 12px; font-size: .86rem; font-weight: 650; }
.progress { height: 10px; background: var(--g100); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, #7fa070, #55724B); border-radius: 99px; }

/* ---------- Auth ---------- */
.auth-body { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; background: var(--cream); }
.auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: 26px; padding: 34px 30px; box-shadow: var(--shadow-lg); }
.auth-card h1 { font-size: 1.6rem; font-weight: 800; }
.auth-logo { display: flex; align-items: center; justify-content: center; gap: 12px; font-weight: 900; font-size: 1.25rem; color: var(--g800); margin-bottom: 26px; font-family: var(--font-round); }
.auth-foot { color: var(--muted); font-size: .8rem; margin-top: 20px; text-align: center; }
.auth-links { display: flex; justify-content: center; margin-top: 18px; font-size: .9rem; }

/* ---------- Dialog ---------- */
dialog { border: 0; border-radius: 24px; padding: 0; width: min(520px, calc(100vw - 24px)); box-shadow: var(--shadow-lg); }
dialog::backdrop { background: rgba(25,31,21,.45); backdrop-filter: blur(3px); }
dialog .dlg-body { padding: 24px; }
dialog .dlg-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
dialog .dlg-head h2 { margin: 0; }
.dlg-close { background: var(--g50); border: 0; width: 34px; height: 34px; border-radius: 50%; font-size: 1.3rem; cursor: pointer; color: var(--muted); line-height: 1; }

/* ---------- Misc ---------- */
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 10px 14px; font-size: .92rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 650; word-break: break-word; }
@media (max-width: 640px) { .kv { grid-template-columns: 1fr; gap: 0; } .kv dd { margin-bottom: 8px; } }
.notice { background: #fff; border-radius: 18px; padding: 16px 18px; margin-bottom: 16px; box-shadow: var(--shadow); display: flex; gap: 14px; align-items: flex-start; }
.notice.important { background: linear-gradient(135deg, #fff6df, #fff 70%); }
.notice h3 { margin-bottom: 2px; }
.notice .pre { font-size: .9rem; color: #4b5245; }
.pre { white-space: pre-line; }
.text-ok { color: var(--ok); } .text-bad { color: var(--bad); } .text-warn { color: var(--warn); }
.nowrap { white-space: nowrap; }
.mt0 { margin-top: 0; } .mb0 { margin-bottom: 0; } .mt { margin-top: 16px; }
.right { text-align: right; }
@media (max-width: 640px) { .hide-mobile { display: none !important; } }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line-2); background: #fff; border-radius: 99px; padding: 7px 13px; font-size: .84rem; cursor: pointer; font: inherit; font-weight: 650; color: var(--g800); display: inline-flex; align-items: center; gap: 4px; }
.chip.active, .chip:hover { background: var(--g800); color: #fff; border-color: var(--g800); }
.chip:has(input:checked) { background: var(--g800); color: #fff; border-color: var(--g800); }
.chip input { display: none !important; }
.stat-line { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); font-size: .92rem; }
.stat-line:last-child { border-bottom: 0; }
.section-title { display: flex; align-items: center; gap: 10px; font-size: .76rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 800; margin: 6px 0 12px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 99px; background: rgba(255,255,255,.16); font-size: .8rem; font-weight: 700; }
.pill .icon { width: 15px; height: 15px; }

/* Firma */
.sign-pad { border: 2px dashed var(--g300); border-radius: 18px; background: #fcfdfb; touch-action: none; width: 100%; height: 200px; display: block; cursor: crosshair; }
.contract-text { white-space: pre-line; font-size: .92rem; line-height: 1.65; max-height: 460px; overflow-y: auto; padding: 22px; background: #fcfcfa; border-radius: 16px; border: 1px solid var(--line); }
.sign-box { border: 1px solid var(--line); border-radius: 16px; padding: 14px; text-align: center; background: #fcfcfa; }
.sign-box img { max-width: 100%; height: 90px; object-fit: contain; }

.doc-frame { width: 100%; height: 78vh; border: 0; border-radius: 18px; box-shadow: var(--shadow); background: #fff; }
@media print {
  body { background: #fff; }
  .sidebar, .topbar, .no-print, .alert, .bottom-nav { display: none !important; }
  .content { padding: 0; }
}

/* Cifras dentro de tarjetas: versión ligera */
.card .stat { box-shadow: none; background: var(--g50); border: 0; padding: 14px; }
.card .stat .value { font-size: 1.2rem; }
.card .stat .ico { width: 40px; height: 40px; border-radius: 13px; }

/* Mostrar/ocultar contraseña */
.pass-wrap { position: relative; display: block; margin-top: 6px; }
.pass-wrap input { padding-right: 48px; margin-top: 0; }
.pass-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border: 0; background: none; border-radius: 10px; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.pass-eye:hover { background: var(--g50); color: var(--g800); }
.pass-eye .eye-off { display: none; }
.pass-eye.visible .eye-on { display: none; }
.pass-eye.visible .eye-off { display: block; }

/* Modo privado: importes difuminados */
.btn-privacy { padding: 9px; width: 40px; height: 40px; }
.btn-privacy .eye-off { display: none; }
.btn-privacy.active { background: var(--g800); color: #fff; border-color: var(--g800); }
.btn-privacy.active .eye-on { display: none; }
.btn-privacy.active .eye-off { display: block; }
html.privado .amt { filter: blur(7px); user-select: none; transition: filter .15s; }
html.privado input[name*="precio"], html.privado input[name*="importe"], html.privado input[name*="fianza"], html.privado input[name^="tarifa"] { color: transparent; text-shadow: 0 0 9px rgba(0,0,0,.55); }
html.privado .doc-frame { filter: blur(10px); }

/* DNI: dos caras */
.dni-slot { display: flex; flex-direction: column; gap: 10px; }
.dni-drop { position: relative; display: flex !important; flex-direction: column; align-items: center; justify-content: center; gap: 12px; aspect-ratio: 1.586; border: 2px dashed var(--g300); border-radius: 18px; background: var(--g50); cursor: pointer; overflow: hidden; color: var(--g700); font-size: .9rem; margin: 0 !important; transition: background .15s, border-color .15s; }
.dni-drop:hover { background: var(--g100); border-color: var(--g500); }
.dni-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; min-height: 0; }
.dni-drop img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.dni-drop b { display: inline-flex; align-items: center; gap: 6px; }
.dni-slot.done .dni-drop { border-style: solid; border-color: var(--g200); background: #fff; }
.dni-foot { display: flex; align-items: center; gap: 8px; }
.dni-card-sketch { width: 120px; height: 76px; border-radius: 10px; background: #fff; border: 2px solid var(--g300); position: relative; }
.dni-card-sketch i { position: absolute; height: 6px; border-radius: 3px; background: var(--g200); left: 52px; right: 12px; }
.dni-card-sketch i:nth-child(1) { top: 16px; } .dni-card-sketch i:nth-child(2) { top: 30px; right: 30px; } .dni-card-sketch i:nth-child(3) { top: 44px; }
.dni-card-sketch::before { content: ''; position: absolute; left: 12px; top: 14px; width: 30px; height: 38px; border-radius: 6px; background: var(--g200); }
.dni-card-sketch.back::before { display: none; }
.dni-card-sketch.back i { left: 12px; }
.dni-card-sketch.back i:nth-child(3) { top: auto; bottom: 12px; height: 12px; background: repeating-linear-gradient(90deg, var(--g300) 0 3px, transparent 3px 6px); }

/* Alta del profesional: pasos */
.onboard-steps { display: flex; gap: 8px; margin: 4px 0 20px; }
.onboard-steps div { flex: 1 1 0; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 6px; white-space: nowrap; border-radius: 12px; background: var(--g50); color: var(--muted); font-size: .82rem; font-weight: 650; }
.onboard-steps span { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: #fff; font-size: .75rem; font-weight: 800; flex: none; }
.onboard-steps .on { background: var(--g800); color: #fff; }
.onboard-steps .on span { background: var(--g400); color: var(--g900); }
.steps-card { background: #fff; border-radius: 22px; box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; border: 1px solid rgba(232,231,222,.7); }
.steps-card h2 { display: flex; align-items: center; gap: 10px; }
.step { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 16px; color: var(--g900); font-weight: 650; margin-top: 8px; background: var(--g50); }
.step:hover { color: var(--g900); background: var(--g100); }
.step .num { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #fff; border: 2px solid var(--g300); font-weight: 800; flex: none; font-family: var(--font-round); }
.step.done { background: none; color: var(--muted); text-decoration: line-through; }
.step.done .num { background: var(--g600); border-color: var(--g600); color: #fff; }
.step.done .num .icon { width: 18px; height: 18px; }
.step .go { white-space: nowrap; margin-left: auto; color: var(--g600); font-size: .85rem; text-decoration: none; }
.step.next { background: linear-gradient(135deg, #eef5ea, #e1ecdb); box-shadow: inset 0 0 0 2px var(--g400); }

/* ---------- Domótica v2 ---------- */
.domo-status { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.pill-status { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 99px; background: #fff; box-shadow: var(--shadow); font: inherit; font-size: .84rem; font-weight: 700; color: var(--g800); border: 0; cursor: default; }
button.pill-status { cursor: pointer; }
.pill-status .icon { width: 17px; height: 17px; }
.pill-status.ok { background: var(--ok-bg); color: var(--ok); }
.pill-status.warn { background: var(--warn-bg); color: var(--warn); }
.pill-status.off { background: #eceae2; color: var(--muted); }

.entrada { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.ent-item { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 18px 12px; border-radius: 18px; background: var(--g50); text-align: center; }
.ent-item b { font-size: .92rem; }
.door-mini { width: 86px; height: 86px; border-radius: 50%; border: 0; cursor: pointer; color: #fff; font: inherit; font-weight: 800; font-size: .8rem; display: grid; place-items: center; align-content: center; gap: 2px; background: radial-gradient(circle at 30% 25%, #85a676, #3A4733 75%); box-shadow: 0 10px 24px rgba(58,71,51,.35); transition: transform .1s; }
.door-mini .icon { width: 30px; height: 30px; }
.door-mini:active { transform: scale(.94); }
.blind { width: 86px; height: 86px; border-radius: 16px; background: linear-gradient(180deg, #cfe2f3, #eaf3fb); border: 3px solid #b9c4cc; position: relative; overflow: hidden; display: flex; flex-direction: column; }
.blind i { flex: 1; background: #8e9aa3; border-bottom: 2px solid #76828b; transition: flex .4s, opacity .4s; }
.blind.open i { flex: 0 0 4px; opacity: .9; }
.blind.open::after { content: '☀︎'; position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.6rem; color: #e6a817; padding-top: 8px; }
.seg-mini { display: inline-flex; background: #fff; border-radius: 10px; padding: 3px; box-shadow: var(--shadow); }
.seg-mini button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; font: inherit; font-size: .8rem; font-weight: 700; color: var(--muted); cursor: pointer; }
.seg-mini button.active { background: var(--g800); color: #fff; }

.zonas { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; }
@media (max-width: 640px) { .zonas { grid-template-columns: 1fr; } }
.zona { border-radius: 24px; padding: 18px; box-shadow: var(--shadow); background: #fff; border-top: 6px solid var(--z, var(--g600)); }
.zona-teal { --z: var(--t-teal); --zbg: var(--t-teal-bg); }
.zona-violet { --z: var(--t-violet); --zbg: var(--t-violet-bg); }
.zona-sky { --z: var(--t-sky); --zbg: var(--t-sky-bg); }
.zona-amber { --z: var(--t-amber); --zbg: var(--t-amber-bg); }
.zona-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.zona-tag { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 99px; background: var(--zbg); color: var(--z); font-weight: 800; font-size: .88rem; font-family: var(--font-round); }
.zona-tag .icon { width: 17px; height: 17px; }
.zona-cubre { font-size: .78rem; color: var(--muted); margin-top: 6px; }
.termo { display: flex; align-items: center; gap: 6px; background: var(--g50); border-radius: 18px; padding: 6px; }
.termo.on { background: var(--zbg); }
.termo-btn { width: 34px; height: 34px; border-radius: 50%; border: 0; background: #fff; font-size: 1.2rem; font-weight: 800; color: var(--g800); cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.termo-val { text-align: center; min-width: 64px; line-height: 1.05; }
.termo-val b { display: block; font-family: var(--font-round); font-size: 1.6rem; font-weight: 900; color: var(--g900); }
.termo.on .termo-val b { color: var(--z); }
.termo-val small { font-size: .66rem; font-weight: 700; color: var(--muted); }
.termo-power { width: 38px; height: 38px; border-radius: 12px; border: 0; background: #fff; color: var(--muted); cursor: pointer; display: grid; place-items: center; margin-left: 4px; box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.termo-power.on { background: var(--z); color: #fff; }
.salas { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.sala { position: relative; border-radius: 18px; padding: 14px; background: var(--g50); min-height: 112px; display: flex; flex-direction: column; justify-content: space-between; gap: 10px; transition: background .2s; }
.sala.ocupada { background: linear-gradient(160deg, #fff6e0, #fdf0d2); }
.sala.luz-on { box-shadow: inset 0 0 0 2px rgba(240,180,40,.45); }
.sala-top b { display: block; font-family: var(--font-round); font-size: .98rem; color: var(--g900); }
.sala-who { display: flex; align-items: center; gap: 6px; font-size: .74rem; font-weight: 600; margin-top: 4px; color: var(--g800); }
.sala-who.muted { color: var(--muted); }
.sala-who .avatar.sm { width: 20px; height: 20px; font-size: .55rem; }
.sala form { align-self: flex-end; }
.bulb { width: 44px; height: 44px; border-radius: 50%; border: 0; display: grid; place-items: center; background: #fff; color: #b5b9ae; cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,.1); transition: all .2s; }
.bulb .icon { width: 22px; height: 22px; }
.bulb.on { background: #ffd34d; color: #8a5a00; box-shadow: 0 0 0 6px rgba(255,211,77,.3), 0 0 22px rgba(255,200,40,.55); }
.bulb.none { opacity: .4; cursor: default; align-self: flex-end; }
.legend .bulb { display: inline-grid; }
.legend .bulb .icon { width: 13px; height: 13px; }
details.card > summary.summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; font-weight: 800; font-family: var(--font-round); color: var(--g900); }
details.card > summary.summary::-webkit-details-marker { display: none; }
details.card > summary.summary::after { content: '▾'; margin-left: auto; color: var(--muted); transition: transform .2s; }
details.card[open] > summary.summary::after { transform: rotate(180deg); }
.termo-lg { justify-content: center; padding: 10px; margin-bottom: 14px; }
.termo-lg .termo-val b { font-size: 2.2rem; }
.termo-lg .termo-btn { width: 44px; height: 44px; font-size: 1.4rem; }
.termo-lg .termo-power { width: 44px; height: 44px; }
.termo button[disabled] { opacity: .4; cursor: not-allowed; }
.shared-note { display: flex; gap: 10px; align-items: flex-start; font-size: .85rem; background: var(--g50); border-radius: 14px; padding: 10px 12px; margin-bottom: 10px; color: var(--g800); }
.shared-note .icon { width: 18px; height: 18px; flex: none; margin-top: 1px; color: var(--t-sky); }
.rotulo { width: 120px; height: 56px; border-radius: 12px; border: 3px solid #3a4235; background: #2b3127; color: #59604f; font: 900 .78rem/1 var(--font-round); letter-spacing: .12em; cursor: pointer; transition: all .3s; }
.rotulo.on { background: #fffbe8; color: #3A4733; border-color: #A4BE98; box-shadow: 0 0 0 4px rgba(255,211,77,.25), 0 0 26px rgba(255,220,120,.7); }

/* ---------- Domótica v3 (estilo casa inteligente) ---------- */
.domo-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.switch-pill { display: inline-flex; align-items: center; gap: 12px; border: 0; background: #fff; border-radius: 18px; padding: 10px 16px 10px 10px; box-shadow: var(--shadow); cursor: pointer; font: inherit; text-align: left; }
.switch-pill b { display: block; font-size: .9rem; color: var(--g900); }
.switch-pill small { color: var(--muted); font-size: .76rem; }
.switch-pill .sw { width: 46px; height: 28px; border-radius: 99px; background: #d6d9d0; position: relative; flex: none; transition: background .2s; }
.switch-pill .sw::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch-pill.on .sw { background: var(--g600); }
.switch-pill.on .sw::after { transform: translateX(18px); }

.hsection { display: flex; align-items: center; gap: 8px; font-family: var(--font-round); font-weight: 800; font-size: 1.05rem; color: var(--g900); margin: 26px 0 12px; }
.hsection .icon { width: 20px; height: 20px; color: var(--g600); }
.htiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; }
@media (max-width: 640px) { .htiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }
.htiles form { display: contents; }
.htile { position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 18px; min-height: 128px; padding: 16px; border: 0; border-radius: 22px; background: rgba(255,255,255,.55); box-shadow: inset 0 0 0 1px rgba(0,0,0,.05); font: inherit; text-align: left; cursor: pointer; color: var(--g900); transition: background .2s, box-shadow .2s, transform .1s; -webkit-tap-highlight-color: transparent; }
.htile:hover { background: rgba(255,255,255,.85); }
.htile:active { transform: scale(.97); }
.htile-ico { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: rgba(0,0,0,.06); color: #8b9184; transition: all .25s; }
.htile-ico .icon { width: 22px; height: 22px; }
.htile-txt b { display: block; font-size: .95rem; line-height: 1.2; }
.htile-txt small { display: block; color: var(--muted); font-size: .78rem; margin-top: 3px; font-weight: 600; }
.htile.on { background: #fff; box-shadow: var(--shadow), inset 0 0 0 1px rgba(0,0,0,.03); }
.htile.tone-amber.on .htile-ico { background: #ffd34d; color: #7a4f00; box-shadow: 0 0 18px rgba(255,200,40,.6); }
.htile.tone-sky.on .htile-ico { background: var(--t-sky); color: #fff; }
.htile.tone-green .htile-ico { background: var(--g600); color: #fff; }
.htile.tone-green { background: linear-gradient(150deg, #eef5ea, #e1ecdb); }
.htile-badge { position: absolute; top: 16px; right: 16px; background: var(--g800); color: #fff; font-size: .75rem; font-weight: 800; padding: 5px 12px; border-radius: 99px; }
.htile-who { position: absolute; top: 14px; right: 14px; }
.htile-who .avatar.sm { width: 28px; height: 28px; font-size: .64rem; box-shadow: 0 0 0 2px #fff; }
.htile.loading { opacity: .6; pointer-events: none; }
.htile.door-open { background: linear-gradient(150deg, #5f8053, #3A4733); color: #fff; }
.htile.door-open .htile-ico { background: #fff; color: var(--g700); animation: pop .5s ease; }
.htile.door-open small { color: var(--g200); }
.htile.door-open .htile-badge { background: #fff; color: var(--g800); }
@keyframes pop { 0% { transform: scale(.6); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }

.thermos { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 16px; }
.thermo-card { border-radius: 26px; padding: 18px; background: rgba(255,255,255,.6); box-shadow: inset 0 0 0 1px rgba(0,0,0,.05); transition: background .25s; }
.thermo-card.on { background: #fff; box-shadow: var(--shadow); }
.thermo-card.tone-teal { --tc: var(--t-teal); --tcb: var(--t-teal-bg); background-color: transparent; color: inherit; }
.thermo-card.tone-violet { --tc: var(--t-violet); --tcb: var(--t-violet-bg); background-color: transparent; color: inherit; }
.thermo-card.tone-sky { --tc: var(--t-sky); --tcb: var(--t-sky-bg); background-color: transparent; color: inherit; }
.thermo-card.on.tone-teal, .thermo-card.on.tone-violet, .thermo-card.on.tone-sky { background: linear-gradient(170deg, var(--tcb), #fff 55%); }
.thermo-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.thermo-head b { font-family: var(--font-round); font-size: 1.1rem; color: var(--g900); display: block; }
.thermo-head small { color: var(--muted); font-size: .78rem; }
.power-btn { width: 46px; height: 46px; border-radius: 50%; border: 0; background: rgba(0,0,0,.06); color: #8b9184; display: grid; place-items: center; cursor: pointer; transition: all .2s; }
.power-btn.on { background: var(--tc); color: #fff; box-shadow: 0 6px 16px rgba(0,0,0,.15); }
.thermo-body { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 8px 0 6px; }
.round-btn { width: 48px; height: 48px; border-radius: 50%; border: 0; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.1); font-size: 1.5rem; font-weight: 700; color: var(--g800); cursor: pointer; }
.round-btn:active { transform: scale(.94); }
.dial-wrap { position: relative; width: 170px; height: 170px; }
.dial { width: 100%; height: 100%; }
.dial-arc { stroke: #c8ccc2; transition: stroke-dasharray .4s; }
.dial-arc.on { stroke: var(--tc); }
.dial-val { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1; }
.dial-val b { font-family: var(--font-round); font-size: 2.6rem; font-weight: 900; color: var(--g900); }
.dial-val small { color: var(--muted); font-size: .75rem; font-weight: 700; margin-top: 6px; }
.thermo-foot { display: flex; align-items: center; gap: 6px; justify-content: center; color: var(--muted); font-size: .8rem; font-weight: 600; }
.thermo-foot .avatar.sm { width: 24px; height: 24px; font-size: .58rem; }

/* Avisos flotantes */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 24px; z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
body.has-bottom-nav .toasts { bottom: 110px; }
.toast { background: var(--g900); color: #fff; padding: 11px 18px; border-radius: 14px; font-size: .9rem; font-weight: 600; box-shadow: var(--shadow-lg); animation: toastIn .25s ease; max-width: calc(100vw - 32px); }
.toast.bad, .toast.warn { background: #8a2a22; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.btn.loading { opacity: .6; pointer-events: none; }
.door-btn.opened { background: radial-gradient(circle at 30% 25%, #9fd08a, #2f7d4f 75%); }
.door-btn.opened .icon { animation: pop .5s ease; }

/* ---------- Agenda: cuadrante semanal ---------- */
.cuadrante-wrap { overflow-x: auto; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px 6px 2px; }
.cuadrante { display: grid; min-width: 900px; gap: 0; }
.cq-head { padding: 10px 6px 12px; text-align: center; font-family: var(--font-round); color: var(--g800); }
.cq-head span { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 800; }
.cq-head b { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; font-size: 1.1rem; margin-top: 2px; }
.cq-head.today b { background: var(--g600); color: #fff; }
.cq-head small { display: block; font-size: .66rem; color: var(--bad); font-weight: 700; font-family: var(--font); }
.cq-corner { text-align: left; display: flex; align-items: flex-end; }
.cq-corner small { color: var(--muted); font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.cq-desp { display: flex; flex-direction: column; justify-content: center; padding: 8px 10px; border-top: 1px solid var(--line); }
.cq-desp b { font-family: var(--font-round); color: var(--g900); font-size: .95rem; }
.cq-desp small { color: var(--muted); font-size: .72rem; font-weight: 600; }
.cq-cell { padding: 10px 6px 8px; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.cq-cell.today { background: #f7faf5; }
.cq-cell.past { opacity: .7; }
.cq-cell.closed { background: repeating-linear-gradient(-45deg, #f8f8f4, #f8f8f4 6px, #f1f1eb 6px, #f1f1eb 12px); display: grid; place-items: center; }
.cq-closed { font-size: .74rem; color: var(--muted); font-weight: 700; text-align: center; }
.cq-track { position: relative; height: 46px; border-radius: 10px; background: var(--g50); box-shadow: inset 0 0 0 1px rgba(0,0,0,.04); overflow: hidden; }
.cq-track[data-cq-free] { cursor: copy; }
.cq-track[data-cq-free]:hover { background: var(--g100); }
.cq-mid { position: absolute; top: 4px; bottom: 4px; width: 0; border-left: 1px dashed rgba(0,0,0,.15); }
.cq-now { position: absolute; top: 0; bottom: 0; width: 2px; background: #d1495b; z-index: 2; }
.cq-ev { position: absolute; top: 4px; bottom: 4px; border-radius: 7px; color: #fff; font-size: .7rem; font-weight: 700; display: flex; align-items: center; padding: 0 6px; overflow: hidden; white-space: nowrap; box-shadow: 0 1px 3px rgba(0,0,0,.15); z-index: 1; }
.cq-ev span { overflow: hidden; text-overflow: ellipsis; }
.cq-ev:hover { color: #fff; filter: brightness(1.1); z-index: 3; }
.cq-ev.pendiente { opacity: .55; background-image: repeating-linear-gradient(-45deg, rgba(255,255,255,.3) 0 5px, transparent 5px 10px) !important; }
.cq-meta { display: flex; justify-content: space-between; font-size: .68rem; color: var(--muted); margin-top: 5px; font-weight: 600; padding: 0 2px; }
.cq-meta b { color: var(--g700); }
.cq-meta b.full { color: var(--t-rose); }
.cq-meta b.zero { color: var(--muted); }
.cq-total { display: grid; place-items: center; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.cq-total .ring .ring-label b { font-size: .72rem; }
.cq-foot { padding: 10px 8px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 6px; font-size: .74rem; }
.cq-foot .progress { flex: 1; height: 6px; }
.cq-foot b { color: var(--g800); min-width: 30px; text-align: right; }

/* Campo trampa anti-robots */
.hp-field { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }

/* Persianas con porcentaje */
.mini-blind { position: relative; overflow: hidden; background: linear-gradient(180deg, #cfe6f7, #eaf4fb) !important; }
.mini-blind i { position: absolute; left: 0; right: 0; top: 0; height: calc(100% - var(--pct)); background: repeating-linear-gradient(180deg, #8e9aa3 0 4px, #76828b 4px 5px); transition: height .4s; }
.htile.on .mini-blind { box-shadow: none !important; }
.htile-pct { position: absolute; top: 14px; right: 16px; font-family: var(--font-round); font-weight: 900; font-size: 1.35rem; color: var(--g900); }
.htile:not(.on) .htile-pct { color: var(--muted); }
.blind-ctrl { display: flex; align-items: center; gap: 22px; margin: 4px 0 18px; }
.blind-big { position: relative; width: 150px; height: 170px; border-radius: 16px; border: 4px solid #b9c4cc; background: linear-gradient(180deg, #bfe0f6, #eef7fd); overflow: hidden; flex: none; }
.blind-big::after { content: '☀︎'; position: absolute; left: 0; right: 0; bottom: 10px; text-align: center; font-size: 2rem; color: #e6a817; }
.blind-slats { position: absolute; left: 0; right: 0; top: 0; height: 100%; background: repeating-linear-gradient(180deg, #95a1aa 0 12px, #7b8790 12px 14px); z-index: 1; transition: height .35s ease; box-shadow: 0 3px 6px rgba(0,0,0,.2); }
.blind-side { text-align: left; }
.blind-pct { font-family: var(--font-round); color: var(--g900); line-height: 1; }
.blind-pct b { font-size: 3.4rem; font-weight: 900; }
.blind-pct span { font-size: 1.4rem; font-weight: 800; color: var(--muted); }
.blind-range { -webkit-appearance: none; appearance: none; width: 100%; height: 14px; border-radius: 99px; background: linear-gradient(90deg, var(--t-sky) var(--v, 0%), #e3e8ec var(--v, 0%)); margin: 0 0 14px; padding: 0; min-height: 0; border: 0; }
.blind-range::-webkit-slider-thumb { -webkit-appearance: none; width: 30px; height: 30px; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.25); cursor: grab; }
.blind-range::-moz-range-thumb { width: 30px; height: 30px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.blind-range:focus { box-shadow: none; }
.blind-chips { justify-content: space-between; margin-bottom: 16px; }
.blind-todo { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.blind-btn-up { background: linear-gradient(135deg, #3f8fc6, #2f7fb5); border-color: transparent; color: #fff; }
.blind-btn-up:hover { background: linear-gradient(135deg, #357fb2, #276d9c); color: #fff; }
.blind-btn-down { background: #eef1f3; border-color: transparent; color: #44515a; }
.blind-btn-down:hover { background: #e2e7ea; color: #2e3a42; }
.blind-sep { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin: 4px 0 14px; }
.blind-sep::before, .blind-sep::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.dial-sala { display: inline-flex; align-items: center; gap: 3px; margin-top: 6px; padding: 2px 8px; border-radius: 99px; background: rgba(0,0,0,.05); font-size: .7rem; font-weight: 700; color: var(--g800); }
.dial-sala .icon { width: 12px; height: 12px; }

/* Cabecera compacta en el móvil */
@media (max-width: 900px) {
  .topbar { gap: 10px; padding: 10px 14px; flex-wrap: nowrap; }
  .topbar h1 { font-size: 1.08rem; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1 1 auto; min-width: 0; }
  .topbar h1 small { font-size: .72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
  .topbar-actions { flex-wrap: nowrap; gap: 6px; flex: 0 0 auto; }
  .topbar-actions form { display: contents; }
  /* Botones con icono: solo el icono */
  .topbar-actions .btn:has(.icon) { font-size: 0; gap: 0; padding: 0; width: 38px; height: 38px; border-radius: 12px; }
  .topbar-actions .btn:has(.icon) .icon { width: 19px; height: 19px; }
  .topbar-actions .btn:has(.icon) span { display: none; }
  .topbar-actions .btn:not(:has(.icon)) { padding: 8px 12px; font-size: .82rem; }
  .hamburger { flex: none; }
}

/* Las columnas nunca desbordan la pantalla (las tablas se desplazan dentro de su tarjeta) */
.cols > *, .cols-even > *, .grid-2 > *, .grid-3 > *, .grid-4 > * { min-width: 0; }
@media (max-width: 640px) { .filters input, .filters select { min-width: 0; } .filters label { flex: 1 1 140px; } }

/* Tipo de contrato */
.tipo-contrato { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
@media (max-width: 760px) { .tipo-contrato { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tipo-opcion { display: flex !important; flex-direction: column; align-items: flex-start; gap: 6px; margin: 0 !important; padding: 12px; border-radius: 14px; background: #fff; border: 2px solid var(--line); cursor: pointer; transition: border .15s, background .15s; }
.tipo-opcion input { display: none; }
.tipo-opcion b { font-size: .88rem; color: var(--g900); }
.tipo-opcion small { font-size: .74rem; color: var(--muted); font-weight: 500; }
.tipo-opcion.on { border-color: var(--g600); background: var(--g50); box-shadow: 0 0 0 3px rgba(164,190,152,.35); }
.tipo-opcion.on .ico { background: var(--g600); color: #fff; }

/* Controles del profesional fuera de su reserva */
.bulb[disabled] { cursor: not-allowed; }
.device.is-locked .bulb { opacity: .45; filter: grayscale(1); }
.device.is-locked .grow { color: var(--muted, #8a8f84); }

/* Grupos del menú lateral */
.nav-group { margin: 14px 10px 6px; font-size: .68rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: rgba(233,239,229,.42); }
.sidebar-foot .logout.active { background: rgba(255,255,255,.12); color: #fff; }

/* Notificaciones push y domiciliación */
.push-aviso { align-items: center; flex-wrap: wrap; }
.push-aviso > span:not(.push-btns) { flex: 1; min-width: 200px; }
.push-btns { display: flex; gap: 6px; margin-left: auto; }
.domi-card { display: flex; align-items: center; gap: 14px; color: inherit; }
.domi-card .grow { flex: 1; min-width: 0; }
.domi-card small { display: block; }
[data-push] [hidden] { display: none !important; }
[data-push][hidden] { display: none !important; }
.pago-opciones { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-bottom: 12px; }
.radio-card { display: flex !important; margin: 0 !important; padding: 12px; border-radius: 14px; background: #fff; border: 2px solid var(--line); cursor: pointer; transition: border .15s, background .15s; }
.radio-card input { display: none; }
.radio-card b { display: block; font-size: .9rem; color: var(--g900); }
.radio-card small { display: block; font-size: .76rem; color: var(--muted); font-weight: 500; }
.radio-card:has(input:checked) { border-color: var(--g600); background: var(--g50); box-shadow: 0 0 0 3px rgba(164,190,152,.35); }
.card h2:has(> .ico) { display: flex; align-items: center; gap: 10px; }
.auth-logo img { display: block; width: 100%; max-width: 230px; height: auto; margin: 0 auto; }

/* Ajustes: menú vertical agrupado (índice en móvil) */
.ajustes { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 24px; align-items: start; }
.ajustes-nav { position: sticky; top: 16px; }
.ajustes-grupo { font-size: .7rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 18px 6px 8px; }
.ajustes-grupo:first-child { margin-top: 0; }
.ajustes-lista { background: #fff; border-radius: 18px; padding: 6px; box-shadow: var(--shadow); }
.ajustes-lista a { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 13px; color: inherit; }
.ajustes-lista a:hover { background: var(--g50); }
.ajustes-lista a.active { background: var(--g100); }
.ajustes-lista b { display: block; font-size: .9rem; color: var(--g900); }
.ajustes-lista small { display: block; font-size: .74rem; color: var(--muted); line-height: 1.3; }
.ajustes-lista .grow { flex: 1; min-width: 0; }
.ajustes-lista .chev { color: var(--muted); font-size: 1.2rem; display: none; }
.ajustes-volver { display: none; font-weight: 700; margin-bottom: 14px; }
.ajustes-main > form, .ajustes-main > .cols, .ajustes-main > .card { max-width: none !important; }
@media (max-width: 1100px) { .ajustes .cols { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .ajustes { grid-template-columns: 1fr; }
  .ajustes-nav { position: static; }
  .ajustes-lista .chev { display: block; }
  .ajustes-lista a.active { background: none; }
  .ajustes:not(.con-seccion) .ajustes-main { display: none; }
  .ajustes.con-seccion .ajustes-nav { display: none; }
  .ajustes-volver { display: inline-block; }
}

/* Botón de la puerta en el inicio del profesional */
.hero-btns { display: flex; gap: 10px; flex-wrap: wrap; position: relative; z-index: 1; }
.hero-btns form { margin: 0; }
.btn-ghost-light { background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.28); }
.btn-ghost-light:hover { background: rgba(255,255,255,.22); color: #fff; }
.door-hero[disabled] { opacity: .55; cursor: not-allowed; }
.door-hero.opened { background: #e6f4dd; color: #2f6b2a; }
@media (max-width: 640px) { .hero-btns { width: 100%; } .hero-btns > * { flex: 1; } .hero-btns .btn { width: 100%; justify-content: center; } }
.iban-link { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; padding: 8px 8px 8px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fafaf7; font-weight: 600; letter-spacing: .03em; }
