:root {
  --studio-accent: #3158d8;
  --studio-accent-soft: #e9efff;
  --studio-surface: #ffffff;
  --studio-background: #f5f7fb;
  --studio-border: #e6eaf2;
  --studio-text: #202b43;
}

html.dark-mode {
  --studio-accent: #91a9ff;
  --studio-accent-soft: #273453;
  --studio-surface: #222b3b;
  --studio-background: #192231;
  --studio-border: #354158;
  --studio-text: #eef2ff;
}

body {
  color: var(--studio-text);
}

.studio-remember-login {
  margin: 0 0 18px;
  color: var(--studio-text);
}

.studio-remember-login label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.studio-remember-login input {
  margin: 0;
}

.studio-remember-login p {
  margin: 6px 0 0 22px;
  font-size: 0.85em;
  color: #65718a;
}

#layout,
#layout > div > .header,
#layout > div > .footer {
  background: var(--studio-background);
}

#layout-menu {
  background: var(--studio-surface);
  border-right: 1px solid var(--studio-border);
}

#taskmenu a,
#layout-menu .popover-header {
  color: var(--studio-text);
}

#taskmenu a.selected,
#taskmenu a:hover {
  color: var(--studio-accent);
  background: var(--studio-accent-soft);
}

#taskmenu a.compose {
  color: #fff;
  background: #3158d8;
  border-radius: 12px;
  margin: 10px 8px;
}

#taskmenu a.compose:hover {
  background: #2548bd;
  color: #fff;
}

#layout-sidebar,
#layout-list,
#layout-content {
  background: var(--studio-surface);
  border-color: var(--studio-border);
}

#layout-sidebar {
  flex: 2;
  max-width: 260px;
  min-width: 210px;
}

#layout-list {
  flex: 4;
  max-width: 38%;
  min-width: 310px;
}

#layout > div > .header {
  min-height: 58px;
  border-color: var(--studio-border);
  color: var(--studio-text);
}

#layout > div > .header .header-title {
  font-weight: 650;
}

#layout > div > .header a.button {
  color: var(--studio-text);
}

#folderlist-content,
#messagelist-content {
  background: var(--studio-surface);
}

#studio-all-mail {
  display: block;
  width: calc(100% - 18px);
  margin: 9px 9px 14px;
  padding: 11px 14px;
  border: 0;
  border-radius: 10px;
  background: var(--studio-accent-soft);
  color: var(--studio-accent);
  font-weight: 650;
  text-align: left;
  cursor: pointer;
}

#studio-all-mail.selected,
#studio-all-mail:hover {
  background: var(--studio-accent);
  color: #fff;
}

.folderlist li a {
  border-radius: 9px;
  margin: 2px 9px;
  padding-top: 9px;
  padding-bottom: 9px;
}

.folderlist li.selected > a,
.folderlist li a:hover {
  color: var(--studio-accent);
  background: var(--studio-accent-soft);
}

.messagelist tr {
  border-bottom: 1px solid var(--studio-border);
}

.messagelist tr:hover,
.messagelist tr.selected {
  background: var(--studio-accent-soft);
}

.messagelist td.subject {
  color: var(--studio-text);
}

.searchbar {
  background: var(--studio-background);
  border-bottom: 1px solid var(--studio-border);
}

.searchbar form,
.searchbar input,
.form-control,
button.btn {
  border-radius: 10px;
}

.btn-primary {
  background-color: #3158d8;
  border-color: #3158d8;
}

.btn-primary:hover {
  background-color: #2548bd;
  border-color: #2548bd;
}

@media (max-width: 1024px) {
  #layout-sidebar,
  #layout-list {
    max-width: none;
  }

  #taskmenu a.compose {
    margin: 6px;
  }
}

@media (max-width: 480px) {
  #layout > div > .header {
    min-height: 54px;
  }

  .folderlist li a {
    padding-top: 12px;
    padding-bottom: 12px;
  }
}

:root {
  --studio-accent: #4263d9;
  --studio-accent-soft: #e6edff;
  --studio-surface: #ffffff;
  --studio-background: #f3f6fc;
  --studio-border: #e2e8f3;
  --studio-text: #1d2a44;
  --studio-muted: #697792;
  --studio-shadow: 0 12px 34px rgba(33, 55, 111, 0.07);
}

html.dark-mode {
  --studio-accent: #a6baff;
  --studio-accent-soft: #2b395c;
  --studio-surface: #202a3c;
  --studio-background: #172132;
  --studio-border: #35425b;
  --studio-text: #f0f3fb;
  --studio-muted: #b5c0d5;
  --studio-shadow: 0 12px 34px rgba(0, 0, 0, 0.2);
}

body {
  background: var(--studio-background);
}

#layout-menu,
html.dark-mode #layout-menu {
  background: var(--studio-background);
  border-right: 1px solid var(--studio-border);
}

@media screen and (min-width: 481px) {
  #layout-menu .popover-header,
  html.dark-mode #layout-menu .popover-header,
  #taskmenu .special-buttons,
  html.dark-mode #taskmenu .special-buttons {
    background: var(--studio-background) !important;
  }

  #layout-menu .popover-header {
    position: relative;
  }

  #layout-menu .popover-header img {
    opacity: 0;
  }

  #layout-menu .popover-header::after {
    content: "2К";
    position: absolute;
    left: 50%;
    top: 11px;
    transform: translateX(-50%);
    width: 44px;
    height: 38px;
    line-height: 38px;
    border-radius: 13px;
    background: #4263d9;
    color: #fff;
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    text-align: center;
    pointer-events: none;
  }

  #taskmenu a,
  #taskmenu .action-buttons a {
    color: var(--studio-muted);
    background: transparent;
  }

  #taskmenu a.selected,
  #taskmenu a.selected:hover,
  #taskmenu a:hover,
  #taskmenu .action-buttons a:hover {
    color: var(--studio-accent);
    background: var(--studio-accent-soft);
  }

  #taskmenu a:not(.compose) {
    border-radius: 12px;
    margin: 3px auto;
  }

  #taskmenu a.compose,
  #taskmenu .action-buttons a.compose {
    color: #fff;
    background: #4263d9;
    border-radius: 16px;
    box-shadow: 0 8px 18px rgba(66, 99, 217, 0.24);
  }

  #taskmenu a.compose:hover {
    color: #fff;
    background: #3152ca;
  }
}

body.task-mail #layout {
  gap: 10px;
  padding: 10px;
}

body.task-mail #layout-sidebar,
body.task-mail #layout-list,
body.task-mail #layout-content {
  background: var(--studio-surface);
  border: 1px solid var(--studio-border);
  border-radius: 18px;
  box-shadow: var(--studio-shadow);
  overflow: hidden;
}

body.task-mail #layout-sidebar {
  flex: 0 0 250px;
  min-width: 220px;
  max-width: 250px;
}

body.task-mail #layout-list {
  flex: 1 1 390px;
  min-width: 300px;
  max-width: 42%;
}

body.task-mail #layout-content {
  flex: 1.25 1 420px;
  min-width: 0;
}

body.task-mail #layout > div > .header,
body.task-mail #layout > div > .footer {
  background: var(--studio-surface);
  color: var(--studio-text);
  border-color: var(--studio-border);
}

body.task-mail #layout > div > .header {
  height: 64px;
  min-height: 64px;
  line-height: 64px;
  padding: 0 12px;
}

body.task-mail #layout > div > .header .header-title {
  font-weight: 700;
}

body.task-mail #layout-sidebar > .header .username {
  font-size: 0.85rem;
  color: var(--studio-muted);
  text-align: left;
  margin: 0;
}

body.task-mail #folderlist-content {
  background: var(--studio-surface);
  padding: 8px 8px 16px;
}

body.task-mail #studio-all-mail {
  width: 100%;
  margin: 0 0 20px;
  padding: 13px 15px;
  border-radius: 13px;
  background: var(--studio-accent-soft);
  color: var(--studio-accent);
  font-size: 0.98rem;
  font-weight: 700;
}

body.task-mail #studio-all-mail::before {
  content: "✉";
  display: inline-block;
  width: 25px;
  font-size: 1.15rem;
  vertical-align: -1px;
}

body.task-mail #studio-all-mail.selected,
body.task-mail #studio-all-mail:hover {
  background: #4263d9;
  color: #fff;
}

body.task-mail #mailboxlist::before {
  content: "ПАПКИ";
  display: block;
  padding: 0 14px 9px;
  color: var(--studio-muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  pointer-events: none;
}

body.task-mail .folderlist li a {
  min-height: 42px;
  margin: 2px 0;
  padding: 9px 12px;
  border-radius: 11px;
  color: var(--studio-text);
}

body.task-mail .folderlist li.selected > a,
body.task-mail .folderlist li a:hover {
  background: var(--studio-accent-soft);
  color: var(--studio-accent);
}

body.task-mail .folderlist li.mailbox .unreadcount {
  background: var(--studio-accent-soft);
  color: var(--studio-accent);
  border-radius: 9px;
}

body.task-mail .searchbar {
  height: 52px;
  min-height: 52px;
  margin: 12px 14px;
  background: var(--studio-background);
  border: 1px solid var(--studio-border);
  border-radius: 13px;
}

body.task-mail .searchbar form:before,
body.task-mail .searchbar a {
  color: var(--studio-muted);
}

body.task-mail .searchbar input {
  color: var(--studio-text);
}

body.task-mail #messagelist-content {
  background: var(--studio-surface);
  padding: 0 10px;
}

body.task-mail .messagelist tr {
  border-bottom: 1px solid var(--studio-border);
}

body.task-mail .messagelist tr.unread {
  background: var(--studio-background);
}

body.task-mail .messagelist tr:hover,
body.task-mail .messagelist tr.selected {
  background: var(--studio-accent-soft);
}

body.task-mail .messagelist td {
  padding-top: 10px;
  padding-bottom: 10px;
}

body.task-mail .messagelist td.subject span.fromto {
  color: var(--studio-text);
  font-weight: 650;
}

body.task-mail .messagelist td.subject span.subject {
  color: var(--studio-muted);
}

body.task-mail .messagelist tr.unread td.subject span.subject,
body.task-mail .messagelist tr.unread td.subject span.fromto {
  color: var(--studio-text);
  font-weight: 700;
}

body.task-mail .messagelist td.subject span.date {
  color: var(--studio-muted);
}

body.task-mail #layout-content .iframe-wrapper {
  background: var(--studio-surface);
}

body.task-login {
  background: radial-gradient(circle at 12% 18%, #dfe8ff 0, transparent 28%),
    radial-gradient(circle at 90% 85%, #e7edff 0, transparent 30%),
    var(--studio-background);
}

body.task-login #layout-content {
  background: var(--studio-surface);
  border: 1px solid var(--studio-border);
  border-radius: 22px;
  box-shadow: 0 24px 68px rgba(33, 55, 111, 0.13);
}

body.task-login .studio-remember-login p {
  color: var(--studio-muted);
}

@media screen and (max-width: 1200px) {
  body.task-mail #layout-sidebar {
    flex-basis: 220px;
    max-width: 220px;
  }

  body.task-mail #layout-list {
    max-width: 44%;
  }
}

@media screen and (max-width: 1024px) {
  body.task-mail #layout-sidebar,
  body.task-mail #layout-list {
    width: auto !important;
    flex: 3 !important;
  }
}

@media screen and (max-width: 768px) {
  body.task-mail #layout {
    gap: 0;
    padding: 0;
  }

  body.task-mail #layout-sidebar,
  body.task-mail #layout-list,
  body.task-mail #layout-content {
    min-width: 0;
    max-width: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  body.task-mail #layout > div > .header {
    height: 58px;
    min-height: 58px;
    line-height: 58px;
  }

  body.task-mail #mailboxlist::before {
    display: none;
  }

  body.task-mail #studio-all-mail {
    margin-bottom: 10px;
  }
}
