@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@500;600;700;800&display=swap');

:root {
  --green: #075e54;
  --green-2: #128c7e;
  --mint: #e7f4ef;
  --ink: #1d2b2a;
  --muted: #71817e;
  --line: #e6ece9;
  --surface: #fff;
  --bg: #f3f6f4;
  --shadow: 0 22px 70px rgba(22, 54, 46, .13);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); font-family: "DM Sans", Arial, sans-serif; }
button, input { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 15% 15%, #d9eee5 0, transparent 34%), linear-gradient(135deg, #f5f8f6, #eaf2ed); }
.login-card { width: min(100%, 420px); background: white; padding: 38px; border: 1px solid #e7eeea; border-radius: 24px; box-shadow: var(--shadow); }
.brand-mark { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 17px; color: white; background: linear-gradient(145deg, var(--green), #159987); font: 800 27px Manrope, sans-serif; box-shadow: 0 8px 20px #075e5430; }
.eyebrow { margin: 24px 0 7px; color: var(--green-2); letter-spacing: .15em; font-size: 10px; font-weight: 700; }
.login-card h1 { margin: 0; font: 800 31px Manrope, sans-serif; letter-spacing: -.04em; }
.muted { margin: 8px 0 28px; color: var(--muted); font-size: 14px; }
.login-card label { display: block; margin: 16px 0 7px; font-size: 12px; font-weight: 700; color: #41514d; }
.login-card input { width: 100%; height: 47px; padding: 0 14px; border: 1px solid #dce6e1; border-radius: 11px; outline: none; background: #fbfdfc; }
.login-card input:focus { border-color: var(--green-2); box-shadow: 0 0 0 3px #128c7e18; }
.primary-btn { border: 0; border-radius: 11px; background: var(--green); color: white; height: 48px; padding: 0 20px; font-weight: 700; }
.primary-btn:hover { background: #064d45; }
.full { width: 100%; margin-top: 23px; }
.demo-note { display: grid; gap: 5px; margin-top: 22px; padding: 13px 14px; border-radius: 12px; background: #f0f7f3; color: #426158; font-size: 12px; }
.demo-note small { color: #788a84; line-height: 1.45; margin-top: 3px; }

.app-shell { width: min(1440px, calc(100vw - 48px)); height: min(850px, calc(100vh - 48px)); min-height: 570px; margin: 24px auto; display: grid; grid-template-columns: 300px minmax(0, 1fr); overflow: hidden; background: var(--surface); border: 1px solid #e4ebe7; border-radius: 20px; box-shadow: var(--shadow); position: relative; }
.sidebar { min-width: 0; display: flex; flex-direction: column; background: #fff; border-right: 1px solid var(--line); }
.sidebar-header { height: 78px; display: flex; align-items: center; gap: 12px; padding: 0 19px; border-bottom: 1px solid var(--line); }
.brand-mark.small { width: 39px; height: 39px; border-radius: 12px; font-size: 20px; }
.sidebar-header h1 { margin: 0; font: 800 15px Manrope, sans-serif; letter-spacing: -.02em; }
.sidebar-header p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 10px; color: #667873; background: transparent; font-size: 22px; }
.icon-btn:hover { background: #f0f5f2; color: var(--green); }
.logout { margin-left: auto; }
.profile-strip { display: flex; align-items: center; gap: 10px; margin: 15px 14px 21px; padding: 12px; border-radius: 13px; background: #f5f8f6; }
.avatar { flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; font-weight: 700; }
.user-avatar { width: 37px; height: 37px; color: #fff; background: #6c8e82; font-size: 11px; }
.profile-copy { min-width: 0; display: grid; gap: 3px; }
.profile-copy strong { font-size: 12px; }
.profile-copy span { color: var(--muted); font-size: 10px; }
.online-dot { width: 8px; height: 8px; margin-left: auto; border-radius: 50%; background: #e5a53c; }
.sidebar-section-title { display: flex; justify-content: space-between; align-items: center; padding: 0 20px 10px; color: #91a09a; font-size: 9px; letter-spacing: .13em; font-weight: 700; }
.count-pill { display: grid; place-items: center; min-width: 21px; height: 21px; padding: 0 6px; border-radius: 20px; color: var(--green); background: var(--mint); font-size: 10px; letter-spacing: 0; }
.course-list { display: grid; gap: 4px; padding: 0 10px; }
.course-item { width: 100%; display: flex; align-items: center; gap: 11px; padding: 11px 10px; text-align: left; border: 0; border-radius: 12px; background: transparent; color: var(--ink); }
.course-item:hover { background: #f6f9f7; }
.course-item.active { background: #eaf5f0; }
.course-icon { width: 39px; height: 39px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 13px; color: var(--green); background: #e3f0e9; font: 700 13px Manrope, sans-serif; }
.course-copy { min-width: 0; display: grid; gap: 4px; }
.course-copy strong { font-size: 12px; }
.course-copy span { max-width: 175px; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.course-unread { margin-left: auto; width: 7px; height: 7px; border-radius: 50%; background: #1aa184; }
.sidebar-footer { display: flex; align-items: center; gap: 7px; margin-top: auto; padding: 16px 20px; color: #8b9993; border-top: 1px solid var(--line); font-size: 10px; }
.lock-symbol { color: #c28b35; font-size: 9px; }

.chat-panel { min-width: 0; display: flex; flex-direction: column; background: #f7faf8; position: relative; }
.chat-header { min-height: 78px; display: flex; align-items: center; gap: 12px; padding: 0 24px; background: #fff; border-bottom: 1px solid var(--line); }
.course-avatar { width: 42px; height: 42px; color: var(--green); background: #e3f0e9; font: 700 15px Manrope, sans-serif; }
.chat-heading { min-width: 0; }
.chat-heading h2 { margin: 0; font: 700 14px Manrope, sans-serif; }
.chat-heading p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.header-actions { display: flex; align-items: center; gap: 9px; margin-left: auto; }
.demo-chip { padding: 6px 9px; border-radius: 20px; color: #95651c; background: #fff5df; font-size: 9px; font-weight: 800; letter-spacing: .08em; }
.demo-banner { padding: 9px 20px; color: #735a2e; background: #fff8e9; border-bottom: 1px solid #f3e8ce; font-size: 10px; line-height: 1.45; }
.message-area { flex: 1; overflow: auto; padding: 23px clamp(16px, 5vw, 68px); background-color: #f5f8f6; background-image: radial-gradient(#dce7e1 0.7px, transparent 0.7px); background-size: 18px 18px; }
.date-divider { display: flex; justify-content: center; margin: 0 0 22px; }
.date-divider span { padding: 6px 12px; border-radius: 20px; color: #82918b; background: #fff; box-shadow: 0 2px 8px #1b40300b; font-size: 9px; font-weight: 700; letter-spacing: .1em; }
.messages { display: flex; flex-direction: column; gap: 12px; }
.message { max-width: min(72%, 520px); padding: 11px 13px 8px; border: 1px solid #edf1ee; border-radius: 4px 14px 14px 14px; background: #fff; box-shadow: 0 3px 10px #18392a08; align-self: flex-start; }
.message.mine { align-self: flex-end; border-color: #d5ebdc; border-radius: 14px 4px 14px 14px; background: #e3f5e8; }
.message-author { margin-bottom: 5px; color: var(--green-2); font-size: 10px; font-weight: 700; }
.message-text { color: #34433e; font-size: 12px; line-height: 1.55; overflow-wrap: anywhere; white-space: pre-wrap; }
.message-meta { display: flex; justify-content: flex-end; gap: 5px; margin-top: 5px; color: #91a09a; font-size: 9px; }
.file-card { display: flex; align-items: center; gap: 9px; margin-top: 8px; padding: 9px; border: 1px solid #e6eeea; border-radius: 9px; background: #fff; }
.file-icon { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 8px; color: #b34b43; background: #fff0ee; font-size: 11px; font-weight: 800; }
.file-name { max-width: 210px; overflow: hidden; color: #465650; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.file-size { margin-top: 3px; color: #91a09a; font-size: 9px; }
.composer { display: flex; align-items: center; gap: 11px; padding: 13px 20px; background: #fff; border-top: 1px solid var(--line); }
.attach-btn { width: 37px; height: 37px; display: grid; place-items: center; border-radius: 11px; color: #71817b; background: #f3f7f4; font-size: 25px; cursor: pointer; }
.attach-btn:hover { color: var(--green); background: var(--mint); }
.message-input { flex: 1; min-width: 0; height: 43px; padding: 0 15px; outline: 0; border: 1px solid #e7eeea; border-radius: 12px; background: #f9fbfa; font-size: 12px; }
.message-input:focus { border-color: #a8d1c1; }
.send-btn { width: 42px; height: 42px; border: 0; border-radius: 12px; color: #fff; background: var(--green); font-size: 17px; }
.send-btn:hover { background: var(--green-2); }
.chat-footnote { padding: 0 20px 9px; color: #9aa7a1; background: #fff; text-align: center; font-size: 9px; }
.selected-file { padding: 8px 20px; color: #4e685e; background: #eff7f2; font-size: 10px; }
.mobile-back { display: none; }

.info-panel { position: absolute; z-index: 5; top: 0; right: 0; width: 280px; height: 100%; padding: 25px 20px; background: #fff; border-left: 1px solid var(--line); box-shadow: -15px 0 40px #1d3d2a10; text-align: center; }
.close-info { margin-left: auto; font-size: 25px; }
.info-avatar { width: 68px; height: 68px; display: grid; place-items: center; margin: 26px auto 14px; border-radius: 22px; color: var(--green); background: #e6f2eb; font-size: 26px; }
.info-panel h3 { margin: 0; font: 700 16px Manrope, sans-serif; }
.info-panel p { margin: 6px 0 20px; color: var(--muted); font-size: 11px; }
.info-rule { height: 1px; background: var(--line); margin: 18px 0; }
.info-row { display: flex; flex-direction: column; gap: 5px; margin: 15px 0; text-align: left; }
.info-row span { color: var(--muted); font-size: 10px; }
.info-row strong { font-size: 11px; }
.info-warning { margin-top: 25px; padding: 12px; border-radius: 10px; color: #785c2d; background: #fff7e7; font-size: 10px; line-height: 1.5; text-align: left; }
.toast { position: fixed; z-index: 20; left: 50%; bottom: 24px; transform: translate(-50%, 20px); padding: 11px 16px; border-radius: 12px; color: #fff; background: #263b35; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: .2s; font-size: 12px; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 760px) {
  .app-shell { width: 100%; height: 100dvh; min-height: 0; margin: 0; border: 0; border-radius: 0; grid-template-columns: 1fr; }
  .sidebar { grid-column: 1; grid-row: 1; }
  .chat-panel { grid-column: 1; grid-row: 1; display: none; }
  .app-shell.chat-open .sidebar { display: none; }
  .app-shell.chat-open .chat-panel { display: flex; }
  .sidebar-header { height: 70px; }
  .profile-strip { margin-bottom: 15px; }
  .course-list { gap: 2px; }
  .course-item { padding: 10px; }
  .sidebar-footer { padding: 12px 20px; }
  .chat-header { min-height: 70px; padding: 0 12px; gap: 8px; }
  .mobile-back { display: grid; font-size: 30px; width: 29px; }
  .course-avatar { width: 37px; height: 37px; }
  .demo-banner { padding: 8px 12px; }
  .message-area { padding: 18px 13px; }
  .message { max-width: 88%; }
  .composer { padding: 10px; gap: 7px; }
  .chat-footnote { padding-bottom: 8px; }
  .info-panel { width: min(280px, 85vw); }
}
@media (max-width: 420px) {
  .login-card { padding: 28px 22px; }
  .chat-heading p { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .demo-chip { display: none; }
}

/* Estados de conexión real */
button:disabled { opacity: .58; cursor: wait; }
.demo-chip { color: #17634d; background: #e8f5ee; }


/* Acciones de llamada */
.call-action{width:36px;height:36px;border:1px solid #dce9e2;border-radius:11px;background:#eff7f2;color:var(--green);font-size:17px;font-weight:700}
.call-action:hover{background:#dff0e7}
.call-action:disabled{opacity:.4;cursor:not-allowed}
.call-overlay{position:fixed;inset:0;z-index:50;display:grid;place-items:center;padding:18px;background:rgba(12,29,25,.62);backdrop-filter:blur(5px)}
.call-window{width:min(760px,100%);overflow:hidden;border:1px solid #dce9e2;border-radius:20px;background:#fff;box-shadow:0 28px 90px #061d1766}
.call-window-head{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:15px 19px;border-bottom:1px solid var(--line)}
.call-window-head div{display:grid;gap:4px}.call-window-head strong{font:700 14px Manrope,sans-serif}.call-window-head span{font-size:11px;color:var(--muted)}
.call-videos{position:relative;min-height:260px;height:min(55vh,480px);display:grid;place-items:center;background:radial-gradient(circle at center,#234a41,#102a26);overflow:hidden}
.call-videos video{width:100%;height:100%;object-fit:contain}
#remoteVideo{position:absolute;inset:0}
#localVideo{position:absolute;right:14px;bottom:14px;width:min(25%,170px);height:auto;max-height:150px;aspect-ratio:4/3;object-fit:cover;border:2px solid white;border-radius:12px;background:#152e29;box-shadow:0 5px 22px #0005}
.call-avatar{width:90px;height:90px;display:grid;place-items:center;border-radius:50%;background:#d9eee4;color:#075e54;font:800 32px Manrope,sans-serif}
.call-controls{display:flex;justify-content:center;flex-wrap:wrap;gap:10px;padding:17px}
.call-controls button{border:1px solid #dbe6e0;border-radius:11px;padding:11px 16px;background:#f4f8f5;color:#25443a;font-weight:700;font-size:12px}
.call-controls .call-accept{border-color:#075e54;background:#075e54;color:white}
.call-controls .call-decline{border-color:#b83e3e;background:#b83e3e;color:white}
@media(max-width:760px){.header-actions{gap:4px}.call-action{width:32px;height:32px}.call-videos{height:52vh;min-height:230px}.call-window{border-radius:16px}}

/* Acceso por teléfono y edición de perfil */
.text-toggle{display:block;margin:14px auto 0;border:0;background:transparent;color:var(--green);font-size:12px;font-weight:700;text-decoration:underline}
.secondary-btn{border:1px solid #dce6e1;border-radius:11px;background:#f7faf8;color:#50615a;padding:0 16px;height:44px;font-weight:600}
.profile-edit-trigger{width:calc(100% - 28px);border:0;text-align:left;cursor:pointer;font:inherit}
.profile-modal{position:fixed;inset:0;z-index:30;display:grid;place-items:center;padding:18px;background:#10231dbb}
.profile-card{position:relative;width:min(100%,430px);max-height:92vh;overflow:auto;padding:28px;background:#fff;border:1px solid #e4ebe7;border-radius:20px;box-shadow:var(--shadow)}
.profile-card h2{margin:0;font:800 22px Manrope,sans-serif}.profile-card>p{margin:6px 0 18px;color:var(--muted);font-size:12px}
.profile-card label{display:block;margin:13px 0 6px;font-size:12px;font-weight:700;color:#41514d}
.profile-card input:not([type=file]){width:100%;height:44px;padding:0 12px;border:1px solid #dce6e1;border-radius:10px;background:#fbfdfc}
.profile-card input[type=file]{width:100%;font-size:11px;color:var(--muted)}
.profile-close{position:absolute;right:14px;top:12px}
.profile-photo-preview{width:76px;height:76px;margin:0 auto 12px;border-radius:50%;display:grid;place-items:center;overflow:hidden;background:#e3f0e9;color:var(--green);font:700 24px Manrope}
.profile-photo-preview img{width:100%;height:100%;object-fit:cover}.profile-actions{display:flex;justify-content:flex-end;gap:9px;margin-top:20px}
