:root
{
    --main-vertical-margin: 150px;
}

body
{
    background: var(--color-gray-200);
}

body.night-mode
{
    background: var(--color-gray-900);
}

body:not(.is-mobile) main
{
    padding: var(--main-vertical-margin) 30px;
}

body.is-mobile main
{
    padding: 30px;
}

body.has-stripe .stripe
{
    position: fixed;
    top: 0;
    z-index: 100;
}

body.has-stripe main
{
    padding-top: calc(var(--main-vertical-margin) + 50px);
}

body.has-stripe .menu-shell
{
    --menu-offset: 60px;
}

/* Menu tool popups */

.menu-tool-popup
{
    position: relative;
    display: inline-flex;
}

.notifications-badge
{
    position: absolute;
    top: 2px;
    right: 0;
    background: var(--color-red);
    color: var(--color-white);
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    border-radius: 8px;
    text-align: center;
    padding: 0 4px;
    pointer-events: none;
}

.notifications-popup
{
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    width: 340px;
    max-height: 420px;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,.12);
    z-index: 9999;
    overflow: hidden;
    flex-direction: column;
}

.menu-tool-popup.open .notifications-popup
{
    display: flex;
}

.notifications-popup-header
{
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    font-weight: 700;
    font-size: 14px;
}

.notifications-popup-header button
{
    background: none;
    border: none;
    cursor: pointer;
    font-size: 12px;
    padding: 0;
}

.notifications-popup-body
{
    overflow-y: auto;
    flex: 1;
    max-height: 320px;
}

.notifications-popup-footer
{
    padding: 10px 16px;
    text-align: center;
    border-top: 1px solid var(--color-border);
    font-size: 13px;
}

.notifications-popup-footer a
{
    color: var(--color-default);
    text-decoration: none;
}

.notifications-item
{
    display: flex;
    gap: 10px;
    padding: 10px 16px;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid var(--color-gray-200);
    transition: background .15s;
}

.notifications-item:hover
{
    background: var(--color-gray-100);
}

.notifications-item.unread
{
    background: var(--color-blue-lighter);
}

.notifications-item.unread:hover
{
    background: var(--color-blue-light);
}

.notifications-item-icon
{
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--color-gray-200);
    color: var(--color-gray-600);
    font-size: 14px;
}

.notifications-item-content
{
    flex: 1;
    min-width: 0;
}

.notifications-item-title
{
    font-weight: 600;
    font-size: 13px;
    line-height: 1.3;
}

.notifications-item-body
{
    font-size: 12px;
    color: var(--color-gray-600);
    line-height: 1.3;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notifications-item-time
{
    font-size: 11px;
    color: var(--color-gray-500);
    margin-top: 3px;
}

.notifications-empty
{
    padding: 30px 20px;
    text-align: center;
    color: var(--color-gray-500);
    font-size: 13px;
}

/* Night mode adjustments */

body.night-mode .notifications-popup
{
    background: var(--color-gray-800);
    border-color: var(--color-border-night);
}

body.night-mode .notifications-popup-header
{
    border-color: var(--color-border-night);
}

body.night-mode .notifications-popup-footer
{
    border-color: var(--color-border-night);
}

body.night-mode .notifications-item
{
    border-color: var(--color-border-night);
}

body.night-mode .notifications-item:hover
{
    background: var(--color-gray-700);
}

body.night-mode .notifications-item.unread
{
    background: var(--color-blue-night-darker);
}

body.night-mode .notifications-item.unread:hover
{
    background: var(--color-blue-night-darker-glass);
}

body.night-mode .notifications-item-icon
{
    background: var(--color-gray-700);
    color: var(--color-gray-400);
}

/* -------------------------------------------------------------------------
   Handsontable — day mode */

body:not(.night-mode) .handsontable
{
    color-scheme: light;
}

body:not(.night-mode) .handsontable .htCore thead th,
body:not(.night-mode) .handsontable .htCore .colHeader
{
    background: var(--color-gray-100);
    color: var(--color-default);
    border-color: var(--color-border);
}

body:not(.night-mode) .handsontable .htCore td
{
    background: var(--color-white);
    color: var(--color-default);
    border-color: var(--color-border);
}

body:not(.night-mode) .handsontable .htCore th
{
    background: var(--color-gray-200);
    color: var(--color-default);
    border-color: var(--color-border);
}

body:not(.night-mode) .handsontable .htCore tr.selected td,
body:not(.night-mode) .handsontable .htCore td.current
{
    background: var(--color-gray-100) !important;
}

body:not(.night-mode) .handsontable .wtBorder
{
    background: var(--color-gray-500) !important;
}

/* -------------------------------------------------------------------------
   Handsontable — night mode */

body.night-mode .handsontable .htCore thead th,
body.night-mode .handsontable .htCore .colHeader
{
    background: var(--color-gray-700);
    color: var(--color-default-night);
    border-color: var(--color-border-night);
}

body.night-mode .handsontable .htCore td
{
    background: var(--color-gray-850);
    color: var(--color-default-night);
    border-color: var(--color-border-night);
}

body.night-mode .handsontable .htCore th
{
    background: var(--color-gray-800);
    color: var(--color-gray-400);
    border-color: var(--color-border-night);
}

body.night-mode .handsontable .htCore tr.selected td,
body.night-mode .handsontable .htCore td.current
{
    background: var(--color-gray-700) !important;
}

body.night-mode .handsontable .wtBorder
{
    background: var(--color-gray-400) !important;
}

/* -------------------------------------------------------------------------
   Menu clock */

@keyframes clock-blink
{
    50% { opacity: 0; }
}

.menu-clock
{
    float: right;
    font-size: var(--menu-breadcrumb-size);
    color: var(--menu-breadcrumb-color);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
}

.menu-clock-sep
{
    animation: clock-blink 1s step-end infinite;
}
