:root {
    --richster-navy: #06172d;
    --richster-navy-2: #09284b;
    --richster-blue: #087cf0;
    --richster-blue-light: #41b7ff;
    --richster-bg: #101a21;
    --richster-panel: #172229;
    --richster-panel-2: #1d2a31;
    --richster-border: #33434d;
    --richster-text: #edf6fc;
    --richster-muted: #9fb0bb;
    --richster-white: #ffffff;
    --richster-shadow: 0 12px 35px rgba(0,0,0,.28);
}

html,
body {
    height: 100%;
}

body:not(.task-login) {
    padding-top: 122px !important;
    background: var(--richster-bg) !important;
    overflow: hidden;
}

.richster-topbar {
    position: fixed;
    z-index: 10000;
    top: 0;
    right: 0;
    left: 0;
    height: 68px;
    display: flex;
    align-items: center;
    gap: 28px;
    padding: 0 24px;
    color: #142234;
    background: #fff;
    border-bottom: 1px solid #dbe4ed;
    box-shadow: 0 2px 9px rgba(8,33,63,.08);
}

.richster-brand {
    display: flex;
    align-items: center;
    min-width: 205px;
    gap: 11px;
}

.richster-brand img {
    width: 43px;
    height: 43px;
    object-fit: contain;
}

.richster-brand div {
    display: flex;
    flex-direction: column;
    line-height: 1;
}

.richster-brand strong {
    color: #09284b;
    font-size: 18px;
    letter-spacing: .13em;
}

.richster-brand span {
    margin-top: 5px;
    color: #087cf0;
    font-size: 10px;
    letter-spacing: .4em;
}

.richster-search {
    display: flex;
    align-items: center;
    width: min(470px, 42vw);
    height: 42px;
    padding: 0 15px;
    border: 1px solid #d3dee8;
    border-radius: 10px;
    background: #f7fafc;
}

.richster-search span {
    margin-right: 10px;
    color: #65788a;
    font-size: 22px;
}

.richster-search input {
    width: 100%;
    border: 0;
    outline: 0;
    color: #253746;
    background: transparent;
    font-size: 14px;
}

.richster-top-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.richster-top-actions button,
.richster-top-actions a {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    color: #182c42;
    background: transparent;
    text-decoration: none;
    cursor: pointer;
    font-size: 19px;
}

.richster-top-actions button:hover,
.richster-top-actions a:hover {
    background: #edf5fc;
}

.richster-avatar {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: linear-gradient(135deg, #0b4b92, #087cf0);
    font-weight: 800;
}

.richster-mobile-menu {
    display: none;
    border: 0;
    background: transparent;
    font-size: 22px;
}

.richster-app-navigation {
    position: fixed;
    z-index: 9999;
    top: 68px;
    right: 0;
    left: 0;
    height: 54px;
    display: flex;
    align-items: stretch;
    padding-left: 226px;
    background: #fff;
    border-bottom: 1px solid #dbe4ed;
}

.richster-app-navigation a {
    min-width: 125px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 0 19px;
    color: #213547;
    border-bottom: 3px solid transparent;
    text-decoration: none;
}

.richster-app-navigation a:hover,
.richster-app-navigation a.active {
    color: #087cf0;
    border-bottom-color: #087cf0;
    background: #f7fbff;
}

.richster-app-navigation a span {
    font-size: 17px;
}

#layout {
    position: relative !important;
    height: calc(100vh - 122px) !important;
    max-height: calc(100vh - 122px) !important;
    background: var(--richster-bg);
}

#taskmenu {
    width: 225px !important;
    min-width: 225px !important;
    color: #fff !important;
    background:
        radial-gradient(circle at 20% 5%, rgba(8,124,240,.25), transparent 34%),
        linear-gradient(180deg, #07192f 0%, #061426 100%) !important;
    border-right: 1px solid #173657 !important;
}

.richster-sidebar-brand {
    height: 108px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px 14px;
}

.richster-sidebar-brand img {
    max-width: 175px;
    max-height: 82px;
    object-fit: contain;
    filter: drop-shadow(0 7px 16px rgba(0,0,0,.28));
}

#taskmenu a {
    color: #dceaff !important;
}

#taskmenu a:hover,
#taskmenu a.selected {
    color: #fff !important;
    background: rgba(8,124,240,.24) !important;
    border-left: 4px solid #39afff;
}

#taskmenu a.button-compose {
    margin: 8px 15px 18px !important;
    border-radius: 8px !important;
    background: linear-gradient(135deg, #087cf0, #22a6ff) !important;
    box-shadow: 0 8px 20px rgba(8,124,240,.27);
}

#taskmenu a.button-richster {
    display: none !important;
}

#layout-sidebar,
#layout-list,
#layout-content {
    border-color: var(--richster-border) !important;
    background: var(--richster-panel) !important;
}

#layout-sidebar {
    min-width: 250px;
}

#layout-list {
    min-width: 390px;
}

#layout-content {
    background: #111b21 !important;
}

.listing li,
.messagelist tr {
    color: var(--richster-text) !important;
    background: var(--richster-panel) !important;
    border-color: var(--richster-border) !important;
}

.listing li:hover,
.messagelist tr:hover {
    background: #22323b !important;
}

.listing li.selected,
.messagelist tr.selected {
    background: #183d59 !important;
}

.toolbar,
.footer,
.header,
.searchbar {
    color: var(--richster-text) !important;
    background: var(--richster-panel-2) !important;
    border-color: var(--richster-border) !important;
}

#messagelist td,
#messagelist th {
    color: var(--richster-text) !important;
    border-color: var(--richster-border) !important;
}

#messagelist .subject,
#messagelist .fromto {
    color: #f3f8fc !important;
}

#messagelist .date,
#messagelist .size {
    color: var(--richster-muted) !important;
}

input,
select,
textarea {
    border-color: #435660 !important;
    color: var(--richster-text) !important;
    background: #111c22 !important;
}

.richster-profile-panel {
    width: 245px;
    flex: 0 0 245px;
    padding: 22px 20px;
    color: #1a2d3d;
    background: #fff;
    border-left: 1px solid #dbe4ed;
    overflow-y: auto;
}

.richster-profile-panel h3 {
    margin: 0 0 20px;
    font-size: 18px;
}

.richster-profile-avatar {
    width: 78px;
    height: 78px;
    display: grid;
    place-items: center;
    margin: 0 auto 13px;
    border-radius: 50%;
    color: #fff;
    background: linear-gradient(135deg, #082e65, #087cf0);
    font-size: 25px;
    font-weight: 800;
}

.richster-profile-name {
    display: block;
    text-align: center;
    overflow-wrap: anywhere;
}

.richster-online {
    width: max-content;
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 13px auto 22px;
    padding: 7px 13px;
    border: 1px solid #dbe4ed;
    border-radius: 7px;
    font-size: 12px;
}

.richster-online span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #23b45d;
}

.richster-profile-panel hr {
    margin: 18px 0;
    border: 0;
    border-top: 1px solid #e1e8ef;
}

.richster-profile-panel h4 {
    margin: 0 0 10px;
    color: #596b7c;
    font-size: 11px;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.richster-profile-panel a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 8px;
    color: #213547;
    border-radius: 7px;
    text-decoration: none;
}

.richster-profile-panel a:hover {
    color: #087cf0;
    background: #f0f7fd;
}

body.task-login {
    min-height: 100vh;
    background:
        radial-gradient(circle at 15% 20%, rgba(53,183,255,.28), transparent 32%),
        radial-gradient(circle at 86% 82%, rgba(8,124,240,.3), transparent 35%),
        linear-gradient(135deg, #041127, #092f59 55%, #087cf0) !important;
}

body.task-login #layout {
    height: 100vh !important;
    max-height: none !important;
    background: transparent !important;
}

body.task-login #layout-content {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 25px;
    background: transparent !important;
}

body.task-login #login-form {
    width: min(430px, 92vw);
    padding: 35px;
    border: 1px solid rgba(255,255,255,.48);
    border-radius: 22px;
    background: rgba(255,255,255,.97);
    box-shadow: 0 26px 70px rgba(0,0,0,.3);
}

.richster-login-brand {
    margin-bottom: 24px;
    color: #183047;
    text-align: center;
}

.richster-login-brand img {
    max-width: 285px;
    max-height: 115px;
    object-fit: contain;
}

.richster-login-brand h1 {
    margin: 18px 0 5px;
    color: #09284b;
    font-size: 25px;
}

.richster-login-brand p {
    margin: 0;
    color: #6a7c8d;
}

body.task-login input {
    color: #213547 !important;
    background: #f6f9fc !important;
    border-color: #cedae5 !important;
}

body.task-login button.mainaction,
body.task-login .formbuttons .button {
    border: 0 !important;
    border-radius: 9px !important;
    background: linear-gradient(135deg, #087cf0, #36b4ff) !important;
    box-shadow: 0 9px 23px rgba(8,124,240,.28);
    font-weight: 700;
}

html.richster-light {
    --richster-bg: #eef3f7;
    --richster-panel: #ffffff;
    --richster-panel-2: #f6f9fc;
    --richster-border: #d7e0e7;
    --richster-text: #203345;
    --richster-muted: #637788;
}

html.richster-light #layout-content {
    background: #f5f8fb !important;
}

html.richster-light .listing li,
html.richster-light .messagelist tr {
    color: #203345 !important;
}

html.richster-light #messagelist .subject,
html.richster-light #messagelist .fromto {
    color: #172b3d !important;
}

html.richster-light input,
html.richster-light select,
html.richster-light textarea {
    color: #203345 !important;
    background: #fff !important;
    border-color: #cad6df !important;
}

@media (max-width: 1250px) {
    .richster-profile-panel {
        display: none;
    }
}

@media (max-width: 850px) {
    body:not(.task-login) {
        padding-top: 112px !important;
    }

    .richster-topbar {
        height: 62px;
        padding: 0 12px;
        gap: 10px;
    }

    .richster-mobile-menu {
        display: block;
    }

    .richster-brand {
        min-width: auto;
    }

    .richster-brand div {
        display: none;
    }

    .richster-search {
        width: auto;
        flex: 1;
    }

    .richster-top-actions a {
        display: none;
    }

    .richster-app-navigation {
        top: 62px;
        height: 50px;
        padding-left: 0;
        overflow-x: auto;
    }

    .richster-app-navigation a {
        min-width: 100px;
        padding: 0 12px;
    }

    #layout {
        height: calc(100vh - 112px) !important;
        max-height: calc(100vh - 112px) !important;
    }

    #taskmenu {
        position: fixed !important;
        z-index: 12000;
        top: 62px;
        bottom: 0;
        left: -240px;
        transition: left .2s ease;
    }

    html.richster-mobile-sidebar #taskmenu {
        left: 0;
    }
}

/* Richster Mail v3.1 corrections */

/* Hide Roundcube's original floating logo block */
#taskmenu > a.home,
#taskmenu .special-buttons,
#taskmenu .button-home,
#taskmenu > .logo,
#logo {
    display: none !important;
}

/* Ensure only one profile panel can occupy the layout */
.richster-profile-panel {
    display: none !important;
}

#richster-profile-panel {
    display: block !important;
    width: 230px;
    min-width: 230px;
    flex: 0 0 230px;
    padding: 22px 18px;
    color: #1a2d3d;
    background: #fff;
    border-left: 1px solid #dbe4ed;
    overflow-y: auto;
}

/* Do not allow injected panels to stretch the layout */
#layout > aside.richster-profile-panel:not(#richster-profile-panel) {
    display: none !important;
}

/* Keep the actual mail interface using the available space */
#layout-content {
    flex: 1 1 auto !important;
    min-width: 350px !important;
}

/* Correct sidebar branding size */
.richster-sidebar-brand {
    height: 80px !important;
    min-height: 80px !important;
    padding: 10px !important;
}

.richster-sidebar-brand img {
    display: block !important;
    width: auto !important;
    max-width: 165px !important;
    height: auto !important;
    max-height: 62px !important;
    margin: auto !important;
    object-fit: contain !important;
    filter: none !important;
}

/* Remove excess blank gap under the top navigation */
body:not(.task-login) {
    padding-top: 112px !important;
}

.richster-app-navigation {
    height: 44px !important;
}

#layout {
    height: calc(100vh - 112px) !important;
    max-height: calc(100vh - 112px) !important;
}

@media (max-width: 1450px) {
    #richster-profile-panel {
        display: none !important;
    }
}


/* =========================================================
   Richster Mail v3.2 visual corrections
   ========================================================= */

/* Remove empty gap left for the missing navigation bar */
body:not(.task-login) {
    padding-top: 64px !important;
}

#layout {
    height: calc(100vh - 64px) !important;
    max-height: calc(100vh - 64px) !important;
}

/* Hide the failed secondary navigation implementation */
.richster-app-navigation {
    display: none !important;
}

/* Clean top header */
.richster-topbar {
    height: 64px !important;
    padding: 0 20px !important;
}

/* Replace image-heavy header branding with clean icon and text */
.richster-brand img {
    width: 40px !important;
    height: 40px !important;
    padding: 6px !important;
    border-radius: 9px !important;
    object-fit: contain !important;
    background: linear-gradient(135deg, #087cf0, #35b9ff) !important;
    filter: none !important;
}

.richster-brand strong {
    color: #071c3b !important;
    font-size: 17px !important;
    letter-spacing: .16em !important;
}

.richster-brand span {
    color: #087cf0 !important;
    font-size: 9px !important;
    letter-spacing: .42em !important;
}

/* Remove glowing image from sidebar */
.richster-sidebar-brand {
    height: 76px !important;
    padding: 10px 8px !important;
}

.richster-sidebar-brand img {
    display: none !important;
}

/* New clean sidebar brand */
.richster-sidebar-brand::before {
    content: "R";
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    margin: auto;
    border-radius: 12px;
    color: #fff;
    background: linear-gradient(135deg, #087cf0, #35b9ff);
    box-shadow: 0 8px 24px rgba(8,124,240,.32);
    font-size: 28px;
    font-weight: 900;
    font-family: Arial, sans-serif;
}

/* Login logo: remove glow/background appearance */
.richster-login-brand img {
    display: none !important;
}

.richster-login-brand::before {
    content: "R";
    width: 78px;
    height: 78px;
    display: grid;
    place-items: center;
    margin: 0 auto 12px;
    border-radius: 18px;
    color: #fff;
    background: linear-gradient(135deg, #087cf0, #35b9ff);
    box-shadow: 0 12px 30px rgba(8,124,240,.3);
    font-size: 44px;
    font-weight: 900;
    font-family: Arial, sans-serif;
}

.richster-login-brand::after {
    content: "RICHSTER MAIL";
    display: block;
    margin-bottom: 20px;
    color: #071c3b;
    font-size: 20px;
    font-weight: 900;
    letter-spacing: .14em;
}

/* Better proportions for folder and message columns */
#layout-sidebar {
    width: 225px !important;
    min-width: 225px !important;
}

#layout-list {
    width: 345px !important;
    min-width: 345px !important;
}

/* Reading area should receive remaining width */
#layout-content {
    flex: 1 1 auto !important;
    min-width: 420px !important;
}

/* Cleaner profile card */
#richster-profile-panel {
    width: 200px !important;
    min-width: 200px !important;
    flex-basis: 200px !important;
    padding: 18px 16px !important;
}

/* Better spacing on the task sidebar */
#taskmenu {
    width: 68px !important;
    min-width: 68px !important;
}

/* Improve Compose button */
#taskmenu a.button-compose {
    margin: 6px 5px 12px !important;
    border-radius: 8px !important;
}

/* Mobile corrections */
@media (max-width: 850px) {
    body:not(.task-login) {
        padding-top: 62px !important;
    }

    #layout {
        height: calc(100vh - 62px) !important;
        max-height: calc(100vh - 62px) !important;
    }

    .richster-brand strong,
    .richster-brand span {
        display: none !important;
    }
}


/* Header service navigation */
#richster-service-menu {
    display: flex;
    align-items: center;
    gap: 4px;
}

#richster-service-menu a {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 38px;
    padding: 0 11px;
    border-radius: 8px;
    color: #34495d;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
}

#richster-service-menu a:hover,
#richster-service-menu a.active {
    color: #087cf0;
    background: #edf7ff;
}

@media (max-width: 1100px) {
    #richster-service-menu a span {
        display: none;
    }

    #richster-service-menu a {
        width: 36px;
        justify-content: center;
        padding: 0;
    }
}

@media (max-width: 750px) {
    #richster-service-menu {
        display: none;
    }
}


/* =========================================================
   Richster Mail v3.2 visual corrections
   ========================================================= */

/* Remove empty gap left for the missing navigation bar */
body:not(.task-login) {
    padding-top: 64px !important;
}

#layout {
    height: calc(100vh - 64px) !important;
    max-height: calc(100vh - 64px) !important;
}

/* Hide the failed secondary navigation implementation */
.richster-app-navigation {
    display: none !important;
}

/* Clean top header */
.richster-topbar {
    height: 64px !important;
    padding: 0 20px !important;
}

/* Replace image-heavy header branding with clean icon and text */
.richster-brand img {
    width: 40px !important;
    height: 40px !important;
    padding: 6px !important;
    border-radius: 9px !important;
    object-fit: contain !important;
    background: linear-gradient(135deg, #087cf0, #35b9ff) !important;
    filter: none !important;
}

.richster-brand strong {
    color: #071c3b !important;
    font-size: 17px !important;
    letter-spacing: .16em !important;
}

.richster-brand span {
    color: #087cf0 !important;
    font-size: 9px !important;
    letter-spacing: .42em !important;
}

/* Remove glowing image from sidebar */
.richster-sidebar-brand {
    height: 76px !important;
    padding: 10px 8px !important;
}

.richster-sidebar-brand img {
    display: none !important;
}

/* New clean sidebar brand */
.richster-sidebar-brand::before {
    content: "R";
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    margin: auto;
    border-radius: 12px;
    color: #fff;
    background: linear-gradient(135deg, #087cf0, #35b9ff);
    box-shadow: 0 8px 24px rgba(8,124,240,.32);
    font-size: 28px;
    font-weight: 900;
    font-family: Arial, sans-serif;
}

/* Login logo: remove glow/background appearance */
.richster-login-brand img {
    display: none !important;
}

.richster-login-brand::before {
    content: "R";
    width: 78px;
    height: 78px;
    display: grid;
    place-items: center;
    margin: 0 auto 12px;
    border-radius: 18px;
    color: #fff;
    background: linear-gradient(135deg, #087cf0, #35b9ff);
    box-shadow: 0 12px 30px rgba(8,124,240,.3);
    font-size: 44px;
    font-weight: 900;
    font-family: Arial, sans-serif;
}

.richster-login-brand::after {
    content: "RICHSTER MAIL";
    display: block;
    margin-bottom: 20px;
    color: #071c3b;
    font-size: 20px;
    font-weight: 900;
    letter-spacing: .14em;
}

/* Better proportions for folder and message columns */
#layout-sidebar {
    width: 225px !important;
    min-width: 225px !important;
}

#layout-list {
    width: 345px !important;
    min-width: 345px !important;
}

/* Reading area should receive remaining width */
#layout-content {
    flex: 1 1 auto !important;
    min-width: 420px !important;
}

/* Cleaner profile card */
#richster-profile-panel {
    width: 200px !important;
    min-width: 200px !important;
    flex-basis: 200px !important;
    padding: 18px 16px !important;
}

/* Better spacing on the task sidebar */
#taskmenu {
    width: 68px !important;
    min-width: 68px !important;
}

/* Improve Compose button */
#taskmenu a.button-compose {
    margin: 6px 5px 12px !important;
    border-radius: 8px !important;
}

/* Mobile corrections */
@media (max-width: 850px) {
    body:not(.task-login) {
        padding-top: 62px !important;
    }

    #layout {
        height: calc(100vh - 62px) !important;
        max-height: calc(100vh - 62px) !important;
    }

    .richster-brand strong,
    .richster-brand span {
        display: none !important;
    }
}


/* Header service navigation */
#richster-service-menu {
    display: flex;
    align-items: center;
    gap: 4px;
}

#richster-service-menu a {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 38px;
    padding: 0 11px;
    border-radius: 8px;
    color: #34495d;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
}

#richster-service-menu a:hover,
#richster-service-menu a.active {
    color: #087cf0;
    background: #edf7ff;
}

@media (max-width: 1100px) {
    #richster-service-menu a span {
        display: none;
    }

    #richster-service-menu a {
        width: 36px;
        justify-content: center;
        padding: 0;
    }
}

@media (max-width: 750px) {
    #richster-service-menu {
        display: none;
    }
}

