/* Tokens mirror design.avanxo.md. Keep in sync. */
:root {
  --canvas: #FAFBF8;
  --surface: #FCFCF9;
  --surface-elevated: #FFFFFF;
  --border: #D9E7FD;
  --border-strong: #C6DAFC;
  --text: #0A1128;
  --text-strong: #172033;
  --text-secondary: #4A5870;
  --text-muted: #66748D;
  --brand-navy: #0A1128;
  --primary: #4285F4;
  --primary-hover: #5B9BF7;
  --on-primary: #0A1128;
  --accent-text: #2F6FD6;
  --focus: #4285F4;
  --success: #1F7A4D;
  --success-bg: #EEF7F1;
  --success-border: #CFE8D9;
  --error: #B42318;
  --error-bg: #FDF1F0;
  --error-border: #F3C9C5;
  --font-sans: 'Manrope', system-ui, sans-serif;
  --font-mono: 'Fira Code', monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--canvas); color: var(--text-strong); font-family: var(--font-sans); font-size: 14px; line-height: 22px; }
h1 { font-size: 22px; line-height: 28px; font-weight: 600; letter-spacing: -0.01em; color: var(--text); margin: 0; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: 0 0 0 3px rgb(66 133 244 / 0.4); border-radius: 8px; }

/* ---- Components (rewritten: forms and corner logo) ---- */
.shell { position: relative; min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 72px 16px 48px; }
.corner-logo { position: absolute; top: 20px; left: 20px; display: inline-flex; background: none; padding: 0; }
.corner-logo img { height: 22px; width: auto; display: block; }
.card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 32px; display: flex; flex-direction: column; gap: 24px; }
.auth-head { display: flex; flex-direction: column; gap: 8px; }
.auth-head .eyebrow { font-size: 13px; font-weight: 500; color: var(--text-muted); }
.auth-head p { color: var(--text-secondary); font-size: 14px; }
.form { display: flex; flex-direction: column; gap: 20px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.label { font-size: 13px; font-weight: 500; color: var(--text-strong); }
.input { height: 40px; width: 100%; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface-elevated); padding: 0 12px; font-size: 15px; color: var(--text); }
.input::placeholder { color: var(--text-muted); }
.input:focus { border-color: var(--focus); box-shadow: 0 0 0 3px rgb(66 133 244 / .25); outline: none; }
.input[aria-invalid="true"] { border-color: var(--error); }
.hint { font-size: 13px; color: var(--text-muted); }
.error-text { font-size: 13px; color: var(--error); }
.btn { height: 40px; width: 100%; border-radius: 9999px; padding: 0 20px; font-size: 14px; font-weight: 600; cursor: pointer; border: 1px solid transparent; transition: background-color 150ms; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: transparent; border-color: var(--border-strong); color: var(--text); }
.btn-secondary:hover { background: var(--surface-elevated); }
.status { width: fit-content; border-radius: 8px; padding: 6px 12px; font-size: 13px; font-weight: 500; }
.status-success { background: var(--success-bg); border: 1px solid var(--success-border); color: var(--success); }
.code-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.code-row .input { text-align: center; font-family: var(--font-mono); font-size: 18px; font-weight: 500; padding: 0; }
.muted { font-size: 13px; color: var(--text-muted); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* Inbox layout */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { border-right: 1px solid var(--border); padding: 20px 16px; display: flex; flex-direction: column; gap: 24px; }
.sidebar .corner-logo { position: static; align-self: flex-start; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); padding: 0 12px 6px; }
.nav-item { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; min-height: 36px; padding: 6px 12px; border-radius: 8px; color: var(--text-secondary); text-decoration: none; background: none; border: 0; text-align: left; cursor: pointer; font-size: 14px; }
.nav-item:hover { background: var(--surface-elevated); }
.nav-item[aria-current="true"] { background: var(--surface-elevated); color: var(--text); font-weight: 600; }
.nav-item small { font-size: 12px; color: var(--text-muted); }
.main { display: flex; flex-direction: column; min-width: 0; }
.main-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 20px 28px; border-bottom: 1px solid var(--border); }
.main-head h1 { font-size: 22px; }
.main-head .sub { font-size: 13px; color: var(--text-secondary); }
.timeline { flex: 1; overflow-y: auto; padding: 28px; display: flex; flex-direction: column; gap: 16px; }
.msg { max-width: 560px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; }
.msg.out { align-self: flex-end; background: var(--surface-elevated); }
.msg-meta { font-size: 12px; color: var(--text-muted); }
.msg-meta strong { font-weight: 600; color: var(--text-secondary); }
.msg p { font-size: 14px; color: var(--text-strong); }
.composer { border-top: 1px solid var(--border); background: var(--surface); padding: 20px 28px; display: flex; flex-direction: column; gap: 16px; }
.composer-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.composer select { height: 40px; min-width: 200px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface-elevated); padding: 0 12px; font-size: 14px; color: var(--text); }
.composer textarea { border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface-elevated); padding: 12px; font-size: 14px; line-height: 22px; min-height: 96px; resize: vertical; color: var(--text); }
.composer textarea:focus, .composer select:focus { border-color: var(--focus); box-shadow: 0 0 0 3px rgb(66 133 244 / .25); outline: none; }
.composer .actions { display: flex; justify-content: flex-end; gap: 12px; align-items: center; }
.composer .actions .btn { width: auto; min-width: 180px; }
.composer .actions .btn-secondary { min-width: 0; }
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--border); flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 12px 16px; }
  .sidebar .corner-logo { margin-right: 4px; }
  .nav-group { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px; }
  .nav-title { display: none; }
  .nav-item { min-height: 32px; padding: 4px 10px; font-size: 13px; }
  .nav-item small { display: none; }
  .main-head { padding: 16px; flex-wrap: wrap; }
  .timeline { padding: 16px; }
  .msg { max-width: 100%; }
  .composer { padding: 16px; }
  .composer .actions .btn { min-width: 0; flex: 1; }
  .shell { padding-top: 64px; }
}

/* Client -> projects navigation and project cards */
.nav-client { display: flex; flex-direction: column; gap: 2px; }
.nav-client-name { font-weight: 600; color: var(--text); }
.nav-subs { display: flex; flex-direction: column; gap: 2px; padding-left: 12px; border-left: 1px solid var(--border); margin-left: 12px; }
.nav-sub { background: none; border: 0; text-align: left; padding: 6px 10px; border-radius: 8px; font-size: 13px; color: var(--text-secondary); cursor: pointer; }
.nav-sub:hover { background: var(--surface-elevated); }
.nav-sub[aria-current="true"] { background: var(--surface-elevated); color: var(--text); font-weight: 600; }
.crumbs { font-size: 13px; color: var(--text-muted); margin-bottom: 4px; }
.crumbs .link { font-size: 13px; }
.project-list { display: flex; flex-direction: column; gap: 12px; max-width: 720px; }
.project-card { text-align: left; display: grid; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; cursor: pointer; }
.project-card:hover { background: var(--surface-elevated); }
.pc-name { font-size: 15px; font-weight: 600; color: var(--text); }
.pc-prev { font-size: 14px; color: var(--text-strong); }
.pc-meta { font-size: 12px; color: var(--text-muted); }

/* Channel icons (replace text prefixes). Icon + hidden text keeps meaning for screen readers. */
.ch { display: inline-flex; align-items: center; vertical-align: -3px; color: var(--text-secondary); }
.ch img { width: 16px; height: 16px; display: block; filter: grayscale(1); opacity: .8; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
/* Text link (breadcrumb): plain text, no border or chip */
.link { background: none; border: 0; padding: 0; margin: 0; font: inherit; color: var(--accent-text); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link:hover { color: var(--text); }

/* Client & project details */
.client-body { gap: 20px; }
.section-title { font-size: 13px; font-weight: 600; color: var(--text-strong); margin-top: 8px; }
.plan-card { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; }
.plan-card .label { margin: 0; }
.plan-name { font-size: 16px; font-weight: 600; color: var(--text); }
.status-pill { font-size: 12px; font-weight: 500; color: var(--success); background: var(--success-bg); border: 1px solid var(--success-border); border-radius: 8px; padding: 2px 10px; }
.contact-list { display: flex; flex-direction: column; gap: 12px; max-width: 760px; }
.contact-row { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; }
.contact-name { font-size: 15px; font-weight: 600; color: var(--text); }
.contact-channel { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary); align-self: start; }
.contact-channel .ch img { width: 16px; height: 16px; filter: grayscale(1); opacity: .8; }
.contact-meta { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; margin: 4px 0 0; }
.contact-meta div { display: flex; flex-direction: column; gap: 2px; }
.contact-meta dt { font-size: 12px; color: var(--text-muted); }
.contact-meta dd { margin: 0; font-size: 13px; color: var(--text-strong); }
.tabs { display: flex; gap: 4px; padding: 0 28px; border-bottom: 1px solid var(--border); }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 4px; margin-right: 16px; font-size: 14px; color: var(--text-secondary); cursor: pointer; }
.tab[aria-selected="true"] { color: var(--text); font-weight: 600; border-bottom-color: var(--focus); }
.site-state { font-size: 13px; color: var(--text-secondary); }
.site-state.ok::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--success); margin-right: 6px; }
.quota { display: flex; flex-direction: column; gap: 6px; max-width: 560px; }
.quota-top { display: flex; justify-content: space-between; font-size: 14px; color: var(--text-strong); }
.bar { height: 8px; background: var(--surface-elevated); border: 1px solid var(--border); border-radius: 9999px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--primary); }
.quota .note { font-size: 13px; color: var(--error); }
.goal-row { display: flex; justify-content: space-between; max-width: 560px; font-size: 14px; color: var(--text-strong); border-bottom: 1px solid var(--border); padding: 8px 0; }
@media (max-width: 760px) { .contact-meta { grid-template-columns: 1fr 1fr; } .tabs { padding: 0 16px; } }

/* ---- Project workspace: contacts list + one chat per contact ---- */
.workspace { flex: 1; display: grid; grid-template-columns: 300px minmax(0, 1fr); min-height: 0; }
.contact-col { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.col-head { padding: 20px 16px 12px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.col-title { font-size: 15px; font-weight: 600; color: var(--text); margin: 0; }
.contact-items { overflow-y: auto; display: flex; flex-direction: column; padding: 8px; gap: 2px; }
.contact-item { display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 12px; text-align: left; background: none; border: 0; border-radius: 12px; padding: 10px; cursor: pointer; }
.contact-item:hover { background: var(--surface-elevated); }
.contact-item[aria-current="true"] { background: var(--surface-elevated); box-shadow: inset 2px 0 0 var(--focus); }
.avatar { width: 36px; height: 36px; border-radius: 9999px; border: 1px solid var(--border-strong); background: var(--surface); display: inline-grid; place-items: center; font-size: 13px; font-weight: 600; color: var(--text-strong); flex: none; }
.ci-text { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.ci-top { display: flex; justify-content: space-between; gap: 8px; }
.ci-name { font-size: 14px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ci-time { font-size: 12px; color: var(--text-muted); flex: none; }
.ci-prev { font-size: 13px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-dot img { width: 14px; height: 14px; filter: grayscale(1); opacity: .7; display: block; }
.chat-col { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 16px 28px; border-bottom: 1px solid var(--border); }
.chat-head h1 { font-size: 18px; line-height: 24px; }
.chat-head .sub { font-size: 13px; color: var(--text-secondary); }
.chat-col .timeline { flex: 1; overflow-y: auto; padding: 24px 28px; display: flex; flex-direction: column; gap: 14px; }
.chat-col .msg-meta { display: flex; align-items: center; gap: 6px; }
.chat-col .msg-meta .ch img { width: 14px; height: 14px; filter: grayscale(1); opacity: .7; display: block; }
.pad { padding: 8px 0; }
/* Composer: channel icons and send icon inside the same box */
.composer { margin: 0 28px 24px; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface-elevated); padding: 12px 12px 10px; display: flex; flex-direction: column; gap: 8px; }
.composer textarea { border: 0; outline: 0; resize: none; background: transparent; font-size: 14px; line-height: 22px; color: var(--text); min-height: 44px; padding: 2px 4px; }
.composer textarea::placeholder { color: var(--text-muted); }
.composer:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px rgb(66 133 244 / .2); }
.composer-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.channel-switch { display: inline-flex; gap: 4px; }
.ch-btn { width: 32px; height: 32px; border-radius: 8px; border: 1px solid transparent; background: transparent; display: grid; place-items: center; cursor: pointer; }
.ch-btn img { width: 16px; height: 16px; filter: grayscale(1); opacity: .4; }
.ch-btn:hover { background: var(--surface); }
.ch-btn[aria-pressed="true"] { border-color: var(--border-strong); background: var(--surface); }
.ch-btn[aria-pressed="true"] img { opacity: 1; }
.ch-btn:disabled { opacity: .35; cursor: not-allowed; }
.composer-actions { display: inline-flex; align-items: center; gap: 6px; }
.icon-btn, .send-btn { width: 32px; height: 32px; border-radius: 9999px; display: grid; place-items: center; cursor: pointer; border: 1px solid transparent; }
.icon-btn { background: transparent; color: var(--text-secondary); border-color: var(--border); }
.icon-btn:hover { color: var(--text); background: var(--surface); }
.send-btn { background: var(--primary); color: var(--on-primary); }
.send-btn:hover { background: var(--primary-hover); }
.icon-btn svg, .send-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.composer-status { font-size: 13px; color: var(--success); }
.composer-status:empty { display: none; }
.draft-note { font-size: 13px; color: var(--accent-text); padding: 0 4px; }
@media (max-width: 760px) {
  .workspace { grid-template-columns: 1fr; }
  .contact-col { border-right: 0; border-bottom: 1px solid var(--border); }
  .contact-items { max-height: 240px; }
  .chat-head, .chat-col .timeline { padding-left: 16px; padding-right: 16px; }
  .composer { margin: 0 16px 16px; }
}

/* ---- Sidebar contacts (per project) and one merged chat per contact ---- */
#sidebar-contacts { display: flex; flex-direction: column; gap: 2px; }
.contact-item { display: grid; grid-template-columns: 32px 1fr; gap: 10px; align-items: start; text-align: left; background: none; border: 0; border-radius: 10px; padding: 8px 10px; cursor: pointer; }
.contact-item:hover { background: var(--surface-elevated); }
.contact-item[aria-current="true"] { background: var(--surface-elevated); box-shadow: inset 2px 0 0 var(--focus); }
.avatar { width: 32px; height: 32px; border-radius: 9999px; border: 1px solid var(--border-strong); background: var(--surface); display: inline-grid; place-items: center; font-size: 12px; font-weight: 600; color: var(--text-strong); flex: none; }
.ci-text { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.ci-top { display: flex; justify-content: space-between; gap: 8px; }
.ci-name { font-size: 14px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ci-time { font-size: 11px; color: var(--text-muted); flex: none; }
.ci-prev { font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ci-chans { display: inline-flex; gap: 6px; margin-top: 3px; }
.ci-chans img, .chat-chans img { filter: grayscale(1); opacity: .65; display: block; }
.workspace { flex: 1; display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.chat-col { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 16px 28px; border-bottom: 1px solid var(--border); }
.chat-id { flex: 1; min-width: 0; }
.chat-id h1 { font-size: 18px; line-height: 24px; }
.chat-id .sub { font-size: 13px; color: var(--text-secondary); }
.chat-chans { display: inline-flex; gap: 10px; }
.chat-col .timeline { flex: 1; overflow-y: auto; padding: 24px 28px; display: flex; flex-direction: column; gap: 14px; }
.chat-col .msg-meta { display: flex; align-items: center; gap: 6px; }
.chat-col .msg-meta img { filter: grayscale(1); opacity: .7; }
.pad { padding: 8px 0; }
.composer { margin: 0 28px 24px; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface-elevated); padding: 12px 12px 10px; display: flex; flex-direction: column; gap: 8px; }
.composer textarea { border: 0; outline: 0; resize: none; background: transparent; font-size: 14px; line-height: 22px; color: var(--text); min-height: 44px; padding: 2px 4px; }
.composer textarea::placeholder { color: var(--text-muted); }
.composer:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px rgb(66 133 244 / .2); }
.composer-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.channel-switch { display: inline-flex; gap: 4px; }
.ch-btn { width: 32px; height: 32px; border-radius: 8px; border: 1px solid transparent; background: transparent; display: grid; place-items: center; cursor: pointer; }
.ch-btn img { width: 16px; height: 16px; filter: grayscale(1); opacity: .4; }
.ch-btn:hover { background: var(--surface); }
.ch-btn[aria-pressed="true"] { border-color: var(--border-strong); background: var(--surface); }
.ch-btn[aria-pressed="true"] img { opacity: 1; }
.composer-actions { display: inline-flex; align-items: center; gap: 6px; }
.icon-btn, .send-btn { width: 32px; height: 32px; border-radius: 9999px; display: grid; place-items: center; cursor: pointer; border: 1px solid transparent; }
.icon-btn { background: transparent; color: var(--text-secondary); border-color: var(--border); }
.icon-btn:hover { color: var(--text); background: var(--surface); }
.send-btn { background: var(--primary); color: var(--on-primary); }
.send-btn:hover { background: var(--primary-hover); }
.icon-btn svg, .send-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.composer-status { font-size: 13px; color: var(--success); }
.composer-status:empty { display: none; }
@media (max-width: 760px) {
  .chat-head { padding: 16px; }
  .chat-col .timeline { padding: 16px; }
  .composer { margin: 0 16px 16px; }
}

/* Project summary entry in the sidebar */
.nav-summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; font-size: 13px; font-weight: 500; color: var(--accent-text); margin-bottom: 6px; border: 1px solid var(--border-strong); border-radius: 8px; padding: 6px 10px; background: transparent; }
.nav-summary::after { content: "→"; font-size: 14px; line-height: 1; }
.nav-summary:hover { background: var(--surface-elevated); text-decoration: underline; text-underline-offset: 3px; }
.nav-summary[aria-current="true"] { background: var(--surface-elevated); color: var(--text); }

/* ---- Project detail (Resumen) ---- */
.detail { gap: 20px; }
.row-end { display: flex; align-items: center; gap: 16px; }
.kpi-row { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.kpi-label { font-size: 12px; color: var(--text-muted); }
.kpi-value { font-size: 24px; line-height: 30px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.kpi-delta { font-size: 12px; color: var(--text-secondary); }
.grid { display: grid; grid-template-columns: repeat(12, minmax(0,1fr)); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.span-8 { grid-column: span 8; } .span-6 { grid-column: span 6; } .span-4 { grid-column: span 4; }
.card-title { font-size: 15px; font-weight: 600; color: var(--text); margin: 0; }
.chart-box { position: relative; height: 240px; min-width: 0; }
.chart-box.short { height: 160px; margin-top: 12px; }
.goal-list { display: flex; flex-direction: column; }
.goal-row { display: flex; justify-content: space-between; font-size: 14px; color: var(--text-strong); padding: 8px 0; border-bottom: 1px solid var(--border); }
.goal-status { font-weight: 500; color: var(--text); }
.score-num { font-size: 36px; line-height: 40px; font-weight: 600; color: var(--text); }
.health-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.vitals { display: flex; gap: 16px; margin: 0; }
.vitals div { display: flex; flex-direction: column; }
.vitals dt { font-size: 12px; color: var(--text-muted); }
.vitals dd { margin: 0; font-size: 14px; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.report-title { font-size: 14px; font-weight: 600; color: var(--text); }
.report-row { display: flex; }
.status-ok, .status-warn { font-size: 13px; font-weight: 500; border-radius: 8px; padding: 4px 10px; border: 1px solid var(--border-strong); color: var(--text-strong); }
.status-warn { background: var(--surface-elevated); border-style: dashed; }
.btn.small { width: auto; height: 32px; padding: 0 14px; font-size: 13px; align-self: flex-start; }
.empty { align-items: flex-start; }
.empty-title { font-size: 15px; font-weight: 600; color: var(--text); }
.sample-note { font-size: 12px; }
@media (max-width: 900px) {
  .kpi-row { grid-template-columns: 1fr 1fr; }
  .span-8, .span-6, .span-4 { grid-column: span 12; }
}

/* Empty states */
.empty-state { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; padding: 48px 32px; max-width: 420px; margin: 0 auto; }
.empty-state-title { font-size: 16px; font-weight: 600; color: var(--text); margin: 0; }
.empty-state p.muted { font-size: 14px; line-height: 22px; margin: 0 0 6px; }
.sidebar-empty { font-size: 13px; color: var(--text-muted); padding: 4px 10px; margin: 0; }
#sidebar-contacts .btn.small { width: auto; align-self: flex-start; margin: 6px 10px 0; }

/* ---- Fit the viewport: app is exactly 100% height; only content areas scroll ---- */
html, body { height: 100%; overflow: hidden; }
.app { height: 100vh; height: 100dvh; min-height: 0; grid-template-rows: minmax(0, 1fr); overflow: hidden; }
.sidebar { min-height: 0; overflow-y: auto; }
#client-view.main { min-height: 0; height: 100%; overflow: hidden; }
.main-head, .chat-head, .composer { flex: none; }
.workspace, .chat-col { min-height: 0; }
.timeline, .chat-col .timeline { min-height: 0; overflow-y: auto; }
.empty-state { min-height: 0; }
@media (max-width: 760px) {
  html, body { height: auto; overflow: auto; }
  .app { height: auto; min-height: 100vh; overflow: visible; grid-template-rows: auto; }
  #client-view.main { height: auto; overflow: visible; }
  .sidebar { overflow: visible; }
  .timeline, .chat-col .timeline { overflow: visible; }
}

/* Empty state for a project without contacts */
.empty-state { gap: 12px; max-width: 440px; padding: 40px 24px; }
.empty-icon { width: 56px; height: 56px; border-radius: 9999px; border: 1px solid var(--border-strong); background: var(--surface); display: grid; place-items: center; margin-bottom: 4px; }
.empty-icon svg { width: 24px; height: 24px; fill: none; stroke: var(--primary); stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.empty-state h2.empty-state-title { font-size: 18px; line-height: 24px; }
.empty-channels { list-style: none; margin: 4px 0 8px; padding: 0; display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; font-size: 13px; color: var(--text-secondary); }
.empty-channels li { display: inline-flex; align-items: center; gap: 6px; }
.empty-channels img { filter: grayscale(1); opacity: .7; }
.empty-state .btn-primary.small { width: auto; min-width: 180px; height: 36px; font-size: 14px; }
.empty-state .link { font-size: 13px; }
.sidebar-empty { font-size: 13px; color: var(--text-muted); padding: 4px 12px; margin: 0; }

/* ---- Chat info panel ---- */
.chat-col { min-height: 0; }
.chat-split { flex: 1; min-height: 0; display: flex; }
.chat-main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.chat-head { gap: 12px; }
.info-toggle { margin-left: 4px; height: 32px; padding: 0 12px; border-radius: 9999px; border: 1px solid var(--border-strong); background: transparent; color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer; }
.info-toggle:hover { background: var(--surface-elevated); }
.info-toggle.on { background: var(--surface-elevated); border-color: var(--focus); }
.info-toggle:focus-visible { outline: none; box-shadow: 0 0 0 3px rgb(66 133 244 / .4); }
.chat-info { width: 300px; flex: none; border-left: 1px solid var(--border); overflow-y: auto; min-height: 0; padding: 24px 20px; display: flex; flex-direction: column; gap: 22px; }
.chat-info[hidden] { display: none; }
.info-profile { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; }
.avatar-lg { width: 72px; height: 72px; border-radius: 9999px; border: 1px solid var(--border-strong); background: var(--surface); display: grid; place-items: center; font-size: 22px; font-weight: 600; color: var(--text-strong); margin-bottom: 6px; }
.info-name { font-size: 16px; font-weight: 600; color: var(--text); margin: 0; }
.info-chans { display: inline-flex; gap: 10px; margin-top: 6px; }
.info-chans img, .chat-chans img { filter: grayscale(1); opacity: .65; }
.info-section { display: flex; flex-direction: column; gap: 10px; }
.info-title { font-size: 13px; font-weight: 600; color: var(--text-strong); margin: 0; }
.info-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 13px; }
.info-list .muted { font-size: 13px; }
.pins li { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; color: var(--text-strong); }
.pins small, .info-list small { font-size: 12px; color: var(--text-muted); }
.row-item { display: grid; grid-template-columns: 18px 1fr; gap: 10px; align-items: start; }
.row-item svg { width: 18px; height: 18px; fill: none; stroke: var(--text-secondary); stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; margin-top: 2px; }
.row-item span { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.row-item strong { font-weight: 500; color: var(--text-strong); }
.info-list a { color: var(--accent-text); text-decoration: underline; text-underline-offset: 3px; }
.thumbs { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; margin: 0; }
.thumb { margin: 0; display: flex; flex-direction: column; gap: 4px; }
.thumb svg { width: 100%; aspect-ratio: 1; padding: 22%; box-sizing: border-box; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); fill: none; stroke: var(--text-muted); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.thumb figcaption { font-size: 11px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Attachments inside messages */
.att { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; background: var(--surface-elevated); font-size: 13px; color: var(--text-strong); }
.att svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--text-secondary); stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.att span { display: flex; flex-direction: column; min-width: 0; }
.att small { font-size: 12px; color: var(--text-muted); }
.att a { color: var(--accent-text); text-decoration: underline; text-underline-offset: 3px; }
.att-image { min-height: 64px; justify-content: center; }
.att-image svg { width: 22px; height: 22px; }
@media (max-width: 1100px) { .chat-info { width: 260px; } }
@media (max-width: 760px) { .chat-split { flex-direction: column; } .chat-info { width: auto; border-left: 0; border-top: 1px solid var(--border); max-height: 50vh; } }

.chat-id h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-id .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head { min-width: 0; }
@media (max-width: 1100px) { .chat-chans { display: none; } }

/* ---- Info tabs ---- */
.tablist { display: flex; gap: 4px; border-bottom: 1px solid var(--border); }
.itab { background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; padding: 8px 6px; font-size: 13px; color: var(--text-secondary); cursor: pointer; white-space: nowrap; }
.itab:hover { color: var(--text); }
.itab[aria-selected="true"] { color: var(--text); font-weight: 600; border-bottom-color: var(--focus); }
.itab:focus-visible { outline: none; box-shadow: 0 0 0 3px rgb(66 133 244 / .4); border-radius: 6px; }
.itab-count { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.info-tabs { display: flex; flex-direction: column; gap: 12px; }
.info-tabs [role=tabpanel] { padding-top: 4px; }
.info-tabs-wrap { gap: 12px; }

/* ---- Pinned messages ---- */
.msg-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.msg-row.out { justify-content: flex-end; }
.msg-row .msg { align-self: auto; }
.msg.is-pinned { background: var(--surface-elevated); }
.pin-btn { width: 28px; height: 28px; flex: none; border-radius: 9999px; border: 1px solid transparent; background: transparent; color: var(--text-muted); display: grid; place-items: center; cursor: pointer; opacity: 0; transition: opacity 150ms, color 150ms, background-color 150ms; }
.pin-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.msg-row:hover .pin-btn, .pin-btn:focus-visible, .pin-btn[aria-pressed="true"] { opacity: 1; }
.pin-btn:hover { color: var(--text-strong); background: var(--surface); }
.pin-btn[aria-pressed="true"] { color: var(--focus); }
.pin-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgb(66 133 244 / .4); }
.pin-banner { flex: none; display: flex; align-items: center; gap: 10px; padding: 10px 28px; border-bottom: 1px solid var(--border); background: var(--surface); font-size: 13px; }
.pin-banner[hidden] { display: none; }
.pin-icon svg { width: 16px; height: 16px; fill: none; stroke: var(--focus); stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; display: block; }
.pin-body { display: flex; gap: 8px; min-width: 0; }
.pin-count { font-weight: 600; color: var(--text-strong); white-space: nowrap; }
.pin-text { color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 760px) { .pin-banner { padding: 10px 16px; } .pin-btn { opacity: 1; } }

/* The pin icon keeps its own diagonal, which already reads as tilted 45 degrees */
.pin-btn svg, .pin-icon svg { transform: none; }

/* Pin as a rounded circle: larger touch target, filled circle when pinned */
.pin-btn { width: 36px; height: 36px; border-radius: 9999px; border: 1px solid transparent; }
.msg-row:hover .pin-btn { background: var(--surface); border-color: var(--border); }
.pin-btn[aria-pressed="true"] { background: rgb(66 133 244 / .12); border-color: var(--focus); color: var(--focus); }
.pin-btn[aria-pressed="true"]:hover { background: rgb(66 133 244 / .2); }
.pin-btn:active { transform: scale(.96); }
@media (pointer: coarse) { .pin-btn { width: 40px; height: 40px; } }

/* Empty state: primary button and text link share one centre axis */
.empty-state > .btn { align-self: center; width: 200px; min-width: 0; margin: 0; }
.empty-state > .link { align-self: center; }

/* Collapsible clients in the sidebar */
.nav-client-row { display: flex; align-items: center; gap: 4px; }
.nav-client-row .nav-client-name { flex: 1; min-width: 0; }
.nav-toggle { width: 28px; height: 28px; flex: none; border-radius: 9999px; border: 1px solid transparent; background: transparent; color: var(--text-muted); display: grid; place-items: center; cursor: pointer; }
.nav-toggle:hover { background: var(--surface-elevated); color: var(--text-strong); }
.nav-toggle:focus-visible { outline: none; box-shadow: 0 0 0 3px rgb(66 133 244 / .4); }
.nav-toggle svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform 150ms; }
.nav-toggle[aria-expanded="false"] svg { transform: rotate(-90deg); }
.nav-subs[hidden] { display: none; }

/* ---- Tasks (grouped table) ---- */
.tasks-grid { align-items: start; }
.task-group { display: flex; flex-direction: column; gap: 6px; }
.task-group + .task-group { margin-top: 20px; }
.group-title { font-size: 13px; font-weight: 600; color: var(--text-strong); margin: 0 0 4px; display: flex; align-items: center; gap: 8px; }
.group-count { font-size: 12px; font-weight: 500; color: var(--text-muted); border: 1px solid var(--border); border-radius: 9999px; padding: 0 8px; }
.task-table { display: flex; flex-direction: column; }
.task-head, .task-row { display: grid; grid-template-columns: minmax(0,1.1fr) minmax(0,1.6fr) 120px 88px 110px 96px; gap: 12px; align-items: center; padding: 0 8px; }
.task-head { font-size: 12px; font-weight: 500; color: var(--text-muted); padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.task-row { list-style: none; padding-top: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--border); cursor: pointer; font-size: 13px; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.task-row::-webkit-details-marker { display: none; }
.task-row:hover { background: var(--surface-elevated); }
.task-row:focus-visible { outline: none; box-shadow: 0 0 0 3px rgb(66 133 244 / .4); border-radius: 8px; }
.task-row-wrap[open] > .task-row { background: var(--surface-elevated); }
.task-name { font-family: var(--font-mono); font-size: 13px; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.c-scope { color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-status { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.c-start, .c-dur, .c-tok { color: var(--text-secondary); white-space: nowrap; }
.c-tok { color: var(--text-strong); }
.st-failed { color: var(--error); }
.task-body { padding: 12px 8px 16px; display: flex; flex-direction: column; gap: 10px; font-size: 14px; color: var(--text-strong); border-bottom: 1px solid var(--border); }
.task-body p { margin: 0; }
.task-err { color: var(--error); }
.task-meta { display: flex; gap: 24px; margin: 0; flex-wrap: wrap; }
.task-meta div { display: flex; flex-direction: column; }
.task-meta dt { font-size: 12px; color: var(--text-muted); }
.task-meta dd { margin: 0; font-size: 13px; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.model-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.model-list li { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); color: var(--text-strong); }
@media (max-width: 900px) {
  .task-head { display: none; }
  .task-row { grid-template-columns: 1fr 1fr; row-gap: 4px; }
  .c-scope { grid-column: 1 / -1; }
}

/* Tasks: table full width; tokens card below with chart and model list side by side */
.tokens-card { display: grid; grid-template-columns: minmax(0,2fr) minmax(0,1fr); gap: 8px 24px; align-items: start; }
.tokens-card > .card-title, .tokens-card > .muted { grid-column: 1 / -1; }
.tokens-card .group-title { margin-top: 0; }
@media (max-width: 900px) { .tokens-card { grid-template-columns: 1fr; } }

/* Full-width grid card (was missing) */
.span-12 { grid-column: 1 / -1; }

/* ---- Tasks view: responsive single column (no 12-col grid) ---- */
.tasks-stack { display: flex; flex-direction: column; gap: 16px; width: 100%; min-width: 0; }
.task-card { width: 100%; min-width: 0; }
.task-table { width: 100%; }
.task-row, .task-head { grid-template-columns: minmax(140px,1.1fr) minmax(160px,1.6fr) 110px 90px 100px 90px; }
.kpi-row { width: 100%; }
@media (max-width: 1100px) {
  .task-row, .task-head { grid-template-columns: minmax(120px,1fr) minmax(140px,1.4fr) 100px 80px 90px; }
  .task-head .c-tok-h, .task-row .c-tok { display: none; }
}
@media (max-width: 760px) {
  .task-head { display: none; }
  .task-row { grid-template-columns: 1fr auto; row-gap: 4px; padding-top: 12px; padding-bottom: 12px; }
  .task-row .c-scope { grid-column: 1 / -1; }
  .task-row .c-start, .task-row .c-dur, .task-row .c-tok { color: var(--text-muted); font-size: 12px; }
  .task-row .c-status { justify-self: end; }
}
.tokens-card { display: grid; grid-template-columns: minmax(0,2fr) minmax(0,1fr); gap: 8px 24px; align-items: start; }
@media (max-width: 900px) { .tokens-card { grid-template-columns: 1fr; } }

/* .card max-width:400px belongs to the auth screens only. Lift it inside detail and tasks views. */
.detail .card, .task-card { max-width: none; }

/* Sidebar client search and load more */
.client-search { width: 100%; height: 34px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface-elevated); padding: 0 10px; font-size: 13px; color: var(--text); margin: 0 0 8px; }
.client-search:focus { border-color: var(--focus); box-shadow: 0 0 0 3px rgb(66 133 244 / .25); outline: none; }
.load-more { width: 100%; height: 32px; margin-top: 6px; border-radius: 9999px; border: 1px solid var(--border-strong); background: transparent; color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer; }
.load-more:hover { background: var(--surface-elevated); }

/* Composer attachments: paperclip inside the bar, file preview chip above the text */
.composer-tools { display: flex; align-items: center; gap: 6px; min-width: 0; }
.attach-btn { position: relative; width: 32px; height: 32px; border-radius: 8px; border: 1px solid transparent; display: grid; place-items: center; cursor: pointer; color: var(--text-secondary); }
.attach-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.attach-btn:hover { background: var(--surface); color: var(--text-strong); }
.attach-btn:focus-within { box-shadow: 0 0 0 3px rgb(66 133 244 / .4); }
.attach-preview { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 0 2px 4px; }
.attach-preview[hidden] { display: none; }
.attach-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); font-size: 13px; color: var(--text-strong); max-width: 100%; }
.attach-chip svg { width: 16px; height: 16px; fill: none; stroke: var(--text-secondary); stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.attach-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.attach-size { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.attach-remove { width: 24px; height: 24px; border-radius: 9999px; border: 1px solid var(--border); background: transparent; color: var(--text-secondary); font-size: 16px; line-height: 1; cursor: pointer; }
.attach-remove:hover { color: var(--text); background: var(--surface); }
.attach-remove:focus-visible { outline: none; box-shadow: 0 0 0 3px rgb(66 133 244 / .4); }
.attach-error { width: 100%; margin: 0; font-size: 13px; color: var(--error); }
.attach-error[hidden] { display: none; }
.composer-bar { gap: 12px; }

/* Composer: no focus ring on the text area or its container (requested). */
.composer:focus-within { box-shadow: none; border-color: var(--border-strong); }
.composer textarea:focus, .composer textarea:focus-visible { outline: none; box-shadow: none; border-color: transparent; }

/* Configuración */
.integration-card { max-width: 560px; }
.integration-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.integration-actions .btn { width: auto; }

/* Sidebar sync icon */
.nav-title-row { display: flex; align-items: center; justify-content: space-between; padding-right: 4px; }
.nav-title-row .nav-title { margin: 0; }
.sync-btn { width: 28px; height: 28px; border-radius: 9999px; border: 1px solid transparent; background: transparent; color: var(--text-muted); display: grid; place-items: center; cursor: pointer; }
.sync-btn:hover { color: var(--text-strong); background: var(--surface-elevated); }
.sync-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgb(66 133 244 / .4); }
.sync-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sync-btn.htmx-request svg { animation: vspin 0.9s linear infinite; }
@keyframes vspin { to { transform: rotate(360deg); } }
.sync-flash { font-size: 12px; margin: 0 0 8px; }
@media (prefers-reduced-motion: reduce) { .sync-btn.htmx-request svg { animation: none; } }

/* UI icons from the andrsrxn set (static/icons/ui). Colour follows the text, size follows the class. */
.ico { width: 16px; height: 16px; display: block; fill: currentColor; flex: none; }
.ico-pin, .ico-clip, .ico-send, .ico-refresh, .ico-file { width: 16px; height: 16px; }
.ico-chev { width: 14px; height: 14px; }
.pin-btn .ico-pin { width: 16px; height: 16px; }
.pin-icon .ico-pin { color: var(--focus); }
.attach-btn .ico-clip { width: 16px; height: 16px; }
.send-btn .ico-send { width: 16px; height: 16px; color: var(--on-primary); }
.nav-toggle .ico-chev { transition: transform 150ms; }
.nav-toggle[aria-expanded="false"] .ico-chev { transform: rotate(-90deg); }
.sync-btn .ico-refresh { width: 16px; height: 16px; }
.sync-btn.htmx-request .ico-refresh { animation: vspin 0.9s linear infinite; }

/* Client page: contacts with their channels */
.contact-list { display: flex; flex-direction: column; gap: 8px; max-width: 720px; }
.contact-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.contact-name { font-size: 14px; font-weight: 600; color: var(--text); margin: 0; }
.contact-channels { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.ci-chan { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); }
.ci-chan img { filter: grayscale(1); opacity: .7; }

/* ---- Inbox: list and reader in two columns (design.avanxo.md tokens) ---- */
.mail { flex: 1; display: grid; grid-template-columns: 340px minmax(0, 1fr); min-height: 0; border-top: 1px solid var(--border); }
.mail-list { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--border); background: var(--surface); }
.mail-list-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.mail-list-title { font-size: 15px; line-height: 22px; font-weight: 600; color: var(--text); margin: 0; }
.mail-count { font-size: 13px; color: var(--text-muted); }
.mail-filters { display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.mail-chips { display: flex; gap: 6px; overflow-x: auto; min-width: 0; flex: 1; }
.mail-chip { flex: none; background: none; border: 1px solid var(--border); border-radius: 9999px; padding: 4px 12px; font-size: 13px; color: var(--text-secondary); cursor: pointer; white-space: nowrap; }
.mail-chip:hover { background: var(--surface-elevated); }
.mail-chip[aria-selected="true"] { background: var(--surface-elevated); border-color: var(--border-strong); color: var(--text); font-weight: 600; }
.mail-rows { flex: 1; overflow-y: auto; min-height: 0; }
.mail-row { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 12px; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--border); padding: 14px 20px; cursor: pointer; }
.mail-row:hover { background: var(--surface-elevated); }
.mail-row[aria-current="true"] { background: var(--surface-elevated); box-shadow: inset 2px 0 0 var(--primary); }
.mail-row-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mail-row-top { display: flex; justify-content: space-between; gap: 8px; min-width: 0; }
.mail-row-from { font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-row-date { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.mail-row-subject { font-size: 13px; color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-row-snippet { font-size: 13px; color: var(--text-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mail-empty { padding: 20px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--border); color: var(--accent-text); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; flex: none; }
.avatar-lg { width: 40px; height: 40px; font-size: 14px; }
.mail-reader { min-height: 0; overflow-y: auto; padding: 28px 40px; background: var(--canvas); }
.mail-message { display: flex; flex-direction: column; gap: 14px; width: 100%; }
.mail-message-content { max-width: 760px; display: flex; flex-direction: column; gap: 14px; }
.mail-message-head { display: flex; align-items: center; gap: 12px; }
.mail-message-who { min-width: 0; flex: 1; }
.mail-message-name { font-weight: 600; color: var(--text); }
.mail-message-subject { font-size: 20px; line-height: 28px; font-weight: 600; color: var(--text); letter-spacing: -0.01em; margin: 8px 0 0; }
.mail-meta { font-size: 13px; line-height: 18px; color: var(--text-muted); margin: 0; }
.mail-meta-end { white-space: nowrap; }
.mail-body { white-space: pre-wrap; font-size: 14px; line-height: 22px; color: var(--text-strong); padding-top: 8px; }
.mail-flash { padding: 10px 28px 0; }
@media (max-width: 760px) { .mail { grid-template-columns: 1fr; } .mail-list { max-height: 45vh; } .mail-reader { padding: 20px; } }

/* Inbox: project menu, project tags and reader paragraphs */
.mail-menu { position: relative; flex: none; }
.mail-menu-btn { list-style: none; cursor: pointer; width: 30px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 9999px; background: none; color: var(--text-secondary); font-size: 16px; line-height: 1; }
.mail-menu-btn::-webkit-details-marker { display: none; }
.mail-menu-btn:hover { background: var(--surface-elevated); }
.mail-menu[open] .mail-menu-btn { background: var(--surface-elevated); border-color: var(--border-strong); }
.mail-menu-panel { position: absolute; right: 0; top: 36px; z-index: 5; width: 260px; display: flex; flex-direction: column; gap: 10px; padding: 14px; background: var(--surface-elevated); border: 1px solid var(--border-strong); border-radius: 12px; }
.mail-menu-title { font-size: 12px; line-height: 18px; font-weight: 600; color: var(--text-muted); margin: 0; }
.mail-menu-item { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-strong); cursor: pointer; }
.mail-menu-item input { margin: 0; accent-color: var(--primary); }
.mail-tag { display: inline-block; max-width: 100%; padding: 0 8px; font-size: 12px; line-height: 18px; color: var(--accent-text); background: var(--surface-elevated); border: 1px solid var(--border-strong); border-radius: 9999px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; align-self: flex-start; }
.mail-body { padding-top: 16px; }
.mail-body p { margin: 0 0 14px; max-width: 68ch; font-size: 15px; line-height: 24px; color: var(--text-strong); white-space: pre-line; overflow-wrap: anywhere; }
.mail-message-head { padding-bottom: 16px; border-bottom: 1px solid var(--border); width: 100%; }
.mail-message-subject { margin-top: 18px; }
.mail-message > .mail-meta { display: flex; }
.mail-assign { display: flex; flex-direction: column; gap: 8px; max-width: 560px; padding-top: 12px; border-top: 1px solid var(--border); margin-top: 8px; }
.mail-assign-row { display: flex; gap: 8px; align-items: center; }
.mail-assign-row select { flex: 1; min-width: 0; }
.mail-submenu { width: 100%; }
.mail-submenu-btn { cursor: pointer; list-style: none; font-weight: 600; }
.mail-submenu-btn::-webkit-details-marker { display: none; }
.mail-submenu-list { display: flex; flex-direction: column; gap: 2px; max-height: 260px; overflow-y: auto; margin-top: 6px; }
.mail-submenu-item { width: 100%; text-align: left; background: none; border: 0; border-radius: 8px; padding: 6px 8px; font-size: 13px; color: var(--text-strong); cursor: pointer; }
.mail-submenu-item:hover { background: var(--surface); }
/* Enviar a: the contact list opens as a side panel beside the menu, with a chevron on the row */
.mail-submenu { position: relative; width: 100%; }
.mail-submenu-btn { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px; border-radius: 8px; cursor: pointer; list-style: none; font-weight: 600; }
.mail-submenu-btn::-webkit-details-marker { display: none; }
.mail-submenu-btn:hover, .mail-submenu[open] > .mail-submenu-btn { background: var(--surface); }
.mail-submenu-chev { font-size: 16px; line-height: 1; color: var(--text-muted); }
.mail-submenu-list { display: none; }
.mail-submenu[open] > .mail-submenu-list { display: flex; flex-direction: column; gap: 2px; position: absolute; top: 0; right: calc(100% + 8px); width: 280px; max-height: 320px; overflow-y: auto; margin: 0; padding: 8px; background: var(--surface-elevated); border: 1px solid var(--border-strong); border-radius: 12px; z-index: 6; }

/* ---- Menu (three dots): refined dropdown and side submenu, light theme, no shadows ---- */
.mail-menu-btn { width: 36px; height: 36px; border-radius: 9999px; border: 1px solid transparent; color: var(--text-secondary); transition: background 150ms ease-out, border-color 150ms ease-out; }
.mail-menu-btn:hover { background: var(--surface); border-color: var(--border); }
.mail-menu-btn:focus-visible, .mail-menu-item:focus-visible, .mail-submenu-item:focus-visible { outline: none; box-shadow: 0 0 0 3px rgb(66 133 244 / 0.4); }
.mail-menu-panel { top: 42px; right: 0; width: 248px; padding: 6px; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--surface-elevated); box-shadow: none; animation: mail-menu-in 150ms ease-out; transform-origin: top right; }
.mail-menu-item, .mail-submenu-btn { min-height: 40px; padding: 8px 10px; border-radius: 8px; font-size: 14px; line-height: 20px; font-weight: 500; color: var(--text-strong); transition: background 150ms ease-out; }
.mail-submenu-btn:hover, .mail-submenu[open] > .mail-submenu-btn { background: var(--surface); }
.mail-submenu-chev { font-size: 18px; color: var(--text-muted); transition: transform 150ms ease-out; }
.mail-submenu[open] > .mail-submenu-btn .mail-submenu-chev { transform: translateX(2px); }
.mail-submenu { position: static; }
.mail-submenu[open] > .mail-submenu-list { top: -7px; right: calc(100% + 6px); width: 272px; max-height: 340px; padding: 6px; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--surface-elevated); box-shadow: none; animation: mail-menu-in 150ms ease-out; transform-origin: top right; }
.mail-submenu-title { font-size: 12px; line-height: 18px; font-weight: 600; color: var(--text-muted); padding: 6px 10px 8px; margin: 0; }
.mail-submenu-form { display: flex; flex-direction: column; gap: 2px; margin: 0; }
.mail-submenu-item { display: flex; flex-direction: column; align-items: flex-start; gap: 0; min-height: 44px; padding: 8px 10px; border-radius: 8px; font-size: 14px; line-height: 20px; transition: background 150ms ease-out; }
.mail-submenu-item:hover { background: var(--surface); }
.mail-submenu-item[aria-current="true"] { background: var(--surface); box-shadow: inset 2px 0 0 var(--primary); }
.mail-submenu-name { font-weight: 600; color: var(--text); }
.mail-submenu-meta { font-size: 12px; line-height: 16px; color: var(--text-muted); }
@keyframes mail-menu-in { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .mail-menu-panel, .mail-submenu[open] > .mail-submenu-list { animation: none; } .mail-menu-btn, .mail-menu-item, .mail-submenu-btn, .mail-submenu-chev, .mail-submenu-item { transition: none; } }

/* ---- Threads: one row per conversation, the whole thread in the reader ---- */
.mail-count-pill { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; font-size: 12px; line-height: 18px; text-align: center; color: var(--accent-text); background: var(--surface-elevated); border: 1px solid var(--border-strong); border-radius: 9999px; vertical-align: 1px; }
.mail-thread { max-width: 100%; }
.mail-thread-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.mail-thread-head .mail-message-subject { margin-top: 0; }
.mail-meta-sep { margin: 0 6px; }
.mail-thread-flash { margin-top: 12px; }
.mail-thread-list { display: flex; flex-direction: column; gap: 0; max-width: 760px; }
.mail-msg { display: flex; flex-direction: column; gap: 10px; padding: 18px 0; border-bottom: 1px solid var(--border); }
.mail-msg:last-child { border-bottom: 0; }
.mail-msg-head { display: flex; align-items: center; gap: 12px; }
.mail-msg-out .avatar { background: var(--primary); color: var(--on-primary); }
.mail-badge { display: inline-block; margin-left: 6px; padding: 0 8px; font-size: 11px; line-height: 18px; font-weight: 600; color: var(--accent-text); background: var(--surface-elevated); border: 1px solid var(--border-strong); border-radius: 9999px; vertical-align: 1px; }
.mail-msg .mail-body { padding-top: 0; }
.mail-thread-head .mail-menu { flex: none; }

/* ---- Conversation: full-width rows, day separators, sender avatar and name with time ---- */
.msg-row { width: 100%; }
.msg-row .msg { flex: 0 1 auto; max-width: min(640px, 80%); }
.msg-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--border); color: var(--accent-text); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; flex: none; align-self: flex-start; margin-top: 2px; }
.msg-avatar.is-team { background: var(--primary); color: var(--on-primary); }
.msg-row.out .msg-avatar { order: 2; }
.msg-row.out .pin-btn { order: 0; }
.day-sep { display: flex; align-items: center; gap: 12px; margin: 12px 0 4px; font-size: 12px; font-weight: 600; color: var(--text-muted); }
.day-sep::before, .day-sep::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.msg-meta strong { font-weight: 600; color: var(--text-secondary); }

/* ---- Thread in the reader: one card per message, the latest open, older ones folded ---- */
.mail-thread-list { display: flex; flex-direction: column; gap: 10px; max-width: 760px; }
.mail-card { background: var(--surface-elevated); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; transition: border-color 150ms ease-out; }
.mail-card:hover { border-color: var(--border-strong); }
.mail-card.is-out { border-left: 3px solid var(--primary); }
.mail-card[open] { border-color: var(--border-strong); }
.mail-card-head { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 12px 16px; cursor: pointer; list-style: none; border-radius: 12px; }
.mail-card-head::-webkit-details-marker { display: none; }
.mail-card-head:focus-visible { outline: none; box-shadow: 0 0 0 3px rgb(66 133 244 / 0.4); }
.mail-card-who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mail-card-name { font-size: 14px; line-height: 20px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-card-snip { font-size: 13px; line-height: 18px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-card[open] > .mail-card-head .mail-card-snip { display: none; }
.mail-card-date { font-size: 12px; line-height: 18px; color: var(--text-muted); white-space: nowrap; flex: none; }
.mail-card-body { padding: 4px 16px 18px 60px; display: flex; flex-direction: column; gap: 8px; }
.mail-card-body .mail-meta { margin: 0; }
.mail-card-body .mail-body { padding-top: 6px; }
.mail-card-body .mail-body p { font-size: 14px; line-height: 22px; }
.mail-quoted { margin-top: 6px; }
.mail-quoted > summary { font-size: 13px; color: var(--accent-text); cursor: pointer; list-style: none; display: inline-block; border-radius: 6px; }
.mail-quoted > summary::-webkit-details-marker { display: none; }
.mail-quoted > summary:focus-visible { outline: none; box-shadow: 0 0 0 3px rgb(66 133 244 / 0.4); }
.mail-quoted pre { margin: 8px 0 0; padding-left: 12px; border-left: 2px solid var(--border); white-space: pre-wrap; font-family: var(--font-sans); font-size: 13px; line-height: 20px; color: var(--text-muted); }
@media (prefers-reduced-motion: reduce) { .mail-card { transition: none; } }

/* The thread uses the full width of the reader pane. */
.mail-thread, .mail-thread-list, .mail-thread-head { max-width: none; width: 100%; }
.mail-card-body .mail-body p { max-width: none; }

/* ---- Perfil de Vicky ---- */
.profile-row { display: flex; align-items: flex-start; gap: 20px; flex-wrap: wrap; }
.profile-photo { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border); flex: none; }
.profile-photo-empty { display: inline-flex; align-items: center; justify-content: center; background: var(--primary); color: var(--on-primary); font-size: 24px; font-weight: 600; }
.profile-form { flex: 1; min-width: 240px; max-width: 420px; }
.msg-avatar.is-photo { object-fit: cover; padding: 0; border: 1px solid var(--border); }

/* Conversation bubbles take the full width left after the avatar and the pin button. */
.msg-row .msg { flex: 1 1 0; min-width: 0; max-width: none; }

/* Bubbles use 90% of the row, leaving the avatar and pin button room. */
.msg-row .msg { flex: 0 1 90%; max-width: 90%; }

/* ---- Message text: paragraphs with their line breaks, and lists ---- */
.msg-p { margin: 0; font-size: 14px; line-height: 22px; color: var(--text-strong); white-space: pre-line; overflow-wrap: anywhere; }
.msg-p + .msg-p, .msg-list + .msg-p, .msg-p + .msg-list, .msg-list + .msg-list { margin-top: 8px; }
.msg-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; line-height: 22px; color: var(--text-strong); }
.msg-list li { padding-left: 2px; overflow-wrap: anywhere; }
ul.msg-list { list-style: disc; }
ol.msg-list { list-style: decimal; }
.msg-list li::marker { color: var(--text-muted); }
.mail-body .msg-list { margin-top: 8px; }

/* Channel icons in message metadata keep their brand colors. */
.msg-meta img, .chat-col .msg-meta img, .chat-col .msg-meta .ch img { filter: none; opacity: 1; }

/* Bubbles grow with their text, up to 72% of the row (90% reduced by 20%). Long messages fold after six lines. */
.msg-row .msg { flex: 0 1 auto; width: auto; max-width: 72%; min-width: 0; }
.msg-collapse { position: relative; }
.msg-collapse.is-clamped:not(.is-expanded) { max-height: 132px; overflow: hidden; }
.msg-collapse.is-clamped:not(.is-expanded)::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 40px; background: linear-gradient(to bottom, rgba(252, 252, 249, 0), var(--surface)); pointer-events: none; }
.msg-toggle { align-self: flex-start; margin-top: 2px; padding: 4px 6px; margin-left: -6px; background: none; border: 0; border-radius: 6px; font: inherit; font-size: 13px; line-height: 18px; font-weight: 600; color: var(--accent-text); cursor: pointer; }
.msg-toggle:hover { text-decoration: underline; }
.msg-toggle:focus-visible { outline: none; box-shadow: 0 0 0 3px rgb(66 133 244 / 0.4); }

/* Pinned messages in Info: each row can be unpinned */
.pin-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.pin-unpin { margin: 0; flex: none; }
.pin-unpin-btn { background: none; border: 1px solid var(--border); border-radius: 9999px; padding: 2px 10px; font: inherit; font-size: 12px; line-height: 18px; color: var(--text-secondary); cursor: pointer; }
.pin-unpin-btn:hover { color: var(--text); border-color: var(--border-strong); }
.pin-unpin-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgb(66 133 244 / 0.4); }

/* Info > Mensajes fijados: each row is text with its unpin button side by side (wins over .pins li) */
.pins li.pin-item { flex-direction: row; align-items: flex-start; justify-content: space-between; gap: 10px; }
.pins li.pin-item .pin-text { flex: 1; min-width: 0; white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; line-height: 20px; color: var(--text-strong); }
.pins .pin-unpin { margin: 0; flex: none; }

/* Conversation paging: sentinels load the next page when they come into view; a pinned message is highlighted */
.chat-more { font-size: 12px; line-height: 18px; color: var(--text-muted); text-align: center; padding: 8px 0; }
.pin-jump { background: none; border: 0; padding: 0; font: inherit; text-align: left; color: inherit; cursor: pointer; }
.pin-jump:hover { text-decoration: underline; }
.pin-jump:focus-visible { outline: none; box-shadow: 0 0 0 3px rgb(66 133 244 / 0.4); border-radius: 4px; }
.msg-row.is-focus .msg { animation: msg-focus 1.6s ease-out; }
@keyframes msg-focus { from { box-shadow: 0 0 0 4px rgb(66 133 244 / 0.45); } to { box-shadow: 0 0 0 4px rgb(66 133 244 / 0); } }
.chat-latest-bar { display: flex; justify-content: center; padding: 6px 0; }
.chat-latest { background: var(--surface-elevated); border: 1px solid var(--border-strong); border-radius: 9999px; padding: 6px 14px; font: inherit; font-size: 13px; font-weight: 600; color: var(--accent-text); cursor: pointer; }
.chat-latest:focus-visible { outline: none; box-shadow: 0 0 0 3px rgb(66 133 244 / 0.4); }
@media (prefers-reduced-motion: reduce) { .msg-row.is-focus .msg { animation: none; } }

/* Channel icons (Gmail, Mattermost, WhatsApp) keep their brand colors everywhere. Disabled buttons still fade. */
.ch img, .ch-dot img, .ci-chan img, .ci-chans img, .chat-chans img, .info-chans img,
.contact-channel .ch img, .chat-col .msg-meta .ch img, .chat-col .msg-meta img, .msg-meta img, .empty-channels img { filter: none; opacity: 1; }
.ch-btn:disabled img { opacity: .35; }
.chat-more-btn { background: var(--surface-elevated); border: 1px solid var(--border-strong); border-radius: 9999px; padding: 4px 14px; font: inherit; font-size: 13px; font-weight: 600; color: var(--accent-text); cursor: pointer; }
.chat-more-btn:hover { background: var(--surface); }
.chat-more-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgb(66 133 244 / 0.4); }

.ico-pin { transform: none; }

.ico-pin { display: inline-block; transform: none; }

/* Group threads: replies sit under the message they answer */
.thread-reply { margin-top: 10px; padding-left: 14px; border-left: 2px solid var(--border-strong); }

/* Directos: contacts on the left, the chat on the right, like the Inbox */
.general-chat .chat-timeline { padding: 16px 28px 24px; }
.general-chat .chat-head { padding: 0 0 16px; border-bottom: 1px solid var(--border); }
.mm-move { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.mm-move select { max-width: 260px; min-width: 0; }
.general-chat .empty-state { padding: 40px 0; }

/* Directos: the actions of a message sit in its top corner, and the conversation has room at the bottom */
.general-chat .chat-timeline { padding: 24px 28px 48px; gap: 18px; }
.msg.has-actions { position: relative; padding-right: 48px; }
.msg-actions { position: absolute; top: 10px; right: 10px; }
.msg-actions .mail-menu-panel { top: 34px; right: 0; }

/* The messages of a chat sit in #chat-messages: give them room between each other (contact chats and Directos) */
#chat-messages { display: flex; flex-direction: column; gap: 14px; }

/* Directos: selecting messages to forward them */
.msg-select { flex: none; align-self: center; width: 16px; height: 16px; margin: 0; accent-color: var(--primary); cursor: pointer; }
.msg-row { position: relative; }
.chat-forward { margin-left: auto; }

/* Perfil de Vicky: photo with drag and drop, and the fields beside it */
.profile-form { display: grid; grid-template-columns: minmax(220px, 280px) minmax(0, 1fr); gap: 28px; align-items: start; max-width: 880px; }
.profile-photo-block { display: flex; flex-direction: column; gap: 14px; }
.profile-photo-frame { display: flex; justify-content: center; }
.profile-photo-frame .profile-photo { width: 140px; height: 140px; }
.profile-photo-frame .profile-photo-empty { width: 140px; height: 140px; font-size: 40px; }
.profile-photo[hidden], .profile-photo-empty[hidden] { display: none; }
.dropzone { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 120px; padding: 18px; border: 1.5px dashed var(--border-strong); border-radius: 12px; background: var(--surface); color: var(--text-secondary); text-align: center; cursor: pointer; transition: border-color 150ms ease-out, background 150ms ease-out; }
.dropzone:hover, .dropzone.is-over { border-color: var(--primary); background: var(--surface-elevated); }
.dropzone:focus-within { box-shadow: 0 0 0 3px rgb(66 133 244 / 0.4); }
.dropzone-text { font-size: 14px; color: var(--text-strong); overflow-wrap: anywhere; }
.dropzone-text u { color: var(--accent-text); text-decoration: underline; text-underline-offset: 3px; }
.dropzone-hint { font-size: 12px; color: var(--text-muted); }
.profile-fields { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
@media (max-width: 760px) { .profile-form { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .dropzone { transition: none; } }

/* Directos: the checkboxes show only while selecting messages from the chat menu */
.msg-select { display: none; }
.general-chat.is-selecting .msg-select { display: block; }

/* Chat header stays at the top while the messages scroll. On narrow screens the whole page scrolls,
   so the header needs sticky positioning there as well. */
.chat-head { position: sticky; top: 0; z-index: 2; background: var(--canvas); }

/* Directos (desktop): the reader is not the scroll container. Its header spans the full width and stays on top,
   and only the conversation scrolls. On narrow screens the page scrolls as before. */
@media (min-width: 761px) {
  .mail-reader.general-chat { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
  .mail-reader.general-chat .chat-split, .mail-reader.general-chat .chat-main { flex: 1; min-height: 0; }
  .mail-reader.general-chat .chat-head { padding: 20px 40px 16px; margin: 0; }
  .mail-reader.general-chat .chat-timeline { padding: 24px 40px 48px; }
}
@media (max-width: 760px) {
  .mail-reader.general-chat .chat-head { padding: 16px 20px 12px; }
  .mail-reader.general-chat .chat-timeline { padding: 16px 20px 32px; }
}

/* Directos contact list: the projects of each contact, and the project filter in the list header */
.mail-row-projects { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.mail-list-head .mail-menu { margin-left: 8px; }

/* Directos: the manual composer is folded. It opens only when a message has to be written by hand. */
.composer-fold { border-top: 1px solid var(--border); }
.composer-fold > summary { list-style: none; cursor: pointer; }
.composer-fold > summary::-webkit-details-marker { display: none; }
.composer-fold-btn { display: flex; align-items: center; gap: 8px; padding: 12px 28px; font-size: 13px; font-weight: 600; color: var(--accent-text); }
.composer-fold-btn::before { content: "▸"; display: inline-block; transition: transform 150ms ease-out; }
.composer-fold[open] > .composer-fold-btn::before { transform: rotate(90deg); }
.composer-fold-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
@media (prefers-reduced-motion: reduce) { .composer-fold-btn::before { transition: none; } }

/* Channel toggles in the composer: a channel is off (grey icon) until it is clicked. The chosen ones show in colour. */
.ch-btn:has(input:checked) { border-color: var(--border-strong); background: var(--surface); }
.ch-btn:has(input:checked) img { filter: none; opacity: 1; }
.ch-btn:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Chat drawer: the contact's email sits under the name and role, aligned with them */
.info-mail { margin: 0; font-size: 13px; color: var(--text-secondary); overflow-wrap: anywhere; }
.info-mail a { color: var(--accent-text); text-decoration: none; }
.info-mail a:hover { text-decoration: underline; }

/* Correo settings: preview of the footer (the logo is a temporary initial until the Avanxo logo is set) */
.email-preview { display: flex; flex-direction: column; gap: 12px; padding: 20px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); max-width: 560px; }
.email-logo { width: 40px; height: 40px; border-radius: 10px; background: var(--accent-text); color: var(--surface); display: grid; place-items: center; font-weight: 700; font-size: 18px; }
.email-foot { margin: 0; white-space: pre-line; color: var(--text-secondary); font-size: 13px; border-top: 1px solid var(--border); padding-top: 12px; }

/* Usuarios and the email footer: a clear structure, progressive disclosure, and destructive actions set apart */
.users-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 12px; }
.invite-panel { border: 1px solid var(--border); border-radius: 12px; background: var(--surface-elevated); margin: 12px 0 20px; }
.invite-toggle { list-style: none; cursor: pointer; padding: 12px 16px; font-weight: 600; color: var(--accent-text); min-height: 44px; display: flex; align-items: center; }
.invite-toggle::-webkit-details-marker { display: none; }
.invite-toggle::before { content: "+"; display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 8px; border-radius: 6px; background: var(--success-bg); color: var(--accent-text); }
.invite-panel[open] > .invite-toggle::before { content: "−"; }
.invite-panel > .user-form { padding: 4px 16px 16px; }
.invite-toggle:focus-visible, .account-summary:focus-visible, .btn:focus-visible, .role-option input:focus-visible, .grant-item input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.user-form { display: flex; flex-direction: column; gap: 14px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; }
.role-group, .grant-group { border: 0; margin: 0; padding: 0; min-width: 0; }
.role-group legend, .grant-group legend { padding: 0; margin-bottom: 8px; }
.role-group[disabled] .role-option { opacity: .6; }
.role-option { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; row-gap: 2px; align-items: start; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-elevated); cursor: pointer; margin-bottom: 8px; }
.role-option:has(input:checked) { border-color: var(--accent-text); background: var(--success-bg); }
.role-option input { margin-top: 3px; accent-color: var(--accent-text); }
.role-name { font-weight: 600; color: var(--text); }
.role-desc { grid-column: 2; font-size: 13px; color: var(--text-secondary); }
.grant-group[hidden] { display: none; }
.user-form:not(:has(input[name="role"][value="cliente"]:checked)) .grant-group { display: none; }
.grant-item { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 4px 0; font-size: 14px; color: var(--text); cursor: pointer; }
.grant-item input { width: 18px; height: 18px; accent-color: var(--accent-text); }
.account-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.account { border: 1px solid var(--border); border-radius: 12px; background: var(--surface-elevated); }
.account > details > summary { list-style: none; }
.account > details > summary::-webkit-details-marker { display: none; }
.account-summary { display: grid; grid-template-columns: 36px 1fr auto auto auto; align-items: center; gap: 12px; padding: 12px 16px; min-height: 56px; cursor: pointer; }
.account-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--success-bg); color: var(--accent-text); display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.account-id { display: flex; flex-direction: column; min-width: 0; }
.account-name { font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-mail { font-size: 13px; color: var(--text-secondary); overflow-wrap: anywhere; }
.account-edit { font-size: 13px; font-weight: 600; color: var(--accent-text); }
.account-edit::after { content: " ▾"; }
.account > details[open] > .account-summary .account-edit::after { content: " ▴"; }
.account-body { display: flex; flex-direction: column; gap: 16px; padding: 4px 16px 16px; border-top: 1px solid var(--border); }
.badge.is-off { color: var(--text-secondary); background: var(--surface); border-style: dashed; }
.danger-zone { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; }
.danger-zone.is-danger { border-color: var(--error-border); background: var(--error-bg); }
.danger-title { margin: 0; font-weight: 600; color: var(--text); }
.danger-zone p { margin: 0; }
.btn-danger { background: var(--error); color: #FFFFFF; border: 1px solid var(--error); }
.btn-danger:hover { filter: brightness(.95); }
.footer-form { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.footer-input { min-height: 120px; resize: vertical; font-family: var(--font-sans); }
.footer-count { margin: 0; font-size: 12px; color: var(--text-muted); text-align: right; }
.footer-actions { display: flex; justify-content: flex-end; }
.footer-preview { margin-top: 18px; padding: 16px; border: 1px dashed var(--border-strong); border-radius: 12px; background: var(--surface); }
.footer-preview-title { margin: 0 0 10px; font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.footer-preview-body { display: flex; gap: 12px; align-items: flex-start; }
.footer-preview-text { margin: 0; white-space: pre-line; color: var(--text-secondary); font-size: 13px; }

/* Buttons inside the Usuarios and footer cards keep their own width, not the full row */
.users-card .btn, .footer-card .btn { width: auto; padding: 0 20px; }

/* Rich text (Trix): the composer and the email footer. Toolbar in the brand colors, attachments are not offered here. */
.composer-rich, .footer-rich { border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface-elevated); color: var(--text); font-family: var(--font-sans); font-size: 14px; line-height: 22px; }
.composer-rich { min-height: 72px; max-height: 240px; overflow-y: auto; padding: 10px 12px; }
.footer-rich { min-height: 120px; padding: 10px 12px; }
.composer-rich:focus, .footer-rich:focus { outline: 2px solid var(--focus); outline-offset: 2px; }
.composer-rich[hidden] { display: none; }
trix-toolbar .trix-button-group { border-color: var(--border-strong); border-radius: 8px; }
trix-toolbar .trix-button { color: var(--text-secondary); }
trix-toolbar .trix-button.trix-active { background: var(--success-bg); color: var(--accent-text); }
trix-toolbar .trix-button--icon-attach, trix-toolbar .trix-button-group--file-tools { display: none; }
trix-toolbar .trix-button:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
trix-editor blockquote { border-left: 3px solid var(--border-strong); padding-left: 12px; color: var(--text-secondary); }

/* Inbox: a message Vicky sent shows her photo in place of the initials */
img.avatar.is-photo { object-fit: cover; }

/* Group channels in the sidebar: the same card as a contact, with a neutral avatar */
.group-avatar { background: var(--surface-elevated); color: var(--accent-text); border: 1px solid var(--border-strong); }

/* Sidebar: each project opens its sections, Resumen and Chats, indented under it */
.nav-children { display: flex; flex-direction: column; gap: 2px; padding-left: 14px; margin: 2px 0 6px; }
.nav-child { font-size: 13px; color: var(--text-secondary); }

/* Chat list rows: channel icons sit side by side with a horizontal gap */
.mail-row-chan { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.mail-row-chan img { flex: none; display: block; }

/* Sidebar: the open project stands out, with a brand-blue tint, a dark label and a side bar */
.nav-sub[aria-current="true"] { background: #DCEBFF; color: #0A1128; font-weight: 600; box-shadow: inset 3px 0 0 #4285F4; }
.nav-sub:hover:not([aria-current="true"]) { background: #EEF4FD; }

/* Planes (read only): overview bar, plan list and the plan reader */
.plans-overview { padding: 16px 28px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; background: var(--surface); }
.plans-bar { display: flex; height: 10px; border-radius: 9999px; overflow: hidden; background: var(--surface-elevated); border: 1px solid var(--border); }
.plans-seg { display: block; height: 100%; }
.seg-ok { background: var(--success); }
.seg-warn { background: #B7791F; }
.seg-alert { background: var(--error); }
.seg-muted { background: var(--text-muted); }
.plans-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--text-secondary); }
.plans-legend li { display: flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-ok { background: var(--success); } .dot-warn { background: #B7791F; } .dot-alert { background: var(--error); } .dot-muted { background: var(--text-muted); }
.plans-mail { flex: 1; }
.plans-project { padding: 12px 20px 4px; margin: 0; }
.plan-avatar { background: var(--surface-elevated); color: var(--accent-text); border: 1px solid var(--border-strong); }
.badge-ok { color: var(--success); background: var(--success-bg); border-color: var(--success-border); }
.badge-warn { color: #7A4F0B; background: #FFF6E0; border-color: #F2DDA9; }
.badge-alert { color: var(--error); background: var(--error-bg); border-color: var(--error-border); }
.badge-muted { color: var(--text-secondary); background: var(--surface); }
.plan-reader { padding: 24px 28px; display: flex; flex-direction: column; gap: 22px; }
.plan-title { margin: 4px 0 8px; font-size: 22px; line-height: 28px; color: var(--text); }
.plan-section { display: flex; flex-direction: column; gap: 10px; }
.plan-meter { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; font-size: 13px; color: var(--text-secondary); }
.plan-meter-track { height: 8px; border-radius: 9999px; background: var(--surface-elevated); border: 1px solid var(--border); overflow: hidden; }
.plan-meter-fill { display: block; height: 100%; background: var(--primary); }
.plan-items, .plan-tasks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.plan-item { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-elevated); }
.plan-item-text { margin: 0; white-space: pre-line; color: var(--text); font-size: 14px; line-height: 21px; }
.plan-task { padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-elevated); display: flex; flex-direction: column; gap: 6px; }
.plan-task-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.plan-task p { margin: 0; font-size: 13px; }
@media (max-width: 760px) { .plans-overview { padding: 14px 16px; } .plan-reader { padding: 18px 16px; } }

/* Sidebar active item: a solid brand pill with white text (contrast about 5:1). Replaces the side bar. */
.nav-sub[aria-current="true"] { background: var(--accent-text); color: #FFFFFF; font-weight: 600; box-shadow: none; }
.nav-sub[aria-current="true"]:hover { background: #2563C4; }

/* Campañas: the project's service plan, with its quotas */
.service-plan { border: 1px solid var(--border); border-radius: 12px; background: var(--surface-elevated); padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.service-plan-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.quota-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 0; }
.quota-grid div { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: var(--surface); }
.quota-grid dt { font-size: 12px; color: var(--text-secondary); margin: 0 0 4px; }
.quota-grid dd { margin: 0; font-size: 18px; font-weight: 600; color: var(--text); }

/* Campañas: the month's campaign from the SEO app, read beside the specs and tasks from Planner */
.campaign-card { border: 1px solid var(--border); border-radius: 12px; background: var(--surface-elevated); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.campaign-name { font-size: 16px; color: var(--text); }
.campaign-text { margin: 0; font-size: 14px; line-height: 21px; color: var(--text); white-space: pre-line; }
.campaign-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.campaign-block { display: flex; flex-direction: column; gap: 6px; }
.campaign-sub { margin: 0; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-secondary); }
.campaign-list { margin: 0; padding-left: 18px; font-size: 14px; color: var(--text); display: flex; flex-direction: column; gap: 4px; }
.campaign-date { font-weight: 600; color: var(--accent-text); margin-right: 6px; }

/* Campañas detail: a compact header and stats, then collapsible sections */
.plan-head-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.plan-chips { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.plan-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 0; }
.plan-stats > div { border: 1px solid var(--border); border-radius: 12px; background: var(--surface-elevated); padding: 12px 14px; }
.plan-stats dt { font-size: 12px; color: var(--text-secondary); margin: 0 0 4px; }
.plan-stats dd { margin: 0; font-size: 20px; font-weight: 600; color: var(--text); }
.plan-stat-wide { grid-column: span 2; }
.plan-stat-wide dd { display: flex; align-items: center; gap: 12px; }
.plan-stat-wide .plan-meter-track { flex: 1; }
.plan-stat-figure { font-size: 14px; color: var(--text-secondary); white-space: nowrap; }
.plan-fold { border: 1px solid var(--border); border-radius: 12px; background: var(--surface-elevated); }
.plan-fold > summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; min-height: 44px; }
.plan-fold > summary::-webkit-details-marker { display: none; }
.plan-fold > summary::before { content: "▸"; color: var(--accent-text); transition: transform 150ms ease-out; }
.plan-fold[open] > summary::before { transform: rotate(90deg); }
.plan-fold > summary:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; border-radius: 12px; }
.fold-title { font-weight: 600; color: var(--text); }
.fold-meta { margin-left: auto; font-size: 13px; color: var(--text-secondary); }
.fold-body { padding: 0 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.campaign-dates { margin: 0; font-size: 13px; }
.campaign-clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.campaign-more { border-top: 1px solid var(--border); padding-top: 8px; }
.campaign-more > summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--accent-text); list-style: none; }
.campaign-more > summary::-webkit-details-marker { display: none; }
.campaign-more[open] > summary { margin-bottom: 8px; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--border-strong); display: flex; flex-direction: column; gap: 10px; }
.timeline li { position: relative; display: flex; flex-direction: column; gap: 2px; }
.timeline li::before { content: ""; position: absolute; left: -20px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent-text); border: 2px solid var(--surface-elevated); }
.timeline-date { font-size: 12px; font-weight: 600; color: var(--accent-text); }
.timeline-label { font-size: 14px; color: var(--text); }
@media (max-width: 760px) { .plan-stat-wide { grid-column: span 1; } }

/* Plan del proyecto: delivered against the plan, per service */
.quota-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.quota-row { display: flex; flex-direction: column; gap: 6px; }
.quota-row-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 14px; color: var(--text); }
.quota-figure { font-variant-numeric: tabular-nums; color: var(--text-secondary); white-space: nowrap; }
.quota-figure strong { color: var(--text); font-size: 16px; }

/* Shared list view toggle (Inbox, Contactos, Campañas): cards or a compact list */
.view-toggle { display: inline-flex; gap: 2px; padding: 2px; margin-left: 8px; border: 1px solid var(--border); border-radius: 9999px; background: var(--surface-elevated); }
.view-toggle-btn { width: 30px; height: 30px; border: 0; border-radius: 9999px; background: transparent; color: var(--text-secondary); display: grid; place-items: center; cursor: pointer; }
.view-toggle-btn[aria-pressed="true"] { background: var(--accent-text); color: #FFFFFF; }
.view-toggle-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.view-toggle-btn .ico-view { width: 16px; height: 16px; }
.mail-list-head { gap: 8px; }
.mail-list.list-compact .mail-row { padding: 8px 14px; min-height: 0; gap: 10px; align-items: center; }
.mail-list.list-compact .mail-row .avatar { width: 26px; height: 26px; font-size: 11px; }
.mail-list.list-compact .mail-row-body { gap: 0; min-width: 0; }
.mail-list.list-compact .mail-row-top { gap: 8px; }
.mail-list.list-compact .mail-row-snippet, .mail-list.list-compact .mail-row-chan, .mail-list.list-compact .mail-row-subject, .mail-list.list-compact .mail-tag { display: none; }
.mail-list.list-compact .mail-row-from { font-size: 13px; }
.mail-list.list-compact .mail-row-date { font-size: 12px; }

/* List view toggle, refined: a quiet segmented control; the active view is outlined, not filled */
.view-toggle { display: inline-flex; align-items: center; gap: 2px; margin-left: 10px; padding: 3px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.view-toggle-btn { width: 32px; height: 28px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--text-muted); display: grid; place-items: center; cursor: pointer; transition: background-color 150ms ease-out, color 150ms ease-out; }
.view-toggle-btn:hover { background: var(--surface-elevated); color: var(--text); }
.view-toggle-btn[aria-pressed="true"] { background: var(--surface-elevated); color: var(--accent-text); border-color: var(--border-strong); box-shadow: 0 0 0 1px var(--border-strong) inset; }
.view-toggle-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.view-toggle-btn .ico-view { width: 15px; height: 15px; }
@media (prefers-reduced-motion: reduce) { .view-toggle-btn { transition: none; } }

/* Card view, lighter: slimmer rows, a smaller avatar, one line of summary, quieter separators */
.mail-list:not(.list-compact) .mail-row { padding: 10px 14px; gap: 10px; align-items: center; border-bottom: 1px solid var(--border); }
.mail-list:not(.list-compact) .mail-row .avatar { width: 30px; height: 30px; font-size: 12px; }
.mail-list:not(.list-compact) .mail-row-body { gap: 2px; min-width: 0; }
.mail-list:not(.list-compact) .mail-row-snippet { font-size: 12px; line-height: 17px; -webkit-line-clamp: 1; color: var(--text-muted); }
.mail-list:not(.list-compact) .mail-row-date { font-size: 11px; color: var(--text-muted); }
.mail-list:not(.list-compact) .mail-row-from { font-size: 13px; font-weight: 600; }
.mail-list:not(.list-compact) .mail-row-chan img { width: 11px; height: 11px; opacity: .8; }
.mail-list:not(.list-compact) .mail-row[aria-current="true"] { background: var(--surface-elevated); box-shadow: inset 2px 0 0 var(--accent-text); }

/* List header: title and count on the left, one view button on the right. The button shows the icon of the view it
   will switch to; both icons live in the button and CSS shows the right one. */
.mail-list-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; }
.mail-list-head .mail-list-title { margin: 0; font-size: 15px; font-weight: 600; }
.mail-list-head .mail-count { font-size: 12px; color: var(--text-muted); background: var(--surface-elevated); border: 1px solid var(--border); border-radius: 9999px; padding: 1px 8px; }
.mail-list-head .view-btn { margin-left: auto; }
.view-btn { width: 32px; height: 32px; flex: none; display: inline-grid; place-items: center; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-elevated); color: var(--text-secondary); cursor: pointer; transition: background-color 150ms ease-out, color 150ms ease-out, border-color 150ms ease-out; }
.view-btn:hover { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.view-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.view-btn-icon { display: none; line-height: 0; }
.view-btn-icon .ico-view { width: 16px; height: 16px; }
.mail-list:not(.list-compact) .view-btn .view-btn-cards { display: inline-flex; }
.mail-list.list-compact .view-btn .view-btn-list { display: inline-flex; }
@media (prefers-reduced-motion: reduce) { .view-btn { transition: none; } }

/* Campañas rows: one line each, like Inbox and Contactos. The summary is cut with an ellipsis instead of wrapping. */
.mail-list .plan-row { min-height: 0; }
.mail-list .plan-row .mail-row-body { min-width: 0; }
.mail-list .plan-row .mail-row-top { gap: 8px; align-items: center; }
.mail-list .plan-row .mail-row-snippet { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; -webkit-line-clamp: unset; }
.mail-list .plan-row .badge { font-size: 11px; line-height: 18px; padding: 0 8px; }

/* Campañas rows: period, plan type, counts and status on one line */
.mail-list .plan-row .mail-row-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mail-list .plan-row .mail-row-from { flex: none; }
.mail-list .plan-row .plan-row-meta { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--text-muted); }

/* Campañas rows. Card view: period and status, then the summary on up to two lines with room between rows.
   Compact view: only the period and the status, one line. */
.mail-list .plan-row { padding: 12px 16px; gap: 12px; align-items: center; }
.mail-list .plan-row .mail-row-body { gap: 4px; min-width: 0; }
.mail-list .plan-row .mail-row-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-width: 0; }
.mail-list .plan-row .mail-row-from { flex: none; }
.mail-list .plan-row .plan-row-meta { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: normal; font-size: 12px; line-height: 17px; color: var(--text-muted); }
.mail-list.list-compact .plan-row { padding: 8px 14px; gap: 10px; }
.mail-list.list-compact .plan-row .plan-row-meta { display: none; }

/* All-projects Campañas: the project name sits on the period line and is cut with an ellipsis when long */
.mail-list .plan-row .plan-row-project { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 600; color: var(--text); }
.mail-list .plan-row .mail-row-top { gap: 8px; }

/* Campañas, all-projects view: the project heading is a distinct accent label; the campaign line is unchanged */
.mail-list .plans-project { font-size: 12px; font-weight: 700; letter-spacing: .02em; color: var(--accent-text); }

/* All-projects Campañas. Compact view: each campaign is one line, with its project inline and cut with an ellipsis,
   and no heading line. Card view: the project heading stands above its group, and the cards carry no project name. */
.mail-list .plan-row-project { display: none; }
.mail-list.list-compact .plan-row-project { display: block; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--accent-text); font-weight: 600; }
.mail-list.list-compact .plans-project { display: none; }
