/* ===========================================================================
   EducaConnect — Product UI styles
   Consumes ../../colors_and_type.css
   =========================================================================== */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--ink-50);
  font-family: var(--font-body);
  color: var(--fg-1);
}

.ec-app {
  display: grid;
  grid-template-columns: 264px 360px 1fr 320px;
  height: 100vh;
  background: var(--paper);
}

.icon-btn {
  background: transparent; border: none; cursor: pointer;
  width: 34px; height: 34px;
  border-radius: var(--radius-md);
  display: grid; place-items: center;
  color: var(--fg-2);
  transition: all var(--dur-fast) var(--ease-out);
}
.icon-btn:hover { background: var(--ink-50); color: var(--fg-1); }
.icon-btn.is-on { background: var(--blue-50); color: var(--blue-500); }
.icon-btn svg { width: 18px; height: 18px; stroke-width: 1.85; }

.dot { width: 8px; height: 8px; border-radius: 999px; display: inline-block; }
.dot--green { background: var(--green-500); }

/* =========================================================================
   Sidebar
   ========================================================================= */
.ec-sidebar {
  background: var(--ink-900); color: rgba(255,255,255,0.78);
  padding: 16px 12px;
  display: flex; flex-direction: column; gap: 16px;
  overflow-y: auto;
}
.ec-sidebar__brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 4px; }
.ec-sidebar__brand img { width: 30px; height: 30px; object-fit: contain; flex-shrink: 0; }
.ec-sidebar__brand strong { display: block; font-family: var(--font-display); font-weight: 800; font-size: 15px; color: white; line-height: 1.1; }
.ec-sidebar__brand small { font-family: var(--font-body); font-size: 11.5px; color: rgba(255,255,255,0.55); }

.ec-sidebar__new {
  background: var(--grad-brand); color: white;
  border: none; border-radius: var(--radius-md);
  padding: 11px 12px;
  font-family: var(--font-display); font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer;
  transition: filter var(--dur-fast) var(--ease-out);
}
.ec-sidebar__new:hover { filter: brightness(1.08); }
.ec-sidebar__new svg { width: 14px; height: 14px; stroke-width: 2.5; }

.ec-sidebar__section { display: flex; flex-direction: column; gap: 2px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,0.06); }
.ec-sidebar__section:first-of-type { border-top: none; padding-top: 0; }
.ec-sidebar__title {
  font-family: var(--font-display); font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: rgba(255,255,255,0.4);
  padding: 8px 10px 4px;
}

.ec-nav {
  background: transparent; border: none; cursor: pointer;
  padding: 8px 10px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: space-between;
  color: rgba(255,255,255,0.82);
  font-family: var(--font-body); font-weight: 600; font-size: 13.5px;
  text-align: left;
  transition: background var(--dur-fast) var(--ease-out);
}
.ec-nav:hover { background: rgba(255,255,255,0.06); color: white; }
.ec-nav.is-active { background: rgba(255,255,255,0.1); color: white; }
.ec-nav__lead { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.ec-nav__lead svg { width: 16px; height: 16px; stroke-width: 1.9; color: rgba(255,255,255,0.6); }
.ec-nav.is-active .ec-nav__lead svg { color: var(--teal-300); }
.ec-nav__dot { width: 8px; height: 8px; border-radius: 999px; margin-right: -2px; }
.ec-nav__count {
  font-family: var(--font-display); font-weight: 700; font-size: 11px;
  background: rgba(255,255,255,0.1); color: white;
  padding: 2px 7px; border-radius: 999px;
  min-width: 22px; text-align: center;
}
.ec-nav__count--muted { background: transparent; color: rgba(255,255,255,0.45); }
.ec-nav--sub { padding-left: 18px; }

.ec-sidebar__bottom { margin-top: auto; padding-top: 16px; border-top: 1px solid rgba(255,255,255,0.06); display: flex; flex-direction: column; gap: 2px; }
.ec-sidebar__me {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 8px; border-radius: var(--radius-md);
  background: rgba(255,255,255,0.04);
  margin-top: 8px;
}
.ec-sidebar__avatar {
  width: 36px; height: 36px; border-radius: 999px;
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 800; font-size: 13px; color: white;
  flex-shrink: 0;
}
.ec-sidebar__me strong { font-family: var(--font-display); font-size: 13px; color: white; display: block; }
.ec-sidebar__me small { font-family: var(--font-body); font-size: 11px; color: rgba(255,255,255,0.55); display: inline-flex; align-items: center; gap: 5px; }
.ec-sidebar__me-more { margin-left: auto; background: transparent; border: none; color: rgba(255,255,255,0.5); cursor: pointer; padding: 4px; }
.ec-sidebar__me-more svg { width: 16px; height: 16px; }

/* =========================================================================
   Conversation list (middle column)
   ========================================================================= */
.ec-list {
  border-right: 1px solid var(--ink-100);
  display: flex; flex-direction: column;
  background: var(--paper);
  overflow: hidden;
}
.ec-list__head {
  padding: 18px 18px 0;
  display: flex; flex-direction: column; gap: 12px;
  border-bottom: 1px solid var(--ink-100);
  padding-bottom: 0;
}
.ec-list__title { font-family: var(--font-display); font-weight: 800; font-size: 22px; letter-spacing: -0.015em; margin: 0; color: var(--fg-1); }

.ec-list__search {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; border-radius: var(--radius-md);
  background: var(--ink-50); border: 1px solid transparent;
  transition: border-color var(--dur-fast) var(--ease-out);
}
.ec-list__search:focus-within { border-color: var(--blue-500); background: white; }
.ec-list__search svg { width: 16px; height: 16px; color: var(--fg-3); stroke-width: 2; }
.ec-list__search input {
  border: none; outline: none; background: transparent;
  flex: 1; font-family: var(--font-body); font-size: 13.5px; color: var(--fg-1);
}

.ec-list__tabs {
  display: flex; gap: 4px;
  overflow-x: auto;
  padding-bottom: 0;
  margin: 0 -18px;
  padding: 0 18px;
}
.ec-list__tabs button {
  background: transparent; border: none; cursor: pointer;
  padding: 10px 4px;
  font-family: var(--font-display); font-weight: 700; font-size: 12.5px;
  color: var(--fg-2);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
  transition: color var(--dur-fast) var(--ease-out);
}
.ec-list__tabs button:hover { color: var(--fg-1); }
.ec-list__tabs button.is-active { color: var(--fg-1); border-bottom-color: var(--blue-500); }
.ec-list__tabs button span {
  font-size: 10.5px; padding: 1px 6px; border-radius: 999px;
  background: var(--ink-100); color: var(--fg-2);
}
.ec-list__tabs button.is-active span { background: var(--blue-500); color: white; }

.ec-list__items {
  list-style: none; padding: 0; margin: 0;
  overflow-y: auto; flex: 1;
}
.ec-conv {
  display: flex; gap: 12px; padding: 14px 18px;
  border-bottom: 1px solid var(--ink-100);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out);
  position: relative;
}
.ec-conv:hover { background: var(--ink-50); }
.ec-conv.is-active { background: var(--blue-50); }
.ec-conv.is-active::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--blue-500); }
.ec-conv__avatar {
  width: 40px; height: 40px; border-radius: 999px;
  display: grid; place-items: center; flex-shrink: 0;
  font-family: var(--font-display); font-weight: 800; font-size: 13.5px; color: white;
}
.ec-conv__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ec-conv__top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ec-conv__top strong { font-family: var(--font-display); font-weight: 700; font-size: 14px; color: var(--fg-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ec-conv.has-unread .ec-conv__top strong { color: var(--ink-900); }
.ec-conv__time { font-family: var(--font-body); font-size: 11.5px; color: var(--fg-3); flex-shrink: 0; }
.ec-conv.has-unread .ec-conv__time { color: var(--blue-500); font-weight: 700; }
.ec-conv__preview {
  font-family: var(--font-body); font-size: 13px; color: var(--fg-2);
  line-height: 1.4;
  overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical;
  display: flex; gap: 4px; align-items: center;
}
.ec-conv__preview span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ec-conv.has-unread .ec-conv__preview { color: var(--fg-1); font-weight: 600; }
.ec-conv__by { display: inline-flex; }
.ec-conv__by svg { width: 12px; height: 12px; color: var(--blue-500); }
.ec-conv__meta { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.ec-conv__chan {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--font-display); font-weight: 700;
  font-size: 10.5px; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 999px;
}
.ec-conv__chan svg { width: 11px; height: 11px; stroke-width: 2.25; }
.ec-conv__chan--whatsapp { background: color-mix(in oklab, var(--whatsapp) 18%, white); color: #128c4b; }
.ec-conv__chan--whatsapp svg { color: var(--whatsapp); }
.ec-conv__chan--email { background: var(--ink-50); color: var(--fg-2); }
.ec-conv__chan--sms { background: var(--blue-50); color: var(--blue-700); }
.ec-conv__chan--telegram { background: #E4F3FB; color: #1e7eb0; }
.ec-conv__tag { font-family: var(--font-body); font-size: 11px; color: var(--fg-3); padding: 2px 6px; border-radius: 999px; background: var(--ink-50); }
.ec-conv__badge {
  margin-left: auto;
  font-family: var(--font-display); font-weight: 800; font-size: 10.5px;
  background: var(--blue-500); color: white;
  padding: 2px 7px; border-radius: 999px;
  min-width: 20px; text-align: center;
}

/* =========================================================================
   Chat pane (main column)
   ========================================================================= */
.ec-chat { display: flex; flex-direction: column; background: var(--paper); min-width: 0; }
.ec-chat__head {
  padding: 14px 22px;
  border-bottom: 1px solid var(--ink-100);
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
}
.ec-chat__head-id { display: flex; align-items: center; gap: 12px; }
.ec-chat__avatar {
  width: 40px; height: 40px; border-radius: 999px;
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 800; font-size: 13.5px; color: white;
  flex-shrink: 0;
}
.ec-chat__head-id strong { display: block; font-family: var(--font-display); font-weight: 700; font-size: 15px; color: var(--fg-1); }
.ec-chat__head-id small { font-family: var(--font-body); font-size: 12px; color: var(--fg-3); display: inline-flex; align-items: center; gap: 6px; margin-top: 1px; }
.ec-chat__head-actions { display: flex; gap: 4px; }

.ec-chat__body {
  flex: 1; overflow-y: auto;
  padding: 24px 22px;
  display: flex; flex-direction: column; gap: 8px;
  background: var(--ink-50);
  background-image:
    radial-gradient(circle at 50% 0%, rgba(10, 139, 61, 0.04) 0%, transparent 50%),
    radial-gradient(circle at 100% 100%, rgba(4, 128, 184, 0.04) 0%, transparent 50%);
}

.ec-sys {
  align-self: center;
  font-family: var(--font-body); font-size: 11.5px; color: var(--fg-2);
  background: white;
  padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--ink-100);
  display: inline-flex; align-items: center; gap: 6px;
  margin: 8px 0;
}
.ec-sys svg { width: 13px; height: 13px; color: var(--green-500); }
.ec-sys strong { color: var(--fg-1); font-family: var(--font-display); font-weight: 700; }

.ec-msg {
  max-width: 70%;
  display: flex; flex-direction: column; gap: 2px;
}
.ec-msg__by {
  font-family: var(--font-display); font-weight: 700; font-size: 11px;
  color: var(--blue-500);
  display: inline-flex; align-items: center; gap: 4px;
  padding-left: 12px;
  margin-bottom: 2px;
}
.ec-msg__by svg { width: 12px; height: 12px; stroke-width: 2.25; }
.ec-msg.is-bot .ec-msg__by { color: var(--teal-500); }

.ec-msg__msg {
  background: white;
  padding: 10px 14px;
  border-radius: 16px;
  font-family: var(--font-body); font-size: 14px; line-height: 1.45;
  color: var(--fg-1);
  box-shadow: 0 1px 1px rgba(0,0,0,0.04);
  border: 1px solid var(--ink-100);
  word-wrap: break-word;
}
.ec-msg__time {
  font-family: var(--font-body); font-size: 10.5px; color: var(--fg-3);
  display: inline-flex; align-items: center; gap: 4px;
  padding: 0 8px;
}
.ec-msg__time svg { width: 12px; height: 12px; color: var(--blue-500); stroke-width: 2.5; }

.ec-msg--in { align-self: flex-start; }
.ec-msg--in .ec-msg__msg { border-bottom-left-radius: 4px; }
.ec-msg--out { align-self: flex-end; align-items: flex-end; }
.ec-msg--out .ec-msg__msg {
  background: var(--blue-500); color: white; border-color: var(--blue-500);
  border-bottom-right-radius: 4px;
}
.ec-msg--out.is-bot .ec-msg__msg {
  background: white; color: var(--fg-1); border-color: var(--teal-300);
  border-left: 3px solid var(--teal-500);
}
.ec-msg--out .ec-msg__by { padding-right: 12px; align-self: flex-end; }

.ec-msg__template-head {
  font-family: var(--font-display); font-weight: 700; font-size: 11px;
  color: var(--green-700);
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 999px;
  background: var(--green-50);
  margin-bottom: 6px;
}
.ec-msg__template-head svg { width: 12px; height: 12px; }

.ec-msg__attach { display: flex; align-items: center; gap: 12px; }
.ec-msg__attach svg { width: 22px; height: 22px; flex-shrink: 0; color: var(--blue-500); }
.ec-msg__attach strong { display: block; font-family: var(--font-display); font-size: 13px; }
.ec-msg__attach small { font-family: var(--font-body); font-size: 11.5px; color: var(--fg-3); }

/* Composer + Template picker */
.ec-templates {
  border-top: 1px solid var(--ink-100);
  background: white;
  max-height: 240px; overflow-y: auto;
}
.ec-templates__head { display: flex; justify-content: space-between; align-items: center; padding: 10px 18px; border-bottom: 1px solid var(--ink-100); }
.ec-templates__head strong { font-family: var(--font-display); font-size: 13px; }
.ec-templates__head button { background: transparent; border: none; cursor: pointer; color: var(--fg-3); }
.ec-templates__head svg { width: 14px; height: 14px; }
.ec-templates ul { list-style: none; padding: 0; margin: 0; }
.ec-templates li { padding: 12px 18px; border-bottom: 1px solid var(--ink-100); cursor: pointer; transition: background var(--dur-fast) var(--ease-out); }
.ec-templates li:hover { background: var(--ink-50); }
.ec-templates__name { font-family: var(--font-mono); font-size: 12px; color: var(--green-700); display: inline-flex; align-items: center; gap: 6px; }
.ec-templates__name svg { width: 12px; height: 12px; }
.ec-templates li p { font-family: var(--font-body); font-size: 12.5px; color: var(--fg-2); margin: 4px 0 0; line-height: 1.4; }

.ec-composer { border-top: 1px solid var(--ink-100); padding: 12px 18px 16px; background: white; }
.ec-composer__tools { display: flex; align-items: center; gap: 4px; margin-bottom: 8px; }
.ec-composer__divider { width: 1px; height: 20px; background: var(--ink-200); margin: 0 6px; }
.ec-composer__channel {
  background: var(--ink-50); border: 1px solid var(--ink-100);
  border-radius: 999px; padding: 6px 12px;
  font-family: var(--font-display); font-weight: 700; font-size: 12px;
  display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer;
}
.ec-composer__channel svg { width: 14px; height: 14px; }
.ec-composer__row { display: flex; gap: 8px; align-items: flex-end; }
.ec-composer textarea {
  flex: 1; border: 1px solid var(--ink-100);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-family: var(--font-body); font-size: 14px; line-height: 1.45;
  color: var(--fg-1); resize: none;
  outline: none;
  min-height: 42px; max-height: 140px;
  transition: border-color var(--dur-fast) var(--ease-out);
}
.ec-composer textarea:focus { border-color: var(--blue-500); }
.ec-composer__send {
  background: var(--blue-500); color: white;
  border: none; border-radius: var(--radius-md);
  width: 42px; height: 42px;
  display: grid; place-items: center; cursor: pointer;
  flex-shrink: 0;
  transition: all var(--dur-fast) var(--ease-out);
}
.ec-composer__send:hover:not(:disabled) { background: var(--blue-700); }
.ec-composer__send:disabled { background: var(--ink-200); cursor: not-allowed; }
.ec-composer__send svg { width: 18px; height: 18px; }

/* =========================================================================
   Student panel (right rail)
   ========================================================================= */
.ec-student {
  border-left: 1px solid var(--ink-100);
  background: var(--paper);
  overflow-y: auto;
  padding: 24px 20px;
  display: flex; flex-direction: column; gap: 20px;
}
.ec-student__head { text-align: center; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.ec-student__avatar {
  width: 72px; height: 72px; border-radius: 999px;
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 800; font-size: 24px; color: white;
}
.ec-student h3 { font-family: var(--font-display); font-weight: 700; font-size: 17px; margin: 0; }
.ec-student__handle { font-family: var(--font-mono); font-size: 12px; color: var(--fg-3); }
.ec-student__tags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 4px; }
.tag-pill {
  font-family: var(--font-display); font-weight: 700; font-size: 10.5px;
  letter-spacing: 0.04em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 999px;
  background: var(--green-50); color: var(--green-700);
}
.tag-pill:nth-child(2) { background: var(--blue-50); color: var(--blue-700); }
.tag-pill:nth-child(3) { background: #FCEFCB; color: #8a6300; }

.ec-student__quick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.quick-action {
  background: white; border: 1px solid var(--ink-100);
  border-radius: var(--radius-md); padding: 9px;
  font-family: var(--font-display); font-weight: 700; font-size: 12px;
  color: var(--fg-1);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
}
.quick-action:hover { border-color: var(--blue-500); color: var(--blue-500); }
.quick-action svg { width: 14px; height: 14px; stroke-width: 2; }

.ec-panel { display: flex; flex-direction: column; gap: 10px; }
.ec-panel__title {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-display); font-weight: 700; font-size: 11.5px;
  color: var(--fg-2); letter-spacing: 0.12em; text-transform: uppercase;
  padding-bottom: 8px; border-bottom: 1px solid var(--ink-100);
}
.ec-panel__title svg { width: 14px; height: 14px; stroke-width: 2; color: var(--fg-3); }
.ec-panel dl { display: grid; grid-template-columns: 90px 1fr; gap: 6px 12px; margin: 0; }
.ec-panel dt { font-family: var(--font-body); font-size: 12px; color: var(--fg-3); }
.ec-panel dd { font-family: var(--font-body); font-size: 12.5px; color: var(--fg-1); margin: 0; font-weight: 600; }

.ec-discipline { display: flex; flex-direction: column; gap: 4px; }
.ec-discipline__name { font-family: var(--font-display); font-weight: 700; font-size: 13px; color: var(--fg-1); }
.ec-discipline__progress { display: flex; align-items: center; gap: 10px; font-family: var(--font-mono); font-size: 11px; color: var(--fg-2); }
.ec-progress { flex: 1; height: 6px; background: var(--ink-100); border-radius: 999px; overflow: hidden; }
.ec-progress__bar { height: 100%; border-radius: 999px; }

.ec-timeline { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.ec-timeline li { display: flex; gap: 10px; align-items: flex-start; }
.ec-timeline li svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--blue-500); margin-top: 2px; stroke-width: 2; }
.ec-timeline li:first-child svg { color: var(--green-500); }
.ec-timeline li strong { display: block; font-family: var(--font-body); font-weight: 600; font-size: 12.5px; color: var(--fg-1); line-height: 1.35; }
.ec-timeline li small { font-family: var(--font-body); font-size: 11px; color: var(--fg-3); }

/* =========================================================================
   Tight viewports
   ========================================================================= */
@media (max-width: 1180px) {
  .ec-app { grid-template-columns: 220px 320px 1fr 280px; }
}
@media (max-width: 1024px) {
  .ec-app { grid-template-columns: 200px 300px 1fr; }
  .ec-student { display: none; }
}
