/* KMC Consultores · panel de citas */
@import url("../css/agent.css");
:root {
  --ink: #0E2A36; --petrol: #17475A; --teal: #1F6F8B; --gold: #B08A3E; --gold-l: #E7D3A8; --bg: #F3F5F6; --paper: #fff; --line: #E3E8EA; --muted: #5B6B72;
  --ok: #1E8E5A; --warn: #C27A00; --bad: #C2413A;
  --display: Fraunces, Georgia, serif; --text: Inter, system-ui, sans-serif;
  --w-ink: var(--ink); --w-main: var(--petrol); --w-display: var(--text); --w-text: var(--text); --w-border: 1.5px solid var(--line);
  --w-shadow: 0 30px 70px rgb(14 42 54 / .3); --w-shadow-sm: 0 8px 20px rgb(14 42 54 / .25);
}
*, *::before, *::after { box-sizing: border-box; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.5 var(--text); overflow-x: hidden; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
h1, h2 { margin: 0; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 200; padding: 10px 16px; border-radius: 10px; background: var(--ink); color: #fff; font-weight: 800; }
.skip:focus { top: 12px; }
.demo-bar { display: flex; gap: 8px; justify-content: center; align-items: center; flex-wrap: wrap; padding: 7px 12px; background: #081A22; color: #C9D6DC; font: 600 12.5px var(--text); }
.demo-bar a { color: #fff; text-decoration: none; padding: 4px 10px; border-radius: 99px; background: rgb(255 255 255 / .08); }
.demo-bar a[aria-current="page"] { background: #12B3A6; color: #0B1B33; font-weight: 800; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot--c { background: var(--teal); } .dot--j { background: var(--gold); }

.app { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: calc(100vh - 34px); background: linear-gradient(90deg, var(--ink) 240px, var(--bg) 240px); }
.side { background: var(--ink); color: #C9D6DC; padding: 22px 16px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; gap: 10px; align-items: center; color: #fff; text-decoration: none; }
.brand img { background: #fff; border-radius: 50%; }
.brand b { display: block; font: 600 20px/1 var(--display); } .brand small { color: #A9B9C0; font-size: 12px; }
.side__nav { display: grid; gap: 4px; }
.side__nav button { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border: 0; border-radius: 10px; background: none; color: #C9D6DC; font-weight: 600; text-align: left; }
.side__nav button:hover { background: rgb(255 255 255 / .06); }
.side__nav button[aria-selected="true"] { background: rgb(255 255 255 / .1); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.side__nav em { margin-left: auto; font-style: normal; min-width: 22px; height: 22px; border-radius: 99px; background: var(--gold); color: #fff; font-size: 12px; display: grid; place-items: center; }
.side__nav em:empty { display: none; }
.side__agent { margin-top: auto; display: flex; gap: 10px; align-items: center; padding: 12px; border-radius: 12px; background: rgb(255 255 255 / .06); }
.side__agent b { color: #fff; display: block; font-size: 14px; } .side__agent small { font-size: 12px; }
.pulse { flex: none; width: 10px; height: 10px; border-radius: 50%; background: #25D366; animation: ping 1.8s infinite; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgb(37 211 102 / .6); } 100% { box-shadow: 0 0 0 10px rgb(37 211 102 / 0); } }
.side__try { min-height: 44px; border: 0; border-radius: 10px; background: #25D366; color: #062A14; font-weight: 800; }
.side__reset { border: 0; background: none; color: #8DA2AA; font-size: 12.5px; text-decoration: underline; }

.main { padding: 26px 30px 120px; min-width: 0; }
.main__head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.hello { margin: 0; color: var(--muted); font-weight: 600; }
h1 { font: 600 32px/1.1 var(--display); }
.filters { display: inline-flex; padding: 4px; border-radius: 12px; background: var(--paper); border: 1px solid var(--line); }
.filters button { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 14px; border: 0; border-radius: 9px; background: none; color: var(--ink); font-weight: 600; }
.filters button[aria-checked="true"] { background: var(--ink); color: #fff; }

.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.kpi small { color: var(--muted); font-weight: 600; font-size: 13px; }
.kpi b { display: block; font: 600 30px/1.15 var(--display); }
.kpi span { font-size: 12.5px; color: var(--muted); }
.kpi--gold { background: var(--ink); color: #fff; border-color: var(--ink); } .kpi--gold small, .kpi--gold span { color: #C9D6DC; } .kpi--gold b { color: var(--gold-l); }

.weeknav { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.weeknav button { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); font-size: 20px; color: var(--ink); }
.weeknav .weeknav__today { width: auto; padding: 0 12px; font-size: 14px; font-weight: 700; }
.weeknav b { font-size: 16px; min-width: 210px; text-align: center; }
.calwrap { overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; }
.cal { display: grid; grid-template-columns: 82px repeat(6, minmax(120px, 1fr)); min-width: 840px; }
.cal__h { position: sticky; top: 0; padding: 10px; border-bottom: 1px solid var(--line); background: #FAFBFB; text-align: center; font-weight: 700; font-size: 13px; }
.cal__h small { display: block; color: var(--muted); font-weight: 600; }
.cal__h.is-today { color: var(--teal); box-shadow: inset 0 -3px 0 var(--teal); }
.cal__t { white-space: nowrap; padding: 6px 8px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; text-align: right; }
.cal__c { position: relative; min-height: 62px; border-top: 1px solid var(--line); border-left: 1px solid var(--line); padding: 3px; display: grid; gap: 3px; align-content: start; }
.cal__c.off { background: repeating-linear-gradient(-45deg, #F7F8F8 0 8px, #F1F3F4 8px 16px); }
.ev { display: grid; gap: 1px; text-align: left; padding: 5px 7px; border: 0; border-radius: 8px; border-left: 4px solid var(--teal); background: #E8F2F5; color: var(--ink); font-size: 12px; line-height: 1.25; width: 100%; transition: transform .15s, box-shadow .15s; }
.ev:hover { transform: translateY(-1px); box-shadow: 0 6px 14px rgb(14 42 54 / .12); }
.ev b { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev span { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev--juridico { border-left-color: var(--gold); background: #F8F1E3; }
.ev--pendiente { outline: 2px dashed var(--warn); outline-offset: -2px; }
.ev--cancelada { opacity: .45; text-decoration: line-through; }
.ev--nuevo { animation: glow 1.6s ease-in-out 3; box-shadow: 0 0 0 3px #25D366; }
@keyframes glow { 50% { box-shadow: 0 0 0 6px rgb(37 211 102 / .25); } }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.st { width: 14px; height: 10px; border-radius: 3px; display: inline-block; }
.st--pendiente { outline: 2px dashed var(--warn); } .st--nuevo { box-shadow: 0 0 0 2px #25D366; }

.tablewrap { position: relative; overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th { text-align: left; padding: 12px 14px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line); background: #FAFBFB; }
td { padding: 10px 14px; border-bottom: 1px solid #EEF1F2; }
tbody tr { cursor: pointer; } tbody tr:hover td { background: #F7FAFB; }
td small { display: block; color: var(--muted); }
.chip { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.chip--confirmada { background: #E3F4EB; color: var(--ok); } .chip--pendiente { background: #FFF1D6; color: var(--warn); }
.chip--atendida { background: #E8F2F5; color: var(--teal); } .chip--no-asistio { background: #FBE7E5; color: var(--bad); } .chip--cancelada { background: #EEF0F1; color: var(--muted); }

.chats { display: grid; gap: 12px; }
.chatcard { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.chatcard header { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.chatcard header b { font-size: 16px; }
.convo { display: grid; gap: 4px; max-height: 260px; overflow-y: auto; padding: 10px; border-radius: 12px; background: #0B141A; }
.convo p { margin: 0; max-width: 85%; padding: 6px 10px; border-radius: 8px; font-size: 13px; color: #E9EDEF; background: #202C33; white-space: pre-line; }
.convo p.me { justify-self: end; background: #005C4B; }
.empty { padding: 30px; text-align: center; color: var(--muted); background: var(--paper); border: 1px dashed var(--line); border-radius: 16px; }
.empty button { margin-top: 12px; min-height: 44px; padding: 0 16px; border: 0; border-radius: 10px; background: #25D366; color: #062A14; font-weight: 800; }

.statsgrid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 14px; }
.box { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 18px; }
.box h2 { font: 600 20px var(--display); margin-bottom: 12px; }
.bar { display: grid; grid-template-columns: minmax(0, 1fr) 36px; gap: 2px 10px; align-items: center; margin-bottom: 10px; font-size: 13.5px; }
.bar span { grid-column: 1 / -1; }
.bar i { display: block; height: 12px; border-radius: 6px; background: var(--teal); transition: width .6s; }
.bar i.j { background: var(--gold); }
.bar b { text-align: right; }
.fine { font-size: 13px; color: var(--muted); margin-top: 14px; }

.detail { position: fixed; inset: 0; z-index: 90; background: rgb(8 26 34 / .5); display: flex; justify-content: flex-end; }
.detail[hidden] { display: none; }
.detail__box { position: relative; width: min(440px, 100%); height: 100%; overflow-y: auto; background: var(--paper); padding: 26px 22px; animation: slide .3s cubic-bezier(.2,.9,.3,1); }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
.detail__x { position: absolute; top: 14px; right: 14px; width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 24px; }
.detail h2 { font: 600 26px/1.15 var(--display); margin: 6px 50px 4px 0; }
.dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; margin: 16px 0; font-size: 14.5px; }
.dl dt { color: var(--muted); } .dl dd { margin: 0; font-weight: 600; }
.acts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.acts button { min-height: 44px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); font-weight: 700; font-size: 14px; }
.acts button:hover { border-color: var(--ink); }
.acts .pri { background: var(--ink); color: #fff; border-color: var(--ink); grid-column: 1 / -1; }
.note { margin-top: 14px; padding: 12px; border-radius: 12px; background: #F7FAFB; border: 1px solid var(--line); font-size: 14px; }
.note b { display: block; margin-bottom: 4px; font-size: 13px; color: var(--muted); }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 99; translate: -50% 160%; visibility: hidden; background: var(--ink); color: #fff; border-radius: 12px; padding: 12px 18px; font-weight: 700; box-shadow: 0 10px 30px rgb(0 0 0 / .3); transition: translate .35s, visibility 0s .35s; max-width: calc(100% - 32px); }
.toast.is-on { translate: -50% 0; visibility: visible; transition: translate .35s; }

@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); background: var(--bg); }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px 16px; gap: 10px; }
  .side__nav { display: flex; overflow-x: auto; width: 100%; order: 3; }
  .side__nav button { white-space: nowrap; }
  .side__agent, .side__reset { display: none; }
  .side__try { margin-left: auto; min-height: 40px; padding: 0 12px; font-size: 13px; }
  .main { padding: 18px 16px 120px; }
  .statsgrid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } h1 { font-size: 26px; } }
