:root {
    --bg-dark: #1B2B44;
    --card-bg: #F5F6F8;
    --card-bg-alt: #ffffff;
    --text-primary: #16202F;
    --text-secondary: #5B6472;
    --accent: #FF1654;
    --accent-dark: #D8123F;
    --success: #17C964;
    --danger: #FF3B3B;
    --danger-dark: #B71C1C;
    --warning: #F5A623;
    --info: #29C0F1;
    --header-height: 132px;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg-dark);
    color: #fff;
    font-family: "HelveticaNeue", "Helvetica Neue", Arial, sans-serif;
    height: 100%;
    overflow: hidden;
}

/* ---------- Watermark ---------- */

.watermark, .login-watermark {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17vw;
    font-weight: 900;
    color: #ffffff;
    opacity: 0.05;
    letter-spacing: 0.02em;
    pointer-events: none;
    z-index: 0;
    user-select: none;
    white-space: nowrap;
}

/* ---------- Header ---------- */

.header {
    position: relative;
    z-index: 2;
    height: var(--header-height);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 0 32px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
    justify-self: start;
}

.logo-img {
    height: 104px;
    width: auto;
    display: block;
}

.header-subtitle {
    font-size: 17px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
}

.header-center {
    justify-self: center;
    text-align: center;
}

.clock {
    font-size: 72px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    letter-spacing: 0.02em;
}

.date-line {
    font-size: 19px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    text-transform: capitalize;
    margin-top: 2px;
}

.header-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 24px;
    justify-self: end;
}

.freshness {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.5);
}

.logout-link {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 14px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    padding: 8px 14px;
}

.logout-link:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.5);
}

/* ---------- Stale banner ---------- */

.stale-banner {
    position: relative;
    z-index: 2;
    background: var(--warning);
    color: #1B2B44;
    font-weight: 700;
    text-align: center;
    padding: 10px;
    font-size: 16px;
}

.stale-banner.hidden {
    display: none;
}

/* ---------- Columns layout ---------- */

/* Fixed-height, no page scroll: each column scrolls its own card list, so
   nothing is ever inaccessible even when a column has more than fits on screen. */
.columns {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    padding: 10px 24px 12px;
    height: calc(100vh - var(--header-height));
    min-height: 0;
}

.column {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 14px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.column-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 8px;
    padding: 0 4px;
    flex: 0 0 auto;
}

.column-title {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 0.01em;
}

.column-count {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.55);
    font-weight: 700;
}

.cards {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 2px;
}

/* Thin, unobtrusive scrollbar — appears only when a column actually overflows. */
.cards::-webkit-scrollbar {
    width: 6px;
}

.cards::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

.empty-placeholder {
    color: rgba(255, 255, 255, 0.35);
    font-size: 18px;
    text-align: center;
    padding: 24px 0;
}

/* ---------- Cards ---------- */

.card {
    background: var(--card-bg);
    color: var(--text-primary);
    border-radius: 10px;
    padding: 10px 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
    flex: 0 0 auto;
}

.card-title {
    font-size: 25px;
    font-weight: 800;
    line-height: 1.15;
    margin: 0 0 3px;
    word-break: break-word;
}

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
}

.tag-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 28px;
    padding: 0 10px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 800;
    color: #1B2B44;
    white-space: nowrap;
}

.card-subtitle {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-secondary);
    margin: 0 0 4px;
}

.card-visit-time {
    font-size: 17px;
    font-weight: 700;
    color: var(--accent);
}

/* Deal whose scheduled visit time has already passed: greyed out, de-emphasized. */
.card.card-past {
    background: #DADFE5;
    opacity: 0.7;
}

.card.card-past .card-title {
    color: #5B6472;
}

.card.card-past .card-visit-time {
    color: #8A93A0;
}

.card-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 3px 16px;
    margin-top: 2px;
    font-size: 17px;
    color: var(--text-secondary);
}

.card-fields .field-item strong {
    color: var(--text-primary);
    font-size: 17px;
    font-weight: 800;
}

.card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

/* Fixed height + no wrapping: "ОПЛАЧЕН" and "НЕ ОПЛАЧЕНО" always render at the
   same size, regardless of how much longer the text is. */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    font-size: 17px;
    font-weight: 900;
    letter-spacing: 0.01em;
    border-radius: 8px;
    padding: 0 12px;
    text-align: center;
    white-space: nowrap;
    flex: 1 1 45%;
}

.badge.badge-success {
    background: var(--success);
    color: #063820;
}

.badge.badge-danger {
    background: var(--danger);
    color: #4A0000;
}

.badge.badge-warning {
    background: var(--warning);
    color: #3a2500;
}

/* Доставка — жёлтый флаг, показывается только когда отмечено "Да". */
.badge.badge-color-yellow {
    background: var(--warning);
    color: #3a2500;
}

/* Зеркала — голубой флаг, показывается только когда отмечено "Да". */
.badge.badge-color-blue {
    background: var(--info);
    color: #05303F;
}

.plain-flags {
    display: flex;
    flex-wrap: wrap;
    gap: 3px 14px;
    margin-top: 4px;
    font-size: 17px;
    font-weight: 600;
    color: var(--text-secondary);
}

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

.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
}

.login-card {
    position: relative;
    z-index: 1;
    background: var(--card-bg);
    color: var(--text-primary);
    border-radius: 20px;
    padding: 40px 36px;
    width: 340px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.login-logo {
    font-size: 40px;
    font-weight: 900;
    color: var(--accent);
    text-align: center;
}

.login-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin: 4px 0 24px;
    font-size: 15px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.login-form label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 10px;
}

.login-form input {
    font-size: 16px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #d5d9e0;
    background: #fff;
    color: var(--text-primary);
}

.login-form input:focus {
    outline: none;
    border-color: var(--accent);
}

.login-error {
    background: #FDE8ED;
    color: var(--accent-dark);
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 12px;
    text-align: center;
}

.btn-accent {
    margin-top: 20px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease;
}

.btn-accent:hover {
    background: var(--accent-dark);
}

/* ---------- Responsive: phone ---------- */

@media (max-width: 900px) {
    :root {
        --header-height: 100px;
    }

    /* On a phone, columns stack vertically — the whole page scrolls normally
       instead of each column scrolling independently inside a fixed box. */
    html, body {
        overflow: auto;
        height: auto;
    }

    .columns {
        grid-template-columns: 1fr;
        padding: 16px;
        gap: 16px;
        height: auto;
    }

    .column {
        min-height: 0;
    }

    .cards {
        overflow-y: visible;
        flex: none;
    }

    .header {
        padding: 0 16px;
        grid-template-columns: auto 1fr auto;
    }

    .logo-img {
        height: 64px;
    }

    .header-subtitle {
        display: none;
    }

    .clock {
        font-size: 34px;
    }

    .date-line {
        font-size: 13px;
    }

    .freshness {
        font-size: 12px;
    }

    .logout-link {
        font-size: 12px;
        padding: 6px 10px;
    }

    .card-title {
        font-size: 24px;
    }

    .card-subtitle {
        font-size: 17px;
    }

    .card-visit-time {
        font-size: 17px;
    }

    .card-fields {
        font-size: 17px;
    }

    .card-fields .field-item strong {
        font-size: 17px;
    }

    .badge {
        height: 38px;
        font-size: 17px;
        padding: 0 10px;
    }

    .plain-flags {
        font-size: 17px;
    }

    .watermark {
        font-size: 25vw;
    }

    .column-title {
        font-size: 18px;
    }
}
