/* Вход на сайт (логин/пароль, «запомнить?», код сотрудника) — тёмный стиль DRN, 2026-11-10 */

.gate-body,
.gate-body *,
.gate-body *::before,
.gate-body *::after {
    box-sizing: border-box;
}

.gate-body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
    font-family: Arial, sans-serif;
    color: #ffffff;
    background-color: #000e20;
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
}

.gate-body.gate-machine {
    background-image: url("../img/gate_bg.webp");
}

.gate-body.gate-worker {
    background-image: url("../img/worker_bg.webp");
}

.gate-box {
    width: 330px;
    max-width: calc(100vw - 32px);
    padding: 20px 22px 20px;
    background: linear-gradient(155deg, rgba(16, 52, 86, 0.92) 0%, rgba(6, 29, 55, 0.94) 100%);
    border: 1px solid #567b9f;
    border-radius: 22px;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.35), inset 0 1px 1px rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(3px);
}

.gate-box form {
    margin: 0;
}

.gate-title {
    margin: 0 0 14px;
    font-size: 17px;
    font-weight: 600;
    text-align: center;
    color: #dce8f5;
}

.gate-text {
    margin: 0 0 14px;
    font-size: 15px;
    line-height: 1.5;
    text-align: center;
    color: #a9bdd1;
}

.gate-field {
    display: flex;
    align-items: center;
    height: 40px;
    margin-bottom: 8px;
    padding: 0 13px;
    border: 1px solid #345675;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.045);
    transition: border-color 0.2s;
}

.gate-field:focus-within {
    border-color: #6596ca;
}

.gate-field svg {
    width: 19px;
    height: 19px;
    flex-shrink: 0;
    stroke: #dce8f5;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.gate-field input {
    width: 100%;
    min-width: 0;
    height: 100%;
    padding: 0 11px;
    border: none;
    outline: none;
    background: transparent;
    color: #ffffff;
    font-size: 16px;
}

.gate-field input::placeholder {
    color: #8399ae;
}

/* Автозаполнение и подсказки браузера (Edge/Chrome) не должны менять фон поля:
   браузер красит фон сам — откладываем эту перекраску «навсегда» (2026-11-11). */
.gate-field input:-webkit-autofill,
.gate-field input:-webkit-autofill:hover,
.gate-field input:-webkit-autofill:focus,
.gate-field input:-webkit-autofill:active,
.gate-field input:autofill {
    -webkit-text-fill-color: #ffffff;
    caret-color: #ffffff;
    -webkit-box-shadow: none;
    box-shadow: none;
    background-color: transparent !important;
    transition: background-color 9999999s ease-out 0s, color 9999999s ease-out 0s;
}

.gate-eye {
    display: flex;
    padding: 4px;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.gate-button {
    width: 100%;
    height: 42px;
    margin-top: 4px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(180deg, #4085c9, #185994);
    color: #ffffff;
    font-size: 17px;
    font-weight: 500;
    cursor: pointer;
    transition: filter 0.2s, transform 0.2s;
}

.gate-button:hover {
    filter: brightness(1.12);
}

.gate-button:active {
    transform: scale(0.99);
}

.gate-button:focus-visible,
.gate-eye:focus-visible {
    outline: 3px solid rgba(101, 150, 202, 0.55);
    outline-offset: 3px;
}

/* Цифровая клавиатура кода сотрудника */
.gate-keypad {
    display: grid;
    grid-template-columns: repeat(3, 74px);
    justify-content: center;
    gap: 8px 12px;
    margin: 4px 0 12px;
}

.gate-key {
    height: 42px;
    border: 1px solid #345675;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.045);
    color: #ffffff;
    font-size: 18px;
    font-family: inherit;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.12s, border-color 0.12s, transform 0.08s;
}

.gate-key svg {
    width: 20px;
    height: 20px;
    vertical-align: middle;
    stroke: #dce8f5;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.gate-key:hover {
    background: rgba(101, 150, 202, 0.14);
    border-color: #4a7299;
}

.gate-key:active,
.gate-key.is-pressed {
    background: rgba(101, 150, 202, 0.38);
    border-color: #6596ca;
    transform: scale(0.96);
}

.gate-key:focus-visible {
    outline: 3px solid rgba(101, 150, 202, 0.55);
    outline-offset: 2px;
}

.gate-button + .gate-button {
    margin-top: 8px;
}

.gate-button.secondary {
    background: transparent;
    border: 1px solid #345675;
    color: #dce8f5;
    font-size: 16px;
}

.gate-error {
    margin: 0 0 14px;
    padding: 11px 14px;
    border: 1px solid rgba(240, 82, 82, 0.45);
    border-radius: 12px;
    background: rgba(240, 82, 82, 0.12);
    color: #ffb4b4;
    font-size: 14px;
    text-align: center;
}

/* Капча из security/login_guard.py — в тёмном стиле */
.gate-box .login-captcha {
    margin: 4px 0 13px !important;
}

.gate-box .login-captcha div {
    color: #a9bdd1 !important;
}

.gate-box .login-captcha img {
    height: 42px !important;
    width: auto !important;
    border-color: #345675 !important;
    border-radius: 12px !important;
}

.gate-box .login-captcha input {
    height: 42px;
    border: 1px solid #345675 !important;
    border-radius: 12px !important;
    background: rgba(255, 255, 255, 0.045) !important;
    color: #ffffff !important;
    outline: none;
}

.gate-box .login-captcha input:focus {
    border-color: #6596ca !important;
}

/* Код сотрудника: по центру и крупнее (иконка слева — компенсируем справа) */
.gate-field input[name="employee_code"] {
    padding-right: 30px;
    text-align: center;
    font-size: 22px;
    letter-spacing: 3px;
}

.gate-field input[name="employee_code"]::placeholder {
    font-size: 16px;
    letter-spacing: normal;
}

/* Свой «глаз» уже есть — встроенный глаз Edge/IE не показываем */
.gate-field input::-ms-reveal,
.gate-field input::-ms-clear {
    display: none;
}

/* Меню разделов (Punching / Work planner / ...) — тот же фон, что у кода сотрудника (2026-11-11).
   Работает в светлой и тёмной теме. */
body.menu-worker-bg,
html[data-theme="dark"] body.menu-worker-bg {
    background: #000e20 url("../img/worker_bg.webp") center center / cover no-repeat fixed;
}

body.menu-worker-bg .home-page,
html[data-theme="dark"] body.menu-worker-bg .home-page {
    background: transparent;
}


/* =========================================================
   Кнопки меню разделов — стиль DRN (тёмное синее стекло), 2026-11-12.
   Только CSS: разметка home.html и ссылки не меняются.
   Иконка — ::before (маска SVG), волна — ::after.
   ========================================================= */

body.menu-worker-bg .system-grid {
    max-width: 938px;
    grid-template-columns: repeat(2, minmax(0, 455px));
    justify-content: center;
    gap: 28px;
}

body.menu-worker-bg .system-grid .system-card {
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 210px;
    min-height: 0;

    flex-direction: column;
    gap: 16px;

    border-radius: 18px;
    background: linear-gradient(145deg, rgba(24, 62, 98, 0.72) 0%, rgba(7, 29, 53, 0.82) 100%);
    border: 1px solid rgba(70, 145, 210, 0.45);
    isolation: isolate;
    box-shadow:
        0 0 14px rgba(18, 110, 190, 0.10),
        inset 0 1px 0 rgba(130, 195, 245, 0.10);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);

    color: #f2f6fc;
    opacity: 1;

    transition:
        transform 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

body.menu-worker-bg .system-grid .system-card:hover {
    transform: translateY(-3px);
    background: linear-gradient(145deg, rgba(24, 62, 98, 0.72) 0%, rgba(7, 29, 53, 0.82) 100%);
    border-color: rgba(110, 185, 245, 0.95);
    box-shadow:
        0 0 22px rgba(46, 155, 255, 0.28),
        inset 0 1px 0 rgba(130, 195, 245, 0.16);
}

body.menu-worker-bg .system-grid .system-card:active {
    transform: translateY(-1px);
}

body.menu-worker-bg .system-grid .system-card:focus-visible {
    outline: 2px solid #5ba8ec;
    outline-offset: 3px;
}

body.menu-worker-bg .system-grid .system-name {
    position: relative;
    z-index: 1;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: #f2f6fc;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
}

/* Иконка: контур 2 px, цвет #5BA8EC */
body.menu-worker-bg .system-grid .system-card::before {
    content: "";
    position: relative;
    z-index: 1;
    flex: none;
    width: 65px;
    height: 65px;
    background-color: #5ba8ec;
    -webkit-mask: var(--menu-icon) center / contain no-repeat;
    mask: var(--menu-icon) center / contain no-repeat;
}

/* Декоративная волна в правом нижнем углу */
body.menu-worker-bg .system-grid .system-card::after {
    content: "";
    position: absolute;
    z-index: 0;
    right: -18%;
    bottom: -55%;
    width: 85%;
    height: 125%;
    border: none;
    border-radius: 50%;
    /* мягкий рассеянный свет из угла — без линий и обводок */
    background: radial-gradient(
        ellipse at 75% 80%,
        rgba(45, 145, 235, 0.20) 0%,
        rgba(35, 115, 195, 0.12) 30%,
        rgba(25, 90, 160, 0.05) 55%,
        transparent 78%
    );
    opacity: 0.85;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

body.menu-worker-bg .system-grid .system-card:hover::after {
    opacity: 1;
}

/* Иконки разделов (по адресу ссылки) */
body.menu-worker-bg .system-card[href="/punching/"] {
    /* стойка с тремя фрезами/свёрлами */
    --menu-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='8' y='47' width='48' height='8' rx='2'/%3E%3Cpath d='M14 47V30h10v17M14 30l5-9 5 9M14 38h10'/%3E%3Cpath d='M27 47V16h10v31M27 16l5-8 5 8M27 24l10-4M27 31l10-4M27 38l10-4'/%3E%3Cpath d='M40 47V24h10v23M40 24h10M40 30l10-4M40 37l10-4M40 42h10'/%3E%3C/svg%3E");
}

body.menu-worker-bg .system-card[href="/work-planner/"] {
    /* календарь с часами */
    --menu-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M33 49H12a4 4 0 0 1-4-4V17a4 4 0 0 1 4-4h30a4 4 0 0 1 4 4v13'/%3E%3Cpath d='M8 23h38M17 9v8M37 9v8'/%3E%3Ccircle cx='46' cy='45' r='11'/%3E%3Cpath d='M46 39v6l4 3'/%3E%3Cg fill='black' stroke='none'%3E%3Ccircle cx='16' cy='30' r='1.6'/%3E%3Ccircle cx='23' cy='30' r='1.6'/%3E%3Ccircle cx='30' cy='30' r='1.6'/%3E%3Ccircle cx='16' cy='38' r='1.6'/%3E%3Ccircle cx='23' cy='38' r='1.6'/%3E%3C/g%3E%3C/svg%3E");
}

body.menu-worker-bg .system-card[href="/laser-planner/"] {
    /* лазерная голова, луч, лист */
    --menu-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M23 8h18v13l-5 8h-8l-5-8z'/%3E%3Cpath d='M23 15h18M32 29v13M26 40l-5-3M38 40l5-3M25 45h-5M39 45h5'/%3E%3Crect x='8' y='46' width='48' height='8' rx='2'/%3E%3C/svg%3E");
}

body.menu-worker-bg .system-card.disabled {
    /* гибка листа */
    --menu-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 44h28l13-24 5 3-14 27H8z'/%3E%3Cpath d='M36 44l4 6'/%3E%3Cpath d='M22 10h12l-6 10z'/%3E%3C/svg%3E");
}

/* Неактивная карточка (BENDING): темнее, без волны, свечения и подъёма */
body.menu-worker-bg .system-grid .system-card.disabled,
body.menu-worker-bg .system-grid .system-card.disabled:hover {
    transform: none;
    cursor: default;
    background: linear-gradient(145deg, rgba(16, 32, 50, 0.72) 0%, rgba(6, 16, 30, 0.84) 100%);
    border-color: rgba(127, 143, 166, 0.35);
    box-shadow: none;
}

body.menu-worker-bg .system-grid .system-card.disabled::before {
    background-color: #7f8fa6;
}

body.menu-worker-bg .system-grid .system-card.disabled::after {
    display: none;
}

body.menu-worker-bg .system-grid .system-card.disabled .system-name {
    color: #7f8fa6;
    text-shadow: none;
}

/* Подпись под названием (PUNCHING → TOOL MANAGEMENT), 2026-11-12 */
body.menu-worker-bg .system-grid .system-sub {
    position: relative;
    z-index: 1;
    margin-top: -10px;
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 1.5px;
    color: #8fb6dc;
}

/* =========================================================
   Меню разделов — СВЕТЛАЯ тема (мягкий макет 2026-11-12).
   Только страница выбора разделов; тёмная тема выше не меняется.
   ========================================================= */

html:not([data-theme="dark"]) body.menu-worker-bg {
    background:
        radial-gradient(ellipse 55% 42% at 0% 0%, rgba(160, 205, 250, 0.30), transparent 72%),
        radial-gradient(ellipse 50% 40% at 100% 100%, rgba(160, 205, 250, 0.30), transparent 72%),
        linear-gradient(135deg, #fafcff 0%, #f6f9ff 100%) fixed;
    background-attachment: fixed;
    color: #1f2f4d;
}

/* мягкие волны в углах */
html:not([data-theme="dark"]) body.menu-worker-bg::before,
html:not([data-theme="dark"]) body.menu-worker-bg::after {
    content: "";
    position: fixed;
    z-index: 0;
    width: 75vw;
    height: 55vh;
    border-radius: 50%;
    border-top: 1px solid rgba(160, 205, 250, 0.45);
    pointer-events: none;
}

html:not([data-theme="dark"]) body.menu-worker-bg::before {
    left: -32vw;
    top: 4vh;
    transform: rotate(-12deg);
    background: linear-gradient(180deg, rgba(160, 205, 250, 0.16) 0%, transparent 55%);
}

html:not([data-theme="dark"]) body.menu-worker-bg::after {
    right: -30vw;
    bottom: -26vh;
    transform: rotate(-10deg);
    background: linear-gradient(180deg, rgba(160, 205, 250, 0.18) 0%, transparent 60%);
}

html:not([data-theme="dark"]) body.menu-worker-bg .home-page {
    position: relative;
    z-index: 1;
}

/* верхняя панель на странице меню */
html:not([data-theme="dark"]) body.menu-worker-bg .global-user-panel {
    background: rgba(255, 255, 255, 0.82);
    border-color: #d6e8fb;
    box-shadow: 0 6px 18px rgba(44, 82, 130, 0.08);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

html:not([data-theme="dark"]) body.menu-worker-bg .language-button {
    color: #6b7c93;
}

html:not([data-theme="dark"]) body.menu-worker-bg .language-button:hover {
    background: #eef6ff;
    color: #1f2f4d;
}

html:not([data-theme="dark"]) body.menu-worker-bg .language-button.active {
    background: #e3f0ff;
    border-color: #bfdfff;
    color: #1f2f4d;
}

html:not([data-theme="dark"]) body.menu-worker-bg .global-theme-toggle:hover {
    background: #eef6ff;
    border-color: #d6e8fb;
}

html:not([data-theme="dark"]) body.menu-worker-bg .global-user-name {
    border-left-color: #d6e8fb;
    color: #1f2f4d;
}

/* карточки */
html:not([data-theme="dark"]) body.menu-worker-bg .system-grid .system-card {
    border-radius: 20px;
    background: linear-gradient(145deg, #ffffff 0%, #f7faff 100%);
    border: 1px solid #d6e8fb;
    box-shadow: 0 6px 18px rgba(44, 82, 130, 0.08);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    color: #1f2f4d;
}

html:not([data-theme="dark"]) body.menu-worker-bg .system-grid .system-card:hover {
    background: linear-gradient(145deg, #ffffff 0%, #f7faff 100%);
    border-color: #bfdfff;
    box-shadow: 0 10px 26px rgba(44, 82, 130, 0.12);
}

html:not([data-theme="dark"]) body.menu-worker-bg .system-grid .system-card:focus-visible {
    outline-color: #3b8eff;
}

html:not([data-theme="dark"]) body.menu-worker-bg .system-grid .system-name {
    color: #1f2f4d;
    text-shadow: none;
}

html:not([data-theme="dark"]) body.menu-worker-bg .system-grid .system-sub {
    color: #6b7c93;
}

html:not([data-theme="dark"]) body.menu-worker-bg .system-grid .system-card::before {
    background-color: #2a6fc4;
}

html:not([data-theme="dark"]) body.menu-worker-bg .system-grid .system-card::after {
    background: radial-gradient(
        ellipse at 75% 80%,
        rgba(84, 165, 245, 0.18) 0%,
        rgba(110, 180, 245, 0.11) 30%,
        rgba(140, 195, 250, 0.05) 55%,
        transparent 78%
    );
}

/* BENDING в светлой теме: приглушённая, без реакции на мышь */
html:not([data-theme="dark"]) body.menu-worker-bg .system-grid .system-card.disabled,
html:not([data-theme="dark"]) body.menu-worker-bg .system-grid .system-card.disabled:hover {
    transform: none;
    background: linear-gradient(145deg, #f7f9fc 0%, #eef2f7 100%);
    border-color: #e6edf6;
    box-shadow: 0 4px 12px rgba(44, 82, 130, 0.05);
}

html:not([data-theme="dark"]) body.menu-worker-bg .system-grid .system-card.disabled::before {
    background-color: #879aaf;
}

html:not([data-theme="dark"]) body.menu-worker-bg .system-grid .system-card.disabled .system-name {
    color: #879aaf;
}

/* Телефон / узкий экран: один столбец */
@media (max-width: 960px) {
    body.menu-worker-bg .system-grid {
        grid-template-columns: minmax(0, 455px);
    }
}

@media (max-width: 750px) {
    body.menu-worker-bg .system-grid {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    body.menu-worker-bg .system-grid .system-card {
        height: 190px;
    }

    body.menu-worker-bg .system-grid .system-name {
        font-size: 22px;
    }

    body.menu-worker-bg .system-grid .system-sub {
        font-size: 12px;
    }

    body.menu-worker-bg .system-grid .system-card::before {
        width: 56px;
        height: 56px;
    }
}
