/* Mifumo look for Roundcube (Elastic). Colours and fonts from mifumo.co.tz (resources/css/site.css):
   deep ink, warm paper, the three logo bars (blue, orange, green), Instrument Sans and Fraunces.
   Light only and flat: no glass, no blur, no gradients. */

@font-face {
    font-family: 'Instrument Sans Variable';
    font-style: normal;
    font-display: swap;
    font-weight: 400 700;
    src: url(fonts/instrument-sans-latin-wght-normal.woff2) format('woff2-variations');
}

@font-face {
    font-family: 'Fraunces Variable';
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url(fonts/fraunces-latin-wght-normal.woff2) format('woff2-variations');
}

:root {
    --mf-ink: #0b1530;
    --mf-ink-2: #14213d;
    --mf-ink-3: #1d2c52;
    --mf-paper: #fbf8f3;
    --mf-paper-2: #f4efe6;
    --mf-line: #e7e0d3;
    --mf-line-2: #d9d0bf;
    --mf-text: #14213d;
    --mf-muted: #5d6680;
    --mf-blue: #1f6fd1;
    --mf-blue-deep: #1a5fb4;
    --mf-blue-soft: #e6effb;
    --mf-orange: #f08a24;
    --mf-green: #2e9e4f;
    --mf-red: #c23b2b;
    --mf-sans: 'Instrument Sans Variable', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --mf-serif: 'Fraunces Variable', 'Iowan Old Style', Georgia, serif;
    color-scheme: only light;
}

/* ---------- Type and base ---------- */

html,
body,
button,
input,
select,
textarea,
.btn,
.form-control,
.popover,
.tooltip,
.ui-dialog,
.ui-widget {
    font-family: var(--mf-sans);
}

body {
    color: var(--mf-text);
    background: var(--mf-paper);
    -webkit-font-smoothing: antialiased;
}

a,
.btn-link {
    color: var(--mf-blue);
}

::selection {
    background: var(--mf-blue-soft);
}

/* ---------- Left menu (Compose, Mail, Contacts, Settings) ---------- */

#layout-menu {
    background: var(--mf-ink);
}

#layout-menu .popover-header {
    background: var(--mf-ink);
}

#layout-menu #logo,
#layout-menu .popover-header img {
    width: 44px;
    height: 44px;
    max-height: none;
    margin: 18px auto 10px;
    object-fit: contain;
}

#taskmenu a,
#taskmenu .special-buttons a {
    color: #c9d1e6;
    font-weight: 500;
}

#taskmenu a:hover,
#taskmenu a:focus {
    background: var(--mf-ink-3);
    color: #fff;
}

#taskmenu a.selected {
    background: var(--mf-ink-2);
    color: #fff;
    box-shadow: inset 3px 0 0 var(--mf-orange);
}

#taskmenu a.compose,
#taskmenu a.compose:hover {
    color: #fff;
}

#taskmenu a.compose:before {
    color: var(--mf-orange);
}

#taskmenu a.logout,
#taskmenu a.logout:hover {
    color: #f3a39a;
}

/* About opens Roundcube's credits page: not needed by Mifumo users. */
#taskmenu a.about {
    display: none;
}

/* ---------- Column headers and toolbars ---------- */

.header,
.footer,
#layout-sidebar > .header,
#layout-list > .header,
#layout-content > .header,
.toolbar-menu,
#layout-sidebar .footer,
#layout-list .footer,
#layout-content .footer {
    background: var(--mf-paper);
    border-color: var(--mf-line);
}

.header .header-title,
#layout-sidebar .header-title {
    color: var(--mf-ink-2);
    font-weight: 600;
    letter-spacing: -0.01em;
}

#layout-sidebar,
#layout-list,
#layout-content {
    border-color: var(--mf-line) !important;
}

#layout-sidebar,
#layout-list {
    background: #fff;
}

#layout-content {
    background: #fff;
}

.toolbar a.button,
.toolbar a.button:before,
.header a.button,
.menu.toolbar a {
    color: var(--mf-ink-2);
}

.toolbar a.button.disabled,
.toolbar a.button.disabled:before {
    color: #a9afbf;
}

.toolbar a.button:not(.disabled):hover,
.toolbar a.button:not(.disabled):focus {
    color: var(--mf-blue);
}

#layout > div > .header,
#layout > div > .footer,
#layout-sidebar > .header,
#layout-list > .header,
#layout-content > .header {
    background-color: var(--mf-paper);
    border-bottom-color: var(--mf-line);
}

/* ---------- Search ---------- */

.searchbar,
#layout-list .searchbar {
    background: #fff;
    border-bottom: 1px solid var(--mf-line);
}

.searchbar input,
.searchbar input:focus {
    color: var(--mf-text);
}

/* ---------- Folder list ---------- */

.listing li,
.listing li a,
#folderlist-content li a {
    color: var(--mf-text);
    border-color: transparent;
}

#folderlist-content li a:before,
.listing li a:before {
    color: var(--mf-muted);
}

.listing li:not(.selected) a:hover,
#folderlist-content li:not(.selected) > a:hover {
    background: var(--mf-paper);
}

.listing li.selected,
.listing li.selected > a,
#folderlist-content li.selected > a,
#folderlist-content li.selected > div > a {
    background: var(--mf-blue-soft);
    color: var(--mf-ink-2);
    font-weight: 600;
}

#folderlist-content li.selected > a:before,
#folderlist-content li.selected > div > a:before {
    color: var(--mf-blue);
}

.listing li .unreadcount,
#folderlist-content li .unreadcount {
    background: var(--mf-blue);
    color: #fff;
    font-weight: 600;
    border-radius: 999px;
}

.listing li.selected .unreadcount {
    background: var(--mf-blue);
    color: #fff;
}

/* ---------- Message list ---------- */

#messagelist tr td,
table.records-table tr td {
    border-color: var(--mf-line);
}

#messagelist tr td.subject span.fromto,
#messagelist tr td.subject span.date,
#messagelist tr td.subject .size {
    color: var(--mf-muted);
}

#messagelist tr td.subject span.subject a,
#messagelist tr td.subject span.subject {
    color: var(--mf-text);
}

#messagelist tr.unread td.subject span.subject a {
    font-weight: 650;
    color: var(--mf-ink);
}

#messagelist tr.unread td.subject span.fromto {
    color: var(--mf-ink-2);
    font-weight: 600;
}

/* Unread dot: Mifumo blue instead of Elastic's yellow. */
#messagelist tr.unread td.subject span.msgicon.status:before,
#messagelist tr td.subject span.msgicon.status.unread:before,
#messagelist td span.unread:before,
#messagelist tr.unread td.subject .msgicon:before {
    color: var(--mf-blue);
}

#messagelist tr:hover td,
table.records-table tr:hover td {
    background: var(--mf-paper);
}

#messagelist tr.selected td,
table.records-table tr.selected td,
table.records-table tr.selected:hover td {
    background: var(--mf-blue-soft);
    color: var(--mf-ink-2);
}

table.records-table tr.focused > td:first-child,
#messagelist tr.focused > td:first-child {
    border-left-color: var(--mf-blue);
}

#messagelist tr.flagged td,
#messagelist tr.flagged td a,
#messagelist tr.flagged td span {
    color: var(--mf-red);
}

/* Empty reading pane: plain instead of Elastic's large 3D box picture. */
#layout-content .watermark,
.watermark {
    background-image: url(images/mark-faint.svg);
    background-size: 64px;
    background-position: center;
    background-repeat: no-repeat;
}

/* ---------- Buttons and fields ---------- */

.btn-primary,
.btn-primary:not(:disabled):not(.disabled),
.button.mainaction,
.mainaction.btn {
    background: var(--mf-blue);
    border-color: var(--mf-blue);
    color: #fff;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
}

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

.btn-secondary {
    background: #fff;
    border-color: var(--mf-line-2);
    color: var(--mf-ink-2);
}

.btn-secondary:hover,
.btn-secondary:focus {
    background: var(--mf-paper);
    border-color: var(--mf-line-2);
    color: var(--mf-ink-2);
}

.form-control,
.custom-select,
input.form-control,
textarea.form-control {
    border-color: var(--mf-line-2);
    color: var(--mf-text);
}

.form-control:focus,
.custom-select:focus,
.btn:focus,
.btn.focus {
    border-color: var(--mf-blue);
    box-shadow: 0 0 0 3px rgb(31 111 209 / 18%);
}

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

/* ---------- Storage bar (1 GB per mailbox) ---------- */

#quotadisplay,
.quota-widget {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 0 16px;
    color: var(--mf-muted);
    font-size: 0.8125rem;
}

.quota-widget .count {
    order: 2;
}

.quota-widget .bar {
    order: 1;
    flex: 1 1 auto;
    width: auto !important;
    margin: 0 !important;
}

.quota-widget .count {
    color: var(--mf-ink-2);
    font-weight: 500;
    white-space: nowrap;
}

.quota-widget .bar {
    background: var(--mf-paper-2);
    border: 0;
    border-radius: 999px;
    height: 6px;
    overflow: hidden;
}

.quota-widget .bar .value {
    background: var(--mf-green);
    border-radius: 999px;
    height: 100%;
}

.quota-widget .bar .value.mf-high {
    background: var(--mf-orange);
}

.quota-widget .bar .value.warning {
    background: var(--mf-red);
}

/* ---------- Popups and dialogs ---------- */

.popover,
.ui-dialog,
.modal-content {
    border-color: var(--mf-line);
    border-radius: 12px;
    box-shadow: 0 2px 4px rgb(20 33 61 / 5%), 0 12px 32px -8px rgb(20 33 61 / 16%);
}

.popover .listing li a:hover,
.popover-body .listing li a.active:hover {
    background: var(--mf-paper);
}

.ui-dialog .ui-dialog-titlebar,
.ui-dialog .ui-dialog-buttonpane,
.modal-header,
.modal-footer {
    background: var(--mf-paper);
    border-color: var(--mf-line);
}

.ui-dialog .ui-dialog-title {
    color: var(--mf-ink-2);
    font-weight: 600;
}

/* ---------- Message view ---------- */

#message-header h2.subject,
.message-partheaders h2.subject {
    font-family: var(--mf-serif);
    font-weight: 600;
    color: var(--mf-ink);
    letter-spacing: -0.01em;
}

#message-header .header-links a,
#message-header .header a {
    color: var(--mf-blue);
}

/* ---------- Login page ---------- */

body.task-login {
    background: var(--mf-paper);
}

body.task-login #layout,
body.task-login #layout-content {
    background: transparent;
}

body.task-login #layout-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 24px 20px;
}

body.task-login #logo {
    display: none;
}

body.task-login #login-form {
    width: 100%;
    max-width: 400px;
    margin: 0;
    top: 0;
    text-align: left;
    padding: 32px 32px 28px;
    background: #fff;
    border: 1px solid var(--mf-line);
    border-radius: 16px;
    box-shadow: 0 1px 2px rgb(20 33 61 / 6%), 0 2px 8px rgb(20 33 61 / 5%);
}

.mf-login-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 28px;
}

.mf-login-head img {
    width: 44px;
    height: 44px;
    flex: none;
}

.mf-login-title {
    margin: 0;
    font-family: var(--mf-serif);
    font-size: 26px;
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--mf-ink);
}

.mf-login-sub {
    margin: 4px 0 0;
    font-size: 14px;
    color: var(--mf-muted);
}

/* Labels above the fields instead of Elastic's icon boxes. */
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%;
    padding: 0;
    margin: 0;
}

body.task-login #login-form tr.form-group {
    margin: 0 0 16px;
}

body.task-login #login-form td.title {
    display: block !important;
    margin-bottom: 6px;
}

body.task-login #login-form td.title label {
    font-size: 14px;
    font-weight: 600;
    color: var(--mf-ink-2);
}

body.task-login #login-form .input-group-prepend {
    display: none;
}

body.task-login #login-form .input-group {
    display: block;
    width: 100%;
}

body.task-login #login-form .form-control {
    display: block;
    width: 100% !important;
    flex: none;
}

body.task-login #rcmloginsubmit.text-uppercase {
    text-transform: none !important;
}

body.task-login #login-form .form-control {
    height: 48px;
    padding: 10px 14px;
    font-size: 16px; /* 16px stops iPhone from zooming into the field */
    background: #fff;
    border: 1px solid var(--mf-line-2);
    border-radius: 10px !important;
}

body.task-login #login-form .form-control::placeholder {
    color: #9aa1b2;
}

body.task-login #login-form .formbuttons {
    margin: 24px 0 0;
}

body.task-login #rcmloginsubmit {
    height: 48px;
    font-size: 16px;
    border-radius: 10px;
}

body.task-login #login-footer {
    margin-top: 18px;
    text-align: center;
    font-size: 13px;
    color: var(--mf-muted);
}

body.task-login #login-footer:empty {
    display: none;
}

.mf-login-foot {
    margin: 20px 0 0;
    font-size: 13px;
    color: var(--mf-muted);
    text-align: center;
}

.mf-login-foot a {
    color: var(--mf-muted);
}

@media (max-width: 480px) {
    body.task-login #layout-content {
        justify-content: flex-start;
        padding-top: 48px;
    }

    body.task-login #login-form {
        padding: 24px 20px 22px;
        border-radius: 14px;
    }
}

/* ---------- Phones: top bar ---------- */

@media (max-width: 768px) {
    .layout-small .header,
    .layout-phone .header,
    #layout > div > .header {
        background: #fff;
    }

    .layout-phone #layout-menu,
    .layout-small #layout-menu {
        background: var(--mf-ink);
    }
}

/* ---------- Fixes for Elastic rules that win on specificity ---------- */

#layout-menu .popover-header,
#layout-menu .special-buttons,
#taskmenu .special-buttons {
    background-color: var(--mf-ink) !important;
}

#layout-sidebar .footer {
    display: flex;
    align-items: center;
}

#layout-sidebar .footer #quotadisplay {
    flex: 1 1 auto;
    max-width: none;
    margin: 0;
}

.floating-action-buttons a.button,
.floating-action-buttons a.button:hover {
    background-color: var(--mf-blue) !important;
    color: #fff;
    box-shadow: 0 6px 16px -4px rgb(20 33 61 / 35%);
}

/* Plain-text mail in the reading pane: easy-to-read sans instead of typewriter text. */
.message-part div.pre,
div.message-part pre {
    font-family: var(--mf-sans);
    font-size: 15px;
    line-height: 1.55;
    color: var(--mf-text);
}
