/* =========================================================
   Courier Design System — единый стиль приложения курьера
   Namespace: .cr-*  (не конфликтует со старыми norm/main.css)
   ========================================================= */

:root {
    /* Акцент раздела — перекрывается темой роли ниже. */
    --brand:        #4f46e5;
    --brand-dark:   #4338ca;
    --brand-soft:   #eef1fe;
    --brand-ink:    #4338ca;

    --cash:         #15a34a;
    --cash-dark:    #128a3e;
    --cash-soft:    #edf9f1;

    --wa:           #22c55e;
    --danger:       #e5484d;
    --danger-soft:  #fdf0f0;
    --warn:         #E09600;
    --warn-soft:    #fff5e4;

    /* Нейтральная шкала — чистый минимализм */
    --ink:          #16181d;
    --ink-2:        #3a3f47;
    --muted:        #8a8f98;
    --faint:        #b4b9c1;

    --bg:           #f6f7f9;
    --surface:      #ffffff;
    --line:         #e9ebef;

    /* «Чернильная» CTA-кнопка (премиальный минимал) */
    --cta:          #16181d;
    --cta-h:        #2a2e35;

    --r-sm: 10px;
    --r-md: 12px;
    --r-lg: 16px;
    --r-pill: 999px;

    /* Мягкие тени */
    --sh-card: 0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.06);
    --sh-soft: 0 4px 16px rgba(16,24,40,.06);
    --sh-pop:  0 6px 20px rgba(16,24,40,.10);
    --sh-nav:  0 -1px 0 #eceef1, 0 -10px 30px rgba(16,24,40,.05);

    --nav-h: 74px;
}

* { box-sizing: border-box; }

/* Тема раздела «Касса» — бирюзовый акцент (отличие от курьера-индиго).
   Переопределяем переменные бренда, все компоненты перекрашиваются сами. */
body.cr.kassa {
    --brand:      #0d9488;
    --brand-dark: #0f766e;
    --brand-soft: #d6f5ef;
    --brand-ink:  #115e59;
}
/* Касса работает на ПК — контейнер широкий (курьерский .cr-wrap = 560px мал). */
body.cr.kassa .cr-wrap { max-width: 1200px; }

/* Тема раздела «Дистрибуция» (Раздача) — фиолетовый акцент. */
body.cr.dist {
    --brand:      #7c3aed;
    --brand-dark: #6d28d9;
    --brand-soft: #f3e8ff;
    --brand-ink:  #5b21b6;
}
body.cr.dist .cr-wrap { max-width: 1200px; }
body.cr.dist-top { padding-top: 58px; padding-bottom: 24px; }
body.cr.dist-top .cr-head { position: static; }

/* Тема раздела «Админ» — золотой акцент (бренд Banzai). */
body.cr.admin {
    --brand:      #d97706;
    --brand-dark: #b45309;
    --brand-soft: #fef3c7;
    --brand-ink:  #92400e;
}
body.cr.admin .cr-wrap { max-width: 1200px; }
body.cr.admin-top { padding-top: 58px; padding-bottom: 24px; }
body.cr.admin-top .cr-head { position: static; }

/* Верхняя навигация кассы (десктоп) */
body.cr.kassa-top { padding-top: 58px; padding-bottom: 24px; }
body.cr.kassa-top .cr-head { position: static; }
.k-top { position: fixed; top: 0; left: 0; right: 0; height: 58px; background: rgba(255,255,255,.85); backdrop-filter: saturate(180%) blur(12px); -webkit-backdrop-filter: saturate(180%) blur(12px); border-bottom: 1px solid var(--line); z-index: 30; }
.k-top_in { max-width: 1400px; margin: 0 auto; height: 100%; display: flex; align-items: center; gap: 12px; padding: 0 16px; }
.k-brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 17px; color: var(--brand-dark); flex: none; }
.k-brand svg { width: 20px; height: 20px; color: var(--brand); }
.k-links { display: flex; gap: 2px; flex: 1; overflow: visible; flex-wrap: nowrap; justify-content: center; }
.k-links::-webkit-scrollbar { display: none; }
.k-link { display: flex; align-items: center; gap: 6px; padding: 8px 11px; border-radius: 10px; color: var(--muted); font-weight: 700; font-size: 14px; text-decoration: none; white-space: nowrap; }
.k-link:hover { background: #f1f5f9; }
.k-link.act { background: var(--brand-soft); color: var(--brand-ink); }
.k-link svg { width: 18px; height: 18px; }
.k-user { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; color: var(--ink-2); font-weight: 700; font-size: 14px; text-decoration: none; flex: none; }
.k-user:hover { background: #f1f5f9; }
.k-user.act { background: var(--brand-soft); color: var(--brand-ink); }
.k-user svg { width: 18px; height: 18px; }

/* Выпадающее меню в верхней навигации */
.k-drop { position: relative; }
.k-drop > .k-link { border: 0; background: transparent; font: inherit; cursor: pointer; }
.k-drop_ar { width: 14px !important; height: 14px !important; opacity: .55; margin-left: -2px; }
.k-drop.act > .k-link { background: var(--brand-soft); color: var(--brand-ink); }
.k-drop_m { position: absolute; top: calc(100% + 2px); left: 0; min-width: 190px; background: #fff;
    border-radius: 14px; box-shadow: 0 8px 30px rgba(15,23,42,.14); padding: 6px; display: none; z-index: 40; }
.k-drop:hover .k-drop_m, .k-drop.open .k-drop_m { display: block; }
.k-drop_m a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
    color: var(--ink-2); font-weight: 700; font-size: 14px; text-decoration: none; white-space: nowrap; }
.k-drop_m a:hover { background: var(--brand-soft); color: var(--brand-ink); }
.k-drop_m a.act { color: var(--brand-ink); }
.k-drop_m a svg { width: 17px; height: 17px; }
/* Переключатель языка */
.lng { display: inline-flex; flex: none; background: #f1f2f4; border-radius: 9px; padding: 2px; gap: 2px; }
.lng_i { padding: 5px 9px; border-radius: 7px; font-size: 12px; font-weight: 800; letter-spacing: .3px;
    color: var(--muted); text-decoration: none; line-height: 1; display: inline-flex; align-items: center; }
.lng_i:hover { color: var(--ink); }
.lng_i.act { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(16,24,40,.08); }

/* Кнопка-бургер: показывается, когда меню не помещается в строку */
.k-burger { display: none; width: 40px; height: 40px; flex: none; border: 1.5px solid var(--line);
    border-radius: 10px; background: var(--surface); color: var(--ink-2); cursor: pointer;
    align-items: center; justify-content: center; padding: 0; }
.k-burger:hover { border-color: var(--ink); }
.k-burger svg { width: 20px; height: 20px; }

/* Узкий экран: меню сворачивается в выдвижную панель под шапкой.
   Так длинные казахские подписи не ломают шапку и удобно с телефона. */
@media (max-width: 1200px) {
    .k-burger { display: inline-flex; order: -1; }
    .k-links {
        display: none; position: fixed; top: 58px; left: 0; right: 0;
        flex-direction: column; align-items: stretch; gap: 2px;
        background: #fff; border-bottom: 1px solid var(--line);
        box-shadow: 0 12px 30px rgba(16,24,40,.10);
        padding: 8px; max-height: calc(100vh - 58px); overflow-y: auto; z-index: 35;
    }
    .k-links.open { display: flex; }
    .k-link { padding: 12px 14px; border-radius: 10px; font-size: 15px; }
    .k-link span, .k-user span { display: inline; }

    /* Выпадающие группы внутри панели раскрыты списком */
    .k-drop { position: static; }
    .k-drop > .k-link { width: 100%; justify-content: flex-start; }
    .k-drop_ar { display: none; }
    .k-drop_m { display: block; position: static; box-shadow: none; padding: 2px 0 6px 26px; min-width: 0; }
    .k-drop_m a { padding: 10px 12px; }
}
@media (max-width: 640px) {
    .k-brand span { display: none; }
    .k-user span { display: none; }
    .k-top_in { gap: 8px; padding: 0 10px; }
    .lng_i { padding: 5px 8px; font-size: 11px; }
}
/* Липкие панели с учётом высоты верхнего меню */
body.cr.kassa-top .pos_right { top: 72px; }
body.cr.kassa-top .op_right { top: 72px; }

/* Иконки Lucide: наследуют цвет (currentColor), фикс-размер по умолчанию */
.cr svg.lucide, body.cr svg.lucide {
    width: 18px; height: 18px;
    stroke-width: 2; vertical-align: -.18em; flex: 0 0 auto;
}
/* Размеры по контекстам (специфичнее глобального) */
.cr .cr-nav_ic svg.lucide { width: 23px; height: 23px; }
.cr .cr-brand_ic svg.lucide { width: 34px; height: 34px; }
.cr .cr-ava_ed svg.lucide { width: 16px; height: 16px; }
.cr .cr-time svg.lucide { width: 14px; height: 14px; }
.cr .cr-pill svg.lucide { width: 13px; height: 13px; }
.cr .cr-num svg.lucide { width: 22px; height: 22px; }

body.cr {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
    padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
}

.cr-wrap { max-width: 560px; margin: 0 auto; padding: 14px 14px 24px; }

/* ---------- Верхний заголовок экрана ---------- */
.cr-head {
    position: sticky; top: 0; z-index: 10;
    margin: -14px -14px 16px;
    padding: 18px 18px 14px;
    background: var(--bg);
    color: var(--ink);
    border-bottom: 1px solid var(--line);
}
.cr-head_t { font-size: 22px; font-weight: 800; letter-spacing: -.4px; color: var(--ink); }
.cr-head_s { font-size: 13px; color: var(--muted); margin-top: 3px; font-weight: 600; }
.cr-stats { display: flex; gap: 10px; margin-top: 14px; }
.cr-stat {
    flex: 1; background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md); padding: 11px 13px;
    box-shadow: var(--sh-card);
}
.cr-stat_l { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.cr-stat_v { font-size: 20px; font-weight: 800; margin-top: 3px; color: var(--ink); letter-spacing: -.3px; }

/* ---------- Датапикер (история) ---------- */
.cr-date { display: flex; justify-content: center; margin: 4px 0 14px; }
.cr-date input {
    border: 0; background: var(--surface); box-shadow: var(--sh-card);
    border-radius: var(--r-pill); padding: 11px 20px;
    font-family: inherit; font-size: 15px; font-weight: 700; color: var(--ink);
}

/* ---------- Карточка заказа ---------- */
.cr-card {
    background: var(--surface); border-radius: var(--r-lg);
    border: 1px solid var(--line); box-shadow: var(--sh-card);
    margin-bottom: 14px; overflow: hidden;
    animation: cr-in .32s ease both;
}
@keyframes cr-in { from { opacity: 0; transform: translateY(8px); } }

.cr-top { display: flex; align-items: center; gap: 12px; padding: 14px 16px 12px; }
.cr-num {
    flex: 0 0 auto; min-width: 52px; height: 52px; padding: 0 12px;
    border-radius: var(--r-md);
    background: var(--brand-soft); color: var(--brand-ink);
    display: flex; align-items: center; justify-content: center;
    font-size: 21px; font-weight: 800; letter-spacing: -.5px;
}
.cr-top_b { flex: 1; min-width: 0; }
.cr-branch { font-size: 16px; font-weight: 800; color: var(--ink); }
.cr-time { font-size: 13px; color: var(--muted); font-weight: 600; margin-top: 1px; }
.cr-time i { margin-right: 4px; }

.cr-pill {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 12px; font-weight: 800; padding: 4px 10px; border-radius: var(--r-pill);
}
.cr-pill.pre  { color: #b45309; background: var(--warn-soft); }
.cr-pill.new  { color: var(--brand-ink); background: var(--brand-soft); }

/* Адрес */
.cr-addr { padding: 2px 16px 14px; }
.cr-addr_t { display: flex; gap: 10px; font-size: 15.5px; font-weight: 700; color: var(--ink); line-height: 1.35; margin-bottom: 10px; }
.cr-addr_t i { color: var(--brand); font-size: 17px; margin-top: 2px; }
.cr-map {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    height: 42px; border-radius: var(--r-sm);
    background: var(--brand-soft); color: var(--brand-ink);
    font-weight: 700; font-size: 14px; text-decoration: none;
}
.cr-map:active { transform: scale(.99); }

/* Сумма к получению — герой */
.cr-cash {
    margin: 0 16px 12px; padding: 11px; border-radius: var(--r-md);
    background: var(--cash-soft); text-align: center;
    border: 1px solid rgba(22,163,74,.14);
}
.cr-cash_l { font-size: 11px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: var(--cash-dark); }
.cr-cash_v { font-size: 26px; font-weight: 800; color: var(--cash); line-height: 1.1; margin-top: 1px; }
.cr-cash_v small { font-size: 16px; }

/* Состав */
.cr-items { margin: 0 16px 12px; }
.cr-items summary {
    list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between;
    padding: 10px 0; font-size: 14px; font-weight: 700; color: var(--muted);
}
.cr-items summary::-webkit-details-marker { display: none; }
.cr-items summary .cv { transition: transform .2s; }
.cr-items[open] summary .cv { transform: rotate(180deg); }
.cr-row { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; padding: 6px 0; color: var(--ink-2); }
.cr-row .q { color: var(--faint); font-weight: 700; }
.cr-row.tot { border-top: 1px dashed var(--line); margin-top: 6px; padding-top: 9px; font-weight: 800; color: var(--ink); font-size: 15px; }

/* Действия */
.cr-act { display: flex; gap: 8px; padding: 0 16px 14px; flex-wrap: wrap; }
.cr-btn {
    flex: 1; min-width: 110px; height: 42px; border: 0; border-radius: var(--r-sm);
    font-family: inherit; font-size: 14px; font-weight: 700;
    display: flex; align-items: center; justify-content: center; gap: 7px;
    text-decoration: none; cursor: pointer; transition: transform .06s;
}
.cr-btn:active { transform: scale(.98); }
.cr-btn.call { background: var(--brand); color: #fff; }
.cr-btn.wa   { background: var(--wa); color: #fff; }
.cr-btn.done {
    flex-basis: 100%; height: 46px; font-size: 15px;
    background: var(--cash);
    color: #fff; box-shadow: var(--sh-card);
}
.cr-btn[disabled] { opacity: .55; }

/* ---------- Пустое состояние ---------- */
.cr-empty { text-align: center; padding: 70px 20px; }
.cr-empty_c {
    width: 96px; height: 96px; margin: 0 auto 18px; border-radius: 50%;
    background: var(--surface); box-shadow: var(--sh-card);
    display: flex; align-items: center; justify-content: center;
    font-size: 40px; color: var(--brand);
}
.cr-empty_t { font-size: 18px; font-weight: 800; color: var(--ink); }
.cr-empty_s { font-size: 14px; color: var(--muted); margin-top: 4px; }

/* ---------- Нижняя навигация (плавающая) ---------- */
.cr-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--surface); box-shadow: var(--sh-nav);
    display: flex; align-items: stretch;
}
.cr-nav_i {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    text-decoration: none; color: var(--faint); font-size: 11px; font-weight: 700;
}
.cr-nav_ic {
    display: flex; align-items: center; justify-content: center;
    width: 46px; height: 28px; border-radius: var(--r-pill); transition: background .15s;
}
.cr-nav_ic svg { width: 21px; height: 21px; }
.cr-nav_i.act { color: var(--brand); }
.cr-nav_i.act .cr-nav_ic { background: var(--brand-soft); }

/* ---------- Экран входа ---------- */
.cr-login { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 24px; }
.cr-login_wrap { width: 100%; max-width: 400px; margin: 0 auto; }
.cr-brand { text-align: center; margin-bottom: 28px; }
.cr-brand_ic {
    width: 76px; height: 76px; margin: 0 auto 14px; border-radius: 22px;
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-size: 34px; box-shadow: var(--sh-pop);
}
.cr-brand_t { font-size: 24px; font-weight: 800; color: var(--ink); }
.cr-brand_s { font-size: 14px; color: var(--muted); margin-top: 4px; }

.cr-lcard { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--sh-card); padding: 22px; }
.cr-field { position: relative; margin-bottom: 14px; }
.cr-field > svg, .cr-field > .cr-eye { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.cr-field > svg { width: 18px; height: 18px; }
.cr-eye svg { width: 18px; height: 18px; display: block; }
.cr-input {
    width: 100%; height: 48px; border: 1.5px solid var(--line); border-radius: var(--r-sm);
    padding: 0 16px 0 44px; font-family: inherit; font-size: 15px; font-weight: 600; color: var(--ink);
    background: #fbfcfe; outline: none; transition: border-color .15s, background .15s;
}
.cr-input:focus { border-color: var(--brand); background: #fff; }
.cr-input::placeholder { color: var(--faint); font-weight: 500; }
.cr-eye { left: auto; right: 14px; cursor: pointer; }

.cr-primary {
    width: 100%; height: 50px; border: 0; border-radius: var(--r-sm); margin-top: 4px;
    background: var(--cta); color: #fff;
    font-family: inherit; font-size: 15.5px; font-weight: 800;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    cursor: pointer; box-shadow: var(--sh-card); transition: background .15s, transform .06s;
}
.cr-primary:hover { background: var(--cta-h); }
.cr-primary:active { transform: scale(.99); }
.cr-error { background: var(--danger-soft); color: var(--danger); border-radius: var(--r-sm); padding: 10px 14px; font-size: 13.5px; font-weight: 700; margin-bottom: 14px; text-align: center; }

/* ---------- Профиль ---------- */
.cr-prof_head { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 8px 0 20px; }
.cr-ava { position: relative; width: 100px; height: 100px; }
.cr-ava_img { width: 100px; height: 100px; border-radius: 50%; object-fit: cover; background: var(--brand-soft); box-shadow: 0 8px 22px rgba(79,70,229,.20); }
.cr-ava_ed { position: absolute; right: 2px; bottom: 2px; width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; border: 3px solid var(--bg); cursor: pointer; }
.cr-prof_name { font-size: 20px; font-weight: 800; color: var(--ink); }
.cr-prof_role { font-size: 13px; color: var(--muted); }

.cr-list { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--sh-card); overflow: hidden; }
.cr-li { display: flex; align-items: center; gap: 13px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.cr-li:last-child { border-bottom: 0; }
.cr-li_ic { flex: 0 0 42px; height: 42px; border-radius: 13px; background: var(--brand-soft); color: var(--brand); display: flex; align-items: center; justify-content: center; font-size: 16px; }
.cr-li_b { flex: 1; min-width: 0; }
.cr-li_l { font-size: 12px; color: var(--faint); font-weight: 700; }
.cr-li_in { width: 100%; border: 0; outline: 0; background: transparent; font-family: inherit; font-size: 15.5px; font-weight: 700; color: var(--ink); padding: 2px 0 0; }
.cr-li_in::placeholder { color: var(--faint); font-weight: 500; }

.cr-save {
    width: 100%; height: 50px; border: 0; border-radius: var(--r-sm); margin-top: 16px;
    background: var(--cta); color: #fff;
    font-family: inherit; font-size: 15px; font-weight: 800;
    display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
    box-shadow: var(--sh-card); transition: background .15s;
}
.cr-save:hover { background: var(--cta-h); }
.cr-logout {
    width: 100%; height: 44px; border: 1.5px solid var(--danger-soft); border-radius: var(--r-sm); margin-top: 10px;
    background: #fff; color: var(--danger); font-family: inherit; font-size: 14px; font-weight: 700;
    display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
}

/* ===== Пагинация (общая для админ-списков) ===== */
.pgn { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; }
.pgn_i {
    min-width: 40px; height: 40px; padding: 0 12px; border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--surface); box-shadow: var(--sh-card);
    color: var(--ink, #1a160d); font-weight: 800; font-size: 14px; text-decoration: none;
    border: 1.5px solid transparent; transition: border-color .12s, transform .06s, background .12s;
    -webkit-tap-highlight-color: transparent;
}
.pgn_i { border: 1px solid var(--line); box-shadow: none; }
a.pgn_i:hover { border-color: var(--ink); color: var(--ink); }
a.pgn_i:active { transform: translateY(0); }
.pgn_i.is-act { background: var(--cta); color: #fff; border-color: var(--cta); }
.pgn_i.pgn_dots { background: transparent; box-shadow: none; color: var(--faint, #b3ac9b); font-weight: 700; cursor: default; min-width: 26px; padding: 0 4px; }
.pgn_i.pgn_nav { color: var(--muted, #8a8578); }
.pgn_i.is-off { opacity: .4; box-shadow: none; background: transparent; cursor: default; }
.pgn_i svg { width: 18px; height: 18px; }

/* Красный акцент в названиях товаров (метка cl_red из старой системы) — глобально */
.cl_red { color: #e11d48; }

/* Тема раздела «Склад» (складовщик) — бирюзовый акцент */
body.cr.stock {
    --brand:      #0f766e;
    --brand-dark: #115e59;
    --brand-soft: #d8f3ef;
    --brand-ink:  #115e59;
}
body.cr.stock .cr-wrap { max-width: 1200px; }
body.cr.stock-top { padding-top: 58px; padding-bottom: 24px; }
body.cr.stock-top .cr-head { position: static; }
