/* go7.uz — CRM → «Почта» (crmmail.js) */

/* ---------- Подключение ---------- */
.cm-connect { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(280px, 1fr); gap: 16px; align-items: start; }
.cm-cbox { padding: 24px; }
.cm-chead { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 18px; }
.cm-chead h3 { margin: 0 0 4px; font-size: 19px; }
.cm-chead p { margin: 0; font-size: 13.5px; }
.cm-cic { flex: none; width: 52px; height: 52px; border-radius: 16px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.cm-cform { display: grid; gap: 12px; }
.cm-pw { position: relative; }
.cm-pw .input { padding-right: 46px; }
.cm-pw .icon-btn { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }
.cm-prov { display: grid; gap: 6px; padding: 12px 14px; border-radius: 14px; background: #EEF5FF; color: #1C3B66; font-size: 13px; line-height: 1.45; }
.cm-prov b { font-size: 13.5px; }
.cm-prov .btn { justify-self: start; margin-top: 2px; }
.cm-adv { border: 1px solid var(--line); border-radius: 14px; padding: 0 14px; }
.cm-adv summary { cursor: pointer; padding: 12px 0; font-weight: 700; font-size: 13.5px; }
.cm-adv summary em { font-weight: 500; font-style: normal; }
.cm-adv-g { display: grid; grid-template-columns: minmax(0, 1fr) 90px 120px; gap: 10px; padding-bottom: 14px; }
.cm-adv-g .wide { grid-column: 1 / -1; }
.cm-why { display: grid; gap: 10px; }
html[data-theme="dark"] .cm-prov { background: rgba(80, 140, 255, .14); color: #CFE0FF; }

/* ---------- Три колонки: папки · список · письмо ---------- */
.cm-page .page-head { margin-bottom: 12px; }
.cm { display: grid; grid-template-columns: 200px minmax(280px, 380px) minmax(0, 1fr); gap: 0; height: calc(100vh - 210px); min-height: 520px;
  background: var(--surface); border-radius: 20px; box-shadow: var(--shadow); overflow: hidden; }
.cm-side { display: flex; flex-direction: column; border-right: 1px solid var(--line); padding: 12px 8px; min-width: 0; background: var(--bg-2, #F6F3EE); }
.cm-folders { display: grid; gap: 2px; }
.cm-folders button { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px; border: 0; border-radius: 11px; background: none; color: var(--ink-2);
  font: 700 14px var(--font); cursor: pointer; text-align: left; }
.cm-folders button:hover { background: rgba(11, 31, 58, .05); }
.cm-folders button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(11, 31, 58, .1); }
.cm-folders button.on .ico { color: var(--accent); }
.cm-folders button span { flex: 1; }
.cm-folders button em { font-style: normal; font-size: 12px; font-weight: 800; color: var(--accent); }
.cm-me { margin-top: auto; display: flex; align-items: center; gap: 6px; padding: 10px 6px 2px 10px; border-top: 1px solid var(--line); }
.cm-me-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cm-me-t b { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cm-me-t small { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.cm-list { display: flex; flex-direction: column; border-right: 1px solid var(--line); min-width: 0; min-height: 0; }
.cm-lbar { display: flex; gap: 6px; padding: 10px 10px 6px; }
.cm-search { position: relative; flex: 1; min-width: 0; display: block; }
.cm-search > .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-4, #98A2B3); pointer-events: none; }
.cm-search .input { padding: 9px 12px 9px 36px; font-size: 13.5px; border-radius: 12px; }
.cm-lbar .icon-btn.spin .ico { animation: cmspin .8s linear infinite; }
@keyframes cmspin { to { transform: rotate(360deg); } }
.cm-chips { display: flex; gap: 6px; padding: 0 10px 8px; overflow-x: auto; scrollbar-width: none; }
.cm-chips::-webkit-scrollbar { display: none; }
.cm-chips button { flex: none; height: 28px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font: 700 12.5px var(--font); cursor: pointer; }
.cm-chips button.on { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.cm-items { flex: 1; overflow-y: auto; overscroll-behavior: contain; min-height: 0; border-top: 1px solid var(--line); }
.cm-it { display: flex; gap: 10px; width: 100%; padding: 11px 12px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; cursor: pointer; font: inherit; color: inherit; position: relative; }
.cm-it:hover { background: rgba(11, 31, 58, .035); }
.cm-it.on { background: var(--accent-soft); }
.cm-it.un::before { content: ""; position: absolute; left: 4px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--accent); }
.cm-ava { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font: 800 13px var(--font); color: #fff;
  background: hsl(var(--h, 20), 55%, 52%); }
.cm-it-b { flex: 1; min-width: 0; display: grid; gap: 2px; }
.cm-it-h { display: flex; align-items: baseline; gap: 8px; }
.cm-it-h b { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cm-it.un .cm-it-h b, .cm-it.un .cm-it-s { font-weight: 800; color: var(--ink); }
.cm-it-h time { flex: none; font-size: 11.5px; color: var(--muted); }
.cm-it.un .cm-it-h time { color: var(--accent); font-weight: 700; }
.cm-it-s { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cm-it-s i { flex: none; display: inline-grid; color: var(--muted); }
.cm-it-s .cm-flag { color: #E8A400; }
.cm-it-m { display: flex; align-items: center; gap: 6px; min-height: 0; }
.cm-it-m:empty { display: none; }
.cm-cl { display: inline-flex; align-items: center; gap: 3px; font-style: normal; font-size: 11px; font-weight: 700; color: var(--teal-ink, #12805C); background: var(--teal-soft, #E3F5EE);
  padding: 1px 7px; border-radius: 999px; max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cm-att { display: inline-grid; color: var(--muted); }
.cm-more { margin: 10px; width: calc(100% - 20px); }
.cm-none { display: grid; justify-items: center; gap: 6px; padding: 40px 20px; text-align: center; color: var(--muted); }
.cm-none p { margin: 0; font-weight: 700; color: var(--ink-2); }
.cm-err { margin: 12px; }
.cm-err .row { margin-top: 10px; gap: 8px; }

.cm-read { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.cm-empty { margin: auto; display: grid; justify-items: center; gap: 8px; padding: 30px; text-align: center; color: var(--muted); }
.cm-empty p { margin: 0; font-weight: 700; color: var(--ink-2); }
.cm-rbar { display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.cm-rbar .sp { flex: 1; }
.cm-back { display: none; }
.cm-rscroll { flex: 1; overflow-y: auto; padding: 18px 22px 26px; min-height: 0; }
.cm-subj { margin: 0 0 14px; font-size: 20px; line-height: 1.3; word-break: break-word; }
.cm-from { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.cm-from-t { flex: 1; min-width: 0; font-size: 14px; }
.cm-from-t small { color: var(--muted); }
.cm-to { margin-top: 2px; font-size: 12.5px; color: var(--muted); word-break: break-word; }
.cm-addr small { color: var(--muted); }
.cm-from time { flex: none; font-size: 12.5px; color: var(--muted); }
.cm-crm { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border-radius: 14px; background: var(--bg-2, #F6F3EE); font-size: 13px; color: var(--ink-2); margin-bottom: 12px; }
.cm-crm > span { flex: 1; min-width: 180px; }
.cm-crm.on { background: var(--teal-soft, #E3F5EE); color: var(--teal-ink, #12805C); }
.cm-crm.on b { color: inherit; }
.cm-imgs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 9px 12px; border-radius: 12px; background: #FFF6E5; color: #8A5300; font-size: 12.5px; margin-bottom: 12px; }
.cm-imgs span { flex: 1; min-width: 200px; }
.cm-body { border-radius: 12px; overflow: hidden; background: #fff; }
.cm-frame { display: block; width: 100%; height: 300px; border: 0; background: #fff; }
.cm-atts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.cm-attb { display: flex; align-items: center; gap: 10px; max-width: 280px; padding: 8px 12px 8px 8px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font: inherit; color: inherit; text-align: left; }
.cm-attb:hover { border-color: var(--accent); }
.cm-attb.busy { opacity: .6; cursor: progress; }
.cm-attb > span:nth-child(2) { flex: 1; min-width: 0; display: grid; }
.cm-attb b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cm-attb small { font-size: 11.5px; color: var(--muted); }
.cm-atti { flex: none; width: 34px; height: 34px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }

/* ---------- Письмо: окно ---------- */
.modal.cm-cmodal { max-width: 860px; }
.cm-comp { display: grid; gap: 8px; }
.cm-cp-row { display: flex; align-items: center; gap: 10px; }
.cm-cp-row label { flex: none; width: 56px; font-size: 13px; font-weight: 700; color: var(--muted); }
.cm-cp-row .input { flex: 1; min-width: 0; }
.cm-tb { display: flex; align-items: center; gap: 4px; padding: 4px; border-radius: 12px; background: var(--bg-2, #F6F3EE); }
.cm-tb > button { width: 34px; height: 32px; border: 0; border-radius: 8px; background: none; color: var(--ink-2); cursor: pointer; font: 700 14px var(--font); display: grid; place-items: center; }
.cm-tb > button:hover { background: var(--surface); color: var(--ink); }
.cm-tb .sp { flex: 1; }
.cm-attadd { cursor: pointer; }
.cm-ed { min-height: 260px; max-height: 52vh; overflow-y: auto; padding: 12px 14px; line-height: 1.55; font-size: 14px; white-space: normal; }
.cm-ed.sm { min-height: 90px; }
.cm-ed:focus { outline: none; }
.cm-ed blockquote { margin: 0 0 0 .8ex; border-left: 2px solid var(--line); padding-left: 1ex; color: var(--muted); }
.cm-ed img { max-width: 100%; }
.cm-cpatts { display: flex; flex-wrap: wrap; gap: 6px; }
.cm-cpatts:empty { display: none; }
.cm-cpatt { display: inline-flex; align-items: center; gap: 6px; padding: 5px 6px 5px 10px; border-radius: 999px; background: var(--bg-2, #F6F3EE); font-size: 12.5px; max-width: 260px; }
.cm-cpatt b { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.cm-cpatt small { color: var(--muted); flex: none; }
.cm-cpatt.busy { opacity: .6; }
.cm-cpatt button { border: 0; background: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: var(--muted); }
.cm-cpatt button:hover { background: rgba(11, 31, 58, .08); color: var(--ink); }
.cm-cpwarn { font-size: 12.5px; color: var(--danger, #C62828); font-weight: 700; }
.cm-cp-note { display: inline-flex; align-items: center; gap: 5px; margin-right: auto; }
.modal.cm-rmodal .mb { padding: 0; }
.cm-mread { max-height: 76vh; }
.cm-sbox { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 14px; background: var(--bg-2, #F6F3EE); }
.cm-sbox > span { flex: 1; min-width: 0; display: grid; }
.cm-sbox small { color: var(--muted); font-size: 12px; }
.linkbtn { border: 0; background: none; padding: 0; color: var(--accent); font: inherit; font-weight: 700; cursor: pointer; text-decoration: underline; }
.cm-cr.un b { font-weight: 800; }

/* ---------- Узкий экран: список → письмо поверх ---------- */
@media (max-width: 1180px) { .cm { grid-template-columns: 170px minmax(250px, 320px) minmax(0, 1fr); } }
@media (max-width: 900px) {
  .cm-connect { grid-template-columns: 1fr; }
  .cm-adv-g { grid-template-columns: 1fr 1fr; }
  .cm-adv-g .field:not(.sm) { grid-column: 1 / -1; }
  .cm { display: flex; flex-direction: column; height: auto; min-height: 0; border-radius: 16px; }
  .cm-side { flex-direction: row; align-items: center; border-right: 0; border-bottom: 1px solid var(--line); padding: 6px; overflow-x: auto; scrollbar-width: none; }
  .cm-side::-webkit-scrollbar { display: none; }
  .cm-folders { display: flex; gap: 4px; }
  .cm-folders button { flex: none; height: 36px; padding: 0 12px; }
  .cm-me { display: none; }
  .cm-list { border-right: 0; }
  .cm-items { max-height: none; overflow: visible; }
  .cm-read { display: none; }
  .cm.reading .cm-list, .cm.reading .cm-side { display: none; }
  .cm.reading .cm-read { display: flex; }
  .cm-back { display: inline-grid; }
  .cm-rscroll { padding: 14px 14px 22px; overflow: visible; }
  .cm-subj { font-size: 18px; }
  .cm-from time { display: none; }
}
html[data-theme="dark"] .cm-side, html[data-theme="dark"] .cm-crm, html[data-theme="dark"] .cm-tb, html[data-theme="dark"] .cm-sbox, html[data-theme="dark"] .cm-cpatt { background: rgba(255, 255, 255, .04); }
html[data-theme="dark"] .cm-imgs { background: rgba(255, 180, 60, .12); color: #FFD08A; }
@media (max-width: 900px) {
  .cm-rbar { flex-wrap: nowrap; gap: 4px; padding: 8px 10px; }
  .cm-rbar .btn span { display: none; }
  .cm-rbar .btn { padding: 8px 10px; }
}
