/*
 * Response Systems brand layer for the Roundcube Elastic-based skin.
 * Brand Guidelines v1.0 (October 2026).
 *
 * The colour palette lives in styles/colors.less (compiled into
 * styles.min.css, embed.min.css). This file carries the rest of the design
 * language: Urbanist type hierarchy, 8px corners, the 4px Response Blue rule,
 * and the branded sign-in page (Midnight hero, rounded-line chevrons,
 * layered Ridge curves).
 *
 * Urbanist is self-hosted (fonts/urbanist-*.woff2, @font-face rules in
 * styles.min.css), so no third-party font request is made.
 *
 * Palette
 *   Response Blue #1B57E6  primary: buttons, links, rules
 *   Midnight      #0F1A3C  primary: heroes, tiles, headings
 *   Signal Blue   #4278EA  secondary
 *   Sky           #8DB3FF  accent on dark only (never text on white)
 *   Ink           #0A1128  body text
 *   Paper         #F4F5F8  page backgrounds
 *   Ridge Deep    #1A2A5C  curves, layered shapes
 *   Ridge         #2A4087  curves, layered shapes
 */

:root {
    --rs-blue: #1B57E6;
    --rs-blue-hover: #1546BF;
    --rs-blue-text: #1B57E6;
    --rs-blue-tint: #E8EEFC;
    --rs-midnight: #0F1A3C;
    --rs-signal: #4278EA;
    --rs-sky: #8DB3FF;
    --rs-ink: #0A1128;
    --rs-heading: #0F1A3C;
    --rs-muted: #4F5873;
    --rs-paper: #F4F5F8;
    --rs-card: #FFFFFF;
    --rs-line: #E2E5EE;
    --rs-line-strong: #CDD3E0;
    --rs-ridge-deep: #1A2A5C;
    --rs-ridge: #2A4087;
    --rs-focus: rgba(27, 87, 230, .22);
    --rs-shadow-card: 0 1px 2px rgba(15, 26, 60, .06), 0 16px 40px rgba(15, 26, 60, .10);
    --rs-shadow-pop: 0 2px 4px rgba(15, 26, 60, .06), 0 14px 32px rgba(15, 26, 60, .14);
    --rs-radius: 8px;
    --rs-rule: 4px;
    --rs-font: Urbanist, Arial, sans-serif;
}

html.dark-mode {
    --rs-blue: #1B57E6;
    --rs-blue-hover: #4278EA;
    --rs-blue-text: #8DB3FF;
    --rs-blue-tint: #1A2A5C;
    --rs-ink: #E4E8F3;
    --rs-heading: #FFFFFF;
    --rs-muted: #A9B3CF;
    --rs-paper: #0B1430;
    --rs-card: #0F1A3C;
    --rs-line: #24335F;
    --rs-line-strong: #34477E;
    --rs-focus: rgba(141, 179, 255, .30);
    --rs-shadow-card: 0 2px 4px rgba(0, 0, 0, .3), 0 20px 44px rgba(0, 0, 0, .35);
    --rs-shadow-pop: 0 2px 4px rgba(0, 0, 0, .35), 0 18px 40px rgba(0, 0, 0, .5);
}

/* ---------- Type ---------- */

html,
body,
button,
input,
optgroup,
select,
textarea,
.popover,
.tooltip,
.ui-widget,
.ui-widget input,
.ui-widget select,
.ui-widget textarea,
.ui-widget button {
    font-family: var(--rs-font);
}

body {
    color: var(--rs-ink);
    font-weight: 500;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Headings: ExtraBold 800; subheadings: Bold 700 */
h1, h2,
.ui-dialog-title,
#message-header .subject {
    color: var(--rs-heading);
    font-weight: 800;
    letter-spacing: -.01em;
}

h3, h4, h5,
.header .header-title,
.header-title.username,
legend,
.formcontent fieldset > legend,
.boxtitle {
    font-weight: 700;
}

b, strong {
    font-weight: 700;
}

/* Labels: SemiBold 600, uppercase, +20% tracking */
.rs-label,
.listing-hint,
.popover-header .header-title,
.menu > h3,
.popupmenu h3,
#layout-sidebar .boxtitle,
.ui-datepicker th {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .2em;
}

::selection {
    background: var(--rs-focus);
}

html:not(.dark-mode) {
    scrollbar-color: var(--rs-line-strong) transparent;
}

a {
    color: var(--rs-blue-text);
}

a:hover,
a:focus {
    color: var(--rs-blue-hover);
}

html.dark-mode a:hover,
html.dark-mode a:focus {
    color: #fff;
}

/* ---------- Layout chrome ---------- */

body,
#layout {
    background-color: var(--rs-paper);
}

#layout > div > .header,
#layout-content > .header,
#layout-sidebar > .header,
#layout-list > .header {
    border-bottom: 1px solid var(--rs-line);
}

#layout-sidebar,
#layout-list {
    border-color: var(--rs-line);
}

#layout-sidebar .header .header-title {
    color: var(--rs-heading);
}

.toolbar a.button,
.header a.button.icon,
.menu.toolbar a {
    border-radius: var(--rs-radius);
}

/* Task rail (Midnight) */

#layout-menu {
    border-top: var(--rs-rule) solid var(--rs-blue);
}

#layout-menu .popover-header {
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

#layout-menu #logo {
    width: 44px;
    height: 44px;
    max-width: 44px;
    padding: 0;
    object-fit: contain;
    opacity: 1;
}

/* The `[dark]` logo type resolves to the long wordmark, which does not fit the
   narrow rail; always show the tile mark there. */
html.dark-mode #layout-menu #logo {
    content: url("../images/rs-mark-white.png");
    opacity: 1;
}

@media screen and (min-width: 481px) and (max-width: 1024px) {
    #layout-menu #logo {
        width: 32px;
        height: 32px;
        max-width: 32px;
    }
}

@media screen and (min-width: 481px) {
    #taskmenu a {
        margin: 3px auto;
        border-radius: var(--rs-radius);
        font-weight: 600;
        transition: background-color .15s ease, color .15s ease;
    }
}

@media screen and (min-width: 1025px) {
    #taskmenu {
        padding: 6px 8px;
    }

    /* dark.less sets a fixed width on `html.dark-mode #taskmenu a`, which is
       more specific than the rule above, so repeat it for dark mode or the
       tiles overflow the rail. */
    #taskmenu a,
    html.dark-mode #taskmenu a {
        width: auto;
        margin: 3px 0;
    }

    /* .special-buttons is absolutely positioned against the page, so give it
       the rail's own width (floor(5.6 * @page-font-size)) rather than 100%. */
    #taskmenu .special-buttons {
        width: 84px;
        padding: 6px 8px;
        box-sizing: border-box;
    }

    #taskmenu .special-buttons a {
        width: auto;
        font-size: .9rem;
    }

    #taskmenu .action-buttons a.compose {
        font-weight: 700;
    }
}

#taskmenu a:not(.selected):hover {
    color: #fff;
}

#taskmenu a:not(.selected):hover:before {
    color: var(--rs-sky);
}

/* Compose is a plain rail item; only the selected page gets the blue tile.
   dark.less colours .action-buttons links with the main blue, so reset it. */
html.dark-mode #taskmenu .action-buttons a {
    color: #fff;
}

html.dark-mode #layout-menu,
html.dark-mode #layout-menu .popover-header {
    background-color: #0F1A3C !important;
}

html.dark-mode #taskmenu a.selected {
    color: #fff;
    background-color: var(--rs-blue);
}

/* ---------- Buttons (8px corners, one primary per view) ---------- */

.btn {
    padding-left: 1.15rem;
    padding-right: 1.15rem;
    border-radius: var(--rs-radius);
    font-weight: 700;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.btn-sm,
.btn-group-sm > .btn,
.btn-lg,
.btn-group-lg > .btn {
    border-radius: var(--rs-radius);
}

.btn:focus,
.btn.focus,
.btn:not(:disabled):not(.disabled):active:focus {
    box-shadow: 0 0 0 3px var(--rs-focus);
}

.btn-primary {
    color: #fff;
    background-color: var(--rs-blue);
    border-color: var(--rs-blue);
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:not(:disabled):not(.disabled):active,
.btn-primary:not(:disabled):not(.disabled).active {
    color: #fff;
    background-color: var(--rs-blue-hover);
    border-color: var(--rs-blue-hover);
}

/* Secondary = outline (guidelines: "See our services") */
.btn-secondary,
.btn-light,
.btn-default {
    color: var(--rs-heading);
    background-color: var(--rs-card);
    border: 1px solid var(--rs-line-strong);
}

.btn-secondary:hover,
.btn-secondary:focus,
.btn-secondary:not(:disabled):not(.disabled):active,
.btn-light:hover,
.btn-light:focus {
    color: var(--rs-blue-text);
    background-color: var(--rs-card);
    border-color: var(--rs-blue);
}

.btn-danger {
    border-radius: var(--rs-radius);
}

.btn-link {
    color: var(--rs-blue-text);
}

.btn.disabled,
.btn:disabled {
    opacity: .5;
}

.floating-action-buttons a.button {
    background-color: var(--rs-blue);
    border-radius: var(--rs-radius);
}

/* ---------- Form controls ---------- */

.form-control,
.custom-select,
.input-group-text,
.recipient-input,
select.form-control,
.searchbar,
.ui-autocomplete,
textarea {
    border-radius: var(--rs-radius);
}

.input-group > .form-control:not(:last-child),
.input-group > .custom-select:not(:last-child),
.input-group > .input-group-append > .btn,
.input-group > .input-group-append > .input-group-text {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.input-group > .input-group-prepend > .input-group-text,
.input-group > .input-group-prepend > .btn {
    border-top-left-radius: var(--rs-radius);
    border-bottom-left-radius: var(--rs-radius);
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.input-group > .form-control:last-child,
.input-group > .custom-select:last-child {
    border-top-right-radius: var(--rs-radius);
    border-bottom-right-radius: var(--rs-radius);
}

.form-control:focus,
.custom-select:focus,
.recipient-input.focus {
    border-color: var(--rs-blue);
    box-shadow: 0 0 0 3px var(--rs-focus);
}

label,
.col-form-label,
.form-check-label {
    font-weight: 600;
}

.searchbar input {
    font-weight: 500;
}

.custom-control-input:checked ~ .custom-control-label::before {
    background-color: var(--rs-blue);
    border-color: var(--rs-blue);
}

.custom-switch .custom-control-input:checked ~ .custom-control-label::before {
    background-color: var(--rs-blue);
}

.progress-bar,
.bg-primary {
    background-color: var(--rs-blue) !important;
}

/* ---------- Lists ---------- */

.listing li > a,
.listing li > span,
table.listing td {
    font-weight: 500;
}

.listing li.selected > a,
.treelist li.selected > a,
table.messagelist tr.selected td:first-child {
    box-shadow: inset var(--rs-rule) 0 0 var(--rs-blue);
}

.listing li.selected > a,
.listing li.selected > a > .inner,
table.messagelist tr.selected td {
    font-weight: 700;
}

.messagelist tr.unread td,
.messagelist tr.unread td a,
.listing li.unread > a {
    font-weight: 700;
}

.listing .unreadcount,
.listing .count,
.badge {
    border-radius: var(--rs-radius);
    font-weight: 700;
}

/* ---------- Popups, dialogs, toasts ---------- */

.popover,
.popupmenu,
.ui-menu,
.ui-autocomplete {
    border-radius: var(--rs-radius);
    box-shadow: var(--rs-shadow-pop);
    overflow: hidden;
}

.popover .listing li > a,
.popupmenu .listing li > a {
    border-radius: 6px;
}

.ui-dialog {
    border: 1px solid var(--rs-line);
    border-top: var(--rs-rule) solid var(--rs-blue);
    border-radius: var(--rs-radius);
    box-shadow: var(--rs-shadow-pop);
    overflow: hidden;
}

.ui-dialog .ui-dialog-titlebar {
    font-weight: 800;
}

.ui-dialog .ui-dialog-buttonpane button {
    border-radius: var(--rs-radius);
}

.ui-dialog .ui-dialog-buttonpane button.mainaction,
.ui-dialog .ui-dialog-buttonpane button:last-child:not(:first-child) {
    color: #fff;
    background-color: var(--rs-blue);
    border-color: var(--rs-blue);
}

#messagestack div {
    border-radius: var(--rs-radius);
    box-shadow: var(--rs-shadow-pop);
    font-weight: 600;
}

.ui-datepicker {
    border-radius: var(--rs-radius);
    box-shadow: var(--rs-shadow-pop);
}

/* ---------- Message view and compose ---------- */

#message-header .subject {
    letter-spacing: -.02em;
}

#compose-attachments.file-upload,
.attachmentslist li {
    border-radius: var(--rs-radius);
}

.quota-widget .bar {
    border-radius: var(--rs-radius);
    overflow: hidden;
}

.quota-widget .value {
    background-color: var(--rs-blue);
}

#contactpic,
.contactphoto,
img.contactphoto {
    border-radius: var(--rs-radius);
}

/* ---------- Sign-in page ---------- */

body.task-login,
body.task-login #layout {
    min-height: 100vh;
    background: var(--rs-paper);
}

/* 4px Response Blue rule opens the page */
body.task-login::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2;
    height: var(--rs-rule);
    background: var(--rs-blue);
}

body.task-login #layout-content,
body.task-login #layout-content.selected.no-navbar {
    position: static;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: none;
    min-height: 100vh;
    height: auto;
    margin: 0;
    padding: 40px 32px;
    transform: none;
    overflow: visible;
    background: transparent;
    border: 0;
    border-radius: 0;
}

body.task-login #layout-content.selected.no-navbar::before,
body.task-login #layout-content.selected.no-navbar::after,
#login-form::before {
    content: none;
    display: none;
}

.rs-login-shell {
    display: grid;
    grid-template-columns: minmax(340px, 480px) minmax(340px, 420px);
    width: min(900px, calc(100vw - 64px));
    min-height: 560px;
    overflow: hidden;
    background: var(--rs-card);
    border: 1px solid var(--rs-line);
    border-radius: var(--rs-radius);
    box-shadow: var(--rs-shadow-card);
    text-align: left;
}

/* Midnight hero */
.rs-brand-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 560px;
    padding: 40px 40px 132px;
    overflow: hidden;
    color: #fff;
    background: #0F1A3C;
}

/* Large rounded-line chevrons (Response Blue + Sky on Midnight) */
.rs-brand-chevrons {
    position: absolute;
    top: 92px;
    right: 32px;
    width: 160px;
    height: 160px;
    background: url("../images/rs-chevrons.svg") center / contain no-repeat;
    pointer-events: none;
}

/* Layered smooth curves close the dark section */
.rs-brand-curves {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 120px;
    background: url("../images/rs-curves.svg") center bottom / 100% 100% no-repeat;
    pointer-events: none;
}

.rs-brand-panel > * {
    z-index: 1;
}

.rs-brand-copy {
    position: relative;
    z-index: 2;
}

/* Reverse logo; clear space = half the tile width (logo height ~ tile) */
body.task-login #logo {
    position: absolute;
    top: 40px;
    left: 40px;
    z-index: 2;
    display: block;
    width: 180px;
    max-width: calc(100% - 80px);
    min-width: 120px;
    height: auto;
    max-height: none;
    padding: 0;
    background: transparent;
    border-radius: 0;
    opacity: 1;
}

/* Phone/dark-mode logo switching would show the bare tile or a dimmed logo
   here; the hero is always Midnight, so always use the reverse logo. */
html body.task-login #logo,
html.dark-mode body.task-login #logo {
    content: url("../images/rs-logo-long-white.png");
    opacity: 1;
}

.rs-brand-label {
    margin-bottom: 14px;
    color: #8DB3FF;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: .2em;
    text-transform: uppercase;
}

.rs-brand-title {
    max-width: 9ch;
    color: #fff;
    font-size: 46px;
    font-weight: 800;
    line-height: 1.04;
    letter-spacing: -.02em;
}

.rs-brand-meta {
    margin-top: 18px;
    color: #C7D6F7;
    font-size: 14px;
    font-weight: 500;
}

/* Sign-in panel */
.rs-auth-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 48px 44px;
    color: var(--rs-ink);
    background: var(--rs-card);
}

.rs-auth-heading {
    margin-bottom: 28px;
}

.rs-auth-kicker {
    margin-bottom: 10px;
    color: var(--rs-blue-text);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .2em;
    text-transform: uppercase;
}

.rs-auth-heading h2 {
    margin: 0;
    color: var(--rs-heading);
    font-size: 36px;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -.02em;
}

.rs-auth-heading h2::after {
    content: "";
    display: block;
    width: 48px;
    height: var(--rs-rule);
    margin-top: 16px;
    background: var(--rs-blue);
    border-radius: 2px;
}

.rs-auth-lead {
    margin: 16px 0 0;
    color: var(--rs-muted);
    font-size: 15px;
    font-weight: 500;
}

#login-form {
    position: static;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

#login-form .form-group {
    margin-bottom: 14px;
}

#login-form .input-group {
    margin-bottom: 0;
}

#login-form .input-group-text {
    min-width: 48px;
    justify-content: center;
    color: var(--rs-blue-text);
    background: var(--rs-paper);
    border-color: var(--rs-line-strong);
}

#login-form .form-control,
#login-form input {
    min-height: 50px;
    color: var(--rs-ink);
    background-color: var(--rs-card);
    border-color: var(--rs-line-strong);
    font-size: 16px;
    font-weight: 500;
}

#login-form .form-control::placeholder {
    color: #6B7389;
    opacity: 1;
}

#login-form .input-group:focus-within .input-group-text {
    border-color: var(--rs-blue);
}

#login-form input:-webkit-autofill,
#login-form input:-webkit-autofill:hover,
#login-form input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--rs-ink);
    caret-color: var(--rs-ink);
    box-shadow: 0 0 0 1000px var(--rs-card) inset;
}

#login-form .formbuttons {
    margin: 0;
}

#rcmloginsubmit {
    width: 100%;
    min-height: 50px;
    margin-top: 8px;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: .01em;
    text-transform: none !important;
}

#login-footer {
    margin-top: 24px;
    color: var(--rs-muted);
    font-size: 13px;
    text-align: left;
}

#login-footer,
#login-footer * {
    color: var(--rs-muted);
}

/* Reachable: the support link is easy to find */
#login-footer > div.rs-support {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 14px;
    padding: 14px 16px;
    background: var(--rs-paper);
    border: 1px solid var(--rs-line);
    border-radius: var(--rs-radius);
    font-size: 14px;
}

#login-footer .rs-support-text {
    color: var(--rs-ink);
    font-weight: 600;
}

#login-footer a,
#login-footer .support-link {
    color: var(--rs-blue-text);
    font-weight: 700;
    text-decoration: none;
}

#login-footer .support-link::after {
    content: "";
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-left: 8px;
    border-top: 2px solid currentColor;
    border-right: 2px solid currentColor;
    border-radius: 1px;
    transform: translateY(-1px) rotate(45deg);
}

#login-footer a:hover,
#login-footer .support-link:hover {
    color: var(--rs-blue-hover);
    text-decoration: underline;
}

#login-footer > div.rs-product {
    margin: 0;
    padding: 0;
    background: transparent;
    border-radius: 0;
    font-size: 12px;
}

#login-footer > div:not(.rs-support):not(.rs-product) {
    padding: 0;
    background: transparent;
    border-radius: 0;
}

@media screen and (max-width: 860px) {
    body.task-login #layout-content,
    body.task-login #layout-content.selected.no-navbar {
        padding: 24px 16px;
    }

    .rs-login-shell {
        grid-template-columns: 1fr;
        width: min(460px, calc(100vw - 32px));
        min-height: 0;
    }

    .rs-brand-panel {
        justify-content: flex-start;
        min-height: 0;
        padding: 28px 28px 88px;
    }

    .rs-brand-chevrons {
        top: 26px;
        right: 22px;
        width: 72px;
        height: 72px;
    }

    .rs-brand-curves {
        height: 72px;
    }

    body.task-login #logo {
        position: relative;
        top: auto;
        left: auto;
        width: 160px;
        margin: 0 0 28px;
    }

    .rs-brand-label {
        margin-bottom: 10px;
        font-size: 11px;
    }

    .rs-brand-meta {
        margin-top: 10px;
    }

    .rs-brand-title {
        max-width: none;
        font-size: 32px;
    }

    .rs-auth-panel {
        padding: 32px 28px;
    }

    .rs-auth-heading h2 {
        font-size: 30px;
    }
}

/* ---------- Dark mode: sign-in ---------- */

html.dark-mode .rs-login-shell {
    border-color: var(--rs-line);
}

html.dark-mode .rs-auth-panel {
    background: #0F1A3C;
}

html.dark-mode .rs-brand-panel {
    background: #0A1128;
}
