/* Тема sng v4 — нейтральный бренд «Компания», PoC.
   Наследует Elastic (не изменяется). Палитра: #008eb9, #ad906b. */
:root {
  --sng-blue: #008eb9;
  --sng-blue-dark: #00759a;
  --sng-navy: #0c3a4c;
  --sng-navy-2: #0f4a60;
  --sng-gold: #ad906b;
  --sng-gold-dark: #8c7050;
  --sng-ink: #1f3a46;
  --sng-muted: #5f7884;
  --sng-line: #dfe8ec;
  --sng-surface: #f4f8fa;
  --sng-tint: #e4f3f8;
}

a { color: var(--sng-blue-dark); }
.btn-primary { background-color: var(--sng-blue); border-color: var(--sng-blue); }
.btn-primary:hover, .btn-primary:focus, .btn-primary:not(:disabled):active { background-color: var(--sng-blue-dark); border-color: var(--sng-blue-dark); }
.form-control:focus { border-color: var(--sng-blue); box-shadow: 0 0 0 3px rgba(0,142,185,.18); }

/* ---------- Вход ---------- */
body.task-login #layout {
  display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 6vh 24px; box-sizing: border-box;
  background: #e9f2f5 url("../images/background-v2.png") center/cover no-repeat fixed;
}
body.task-login #layout-content {
  display: block !important; position: static; width: 100%; max-width: 940px; height: auto; min-height: 0;
  margin: 0 auto; padding: 0; background: transparent; border: 0; box-shadow: none; overflow: visible;
}
.sng-login {
  display: grid; grid-template-columns: minmax(0,1.08fr) minmax(0,1fr); min-height: 520px;
  background: #fff; border-radius: 20px; overflow: hidden;
  box-shadow: 0 30px 80px rgba(12,58,76,.18), 0 2px 6px rgba(12,58,76,.06);
}
.sng-brand {
  position: relative; display: flex; flex-direction: column; justify-content: space-between;
  padding: 36px 40px 30px; color: #fff; overflow: hidden; text-align: left;
  background: linear-gradient(150deg, #0a3c4f 0%, #0b5a75 52%, #0a86ad 100%);
}
.sng-brand > *:not(.sng-waves) { position: relative; z-index: 1; }
.sng-logo-plate { display: inline-block; padding: 10px 14px; background: #fff; border-radius: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
body.task-login .sng-logo-plate #logo { position: static; display: block; width: 140px; height: 79px; max-height: none; margin: 0; transform: none; }
.sng-brand-main { margin-top: 28px; }
.sng-eyebrow { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: #e3cfb2; margin-bottom: 10px; }
.sng-brand-title { font-size: 34px; line-height: 1.15; font-weight: 700; letter-spacing: -.01em; margin-bottom: 14px; }
.sng-brand-lead { font-size: 15px; line-height: 1.6; color: #d4e9f0; margin: 0 0 24px; max-width: 380px; }
.sng-features { list-style: none; margin: 0; padding: 0; }
.sng-features li { display: flex; align-items: center; gap: 12px; font-size: 14px; color: #eef7fa; padding: 7px 0; }
.sng-ico {
  font-family: 'Icons'; font-weight: 900; font-size: 13px; flex: 0 0 30px; height: 30px; line-height: 30px; text-align: center;
  border-radius: 9px; background: rgba(255,255,255,.12); color: #e3cfb2;
}
.sng-brand-foot { font-size: 12px; color: #a9cfdc; letter-spacing: .02em; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.14); }
.sng-waves { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 58%; z-index: 0; }
.sng-waves path { fill: none; stroke: var(--sng-gold); stroke-width: 1.4; opacity: .45; }
.sng-waves path + path { opacity: .28; }
.sng-waves path + path + path { opacity: .16; }

.sng-form { display: flex; flex-direction: column; justify-content: center; padding: 48px 52px; text-align: left; }
body.task-login .sng-title { text-align: left; font-size: 26px; font-weight: 700; color: var(--sng-ink); margin: 0 0 6px; }
.sng-hint { color: var(--sng-muted); font-size: 14px; margin: 0 0 26px; }
body.task-login #login-form {
  position: static !important; top: auto !important; left: auto !important; transform: none !important;
  width: 100%; max-width: none; margin: 0; padding: 0;
}
body.task-login #login-form table, body.task-login #login-form tbody, body.task-login #login-form tr, body.task-login #login-form td { display: block; width: 100%; }
body.task-login #login-form td.title { display: none; }
body.task-login #login-form tr.form-group { margin: 0; }
body.task-login #login-form td.input { display: flex; flex-wrap: nowrap; align-items: stretch; padding: 0 0 14px; }
body.task-login #login-form td.input .form-control { flex: 1 1 auto; width: 1%; min-width: 0; }
body.task-login #login-form .input-group-prepend { display: flex; }
body.task-login #login-form .input-group { flex-wrap: nowrap; }
body.task-login #login-form .input-group-text { background: var(--sng-surface); border-color: #d3e0e6; color: #6f8a96; min-width: 44px; justify-content: center; border-radius: 10px 0 0 10px; }
body.task-login #login-form .form-control { height: 46px; font-size: 15px; border-color: #d3e0e6; border-radius: 0 10px 10px 0; }
body.task-login #login-form .formbuttons, body.task-login #login-form p.formbuttons { margin: 8px 0 0; padding: 0; }
body.task-login #login-form .button.mainaction, body.task-login #login-form #rcmloginsubmit {
  width: 100%; height: 48px; font-size: 15px; font-weight: 600; letter-spacing: .02em; text-transform: none;
  border-radius: 10px; color: #fff !important; background: var(--sng-blue); border-color: var(--sng-blue); box-shadow: 0 8px 20px rgba(0,142,185,.28);
}
body.task-login #login-form #rcmloginsubmit:hover { background: var(--sng-blue-dark); border-color: var(--sng-blue-dark); }
body.task-login #login-footer { margin-top: 20px; padding-top: 0; border-top: 0; font-size: 12px; color: var(--sng-muted); text-align: left; }
body.task-login #login-footer:empty { display: none; }
body.task-login #layout-content > #login-footer { display: none; }

@media (max-width: 820px) {
  body.task-login #layout { padding: 16px; }
  .sng-login { grid-template-columns: minmax(0,1fr); min-height: 0; border-radius: 16px; }
  .sng-brand { padding: 22px 20px 20px; }
  .sng-brand-lead, .sng-features, .sng-brand-foot, .sng-waves { display: none; }
  .sng-brand-main { margin-top: 16px; }
  .sng-brand-title { font-size: 24px; margin-bottom: 0; }
  body.task-login .sng-logo-plate #logo { width: 105px; height: 59px; }
  .sng-form { padding: 28px 20px 24px; }
}

/* ---------- Рабочий экран ---------- */
html:not(.iframe) body:not(.task-login) { background: var(--sng-surface); color: var(--sng-ink); }

/* Левая навигация */
body:not(.task-login) #layout-menu { background: linear-gradient(180deg, var(--sng-navy-2) 0%, var(--sng-navy) 100%); }
body:not(.task-login) #layout-menu .popover-header { background: transparent; }
body:not(.task-login) #layout-menu #logo {
  display: block; box-sizing: border-box; object-fit: contain; background: #fff;
  border-radius: 12px; border: 0; box-shadow: 0 6px 16px rgba(0,0,0,.22);
}
body:not(.task-login) #taskmenu { background: transparent; }
body:not(.task-login) #taskmenu a { color: #cfe3ea; border-radius: 12px; transition: background .15s, color .15s; }
body:not(.task-login) #taskmenu a:before { color: #9fc4d2; transition: color .15s; }
body:not(.task-login) #taskmenu a:hover { background: rgba(255,255,255,.08); color: #fff; }
body:not(.task-login) #taskmenu a:hover:before { color: #fff; }
body:not(.task-login) #taskmenu a.selected { background: rgba(0,142,185,.9); color: #fff; box-shadow: 0 6px 16px rgba(0,0,0,.2); }
body:not(.task-login) #taskmenu a.selected:before { color: #fff; }
body:not(.task-login) #taskmenu a.compose { background: var(--sng-gold); color: #fff; box-shadow: 0 6px 16px rgba(0,0,0,.22); }
body:not(.task-login) #taskmenu a.compose:before { color: #fff; }
body:not(.task-login) #taskmenu a.compose:hover { background: var(--sng-gold-dark); }
body:not(.task-login) #taskmenu a span.inner { font-size: 11.5px; line-height: 1.25; white-space: normal; }
body:not(.task-login) #taskmenu .special-buttons { background: transparent; border-top: 1px solid rgba(255,255,255,.08); }
body:not(.task-login) #taskmenu a.logout, body:not(.task-login) #taskmenu a.logout:before { color: #f2b3a8; }

@media screen and (min-width: 1025px) {
  body:not(.task-login) #layout-menu { width: 104px; flex: 0 0 104px; max-width: 104px; }
  body:not(.task-login) #layout-menu #logo { width: 88px; max-width: 88px; height: 56px; margin: 12px 8px 6px; padding: 6px 8px; }
  body:not(.task-login) #taskmenu { width: 104px; }
  body:not(.task-login) #taskmenu a { box-sizing: border-box; width: 88px; height: auto; min-height: 64px; margin: 6px 8px; padding: 10px 4px 8px; }
  body:not(.task-login) #taskmenu a.compose { min-height: 74px; margin-top: 14px; margin-bottom: 14px; }
  body:not(.task-login) #taskmenu .special-buttons a { min-height: 58px; }
}

/* Заголовки панелей и тулбары */
body:not(.task-login) .header { background: #fff; border-bottom: 1px solid var(--sng-line); }
body:not(.task-login) .header .header-title { color: var(--sng-ink); font-weight: 600; }
body:not(.task-login) .toolbar a.button, body:not(.task-login) .header a.button { color: #46636f; border-radius: 9px; }
body:not(.task-login) .toolbar a.button:before, body:not(.task-login) .header a.button:before { color: #3d6676; }
body:not(.task-login) .toolbar a.button:not(.disabled):hover, body:not(.task-login) .header a.button:not(.disabled):hover { background: var(--sng-tint); color: var(--sng-blue-dark); }
body:not(.task-login) .toolbar a.button:not(.disabled):hover:before { color: var(--sng-blue); }
body:not(.task-login) .toolbar a.button.disabled, body:not(.task-login) .toolbar a.button.disabled:before { color: #a9bbc3; }

/* Папки */
body:not(.task-login) #layout-sidebar { background: #f7fafb; border-right: 1px solid var(--sng-line); }
body:not(.task-login) #layout-sidebar .header { background: #f7fafb; }
body:not(.task-login) #layout-sidebar .header .header-title { font-size: 14px; color: var(--sng-navy-2); }
body:not(.task-login) .listing li { border-bottom: 0; }
body:not(.task-login) #mailboxlist li > a, body:not(.task-login) .folderlist li > a { color: #3a5562; border-radius: 10px; margin: 2px 10px; }
body:not(.task-login) #mailboxlist li > a:before { color: #6d8b98; }
body:not(.task-login) #mailboxlist li > a:hover { background: #eaf2f5; }
body:not(.task-login) #mailboxlist li.selected > a { background: var(--sng-tint); color: #005f80; font-weight: 600; box-shadow: inset 3px 0 var(--sng-blue); }
body:not(.task-login) #mailboxlist li.selected > a:before { color: var(--sng-blue); }
body:not(.task-login) #mailboxlist li.selected { background: transparent; }
body:not(.task-login) .unreadcount { background: var(--sng-blue); color: #fff; border-radius: 10px; font-weight: 600; }
body:not(.task-login) #layout-sidebar .footer { border-top: 1px solid var(--sng-line); }
body:not(.task-login) .quota-widget .bar { border-color: #cfdde3; }
body:not(.task-login) .quota-widget .bar .value { background: var(--sng-blue); }

/* Поиск и список писем */
body:not(.task-login) #layout-list { background: #fff; border-right: 1px solid var(--sng-line); }
body:not(.task-login) .searchbar { background: #fff; border-bottom: 1px solid var(--sng-line); }
body:not(.task-login) .searchbar input { background: var(--sng-surface); border-radius: 10px; }
body:not(.task-login) #messagelist tr td { border-bottom: 1px solid #edf2f4; }
body:not(.task-login) #messagelist tr td.subject { padding-top: 10px; padding-bottom: 10px; }
body:not(.task-login) .messagelist .subject a, body:not(.task-login) .messagelist .subject span.subject { color: #2a4652; }
body:not(.task-login) .messagelist tr.unread .subject a { color: var(--sng-ink); font-weight: 700; }
body:not(.task-login) .messagelist .fromto, body:not(.task-login) .messagelist .date { color: var(--sng-muted); }
body:not(.task-login) .messagelist tr.unread .msgicon.status:before, body:not(.task-login) .messagelist tr.unread td.subject span.msgicon:before { color: var(--sng-blue); }
body:not(.task-login) #messagelist tr:hover td { background: #f3f9fb; }
body:not(.task-login) #messagelist tr.selected td { background: var(--sng-tint); color: #163f51; }
body:not(.task-login) #messagelist tr.selected td:first-child { box-shadow: inset 3px 0 var(--sng-blue); }
body:not(.task-login) .pagenav { border-top: 1px solid var(--sng-line); }

/* Область письма */
body:not(.task-login) #layout-content { background: #fff; }
html.iframe body.action-preview, html.iframe body.action-show { background: #fff; }
body.action-preview #message-header, body.action-show #message-header { border-bottom: 1px solid var(--sng-line); padding-bottom: 14px; }
body.action-preview #message-header h2.subject, body.action-show #message-header h2.subject { font-size: 22px; font-weight: 700; color: var(--sng-ink); letter-spacing: -.01em; }
body.action-preview #message-header .header-links a, body.action-show #message-header .header-links a { color: var(--sng-blue-dark); }
#message-header .contactphoto, #message-header .headers-table img.contactphoto { border-radius: 50%; background: var(--sng-tint); }
#messagebody div.pre, #messagebody .message-part div.pre {
  font-family: Roboto, "Segoe UI", system-ui, sans-serif; font-size: 15px; line-height: 1.65; color: #24404c; white-space: pre-wrap;
}
#messagebody .message-part { padding-top: 6px; }
#messagebody blockquote { border-left-color: var(--sng-gold); }

/* Создание письма */
body.action-compose #layout-content .formcontent, body.action-compose .formcontainer { background: #fff; }
body.action-compose #compose-subject, body.action-compose .input-group > .form-control { border-color: #d3e0e6; }
body.action-compose .formbuttons .btn.primary, body.action-compose .formbuttons .button.mainaction { background: var(--sng-blue); border-color: var(--sng-blue); }

/* Диалоги и всплывающие меню */
.popover .popover-header { background: var(--sng-surface); }
.ui-dialog .ui-dialog-titlebar { border-bottom: 2px solid var(--sng-gold); }
.ui-dialog .ui-dialog-buttonpane .btn.mainaction, .ui-dialog .ui-dialog-buttonpane .btn-primary { background: var(--sng-blue); border-color: var(--sng-blue); }

/* ---------- v4.1: доводка рабочих экранов ---------- */
/* Кнопка «Написать» — насыщеннее, читаемый белый текст */
body:not(.task-login) #taskmenu a.compose { background: linear-gradient(180deg, #b89a72 0%, #977852 100%); text-shadow: 0 1px 1px rgba(0,0,0,.18); }
body:not(.task-login) #taskmenu a.compose:hover, body:not(.task-login) #taskmenu a.compose.selected { background: linear-gradient(180deg, #a98b63 0%, #866944 100%); }

/* Шапка панели: адрес не обрезается */
body:not(.task-login) #layout-sidebar .header .header-title { font-size: 12.5px; letter-spacing: -.01em; }
@media screen and (min-width: 1440px) {
  body:not(.task-login) #layout-sidebar { width: 250px; flex: 0 0 250px; max-width: 250px; }
}

/* Единые выделения во всех списках (папки, настройки, контакты, письма) */
body:not(.task-login) .listing li.selected, body:not(.task-login) .listing tr.selected td { background-color: #d9eef5; color: #0b4a60; }
body:not(.task-login) .listing li.selected > a { color: #005f80; font-weight: 600; box-shadow: inset 3px 0 var(--sng-blue); }
body:not(.task-login) .listing li.selected > a:before { color: var(--sng-blue); }
body:not(.task-login) #mailboxlist li.selected > a { background: #d9eef5; }
body:not(.task-login) .listing li > a { border-radius: 10px; margin: 2px 10px; }
body:not(.task-login) .listing li:not(.selected) > a:hover { background: #eaf2f5; }
body:not(.task-login) .listing tr.selected td:first-child { box-shadow: inset 3px 0 var(--sng-blue); }
body:not(.task-login) .listing tr.focused > td { outline: 0; }

/* Пустые списки */
body:not(.task-login) .listing-info { font-weight: 400; color: var(--sng-muted); font-size: 14px; line-height: 1.55; padding: 64px 28px 0; text-align: center; }
body:not(.task-login) .listing-info:before {
  content: "\f0e0"; font-family: 'Icons'; font-weight: 900; display: block; margin: 0 auto 14px;
  width: 56px; height: 56px; line-height: 56px; border-radius: 16px; font-size: 22px;
  color: var(--sng-blue); background: var(--sng-tint);
}
body.task-addressbook .listing-info:before { content: "\f2bb"; }

/* Акценты Elastic (#37beff) → фирменный бирюзовый */
.custom-switch .custom-control-input:checked ~ .custom-control-label:before { background-color: var(--sng-blue); border-color: var(--sng-blue); }
.custom-control-input:focus ~ .custom-control-label:before { box-shadow: 0 0 0 3px rgba(0,142,185,.18); }
.form-control:focus, .custom-select:focus { border-color: var(--sng-blue); }
.unreadcount, .badge-info { background-color: var(--sng-blue); }
.ui-dialog .ui-dialog-titlebar a.ui-dialog-titlebar-close:hover { color: var(--sng-blue); }
.popover .listing li a.active:hover, .popupmenu li a.active:hover { color: var(--sng-blue-dark); }
.boxinformation, .hint.boxinformation { background-color: #eaf5f9; border-color: #cfe6ee; color: #23495a; }

/* Кнопки форм */
body:not(.task-login) .formbuttons .btn, body:not(.task-login) .btn { border-radius: 9px; }
body:not(.task-login) .btn-primary { background: var(--sng-blue); border-color: var(--sng-blue); color: #fff; font-weight: 600; }
body:not(.task-login) .btn-primary:hover { background: var(--sng-blue-dark); border-color: var(--sng-blue-dark); }
body:not(.task-login) .btn-secondary { background: #fff; color: #2f5565; border: 1px solid #c9dbe2; }
body:not(.task-login) .btn-secondary:hover { background: var(--sng-tint); color: var(--sng-blue-dark); border-color: #a9cddb; }
body.action-compose .formbuttons .btn.send { padding-left: 22px; padding-right: 22px; box-shadow: 0 6px 16px rgba(0,142,185,.25); }

/* Создание письма: поля и зона вложений */
body.action-compose #compose-headers .form-control, body.action-compose .recipient-input, body.action-compose #compose-subject { border-radius: 8px; }
body.action-compose #compose-attachments .upload-form, body.action-compose .compose-attachments .upload-form { background: #f7fbfc; }
body.action-compose #compose-attachments, body.action-compose .compose-attachments { border-color: #b9d7e2; background: #f7fbfc; border-radius: 12px; }
body.action-compose #layout-sidebar .header, body.action-compose #layout-sidebar { background: #f7fafb; }
body.action-compose .editor-toolbar, body.action-compose .mce-tinymce .mce-top-part { background: #f4f8fa; border-color: var(--sng-line); }

/* Тулбар над списком писем помещается в панель */
@media screen and (min-width: 1025px) {
  body:not(.task-login) #messagelist-header .toolbar a, body:not(.task-login) #messagelist-header a.toolbar-button {
    min-width: 0; max-width: 76px; padding-left: 4px; padding-right: 4px; font-size: 11.5px;
  }
  body:not(.task-login) #messagelist-header .toolbar { margin-left: auto; }
}
