/* Ever Mail. Extends Elastic (Roundcube Dev Team), CC BY-SA 3.0.
 * Chrome only: no replacement templates, scripts, icon fonts, editor or email CSS.
 * Elastic owns visibility, mobile navigation, column sizing and keyboard behavior.
 */
:root {
  --ever-canvas: #f6f8fc;
  --ever-rail: #eaf0f8;
  --ever-surface: #fff;
  --ever-row: #f2f6fc;
  --ever-text: #1f2937;
  --ever-muted: #526077;
  --ever-line: #dde4ef;
  --ever-accent: #0b57d0;
  --ever-accent-text: #fff;
  --ever-selected: #d3e3fd;
  --ever-hover: #e2eafa;
  --ever-shadow: 0 8px 30px rgb(35 60 100 / 7%);
}

html.dark-mode {
  --ever-canvas: #111820;
  --ever-rail: #172230;
  --ever-surface: #1c2836;
  --ever-row: #202e3e;
  --ever-text: #e3e7ef;
  --ever-muted: #b6c2d4;
  --ever-line: #36465a;
  --ever-accent: #a8c7fa;
  --ever-accent-text: #102b54;
  --ever-selected: #2c4668;
  --ever-hover: #293b52;
  --ever-shadow: 0 8px 30px rgb(0 0 0 / 12%);
}

/* Explicit chrome selectors leave HTML mail and print views untouched. */
html:root body #layout {
  background-color: var(--ever-canvas);
}

html:root body #layout-menu,
html:root body #taskmenu .special-buttons {
  background-color: var(--ever-rail);
}

html:root body #layout-sidebar {
  background-color: var(--ever-canvas);
  border-color: var(--ever-line);
}

html:root body #layout-list,
html:root body #layout-content {
  background-color: var(--ever-surface);
  border-color: var(--ever-line);
}

html:root body #layout > div > .header,
html:root body #layout > div > .footer {
  color: var(--ever-text);
  background-color: var(--ever-surface);
  border-color: var(--ever-line);
}

html:root body #layout-sidebar > .header,
html:root body #layout-sidebar > .footer {
  background-color: var(--ever-canvas);
}

html:root body #taskmenu a {
  color: var(--ever-muted);
}

html:root body #taskmenu a.selected,
html:root body #taskmenu a:hover,
html:root body #taskmenu a:focus-visible {
  color: var(--ever-text);
  background-color: var(--ever-selected);
}

/* Elastic gives the mode switch its own dark background; keep readable contrast. */
html:root body #taskmenu a.theme {
  color: var(--ever-text);
  background-color: var(--ever-rail);
}

html:root body #taskmenu a.theme:hover,
html:root body #taskmenu a.theme:focus-visible {
  color: var(--ever-text);
  background-color: var(--ever-selected);
}

html:root body #taskmenu .action-buttons a.compose {
  color: var(--ever-accent-text);
  background-color: var(--ever-accent);
}

html:root body #taskmenu .action-buttons a.compose:hover {
  box-shadow: 0 2px 6px rgb(11 87 208 / 25%);
}

html:root body #folderlist li:not(.droptarget) > a {
  color: var(--ever-text);
  border-color: transparent;
  border-radius: 0 24px 24px 0;
}

html:root body #folderlist li.selected:not(.droptarget) > a {
  color: var(--ever-text);
  background-color: var(--ever-selected);
  font-weight: 700;
}

html:root body #folderlist li:not(.droptarget) > a:hover {
  background-color: var(--ever-hover);
}

html:root body #messagelist tbody tr:not(.droptarget) td {
  background-color: var(--ever-row);
  border-bottom-color: var(--ever-line);
}

html:root body #messagelist tbody tr:not(.droptarget).unread td {
  background-color: var(--ever-surface);
}

html:root body #messagelist tbody tr:not(.droptarget):hover td {
  background-color: var(--ever-hover);
}

html:root body #messagelist tbody tr:not(.droptarget).selected td {
  background-color: var(--ever-selected);
}

/* Preserve flag/deleted colors and inherited icon glyphs. */
html:root body #messagelist tbody tr:not(.droptarget):not(.flagged):not(.deleted) td.subject,
html:root body #messagelist tbody tr:not(.droptarget):not(.flagged):not(.deleted) td.subject span.subject a {
  color: var(--ever-text);
}

html:root body #messagelist tbody tr:not(.droptarget):not(.flagged):not(.deleted) td.subject span.fromto,
html:root body #messagelist tbody tr:not(.droptarget):not(.flagged):not(.deleted) td.subject span.date {
  color: var(--ever-muted);
}

html:root body #layout-list .searchbar {
  background-color: var(--ever-row);
  border-color: var(--ever-line);
}

html:root body #layout-list .searchbar input {
  color: var(--ever-text);
  background-color: transparent;
}

html:root body #taskmenu a:focus-visible,
html:root body #folderlist a:focus-visible {
  outline: 2px solid var(--ever-accent);
  outline-offset: -3px;
}

/* Rounded desktop panels without changing Elastic's flex or resize dimensions. */
@media screen and (min-width: 1201px) {
  html:not(.iframe) body:not(.task-login) #layout-list,
  html:not(.iframe) body:not(.task-login) #layout-content {
    margin: 10px 10px 10px 0;
    border: 1px solid var(--ever-line);
    border-radius: 16px;
  }

  html:not(.iframe) body:not(.task-login) #layout-list > .header,
  html:not(.iframe) body:not(.task-login) #layout-content > .header {
    border-radius: 15px 15px 0 0;
  }

  html:not(.iframe) body:not(.task-login) #layout-list > .footer,
  html:not(.iframe) body:not(.task-login) #layout-content > .footer {
    border-radius: 0 0 15px 15px;
  }

  html:root body #taskmenu a {
    border-radius: 18px;
  }

  html:root body #taskmenu .action-buttons a.compose {
    border-radius: 18px;
  }
}

/* Retain the native login form and validation. No extra network requests. */
html:root body.task-login #layout-content {
  background: var(--ever-canvas);
  overflow-y: auto;
}

html:root body.task-login #logo {
  width: 240px;
  height: 64px;
  max-width: 85%;
  top: 10vh;
}

html:root body.task-login #login-form {
  box-sizing: border-box;
  max-width: 380px;
  top: 13vh;
  padding: 28px;
  border: 1px solid var(--ever-line);
  border-radius: 24px;
  background: var(--ever-surface);
  color: var(--ever-text);
  box-shadow: var(--ever-shadow);
  margin-bottom: 18vh;
}

html:root body.task-login #login-form .form-control {
  border-radius: 10px;
}

html:root body.task-login #rcmloginsubmit {
  color: var(--ever-accent-text);
  background-color: var(--ever-accent);
  border-color: var(--ever-accent);
  border-radius: 24px;
}

html:root body.task-login #login-footer {
  color: var(--ever-muted);
}

@media screen and (max-width: 480px) {
  html:root body.task-login #login-form {
    padding: 22px 18px;
  }
}
