/* ============================================================
   LUMOS — Pages CSS (Notes, Deadlines, Calendar, Subjects, Settings)
   ============================================================ */

/* ============ NOTES PAGE ============ */

/* Split layout shell */
.notes-shell {
  display: flex;
  gap: 0;
  height: calc(100vh - var(--header-h) - 3.5rem);
  min-height: 500px;
}

/* Left panel: list */
.notes-list-panel {
  width: 280px;
  min-width: 220px;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: .625rem;
  border-right: 1.5px solid var(--border);
  padding-right: 1rem;
  overflow-y: auto;
  flex-shrink: 0;
}
.notes-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.notes-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  margin-bottom: .375rem;
}
.notes-cards-list {
  display: flex;
  flex-direction: column;
  gap: .375rem;
  overflow-y: auto;
}

/* Note list card */
.note-list-card {
  padding: .75rem .875rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-left: 3px solid var(--subject-color, var(--primary));
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
}
.note-list-card:hover { border-color: var(--subject-color, var(--primary)); background: var(--surface-hover); transform: translateY(-3px); box-shadow: var(--shadow-md); }
.note-list-card.active {
  background: var(--primary-soft);
  border-color: var(--primary);
  border-left-color: var(--subject-color, var(--primary));
}
.note-list-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .25rem;
}
.note-list-subj {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--subject-color, var(--primary));
}
.note-list-title {
  font-size: .875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: .2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.note-list-preview {
  font-size: .75rem;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.note-list-date { font-size: .68rem; color: var(--text-muted); margin-top: .3rem; }

/* Right panel: editor */
.notes-editor-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding-left: 1.25rem;
  min-width: 0;
  overflow: hidden;
}
.notes-editor-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .5rem;
}
.notes-editor-form {
  flex: 1;
  flex-direction: column;
  gap: 0;
  min-height: 0;
  overflow: hidden;
}

/* Editor top bar */
.editor-top-bar {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  padding-bottom: .75rem;
  border-bottom: 1.5px solid var(--border);
  margin-bottom: .5rem;
  flex-shrink: 0;
}
.note-editor-title {
  font-size: 1.35rem;
  font-weight: 700;
  border: none;
  background: transparent;
  color: var(--text-primary);
  padding: 0;
  width: 100%;
  outline: none;
}
.note-editor-title:focus { box-shadow: none; border: none; }
.editor-select {
  font-size: .82rem;
  padding: 5px 10px;
  min-width: 140px;
}

/* Rich text toolbar */
.rte-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .25rem;
  padding: .5rem .625rem;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: .5rem;
  flex-shrink: 0;
}
.rte-group {
  display: flex;
  align-items: center;
  gap: 2px;
}
.rte-sep {
  width: 1px;
  height: 20px;
  background: var(--border-light);
  margin: 0 .25rem;
}
.rte-btn {
  min-width: 28px;
  height: 28px;
  padding: 0 5px;
  border-radius: 5px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  line-height: 1;
}
.rte-btn:hover { background: var(--surface-hover); color: var(--text-primary); border-color: var(--border); }
.rte-btn:active { background: var(--primary-soft); color: var(--primary); }
.rte-select {
  height: 28px;
  font-size: .75rem;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text-primary);
  cursor: pointer;
  outline: none;
  min-width: 0;
}
.rte-color-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 4px 5px;
  border-radius: 5px;
  color: var(--text-secondary);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
  position: relative;
  line-height: 1;
}
.rte-color-btn:hover { background: var(--surface-hover); border-color: var(--border); }
.color-bar {
  display: block;
  width: 18px;
  height: 3px;
  border-radius: 2px;
  margin-top: 2px;
}
.hidden-color-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

/* Rich text content area */
.rte-content {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: .95rem;
  line-height: 1.8;
  color: var(--text-primary);
  outline: none;
  min-height: 200px;
}
.rte-content:focus { border-color: var(--primary); }
.rte-content blockquote {
  border-left: 3px solid var(--primary);
  padding-left: 1rem;
  color: var(--text-secondary);
  font-style: italic;
  margin: .5rem 0;
}
.rte-content pre {
  background: var(--surface-2);
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  font-family: monospace;
  font-size: .88rem;
  overflow-x: auto;
}
.rte-content h1 { font-size: 1.6rem; margin: .5rem 0; }
.rte-content h2 { font-size: 1.3rem; margin: .5rem 0; }
.rte-content h3 { font-size: 1.1rem; margin: .4rem 0; }
.rte-content ul, .rte-content ol { padding-left: 1.5rem; }
.rte-content ul { list-style: disc; }
.rte-content ol { list-style: decimal; }

/* Responsive notes */
@media (max-width: 768px) {
  .notes-shell { flex-direction: column; height: auto; }
  .notes-list-panel { width: 100%; max-width: 100%; border-right: none; border-bottom: 1.5px solid var(--border); padding-right: 0; padding-bottom: 1rem; max-height: 280px; }
  .notes-editor-panel { padding-left: 0; padding-top: 1rem; }
}

/* Kept for backwards compat */
.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.note-view-content {
  font-size: .95rem;
  line-height: 1.8;
  color: var(--text-secondary);
  word-break: break-word;
}

/* ============ DEADLINES PAGE ============ */
.deadlines-list { display: flex; flex-direction: column; gap: .625rem; }

.deadlines-section-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin: 1.25rem 0 .75rem;
}
.deadlines-section-header:first-child { margin-top: 0; }
.section-count {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: .7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
}

/* Type icons */
.type-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.type-prova    { background: var(--danger-soft);  color: var(--danger); }
.type-trabalho { background: var(--warning-soft); color: var(--warning); }
.type-atividade { background: var(--info-soft);   color: var(--info); }
.type-seminario { background: var(--primary-soft); color: var(--primary-dark); }
.type-outro    { background: var(--surface-2);    color: var(--text-secondary); }

/* ============ CALENDAR / SCHEDULE PAGE ============ */
.schedule-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  justify-content: space-between;
  flex-wrap: wrap;
}
.schedule-nav {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.schedule-month {
  font-size: 1.125rem;
  font-weight: 700;
  min-width: 180px;
  text-align: center;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  background: var(--border);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.calendar-day-header {
  background: var(--surface);
  padding: .625rem .25rem;
  text-align: center;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
}
.calendar-day {
  background: var(--surface);
  min-height: 90px;
  padding: .5rem;
  cursor: pointer;
  transition: background var(--transition);
  position: relative;
}
.calendar-day:hover { background: var(--surface-hover); }
.calendar-day.other-month { opacity: .35; }
.calendar-day.today { background: var(--primary-soft); }
.calendar-day.today .day-number { color: var(--primary); font-weight: 700; }
.day-number {
  font-size: .85rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: .375rem;
}
.day-events { display: flex; flex-direction: column; gap: 2px; }
.day-event {
  font-size: .67rem;
  font-weight: 600;
  padding: 2px 5px;
  border-radius: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: var(--primary-soft);
  color: var(--primary);
}
.day-event.deadline-event { background: var(--danger-soft); color: var(--danger); }

/* Weekly schedule */
.week-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: .5rem;
}
.week-month-year {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -.01em;
}
.week-month-year strong { font-weight: 800; }
.week-nav { display: flex; align-items: center; gap: .5rem; }
.week-range-label {
  font-size: .88rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: underline;
  cursor: default;
  min-width: 120px;
  text-align: center;
}
.week-schedule {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: .625rem;
}
.week-day-col { display: flex; flex-direction: column; gap: .5rem; }
.week-day-header {
  text-align: center;
  padding: .5rem .25rem .6rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  border: 1.5px solid transparent;
}
.week-day-header.today {
  background: #798191;
  color: #0f0f0f;
  border-radius: var(--radius-sm);
  border-color: #798191;
}
.week-day-name {
  font-size: .67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
}
.week-day-num { font-size: 1.25rem; font-weight: 700; margin-top: .1rem; }
/* Class card */
.week-class-slot {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: .875rem .75rem .625rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  font-size: .78rem;
  transition: all var(--transition);
}
.week-class-slot:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.week-no-class { opacity: .55; }
.wcs-icon { margin-bottom: .35rem; line-height: 1; color: var(--subject-color, var(--border)); }
.wcs-bar { width: 44px; height: 4px; border-radius: 3px; margin-bottom: .5rem; }
.wcs-type { font-size: .7rem; color: var(--text-muted); margin-bottom: .5rem; letter-spacing: .03em; }
.wcs-time { font-size: .82rem; font-weight: 700; color: var(--text-primary); margin-bottom: .5rem; letter-spacing: .01em; }
.wcs-name { font-size: .8rem; font-weight: 700; color: var(--subject-color, var(--primary)); margin-bottom: .4rem; line-height: 1.35; }
.wcs-room { font-size: .7rem; color: var(--text-secondary); margin-bottom: .3rem; line-height: 1.45; }
.wcs-sep { width: 100%; height: 1px; background: var(--border); margin: .35rem 0; }
.wcs-prof { font-size: .7rem; color: var(--text-muted); margin-bottom: .4rem; line-height: 1.35; }
.wcs-actions { display: flex; gap: .375rem; margin-top: .375rem; }
.wcs-btn {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1.5px solid;
  font-size: .85rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  padding: 0;
  background: transparent;
}
.wcs-present { border-color: var(--success); color: var(--success); }
.wcs-present:hover { background: var(--success); color: #fff; }
.wcs-absent { border-color: var(--danger); color: var(--danger); }
.wcs-absent:hover { background: var(--danger); color: #fff; }

@media (max-width: 700px) {
  .week-schedule { grid-template-columns: repeat(2, 1fr); }
  .calendar-day { min-height: 60px; padding: .25rem; }
  .day-event { display: none; }
}

/* ============ SUBJECTS PAGE ============ */
.subjects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.subject-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition);
  cursor: pointer;
}
.subject-card:hover { border-color: var(--subject-color, var(--primary)); transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.subject-card-header {
  height: 6px;
  background: var(--subject-color, var(--primary));
}
.subject-card-body { padding: 1.25rem; }
.subject-card-name { font-size: 1rem; font-weight: 700; margin-bottom: .25rem; }
.subject-card-meta { font-size: .8rem; color: var(--text-secondary); display: flex; flex-direction: column; gap: .2rem; }
.subject-card-meta span { display: flex; align-items: center; gap: .375rem; }
.subject-card-meta svg { width: 13px; height: 13px; flex-shrink: 0; }
.subject-card-footer {
  padding: .75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.subject-schedule-tags { display: flex; flex-wrap: wrap; gap: .25rem; }
.schedule-day-tag {
  padding: 2px 6px;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 4px;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
}

/* Attendance mini bar */
.attendance-bar {
  height: 4px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  margin-top: .5rem;
}
.attendance-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--subject-color, var(--primary));
  transition: width .6s ease;
}

/* ============ SETTINGS PAGE ============ */
.settings-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1.5rem;
  align-items: start;
}
.settings-nav {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: .5rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: sticky;
  top: calc(var(--header-h) + 1.75rem);
}
.settings-nav-item {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .625rem .875rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  background: none;
  text-align: left;
  width: 100%;
}
.settings-nav-item:hover { background: var(--surface-2); color: var(--text-primary); }
.settings-nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.settings-nav-item svg { width: 16px; height: 16px; }

.settings-panel { display: none; }
.settings-panel.active { display: block; animation: pageIn .25s ease; }
.settings-section { margin-bottom: 2rem; }
.settings-section-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  padding-bottom: .625rem;
  border-bottom: 1.5px solid var(--border);
}

/* Theme toggle card */
.theme-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
}
.theme-option {
  padding: 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: center;
  transition: all var(--transition);
}
.theme-option:hover { border-color: var(--primary); }
.theme-option.active { border-color: var(--primary); background: var(--primary-soft); }
.theme-option-icon { display: flex; justify-content: center; margin-bottom: .45rem; color: var(--text-secondary); }
.theme-option.active .theme-option-icon { color: var(--brand-gold); }
.theme-option-label { font-size: .8rem; font-weight: 600; }

/* Profile avatar */
.profile-avatar-section {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.25rem;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 1.25rem;
}
.profile-avatar-big {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--text-inverse);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  font-weight: 800;
  flex-shrink: 0;
  border: 3px solid var(--primary);
}
.profile-name-big { font-size: 1.1rem; font-weight: 700; }
.profile-email-sub { font-size: .85rem; color: var(--text-secondary); }

@media (max-width: 768px) {
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { position: static; }
}

/* ============ FINANCE PAGE ============ */
.finance-summary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.finance-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.125rem 1.25rem;
}
.finance-card-paid  { border-top: 3px solid #22c55e; }
.finance-card-due   { border-top: 3px solid #f59e0b; }
.finance-card-label { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-secondary); margin-bottom: .35rem; }
.finance-card-value { font-size: 1.4rem; font-weight: 700; color: var(--text-primary); }

.finance-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: .625rem;
  transition: all var(--transition);
}
.finance-row:hover { border-color: var(--primary); background: var(--surface-hover); transform: translateY(-3px); box-shadow: var(--shadow-md); }
.finance-row-left { display: flex; align-items: flex-start; gap: .875rem; min-width: 0; }
.finance-status-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; margin-top: .35rem; }
.finance-status-paid { background: #22c55e; }
.finance-status-due  { background: #f59e0b; }
.finance-row-title { font-size: .95rem; font-weight: 600; color: var(--text-primary); }
.finance-row-meta  { font-size: .78rem; color: var(--text-secondary); margin-top: .15rem; }
.finance-row-notes { font-size: .78rem; color: var(--text-muted); margin-top: .1rem; font-style: italic; }
.finance-row-right { display: flex; align-items: center; gap: .875rem; flex-shrink: 0; }
.finance-row-amount { font-size: 1.05rem; font-weight: 700; color: var(--text-primary); white-space: nowrap; }
.finance-row-actions { display: flex; align-items: center; gap: .375rem; }
.btn-xs { padding: .25rem .55rem; font-size: .75rem; border-radius: 6px; }
.btn-success { background: #22c55e; color: #fff; border: none; }
.btn-success:hover { background: #16a34a; }

/* ============ CHAT PAGE ============ */
.chat-shell {
  display: flex;
  gap: 0;
  height: calc(100vh - var(--header-h) - 3.5rem);
  min-height: 500px;
  background:
    radial-gradient(120% 180% at 100% 0%, rgba(148, 163, 184, 0.18), transparent 50%),
    radial-gradient(120% 180% at 0% 100%, rgba(100, 116, 139, 0.15), transparent 45%),
    var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

/* Painel esquerdo: Sidebar de Canais e contatos */
.chat-sidebar {
  width: 280px;
  min-width: 240px;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  border-right: 1.5px solid var(--border);
  background:
    linear-gradient(180deg, rgba(148, 163, 184, 0.16) 0%, rgba(100, 116, 139, 0.1) 30%, transparent 100%),
    var(--surface-2);
  flex-shrink: 0;
}

.chat-sidebar-header {
  padding: 1rem 1.25rem;
  border-bottom: 1.5px solid var(--border);
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 64px;
}

.chat-list-container {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.chat-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 0 0.75rem;
  margin-bottom: 0.35rem;
}

.chat-list-items {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.chat-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-secondary);
}

.chat-item:hover {
  background: rgba(148, 163, 184, 0.16);
  color: var(--text-primary);
}

.chat-item.active {
  background: linear-gradient(90deg, rgba(148, 163, 184, 0.28), rgba(100, 116, 139, 0.18));
  color: #e5e7eb;
  font-weight: 600;
}

.chat-item-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  color: #fff;
  position: relative;
  flex-shrink: 0;
  background: linear-gradient(135deg, #64748b, #475569);
}

.chat-item-avatar.has-image {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  color: transparent;
  border: 1px solid rgba(226, 232, 240, 0.35);
}

.chat-msg-avatar {
  width: 30px;
  height: 32px;
  border-radius: 50%;
}

.chat-status-indicator {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--surface-2);
}
.chat-status-online { background-color: #22c55e; }
.chat-status-away { background-color: #f59e0b; }
.chat-status-offline { background-color: #6a6a6a; }

.chat-item-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.chat-item-name {
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-item-subtext {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-item-badge {
  background-color: var(--danger);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 99px;
  margin-left: auto;
}

/* Painel direito: Área da conversa */
.chat-content-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(110% 140% at 50% 0%, rgba(148, 163, 184, 0.14), transparent 50%),
    var(--surface);
  min-width: 0;
}

.chat-content-header {
  padding: 1rem 1.25rem;
  border-bottom: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background:
    linear-gradient(180deg, rgba(148, 163, 184, 0.16) 0%, rgba(100, 116, 139, 0.1) 30%, transparent 100%),
    var(--surface-2);
  min-height: 64px;
}

.chat-content-header.chat-header-conversation-active {
  background:
    linear-gradient(180deg, rgba(148, 163, 184, 0.16) 0%, rgba(100, 116, 139, 0.1) 30%, transparent 100%),
    var(--surface-2);
}

.chat-content-header.chat-header-group-active {
  background:
    linear-gradient(90deg, rgba(148, 163, 184, 0.2), rgba(71, 85, 105, 0.22)),
    linear-gradient(180deg, rgba(148, 163, 184, 0.16) 0%, rgba(100, 116, 139, 0.1) 30%, transparent 100%),
    var(--surface-2);
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.chat-header-avatar {
  width: 32px;
  height: 32px;
  font-size: 0.78rem;
}

.chat-header-text {
  min-width: 0;
}

.chat-header-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-header-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Mensagens */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.2), transparent 18%),
    var(--surface);
}

.chat-message-group {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  max-width: 75%;
}

.chat-message-group.self {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-msg-bubble {
  background: linear-gradient(180deg, rgba(148, 163, 184, 0.2), rgba(71, 85, 105, 0.12));
  border: 1.5px solid rgba(148, 163, 184, 0.32);
  padding: 0.75rem 1rem;
  border-radius: 0 var(--radius-md) var(--radius-md) var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9rem;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  word-break: break-word;
  position: relative;
}

.chat-message-group.self .chat-msg-bubble {
  background: linear-gradient(180deg, rgba(148, 163, 184, 0.25), rgba(71, 85, 105, 0.18));
  border-color: rgba(148, 163, 184, 0.45);
  border-radius: var(--radius-md) 0 var(--radius-md) var(--radius-md);
}

.chat-msg-bubble.has-menu {
  padding-right: 2.35rem;
}

.chat-msg-sender {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.chat-msg-meta {
  font-size: 0.65rem;
  color: rgba(226, 232, 240, 0.72);
  align-self: flex-end;
  margin-top: 0.15rem;
  text-align: right;
}

.chat-msg-menu-wrap {
  position: absolute;
  right: 0.45rem;
  top: 0.45rem;
}

.chat-msg-menu-toggle {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  border: 1px solid rgba(203, 213, 225, 0.35);
  background: rgba(15, 23, 42, 0.28);
  color: #e2e8f0;
  font-size: 0.72rem;
  line-height: 1;
  padding: 0;
}

.chat-msg-menu-toggle:hover {
  background: rgba(148, 163, 184, 0.28);
  border-color: rgba(148, 163, 184, 0.6);
}

.chat-msg-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 120px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  display: none;
  z-index: 5;
}

.chat-msg-menu.open {
  display: block;
}

.chat-msg-menu-item {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: #dbeafe;
  font-size: 0.75rem;
  padding: 0.45rem 0.6rem;
}

.chat-msg-menu-item:hover {
  background: rgba(148, 163, 184, 0.2);
}

.chat-edit-modal {
  max-width: 460px;
}

.chat-edit-modal .modal-body {
  margin-bottom: 1rem;
}

.chat-edit-modal-body {
  display: flex;
}

.chat-edit-input {
  width: 100%;
  min-height: 110px;
  resize: vertical;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.35);
  color: var(--text-primary);
  padding: 0.75rem 0.85rem;
  font-size: 0.92rem;
  line-height: 1.45;
}

.chat-edit-input:focus {
  outline: none;
  border-color: rgba(203, 213, 225, 0.72);
  box-shadow: 0 0 0 2px rgba(148, 163, 184, 0.2);
}

.chat-msg-menu-item.danger {
  color: #fecaca;
}

.chat-msg-menu-item.danger:hover {
  background: rgba(239, 68, 68, 0.22);
}

/* Input Área */
.chat-input-area {
  padding: 1rem 1.25rem;
  border-top: 1.5px solid var(--border);
  background: var(--surface);
}

.chat-form {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.chat-input {
  flex: 1;
  border-radius: var(--radius-md);
  background: rgba(2, 6, 23, 0.25);
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.chat-send-btn {
  background: linear-gradient(135deg, #9ca3af, #4b5563);
  color: #f8fafc;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}

.chat-send-btn:hover {
  background: linear-gradient(135deg, #6b7280, #374151);
  transform: scale(1.05);
}

/* Empty State do Chat */
.chat-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  padding: 2rem;
  text-align: center;
}

.chat-discovery-area {
  padding: 0.85rem;
  border-bottom: 1.5px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.chat-search-input {
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.22);
  border: 1px solid rgba(148, 163, 184, 0.28);
  color: var(--text-primary);
  padding: 0.5rem 0.65rem;
  font-size: 0.82rem;
}

.chat-search-results {
  max-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.chat-search-item {
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.55rem;
  background: rgba(15, 23, 42, 0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.chat-search-avatar {
  width: 30px;
  height: 30px;
  font-size: 0.72rem;
}

.chat-search-user-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.chat-search-user-info strong {
  font-size: 0.77rem;
  color: var(--text-primary);
}

.chat-search-user-info span {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-search-actions {
  display: flex;
  align-items: center;
  gap: 0.32rem;
}

.chat-search-btn {
  border: 1px solid rgba(148, 163, 184, 0.34);
  border-radius: 6px;
  background: rgba(148, 163, 184, 0.16);
  color: #e5e7eb;
  font-size: 0.68rem;
  padding: 0.2rem 0.45rem;
}

.chat-search-btn:hover {
  border-color: #cbd5e1;
  color: #f8fafc;
}

.chat-group-draft {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  min-height: 1.5rem;
}

.chat-draft-empty {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.chat-draft-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  font-size: 0.68rem;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(148, 163, 184, 0.16);
  color: #e5e7eb;
  border-radius: 999px;
  padding: 0.2rem 0.5rem;
}

.chat-draft-avatar {
  width: 22px;
  height: 22px;
  font-size: 0.62rem;
}

.chat-draft-remove {
  opacity: 0.75;
}

.chat-group-member-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.15rem 0.5rem 0.15rem 0.2rem;
}

.chat-group-member-avatar {
  width: 22px;
  height: 22px;
  font-size: 0.62rem;
}

.chat-group-member-name {
  font-weight: 700;
}

.chat-group-member-role {
  color: var(--text-muted);
}

.chat-group-search-user-meta {
  flex: 1;
  min-width: 0;
}

.chat-create-group-btn {
  width: 100%;
  font-size: 0.72rem;
  padding: 0.45rem 0.6rem;
}

.chat-empty-list {
  font-size: 0.72rem;
  color: var(--text-muted);
  padding: 0.25rem 0.75rem;
}

.chat-avatar-public {
  background: linear-gradient(135deg, rgba(156, 163, 175, 0.42), rgba(100, 116, 139, 0.45));
  color: #f1f5f9;
  border: 1px solid rgba(148, 163, 184, 0.56);
}

.chat-attach-btn {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(148, 163, 184, 0.14);
  color: #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-attach-btn:hover {
  border-color: #cbd5e1;
  color: #f8fafc;
}

.chat-attachment-preview {
  border-top: 1px solid var(--border);
  padding: 0.55rem 1.25rem;
  background: var(--surface-2);
}

.chat-attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.24rem 0.55rem;
  font-size: 0.72rem;
}

.chat-attachment-chip button {
  border: none;
  background: transparent;
  color: var(--danger);
  font-size: 0.68rem;
}

.chat-attachment-card {
  margin-top: 0.4rem;
  border: 1px solid rgba(148, 163, 184, 0.42);
  background: rgba(100, 116, 139, 0.2);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.6rem;
  display: inline-flex;
  flex-direction: column;
  text-decoration: none;
  max-width: 260px;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition);
}

.chat-attachment-card:hover {
  border-color: rgba(203, 213, 225, 0.8);
  transform: translateY(-1px);
}

.chat-attachment-name {
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 600;
}

.chat-attachment-meta {
  color: var(--text-muted);
  font-size: 0.68rem;
}

/* ============ KANBAN PAGE ============ */
.kanban-shell {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 1rem;
  min-height: calc(100vh - var(--header-h) - 3.5rem);
}

.kanban-sidebar {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.kanban-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kanban-sidebar-header h3 {
  font-size: 0.95rem;
  color: var(--text-primary);
}

.kanban-search-input {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  padding: 0.5rem 0.6rem;
  font-size: 0.78rem;
}

.kanban-user-results,
.kanban-selected-members,
.kanban-board-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.kanban-user-results {
  max-height: 150px;
  overflow-y: auto;
}

.kanban-user-row {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.kanban-user-row strong {
  display: block;
  font-size: 0.74rem;
  color: var(--text-primary);
}

.kanban-user-row span {
  display: block;
  font-size: 0.67rem;
  color: var(--text-muted);
}

.kanban-board-item {
  text-align: left;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 0.55rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.kanban-board-item.active {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.kanban-board-item strong {
  font-size: 0.78rem;
  color: var(--text-primary);
}

.kanban-board-item span {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.kanban-content {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 1rem;
  overflow: auto;
}

.kanban-board-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}

.kanban-header-actions {
  flex-shrink: 0;
}

.kanban-board-header h2 {
  font-size: 1.2rem;
  margin-bottom: 0.35rem;
}

.kanban-board-header p {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.kanban-members-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.kanban-member-chip {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-secondary);
  padding: 0.2rem 0.55rem;
  font-size: 0.7rem;
}

.kanban-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 0.8rem;
}

.kanban-column {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  min-height: 380px;
}

.kanban-column-header {
  padding: 0.7rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kanban-column-header h4 {
  font-size: 0.84rem;
  color: var(--text-primary);
}

.kanban-cards {
  padding: 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.kanban-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 0.55rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  cursor: pointer;
  transition: border-color var(--transition);
}

.kanban-card:hover {
  border-color: var(--primary);
}

.kanban-card.is-busy {
  opacity: 0.6;
  cursor: wait;
}

.kanban-card h5 {
  font-size: 0.82rem;
  color: var(--text-primary);
}

.kanban-card p {
  font-size: 0.74rem;
  color: var(--text-secondary);
  min-height: 1.1rem;
}

.kanban-card-assignee {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.kanban-card-actions {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.kanban-empty-small {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.kanban-empty-state {
  min-height: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-secondary);
}

@media (max-width: 980px) {
  .kanban-shell {
    grid-template-columns: 1fr;
  }

  .kanban-columns {
    grid-template-columns: 1fr;
  }

  .chat-shell {
    flex-direction: column;
    height: auto;
    min-height: 600px;
  }

  .chat-sidebar {
    width: 100%;
    max-width: 100%;
    border-right: none;
    border-bottom: 1.5px solid var(--border);
  }
}