:root {
  color-scheme: only light;
  --blue: #0b5389;
  --blue-light: #e2f6fd;
  --bg: #f6f7f9;
  --text-dark: #223035;
  --text-muted: #4f5158;
  --text-faint: #a6a6a6;
  --border: #ebedef;
  --success: #34c759;
  --danger: #ef4635;
  --warning: #ff9500;
  --high: #ef4635; --high-bg: #fdecea;
  --medium: #ff9500; --medium-bg: #fff3e0;
  --low: #34c759; --low-bg: #e8f8ee;

  --sidebar-bg: #0a2540;
  --sidebar-bg-hover: rgba(255,255,255,0.07);
  --sidebar-bg-active: rgba(255,255,255,0.13);
  --sidebar-text: rgba(255,255,255,0.68);
  --sidebar-text-dim: rgba(255,255,255,0.40);
  --sidebar-border: rgba(255,255,255,0.09);
  --accent: #4fb3e8;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  background: var(--bg);
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text-dark);
}

button, input { font-family: inherit; }

.hidden { display: none !important; }

/* ══════════════════ SHELL ══════════════════ */

.web-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ══════════════════ SIDEBAR ══════════════════ */

.sidebar {
  width: 268px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}
.ws-icon {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, #0b5389, #4fb3e8);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; font-size: 12.5px; flex-shrink: 0;
}
.ws-name { font-size: 15px; font-weight: 700; color: #fff; letter-spacing: -0.1px; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 10px 8px;
  min-height: 0;
}
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 4px; }

.nav-section { margin-bottom: 22px; }
.nav-section-title {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.7px;
  color: var(--sidebar-text-dim); padding: 0 10px 7px;
}

.nav-item, .channel-row, .dm-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 7px; cursor: pointer;
  font-size: 13.5px; color: var(--sidebar-text);
  transition: background 0.12s, color 0.12s;
}
.nav-item { font-size: 14px; }
.nav-item:hover, .channel-row:hover, .dm-row:hover { background: var(--sidebar-bg-hover); color: #fff; }
.nav-item.active, .channel-row.active, .dm-row.active { background: var(--sidebar-bg-active); color: #fff; font-weight: 600; }
.nav-icon { flex-shrink: 0; opacity: 0.9; }
.nav-badge {
  margin-left: auto; font-size: 11px; font-weight: 700;
  background: rgba(255,255,255,0.15); color: #fff;
  padding: 1px 7px; border-radius: 9px; min-width: 18px; text-align: center;
}
.nav-item.active .nav-badge { background: #fff; color: var(--blue); }

.channel-emoji {
  width: 20px; text-align: center; font-size: 13px; flex-shrink: 0;
}
.dm-avatar-mini {
  width: 20px; height: 20px; border-radius: 6px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700; color: #fff; position: relative;
}
.dm-avatar-mini .online-dot-mini {
  position: absolute; bottom: -2px; right: -2px; width: 7px; height: 7px;
  border-radius: 50%; background: var(--success); border: 1.5px solid var(--sidebar-bg);
}
.row-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unread-pill {
  flex-shrink: 0; font-size: 10.5px; font-weight: 700; color: #fff;
  background: var(--accent); padding: 1px 6px; border-radius: 8px; min-width: 16px; text-align: center;
}
.channel-row.active .row-label, .channel-row:not(.active) .row-label { font-weight: inherit; }
.channel-row[data-unread="true"]:not(.active) .row-label,
.dm-row[data-unread="true"]:not(.active) .row-label { color: #fff; font-weight: 600; }

/* always-visible profile footer */
.sidebar-footer {
  border-top: 1px solid var(--sidebar-border);
  padding: 14px 16px 16px;
  flex-shrink: 0;
}
.profile-row { display: flex; align-items: center; gap: 10px; }
.profile-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: #c97559;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0; position: relative;
}
.profile-avatar .status-dot {
  position: absolute; bottom: -1px; right: -1px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--success); border: 2px solid var(--sidebar-bg);
}
.profile-meta { flex: 1; min-width: 0; }
.profile-name { font-size: 13.5px; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-role { font-size: 11.5px; color: var(--sidebar-text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }

.profile-stats { display: flex; gap: 7px; margin-top: 12px; }
.profile-stat { flex: 1; background: rgba(255,255,255,0.07); border-radius: 8px; padding: 6px 4px; text-align: center; }
.profile-stat-value { font-size: 15px; font-weight: 700; color: #fff; line-height: 1; }
.profile-stat-label { font-size: 8.5px; color: var(--sidebar-text-dim); margin-top: 3px; text-transform: uppercase; letter-spacing: 0.4px; }

.profile-settings { display: flex; gap: 6px; margin-top: 10px; }
.profile-settings-icon {
  flex: 1; background: rgba(255,255,255,0.07); border-radius: 8px; height: 28px;
  display: flex; align-items: center; justify-content: center; font-size: 13px; cursor: pointer;
}
.profile-settings-icon:hover { background: rgba(255,255,255,0.14); }

/* ══════════════════ MAIN PANE ══════════════════ */

.main-pane {
  flex: 1; min-width: 0; display: flex; flex-direction: column;
  background: #fff; height: 100%;
}

.main-topbar {
  height: 58px; flex-shrink: 0; display: flex; align-items: center;
  padding: 0 28px; border-bottom: 1px solid var(--border); gap: 12px;
}
.topbar-icon {
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.topbar-title-wrap { min-width: 0; }
.topbar-title { font-size: 15.5px; font-weight: 700; color: var(--text-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-sub { font-size: 11.5px; color: var(--text-faint); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.topbar-search-wrap {
  margin-left: auto; position: relative; flex-shrink: 0;
}
.search-icon {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  pointer-events: none;
}
.search-input {
  width: 220px; padding: 7px 12px 7px 32px; border-radius: 9px;
  border: 1.5px solid var(--border); background: var(--bg);
  font-size: 13px; color: var(--text-dark); font-family: inherit;
  outline: none; transition: border-color 0.15s, width 0.2s;
}
.search-input:focus { border-color: var(--blue); width: 280px; background: #fff; }
.search-input::placeholder { color: var(--text-faint); }

.search-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 340px; background: #fff; border: 1.5px solid var(--border);
  border-radius: 12px; box-shadow: 0 8px 28px rgba(34,48,53,0.13);
  z-index: 100; overflow: hidden;
}
.search-section-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.7px; color: var(--text-faint);
  padding: 10px 14px 4px;
}
.search-result {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; cursor: pointer; transition: background 0.1s;
}
.search-result:hover { background: var(--bg); }
.sr-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.sr-chat-icon {
  width: 24px; height: 24px; border-radius: 7px; background: var(--blue-light);
  color: var(--blue); font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sr-body { flex: 1; min-width: 0; }
.sr-title { font-size: 13px; font-weight: 600; color: var(--text-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-title mark { background: #fff3b0; color: inherit; border-radius: 2px; padding: 0 1px; }
.sr-sub { font-size: 11px; color: var(--text-faint); margin-top: 2px; display: flex; align-items: center; gap: 5px; }
.sr-dept { font-size: 9.5px; font-weight: 700; color: #fff; padding: 1px 6px; border-radius: 10px; text-transform: uppercase; }
.sr-done { font-size: 11px; color: var(--success); font-weight: 700; flex-shrink: 0; }
.search-empty { padding: 16px 14px; font-size: 13px; color: var(--text-faint); }

.main-content { flex: 1; overflow-y: auto; min-height: 0; }
.main-content.padded { padding: 26px 32px 48px; }

/* ── today view ── */
.today-head { margin-bottom: 18px; max-width: 760px; }
.date-label { font-size: 11.5px; color: var(--text-faint); font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; }
.greeting { font-size: 23px; font-weight: 700; color: var(--text-dark); margin-top: 2px; }

.ai-nudge {
  margin-top: 16px; background: linear-gradient(135deg, #e2f6fd 0%, #c2eaf8 100%);
  border-radius: 14px; padding: 13px 16px; display: flex; align-items: flex-start; gap: 11px;
}
.ai-nudge-icon {
  width: 30px; height: 30px; background: var(--blue); border-radius: 50%;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 1px;
}
.ai-nudge-body { flex: 1; min-width: 0; }
.ai-nudge-label { font-size: 10px; font-weight: 700; color: var(--blue); text-transform: uppercase; letter-spacing: 0.7px; }
.ai-nudge-text { font-size: 13px; color: var(--text-dark); margin-top: 2px; line-height: 1.5; }

.section-row { display: flex; justify-content: space-between; align-items: center; padding: 22px 0 12px; max-width: 760px; }
.section-title { font-size: 14.5px; font-weight: 700; color: var(--text-dark); }
.section-pill { font-size: 11px; color: var(--blue); font-weight: 700; background: var(--blue-light); padding: 3px 10px; border-radius: 20px; }

.task-list { max-width: 760px; }
.task-row {
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 14px; display: flex; align-items: center; gap: 12px; margin-bottom: 8px;
  cursor: pointer; transition: box-shadow 0.12s, border-color 0.12s;
}
.task-row:hover { box-shadow: 0 2px 10px rgba(34,48,53,0.08); border-color: #e2e6e8; }
.task-row-stripe { width: 3px; height: 28px; border-radius: 2px; flex-shrink: 0; }
.task-check {
  width: 23px; height: 23px; border-radius: 50%; border: 2.5px solid #cdd5da;
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.15s; background: transparent;
}
.task-check.done { border-color: var(--success); background: var(--success); }
.task-main { flex: 1; min-width: 0; }
.task-title { font-size: 14px; font-weight: 600; color: var(--text-dark); line-height: 1.3; }
.task-title.done { color: #b0bcc2; text-decoration: line-through; }
.task-meta { display: flex; align-items: center; gap: 7px; margin-top: 5px; flex-wrap: wrap; }
.task-dept { font-size: 10px; font-weight: 700; color: #fff; padding: 2px 8px; border-radius: 20px; text-transform: uppercase; letter-spacing: 0.3px; white-space: nowrap; }
.task-due { font-size: 11.5px; color: var(--text-faint); white-space: nowrap; }
.task-priority-badge { font-size: 10px; font-weight: 700; color: var(--blue); background: var(--blue-light); padding: 2px 8px; border-radius: 20px; white-space: nowrap; }

.quick-add { max-width: 760px; margin-top: 4px; }
.quick-add-row {
  border: 1.5px dashed #d8e0e4; border-radius: 12px; padding: 12px 14px;
  display: flex; align-items: center; gap: 10px; cursor: pointer; color: var(--blue); font-weight: 600; font-size: 14px;
}
.quick-add-row:hover { border-color: var(--blue); background: var(--blue-light); }
.quick-add-icon {
  width: 23px; height: 23px; border-radius: 50%; background: var(--blue-light);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.quick-add-form {
  display: flex; gap: 8px; border: 1.5px solid var(--blue); border-radius: 12px; padding: 8px;
}
.quick-add-input {
  flex: 1; border: none; outline: none; font-size: 14px; padding: 6px 8px; color: var(--text-dark);
}
.quick-add-btn {
  background: var(--blue); color: #fff; border: none; border-radius: 8px;
  padding: 0 16px; font-size: 13px; font-weight: 700; cursor: pointer;
}
.quick-add-cancel {
  background: var(--bg); color: var(--text-muted); border: none; border-radius: 8px;
  padding: 0 14px; font-size: 13px; font-weight: 600; cursor: pointer;
}

.filter-bar {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  max-width: 760px; margin-bottom: 14px;
}
.filter-chip {
  font-family: inherit; font-size: 12px; font-weight: 600;
  padding: 4px 11px; border-radius: 20px; border: 1.5px solid var(--border);
  background: #fff; color: var(--text-muted); cursor: pointer;
  transition: all 0.12s; white-space: nowrap;
}
.filter-chip:hover { border-color: #c0ccd2; color: var(--text-dark); }
.filter-chip.active { font-weight: 700; }
.filter-chip-clear { border-color: #d0d8dc; color: var(--text-faint); margin-left: 4px; }
.filter-chip-clear:hover { border-color: var(--danger); color: var(--danger); }
.filter-divider { width: 1px; height: 18px; background: var(--border); margin: 0 2px; }
.filter-empty { color: var(--text-faint); font-size: 13.5px; padding: 24px 0; text-align: center; }

.empty-state { text-align: center; padding: 50px 0; color: var(--text-faint); max-width: 760px; }
.empty-state-icon { font-size: 30px; margin-bottom: 8px; }
.empty-state-text { font-size: 14px; font-weight: 500; }

/* ── week view ── */
.week-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 20px; flex-wrap: wrap; gap: 14px; }
.week-head-title { font-size: 23px; font-weight: 700; color: var(--text-dark); }
.week-head-range { font-size: 12px; color: var(--text-faint); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px; }
.week-overall {
  background: var(--bg); border-radius: 12px; padding: 10px 16px; min-width: 220px;
}
.week-overall-row { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-muted); margin-bottom: 7px; }
.week-overall-row strong { color: var(--text-dark); }
.week-overall-track { height: 5px; background: #e0e4e8; border-radius: 4px; overflow: hidden; }
.week-overall-fill { height: 100%; background: linear-gradient(90deg, #0b5389, #86d7f7); border-radius: 4px; transition: width 0.35s ease; }

.week-board { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 16px; }
.week-day-col {
  flex: 1; min-width: 196px; max-width: 230px; background: var(--bg); border-radius: 14px;
  padding: 14px; display: flex; flex-direction: column; flex-shrink: 0;
  border: 1.5px solid transparent;
}
.week-day-col.is-today { background: var(--blue-light); border-color: var(--blue); }
.week-day-col-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.week-day-name { font-size: 11.5px; font-weight: 700; color: var(--text-dark); text-transform: uppercase; letter-spacing: 0.4px; }
.week-day-col.is-today .week-day-name { color: var(--blue); }
.week-day-date { font-size: 11px; color: var(--text-faint); font-weight: 600; }
.week-day-progress-track { height: 4px; background: rgba(0,0,0,0.07); border-radius: 3px; overflow: hidden; margin-bottom: 11px; }
.week-day-progress-fill { height: 100%; background: linear-gradient(90deg, #0b5389, #86d7f7); border-radius: 3px; transition: width 0.3s ease; }

.week-task-chip {
  background: #fff; border-radius: 10px; padding: 9px 10px 9px 11px; margin-bottom: 7px;
  box-shadow: 0 1px 3px rgba(34,48,53,0.08); cursor: pointer; display: flex; align-items: flex-start; gap: 8px;
  border-left: 3px solid #dedede;
}
.week-task-chip .task-check { width: 18px; height: 18px; border-width: 2px; margin-top: 1px; }
.week-task-chip .task-check svg { width: 9px; height: 9px; }
.chip-body { flex: 1; min-width: 0; }
.chip-title { font-size: 12.5px; font-weight: 600; color: var(--text-dark); line-height: 1.35; }
.chip-title.done { color: #b0bcc2; text-decoration: line-through; }
.chip-meta { display: flex; align-items: center; gap: 5px; margin-top: 4px; flex-wrap: wrap; }
.chip-dept { font-size: 8.5px; font-weight: 700; color: #fff; padding: 1px 6px; border-radius: 16px; text-transform: uppercase; letter-spacing: 0.2px; }
.chip-due { font-size: 10px; color: var(--text-faint); }

.week-day-empty { text-align: center; padding: 18px 4px; color: var(--text-faint); font-size: 11.5px; }

/* ── chat view ── */
.main-content.chat-mode { display: flex; flex-direction: column; padding: 0; }
.chat-messages { flex: 1; overflow-y: auto; padding: 18px 0; }
.msg-row { display: flex; gap: 12px; padding: 9px 28px; }
.msg-row:hover { background: #f8f9fb; }
.msg-avatar {
  width: 36px; height: 36px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: #fff;
}
.msg-body { flex: 1; min-width: 0; }
.msg-head { display: flex; align-items: baseline; gap: 8px; }
.msg-sender { font-weight: 700; font-size: 13.5px; color: var(--text-dark); }
.msg-sender.mine { color: var(--blue); }
.msg-time { font-size: 11px; color: var(--text-faint); }
.msg-text { font-size: 13.5px; color: var(--text-dark); line-height: 1.5; margin-top: 2px; }

.chat-composer {
  flex-shrink: 0; margin: 0 28px 22px; border: 1.5px solid var(--border); border-radius: 12px;
  padding: 10px 10px 10px 14px; display: flex; align-items: flex-end; gap: 8px;
  transition: border-color 0.15s;
}
.chat-composer:focus-within { border-color: var(--blue); }
.chat-input {
  flex: 1; border: none; outline: none; font-size: 14px; color: var(--text-dark);
  resize: none; line-height: 1.5; max-height: 120px; overflow-y: auto;
  background: transparent; font-family: inherit;
}
.chat-input::placeholder { color: var(--text-faint); }
.chat-composer-send {
  width: 34px; height: 34px; border-radius: 8px; background: var(--blue); border: none;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  cursor: pointer; transition: background 0.12s, opacity 0.12s;
}
.chat-composer-send:hover { background: #0a4070; }
.chat-composer-send:active { opacity: 0.8; }
/* subtle "mine" highlight */
.msg-row.msg-mine .msg-text { color: #223035; }
.msg-row.msg-mine .msg-sender { color: var(--blue); }

/* ══════════════════ TASK DETAIL PANEL ══════════════════ */
.detail-panel {
  width: 320px; flex-shrink: 0; background: #fff; border-left: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 20px; height: 100%;
}
.detail-panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.detail-panel-title { font-size: 11px; font-weight: 700; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.6px; }
.detail-close { padding: 5px; cursor: pointer; border-radius: 6px; }
.detail-close:hover { background: var(--bg); }
.detail-priority-bar { height: 3px; border-radius: 2px; margin-bottom: 14px; }
.detail-task-title { font-size: 16.5px; font-weight: 700; color: var(--text-dark); line-height: 1.35; margin-bottom: 14px; }
.detail-tags { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 20px; }
.tag { font-size: 12px; font-weight: 600; padding: 4px 12px; border-radius: 20px; text-transform: capitalize; }
.tag-dept { color: #fff; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px; }
.tag-neutral { color: var(--text-muted); background: var(--bg); font-weight: 500; text-transform: none; }
.detail-btn-primary {
  background: var(--blue); color: #fff; padding: 12px; border-radius: 12px;
  text-align: center; font-size: 14.5px; font-weight: 700; cursor: pointer;
}

/* ══════════════════ responsive ══════════════════ */
@media (max-width: 980px) {
  .sidebar { width: 220px; }
  .detail-panel { width: 280px; }
  .week-day-col { min-width: 168px; }
}

/* ══════════════════ THREADS ══════════════════ */

/* When thread panel is open, make web-shell flex accommodate it */
.web-shell.thread-open .thread-panel { display: flex; }
.web-shell.thread-open .detail-panel { display: none !important; }

/* Thread panel */
.thread-panel {
  width: 340px; flex-shrink: 0; background: #fff;
  border-left: 1px solid var(--border);
  display: none; flex-direction: column; height: 100%;
}

.thread-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.thread-panel-title-wrap { display: flex; align-items: center; gap: 7px; }
.thread-panel-title { font-size: 14px; font-weight: 700; color: var(--text-dark); }
.thread-close {
  width: 26px; height: 26px; border-radius: 6px; display: flex;
  align-items: center; justify-content: center; cursor: pointer; color: var(--text-muted);
}
.thread-close:hover { background: var(--bg); }

/* Original message shown at top of thread */
.thread-original {
  padding: 12px 16px; background: #fafbfc;
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.thread-original .msg-row { padding: 0; }
.thread-original .msg-actions { display: none; }

/* Reply count divider */
.thread-divider-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px; flex-shrink: 0;
}
.thread-reply-count { font-size: 11px; font-weight: 700; color: var(--text-faint); white-space: nowrap; text-transform: uppercase; letter-spacing: 0.5px; }
.thread-divider-line { flex: 1; height: 1px; background: var(--border); }

/* Thread reply list */
.thread-messages { flex: 1; overflow-y: auto; padding: 4px 0 8px; }
.thread-messages .msg-row { padding: 7px 16px; }
.thread-empty {
  padding: 24px 16px; text-align: center; color: var(--text-faint); font-size: 13px;
}

/* Thread composer */
.thread-composer {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 10px 12px; border-top: 1px solid var(--border); flex-shrink: 0; background: #fff;
}
.thread-input {
  flex: 1; resize: none; border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 12px; font-size: 13.5px; color: var(--text-dark);
  background: var(--bg); font-family: inherit; line-height: 1.4;
  max-height: 100px; overflow-y: auto; outline: none;
}
.thread-input:focus { border-color: var(--blue); background: #fff; }
.thread-send-btn {
  width: 32px; height: 32px; border-radius: 8px; background: var(--blue);
  border: none; cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-bottom: 2px;
}
.thread-send-btn:hover { background: #0a4370; }

/* Reply button on message hover */
.msg-row { position: relative; }
.msg-actions {
  position: absolute; right: 10px; top: 6px;
  opacity: 0; transition: opacity 0.12s; display: flex; gap: 4px; z-index: 2;
}
.msg-row:hover .msg-actions { opacity: 1; }
.msg-action-btn {
  background: #fff; border: 1px solid var(--border); border-radius: 6px;
  padding: 3px 9px; font-size: 11.5px; cursor: pointer; color: var(--text-muted);
  font-family: inherit; white-space: nowrap; line-height: 1.5;
}
.msg-action-btn:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-light); }

/* Thread indicator below messages that have replies */
.msg-thread-indicator {
  display: inline-flex; align-items: center; gap: 7px;
  margin: 2px 0 4px 50px;
  padding: 4px 10px 4px 7px; border-radius: 7px;
  font-size: 12px; color: var(--blue); cursor: pointer;
  font-weight: 600; transition: background 0.12s;
}
.msg-thread-indicator:hover { background: var(--blue-light); }
.thread-avatars { display: flex; }
.thread-avatar-mini {
  width: 18px; height: 18px; border-radius: 50%; font-size: 8px;
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; border: 1.5px solid #fff; margin-right: -4px;
}
.thread-indicator-txt { margin-left: 6px; }

@media (max-width: 980px) {
  .thread-panel { width: 300px; }
}

/* ══════════════════ VOICE COMPOSER ══════════════════ */

/* Mic button in composer */
.composer-mic-btn {
  width: 34px; height: 34px; border-radius: 8px; border: none;
  background: transparent; cursor: pointer; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background 0.15s, color 0.15s;
}
.composer-mic-btn:hover { background: var(--bg); color: var(--blue); }
.composer-mic-btn.active { background: #fdecea; color: var(--danger); }

/* Recording bar — replaces composer while recording */
.voice-recording-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-top: 1px solid var(--border);
  background: #fff8f8; gap: 12px;
}
.voice-bar-left { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.rec-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--danger);
  animation: recPulse 1s ease-in-out infinite;
}
@keyframes recPulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }
.rec-label { font-size: 12px; font-weight: 600; color: var(--danger); }
.rec-timer { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; min-width: 28px; }

/* Animated waveform */
.voice-waveform { display: flex; align-items: center; gap: 2px; flex: 1; justify-content: center; }
.wave-bar {
  width: 3px; border-radius: 2px; background: var(--blue);
  opacity: 0.6; transition: height 0.25s ease;
  min-height: 4px;
}

.voice-bar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.voice-cancel-btn {
  width: 30px; height: 30px; border-radius: 7px; border: 1px solid var(--border);
  background: #fff; cursor: pointer; font-size: 13px; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
}
.voice-cancel-btn:hover { background: var(--bg); }
.voice-send-btn {
  width: 32px; height: 32px; border-radius: 8px; background: var(--blue);
  border: none; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.voice-send-btn:hover { background: #0a4070; }

/* Hide composer textarea/send when recording */
.chat-composer.recording .chat-input,
.chat-composer.recording .chat-composer-send { display: none; }

/* ══════════════════ VOICE NOTE CARD ══════════════════ */

.voice-note-card {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--blue-light); border-radius: 12px;
  padding: 10px 14px; min-width: 200px; max-width: 300px;
}
.msg-row.msg-mine .voice-note-card { background: #ddeefb; }
.voice-play-btn {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--blue); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: #fff; flex-shrink: 0;
}
.voice-play-btn:hover { background: #0a4070; }
.voice-note-wave { display: flex; align-items: center; gap: 2px; flex: 1; }
.vnw-bar { width: 3px; border-radius: 2px; background: var(--blue); opacity: 0.5; min-height: 4px; }
.voice-note-dur { font-size: 11px; color: var(--text-muted); font-variant-numeric: tabular-nums; flex-shrink: 0; }

/* ══════════════════ AI ASSISTANT PANEL ══════════════════ */

/* Topbar button */
.ai-topbar-btn {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 13px; border-radius: 20px;
  background: linear-gradient(135deg, #0b5389 0%, #5856d6 100%);
  border: none; cursor: pointer; color: #fff;
  font-size: 13px; font-weight: 600; font-family: inherit;
  white-space: nowrap; transition: opacity 0.15s;
  margin-right: 10px;
}
.ai-topbar-btn:hover { opacity: 0.88; }
.ai-topbar-btn.active { box-shadow: 0 0 0 2px rgba(88,86,214,0.4); }
.ai-topbar-orb {
  width: 8px; height: 8px; border-radius: 50%;
  background: #fff; opacity: 0.9;
  animation: orbPulse 2.5s ease-in-out infinite;
}
@keyframes orbPulse { 0%,100% { transform: scale(1); opacity:0.9; } 50% { transform: scale(1.35); opacity:0.5; } }

/* Panel shell */
.ai-panel {
  width: 320px; flex-shrink: 0;
  background: #fff; border-left: 1px solid var(--border);
  display: flex; flex-direction: column; height: 100%; overflow: hidden;
}
.web-shell.ai-open .ai-panel { display: flex; }
.web-shell.ai-open .detail-panel,
.web-shell.ai-open .thread-panel { display: none !important; }

.ai-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0;
  background: linear-gradient(135deg, #0b5389 0%, #5856d6 100%);
}
.ai-panel-title-wrap { display: flex; align-items: center; gap: 8px; }
.ai-panel-orb {
  width: 10px; height: 10px; border-radius: 50%; background: #fff;
  animation: orbPulse 2.5s ease-in-out infinite;
}
.ai-panel-title { font-size: 14px; font-weight: 700; color: #fff; }
.ai-panel-close {
  width: 26px; height: 26px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; opacity: 0.7; transition: opacity 0.15s;
}
.ai-panel-close:hover { opacity: 1; background: rgba(255,255,255,0.15); }
.ai-panel-close svg path { stroke: #fff; }

.ai-panel-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 20px; }

/* Sections */
.ai-section { display: flex; flex-direction: column; gap: 8px; }
.ai-section-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.6px; color: var(--text-faint);
}

/* Briefing card */
.ai-briefing-card {
  background: linear-gradient(135deg, #f0f5ff 0%, #f5f0ff 100%);
  border-radius: 12px; padding: 14px; font-size: 13px;
  color: var(--text-dark); line-height: 1.6; border: 1px solid #e0e8ff;
}
.ai-briefing-stat-row { display: flex; gap: 8px; margin-top: 10px; }
.ai-briefing-stat {
  flex: 1; background: #fff; border-radius: 8px; padding: 8px 10px;
  text-align: center; border: 1px solid var(--border);
}
.ai-briefing-stat-val { font-size: 18px; font-weight: 700; color: var(--blue); }
.ai-briefing-stat-lbl { font-size: 10px; color: var(--text-faint); margin-top: 2px; }

/* Suggestions */
.ai-suggestion {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px; background: var(--bg); border-radius: 10px;
  cursor: pointer; transition: background 0.12s; border: 1px solid transparent;
  margin-bottom: 6px;
}
.ai-suggestion:hover { background: var(--blue-light); border-color: #c0d8f0; }
.ai-suggestion-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 4px;
}
.ai-suggestion-body { flex: 1; }
.ai-suggestion-title { font-size: 13px; font-weight: 600; color: var(--text-dark); margin-bottom: 2px; }
.ai-suggestion-reason { font-size: 11px; color: var(--text-muted); line-height: 1.4; }
.ai-suggestion-action {
  font-size: 11px; color: var(--blue); font-weight: 600;
  white-space: nowrap; flex-shrink: 0; margin-top: 3px;
}

/* Draft section */
.ai-draft-wrap { display: flex; flex-direction: column; gap: 8px; }
.ai-draft-input {
  resize: none; border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; font-size: 13px; color: var(--text-dark);
  background: var(--bg); font-family: inherit; line-height: 1.4; outline: none;
}
.ai-draft-input:focus { border-color: var(--blue); background: #fff; }
.ai-draft-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  background: linear-gradient(135deg, #0b5389 0%, #5856d6 100%);
  color: #fff; border: none; border-radius: 8px; padding: 9px 14px;
  font-size: 13px; font-weight: 600; font-family: inherit; cursor: pointer;
}
.ai-draft-btn:hover { opacity: 0.88; }
.ai-draft-btn.loading { opacity: 0.6; pointer-events: none; }
.ai-draft-result {
  background: #f8f9ff; border: 1px solid #dde4ff; border-radius: 10px; padding: 12px;
}
.ai-draft-text { font-size: 13px; color: var(--text-dark); line-height: 1.6; margin-bottom: 10px; }
.ai-draft-actions { display: flex; gap: 8px; }
.ai-draft-copy, .ai-draft-send {
  flex: 1; padding: 7px; border-radius: 7px; font-size: 12px;
  font-weight: 600; cursor: pointer; font-family: inherit; border: none;
}
.ai-draft-copy { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }
.ai-draft-copy:hover { background: #e8edf2; }
.ai-draft-send { background: var(--blue); color: #fff; }
.ai-draft-send:hover { background: #0a4070; }

/* Quick actions grid */
.ai-actions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ai-action-card {
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 10px; cursor: pointer; text-align: center;
  transition: background 0.12s, border-color 0.12s;
}
.ai-action-card:hover { background: var(--blue-light); border-color: #c0d8f0; }
.ai-action-icon { font-size: 20px; margin-bottom: 5px; }
.ai-action-label { font-size: 11px; font-weight: 600; color: var(--text-dark); }
.ai-action-sub { font-size: 10px; color: var(--text-faint); margin-top: 2px; }

@media (max-width: 980px) {
  .ai-panel { width: 290px; }
}

/* ═══════════════════════════════════════════
   FILE SHARING
═══════════════════════════════════════════ */

/* Attach button in composer */
.composer-attach-btn {
  flex-shrink: 0; background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 6px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  transition: color .15s, background .15s;
}
.composer-attach-btn:hover { color: var(--blue); background: #eef4ff; }

/* File preview strip (above composer, when files staged) */
.file-preview-strip {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 8px 14px 0; border-top: 1px solid var(--border);
}
.file-preview-chip {
  display: flex; align-items: center; gap: 6px;
  background: #f0f4ff; border: 1px solid #d0daff;
  border-radius: 8px; padding: 5px 8px;
  font-size: 12px; color: var(--text-dark); max-width: 180px;
}
.file-preview-chip .chip-icon { font-size: 16px; flex-shrink: 0; }
.file-preview-chip .chip-name {
  flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-weight: 500;
}
.file-preview-chip .chip-remove {
  flex-shrink: 0; cursor: pointer; color: #8a9bb0;
  font-size: 14px; line-height: 1; margin-left: 2px;
}
.file-preview-chip .chip-remove:hover { color: #e74c3c; }

/* Image thumbnail chip */
.file-preview-chip.chip-image { padding: 4px; gap: 6px; }
.chip-thumb {
  width: 36px; height: 36px; border-radius: 6px;
  object-fit: cover; display: block;
}

/* Drag-over state on chat area */
.chat-area.drag-over {
  outline: 2px dashed var(--blue);
  outline-offset: -6px;
  background: #f0f6ff;
}

/* ── Message attachment card ── */
.msg-attachment {
  margin-top: 6px; display: flex; flex-direction: column; gap: 6px;
}

/* Image attachment */
.attach-image {
  max-width: 280px; max-height: 200px; border-radius: 10px;
  object-fit: cover; display: block; cursor: pointer;
  border: 1px solid var(--border);
  transition: opacity .15s;
}
.attach-image:hover { opacity: .88; }

/* File card (non-image) */
.attach-file-card {
  display: flex; align-items: center; gap: 10px;
  background: #f8f9fc; border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px;
  max-width: 280px; cursor: pointer; text-decoration: none;
  transition: background .15s;
}
.attach-file-card:hover { background: #eef2ff; }
.attach-file-icon {
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.attach-file-meta { flex: 1; overflow: hidden; }
.attach-file-name {
  font-size: 13px; font-weight: 600; color: var(--text-dark);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.attach-file-size { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.attach-file-dl {
  color: var(--blue); flex-shrink: 0;
}

/* Lightbox overlay */
.lightbox-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.82);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999; cursor: zoom-out; animation: fadeIn .15s;
}
.lightbox-overlay img {
  max-width: 92vw; max-height: 92vh; border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
}

/* ═══════════════════════════════════════════
   LANGUAGE SWITCHER
═══════════════════════════════════════════ */
.lang-switcher {
  display: flex; align-items: center; gap: 5px;
  padding: 8px 14px 0; flex-wrap: wrap;
}
.lang-switcher-label {
  font-size: 11px; color: var(--text-muted); font-weight: 500; margin-right: 2px;
}
.lang-btn {
  background: none; border: 1px solid var(--border); border-radius: 7px;
  padding: 3px 8px; font-size: 11px; font-weight: 600; cursor: pointer;
  color: var(--text-muted); font-family: inherit; transition: all .15s;
  display: flex; align-items: center; gap: 3px;
}
.lang-btn:hover { border-color: var(--blue); color: var(--blue); }
.lang-btn.active { background: var(--blue); border-color: var(--blue); color: #fff; }

/* ═══════════════════════════════════════════
   VOICE AGENT PANEL
═══════════════════════════════════════════ */

/* Tab switcher inside AI panel */
.ai-panel-tabs {
  display: flex; border-bottom: 1px solid var(--border);
  padding: 0 16px; gap: 0; flex-shrink: 0;
}
.ai-panel-tab {
  flex: 1; padding: 10px 8px; font-size: 12px; font-weight: 600;
  color: var(--text-muted); cursor: pointer; text-align: center;
  border-bottom: 2px solid transparent; transition: all .15s;
  background: none; border-top: none; border-left: none; border-right: none;
  font-family: inherit;
}
.ai-panel-tab.active { color: var(--blue); border-bottom-color: var(--blue); }

/* Agent conversation area */
.agent-pane { display: flex; flex-direction: column; flex: 1; overflow: hidden; }
.agent-messages {
  flex: 1; overflow-y: auto; padding: 14px 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.agent-bubble {
  max-width: 88%; border-radius: 14px; padding: 10px 13px;
  font-size: 13px; line-height: 1.5;
}
.agent-bubble.agent { background: #f0f4ff; color: var(--text-dark); align-self: flex-start; border-bottom-left-radius: 4px; }
.agent-bubble.user  { background: var(--blue); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.agent-bubble.action {
  background: #e8f8ee; border: 1px solid #b8e8c8; color: #1a6640;
  align-self: flex-start; font-size: 12px; border-bottom-left-radius: 4px;
}
.agent-bubble.error { background: #fdecea; color: #c0392b; align-self: flex-start; font-size: 12px; }

/* Action chip inside bubble */
.agent-action-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(255,255,255,0.6); border-radius: 20px;
  padding: 2px 8px; font-size: 11px; font-weight: 600; margin-top: 4px;
}

/* Voice orb */
.agent-voice-area {
  padding: 16px; border-top: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  flex-shrink: 0;
}
.agent-orb {
  width: 64px; height: 64px; border-radius: 50%;
  background: linear-gradient(135deg, #0b5389 0%, #5856d6 100%);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: transform .15s, box-shadow .15s;
  box-shadow: 0 4px 16px rgba(11,83,137,0.3);
  position: relative; flex-shrink: 0;
}
.agent-orb:hover { transform: scale(1.06); box-shadow: 0 6px 24px rgba(11,83,137,0.4); }
.agent-orb.listening {
  animation: orbPulse 1.2s ease-in-out infinite;
  box-shadow: 0 0 0 0 rgba(11,83,137,0.5);
}
.agent-orb.speaking {
  animation: orbSpeak 0.6s ease-in-out infinite alternate;
}
.agent-orb.thinking {
  animation: orbThink 1s linear infinite;
}
@keyframes orbPulse {
  0%   { box-shadow: 0 0 0 0 rgba(88,86,214,0.5); }
  70%  { box-shadow: 0 0 0 18px rgba(88,86,214,0); }
  100% { box-shadow: 0 0 0 0 rgba(88,86,214,0); }
}
@keyframes orbSpeak {
  from { transform: scale(1); }
  to   { transform: scale(1.08); }
}
@keyframes orbThink {
  from { filter: hue-rotate(0deg); }
  to   { filter: hue-rotate(30deg); }
}
.agent-orb-icon { color: #fff; pointer-events: none; }
.agent-orb-waves {
  display: none; position: absolute; inset: 0; border-radius: 50%;
}
.agent-orb.listening .agent-orb-waves { display: block; }

.agent-status {
  font-size: 12px; color: var(--text-muted); font-weight: 500; text-align: center;
}
.agent-status.active { color: var(--blue); }

/* Text input fallback */
.agent-text-row {
  display: flex; gap: 8px; width: 100%;
}
.agent-text-input {
  flex: 1; border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 12px; font-size: 13px; font-family: inherit;
  color: var(--text-dark); background: var(--bg); outline: none;
  resize: none;
}
.agent-text-input:focus { border-color: var(--blue); }
.agent-text-send {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--blue); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: opacity .15s; flex-shrink: 0;
}
.agent-text-send:hover { opacity: .85; }

/* ═══════════════════════════════════════════════
   NOTIFICATION BELL
═══════════════════════════════════════════════ */
.notif-bell-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.notif-bell-btn {
  width: 36px; height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-hover);
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .15s, color .15s;
  position: relative;
}
.notif-bell-btn:hover { background: var(--bg-active); color: var(--blue); }
.notif-badge {
  position: absolute; top: -5px; right: -5px;
  background: #e53e3e; color: #fff;
  font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
  pointer-events: none;
}

/* ── Notification dropdown panel ── */
.notif-panel {
  position: absolute; top: calc(100% + 10px); right: 0;
  width: 300px;
  background: var(--sidebar);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.14);
  z-index: 600;
  overflow: hidden;
}
.notif-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px 8px;
  border-bottom: 1px solid var(--border);
}
.notif-panel-title {
  font-size: 12px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .06em;
}
.notif-clear-btn {
  font-size: 11px; color: var(--blue); background: none; border: none;
  cursor: pointer; padding: 0; font-family: inherit;
}
.notif-clear-btn:hover { text-decoration: underline; }
.notif-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .12s;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg-hover); }
.notif-title { font-size: 13px; font-weight: 600; color: var(--text-dark); }
.notif-body { font-size: 12px; color: var(--text-muted); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-time { font-size: 11px; color: var(--text-muted); opacity: .7; margin-top: 3px; }
.notif-empty {
  padding: 20px 14px;
  font-size: 13px; color: var(--text-muted);
  text-align: center;
}

/* ═══════════════════════════════════════════════
   CREATE CHANNEL MODAL
═══════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 900;
}
.modal-box {
  background: var(--sidebar);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 400px;
  max-width: calc(100vw - 40px);
  box-shadow: 0 16px 48px rgba(0,0,0,.18);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 15px; font-weight: 700; color: var(--text-dark); }
.modal-close {
  width: 28px; height: 28px; border-radius: 8px;
  border: none; background: var(--bg-hover);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.modal-close:hover { background: var(--bg-active); }
.modal-body { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-field { display: flex; flex-direction: column; gap: 6px; }
.modal-label { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.modal-input {
  border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 11px; font-size: 13px; font-family: inherit;
  color: var(--text-dark); background: var(--bg); outline: none;
}
.modal-input:focus { border-color: var(--blue); }
.modal-footer {
  display: flex; gap: 8px; justify-content: flex-end;
  padding: 14px 20px 18px;
  border-top: 1px solid var(--border);
}
.modal-btn-secondary {
  padding: 8px 16px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg);
  color: var(--text-muted); font-size: 13px; font-family: inherit;
  cursor: pointer; transition: background .15s;
}
.modal-btn-secondary:hover { background: var(--bg-hover); }
.modal-btn-primary {
  padding: 8px 18px; border-radius: 8px;
  border: none; background: var(--blue);
  color: #fff; font-size: 13px; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: opacity .15s;
}
.modal-btn-primary:hover { opacity: .88; }

/* ═══════════════════════════════════════════════
   MESSAGE EDIT / DELETE
═══════════════════════════════════════════════ */
/* Show action buttons on hover */
.msg-row .msg-actions { opacity: 0; }
.msg-row:hover .msg-actions { opacity: 1; }

.msg-del-btn { color: #e53e3e !important; }
.msg-del-btn:hover { background: rgba(229,62,62,.08) !important; }

.msg-edited {
  font-size: 11px; color: var(--text-muted); opacity: .7;
  font-style: italic;
}

/* Inline edit */
.msg-edit-wrap {
  display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
  margin-top: 2px;
}
.msg-edit-input {
  flex: 1; min-width: 120px;
  border: 1px solid var(--blue); border-radius: 7px;
  padding: 5px 9px; font-size: 13px; font-family: inherit;
  color: var(--text-dark); background: var(--bg); outline: none;
}
.msg-edit-save, .msg-edit-cancel {
  padding: 4px 10px; border-radius: 6px;
  font-size: 12px; font-family: inherit;
  cursor: pointer; border: none;
}
.msg-edit-save { background: var(--blue); color: #fff; font-weight: 600; }
.msg-edit-cancel { background: var(--bg-hover); color: var(--text-muted); }
.msg-edit-save:hover { opacity: .85; }
.msg-edit-cancel:hover { background: var(--bg-active); }
