:root {
  --primary: #4f46e5;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --border: #e5e7eb;
  --text: #111827;
  --muted: #6b7280;
  --danger: #dc2626;
  --green: #16a34a;
  --amber: #d97706;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif; color: var(--text); background: var(--bg); font-size: 14px; }

.hidden { display: none !important; }

.login-screen { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(160deg, #eef2ff, #f8fafc); padding: 20px; }
.login-card { background: #fff; border: 1px solid var(--border); border-radius: 20px; box-shadow: 0 20px 50px rgba(16,24,40,.12); padding: 36px 32px; width: 100%; max-width: 380px; }
.login-logo { width: 56px; height: 56px; border-radius: 16px; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 28px; font-weight: 700; margin: 0 auto 14px; }
.login-card h1 { font-size: 20px; text-align: center; margin: 0 0 22px; }
.login-error { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 10px; text-align: center; }

.app { display: flex; min-height: 100vh; }
.sidebar { width: 240px; background: #111827; color: #d1d5db; display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; }
.sidebar .logo { color: #fff; font-weight: 700; letter-spacing: .5px; padding: 20px 18px; border-bottom: 1px solid #1f2937; }
.menu { flex: 1; overflow-y: auto; padding: 10px 0; }
.menu-item { display: block; width: 100%; text-align: left; background: none; border: 0; color: #d1d5db; padding: 11px 18px; font-size: 14px; cursor: pointer; border-left: 3px solid transparent; }
.menu-item:hover { background: #1f2937; color: #fff; }
.menu-item.active { background: #1f2937; color: #fff; border-left-color: var(--primary); }
.sidebar-footer { padding: 14px; border-top: 1px solid #1f2937; }
.user-info { color: #fff; font-weight: 600; margin-bottom: 10px; }
.user-info .role { display: block; color: #9ca3af; font-weight: 400; font-size: 12px; }

.content { flex: 1; min-width: 0; margin-left: 240px; padding: 24px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 1px 3px rgba(16,24,40,.06); margin-bottom: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h2 { margin: 0; font-size: 17px; }
.card-body { padding: 20px; }
.card-body.no-pad { padding: 0; }

.flex { display: flex; align-items: center; gap: 8px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.mt { margin-top: 12px; }
.mb { margin-bottom: 12px; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.link { color: var(--primary); cursor: pointer; text-decoration: none; }

.btn { display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 10px; padding: 9px 14px; font-size: 14px; font-weight: 500; cursor: pointer; background: #e5e7eb; color: #111827; }
.btn:hover { opacity: .92; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-secondary { background: #f3f4f6; border-color: var(--border); color: #111827; }
.btn-danger { background: #fee2e2; color: var(--danger); }
.btn-ghost { background: transparent; color: #d1d5db; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-block { width: 100%; }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field span { font-size: 12px; color: var(--muted); }
input, select, textarea { border: 1px solid #d1d5db; border-radius: 10px; padding: 9px 11px; font-size: 14px; font-family: inherit; color: var(--text); background: #fff; width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
th { background: #f9fafb; font-weight: 600; color: #374151; }
td.num, th.num { text-align: right; white-space: nowrap; }
.empty { padding: 28px; text-align: center; color: var(--muted); }
tbody tr:hover { background: #fafafa; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; }
.badge-green { background: #dcfce7; color: #15803d; }
.badge-amber { background: #fef3c7; color: #b45309; }
.badge-red { background: #fee2e2; color: #b91c1c; }
.badge-gray { background: #f3f4f6; color: #4b5563; }
.badge-indigo { background: #e0e7ff; color: #4338ca; }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.tab { background: none; border: 0; padding: 9px 14px; cursor: pointer; color: var(--muted); font-size: 14px; border-bottom: 2px solid transparent; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(17,24,39,.45); display: grid; place-items: center; padding: 20px; z-index: 100; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 640px; max-height: 90vh; overflow-y: auto; box-shadow: 0 25px 60px rgba(0,0,0,.25); }
.modal:has(.cr-table) { max-width: 920px; }
.cr-table th, .cr-table td { padding: 6px 8px; font-size: 13px; vertical-align: middle; }
.cr-table thead th { position: sticky; top: 0; background: #fff; z-index: 1; }
.cr-table input { width: 80px; padding: 5px 8px; border-radius: 6px; text-align: right; }
.cr-table input:disabled { background: #f3f4f6; }
.cr-table .cr-left, .cr-table .cr-sum { font-weight: 600; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-close { background: none; border: 0; font-size: 22px; cursor: pointer; color: var(--muted); }
.modal-body { padding: 20px; }

#toast-root { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: #111827; color: #fff; padding: 11px 16px; border-radius: 10px; font-size: 14px; box-shadow: 0 8px 20px rgba(0,0,0,.2); }
.toast-success { background: #16a34a; }
.toast-error { background: #dc2626; }

.qr-img { max-width: 260px; width: 100%; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; }
.sort-arrow { font-size: 10px; margin-left: 2px; }

.gantt-order { background: #f9fafb; font-weight: 600; }
.gantt-cat { border-left: 4px solid #ccc; padding-left: 12px; }
.gantt-row { display: grid; grid-template-columns: 300px 1fr; border-bottom: 1px solid var(--border); }
.gantt-label { padding: 8px 12px; border-right: 1px solid var(--border); }
.gantt-track { position: relative; min-height: 34px; background: #fff; }
.gantt-bar { height: 14px; border-radius: 7px; background: var(--primary); }

.pf-wrap { overflow: auto; max-width: 100%; max-height: calc(100vh - 230px); border: 1px solid var(--border); border-radius: 8px; overscroll-behavior: contain; }
.pf-table { width: max-content; border-collapse: separate; border-spacing: 0; table-layout: auto; }
.pf-table th, .pf-table td { padding: 4px 6px; font-size: 12px; line-height: 1.3; white-space: nowrap; border-bottom: 1px solid var(--border); border-right: 1px solid #eef0f2; }
.pf-table thead th { position: sticky; top: 0; z-index: 3; background: #f9fafb; text-align: center; }
.pf-table thead th.pf-sticky { z-index: 4; }
.pf-sticky { position: sticky; z-index: 2; background: #fff; }
.pf-c1 { left: 0; width: 170px; min-width: 170px; max-width: 170px; text-align: left; white-space: normal !important; overflow-wrap: anywhere; }
.pf-c2 { left: 170px; width: 100px; min-width: 100px; max-width: 100px; text-align: left; }
.pf-c3 { left: 270px; width: 84px; min-width: 84px; max-width: 84px; text-align: right; box-shadow: inset -2px 0 0 #d1d5db; }
.pf-table thead .pf-c1, .pf-table thead .pf-c2 { text-align: left; }
.pf-cell { width: 36px; min-width: 36px; max-width: 36px; padding-left: 0 !important; padding-right: 0 !important; text-align: center; overflow: hidden; }
.pf-table thead th.pf-cell { line-height: 1.15; padding-top: 3px; padding-bottom: 3px; }
.pf-dow { font-size: 10px; font-weight: 500; color: var(--muted); text-transform: lowercase; }
.pf-table thead th.pf-weekend { background: #eceef1; }
.pf-table thead th.pf-weekend .pf-dow { color: #dc2626; }
.pf-weekend { background: #f1f3f5; }
.pf-deadline { background: #fecaca !important; }
.pf-dl { background-color: #fee2e2; box-shadow: inset 2px 0 0 #dc2626, inset -2px 0 0 #dc2626; }
.pf-total { text-align: right; font-weight: 600; background: #f9fafb; min-width: 80px; }
.pf-kind { color: var(--muted); }
.gantt-order td { background: #f3f4f6; }
.pf-shop td { background: #fbfbfe; }
.pf-shop-name { font-weight: 700; }
.pf-plan, .pf-fact { height: 30px; padding: 0 2px !important; font-variant-numeric: tabular-nums; }
.pf-fact { font-weight: 600; }
.pf-editable { cursor: cell; user-select: none; }
.pf-editable:hover { box-shadow: inset 0 0 0 2px var(--primary); }
.pf-fill { box-shadow: inset 0 0 0 2px var(--primary); background-image: linear-gradient(rgba(79,70,229,.18), rgba(79,70,229,.18)); }
.pf-in { display: block; width: 100%; height: 28px; margin: 0; padding: 0; border: none !important; border-radius: 0 !important; background: #fff; box-shadow: inset 0 0 0 2px var(--primary); outline: none; font-size: 12px; text-align: center; }
body.pf-filling, body.pf-filling * { cursor: ew-resize !important; }
body.pf-moving, body.pf-moving * { cursor: grabbing !important; user-select: none; }
.pf-cat-name { vertical-align: middle; cursor: grab; }
.pf-cat-inner { display: flex; align-items: center; gap: 6px; }
.pf-drag { color: #9ca3af; letter-spacing: -2px; font-size: 13px; }
.pf-cat-name:hover .pf-drag { color: var(--primary); }
.pf-cat-dot { width: 10px; height: 10px; border-radius: 2px; flex: none; }
.pf-dragging td { opacity: .45; }
.pf-drop-before td { box-shadow: inset 0 2px 0 var(--primary); }
.pf-drop-after td { box-shadow: inset 0 -2px 0 var(--primary); }
.pf-fact-row td { border-bottom-color: #d1d5db; }

/* Заказ: компактная таблица номенклатуры и операций */
.od-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.od-table th, .od-table td { padding: 3px 6px; font-size: 12px; line-height: 1.3; border-bottom: 1px solid #eef0f2; border-right: 1px solid #eef0f2; vertical-align: middle; white-space: nowrap; }
.od-table thead th { position: sticky; top: 0; z-index: 2; background: #f9fafb; text-align: left; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--border); }
.od-table th.num, .od-table td.num { text-align: right; }
.od-table tbody.od-unit tr:last-child td, .od-table td.od-items, .od-table td.od-chk { border-bottom: 2px solid #d1d5db; }
.od-table td.od-items { vertical-align: top; width: 340px; min-width: 300px; background: #fcfcfd; white-space: normal; }
.od-table td.od-chk, .od-table th.od-chk { width: 28px; text-align: center; vertical-align: top; padding-top: 7px; }
.od-group td.od-items, .od-group td.od-chk { background: #f5f3ff; }
.od-group-head { display: flex; align-items: center; gap: 8px; margin: 2px 0 4px; }
.od-group-head .badge { background: #ede9fe; color: #5b21b6; }
.od-item { padding: 2px 0; }
.od-item + .od-item { border-top: 1px dashed #e5e7eb; }
.od-item-line { display: flex; align-items: center; gap: 4px; }
.od-item-line .item-name { flex: 1; min-width: 0; font-weight: 500; }
.od-meta { color: var(--muted); font-size: 11px; padding-left: 7px; }
.od-in { height: 24px; padding: 1px 6px; font-size: 12px; border: 1px solid transparent; border-radius: 4px; background: transparent; color: var(--text); width: auto; min-width: 0; box-shadow: none; }
.od-in:hover { border-color: #d1d5db; background: #fff; }
.od-in:focus { border-color: var(--primary); background: #fff; outline: none; }
.od-table input[type=number].od-in { -moz-appearance: textfield; appearance: textfield; text-align: right; }
.od-table input[type=number].od-in::-webkit-outer-spin-button, .od-table input[type=number].od-in::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.od-qty { width: 56px; }
.od-num { width: 64px; }
.od-num2 { width: 30px; padding: 1px 3px; }
.od-time { display: inline-flex; align-items: center; color: var(--muted); }
.od-cat { width: 120px; padding-left: 2px; }
.od-dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 2px; vertical-align: middle; }
.od-opname { min-width: 160px; white-space: normal; }
.od-handle { display: inline-block; width: 14px; margin-right: 4px; color: #c0c4cc; cursor: grab; user-select: none; letter-spacing: -2px; }
.od-oprow:hover .od-handle { color: var(--muted); }
.od-drag-active, .od-drag-active * { cursor: grabbing !important; user-select: none; }
.od-oprow.od-dragging > td:not(.od-chk):not(.od-items) { background: #eef2ff; opacity: .7; }
.od-oprow.od-drop-before > td:not(.od-chk):not(.od-items) { box-shadow: inset 0 2px 0 var(--primary); }
.od-oprow.od-drop-after > td:not(.od-chk):not(.od-items) { box-shadow: inset 0 -2px 0 var(--primary); }
.od-table .badge { font-size: 11px; padding: 1px 6px; }
.od-act { width: 26px; text-align: center; }
.od-icon { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 14px; line-height: 1; width: 22px; height: 22px; border-radius: 4px; padding: 0; flex: none; }
.od-icon:hover { background: #eef0f2; color: var(--text); }
.od-icon.od-del:hover { background: #fee2e2; color: var(--danger); }

/* Комплектовка: компактная таблица маршрутов */
.rt-table td { border-bottom-color: #e5e7eb; }
.rt-table tbody tr:hover td { background: #fafafb; }
.rt-table td.od-chk { padding-top: 3px; vertical-align: middle; }
.rt-item { white-space: normal; min-width: 180px; }
.rt-workers { white-space: normal; min-width: 200px; max-width: 420px; }
.rt-chip { display: inline-flex; align-items: center; gap: 4px; margin: 1px 3px 1px 0; padding: 0 6px; height: 18px; border: 1px solid; border-radius: 4px; font-size: 11px; line-height: 16px; white-space: nowrap; }
.rt-chip b { font-weight: 600; opacity: .85; }
.rt-acts { width: 76px; text-align: right; }
.rt-acts .od-icon { display: inline-block; }
.od-link { border: 0; background: transparent; color: var(--primary); cursor: pointer; font-size: 12px; padding: 2px 6px; border-radius: 4px; }
.od-link:hover { background: #eef2ff; }
.od-addrow { background: #fff; }
.od-sumrow td.od-sumcell { background: #f8fafc; white-space: normal; padding: 4px 8px; }
.od-sums { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; }
.od-sum { white-space: nowrap; color: var(--text); }
.od-sum-l { color: var(--muted); }
.od-sum-sew .od-sum-l, .od-total-cell.od-sum-sew span { color: #4f46e5; }
.od-sum-cut .od-sum-l, .od-total-cell.od-sum-cut span { color: #b45309; }
.od-total { padding: 10px 14px; border-bottom: 1px solid var(--border); background: #fcfcfd; }
.od-total-title { font-size: 12px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.od-total-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.od-total-cell { display: flex; flex-direction: column; gap: 2px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; background: #fff; }
.od-total-cell span { font-size: 12px; color: var(--muted); }
.od-total-cell b { font-size: 16px; }
.od-total-all { background: #eef2ff; border-color: #c7d2fe; }
@media (max-width: 700px) { .od-total-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.mw-table td.mw-order, .mw-table td.mw-item { vertical-align: top; white-space: normal; background: #fcfcfd; }
.mw-table td.mw-order { min-width: 130px; }
.mw-table td.mw-item { min-width: 160px; font-weight: 500; }
.mw-table tfoot td { background: #f9fafb; border-top: 1px solid var(--border); }
.mw-table .mw-warn { color: #b45309; font-weight: 600; }
.mw-row { cursor: pointer; }
.mw-table tr.mw-short > td { background: #fffbeb; }
.mw-table tbody tr.mw-short:hover > td { background: #fef3c7; }
.mw-table tr.mw-short > td:first-child { box-shadow: inset 3px 0 0 #f59e0b; }
.rt-table tr.rt-short > td { background: #fffbeb; }
.rt-table tbody tr.rt-short:hover > td { background: #fef3c7; }
.rt-table tr.rt-short > td:first-child { box-shadow: inset 3px 0 0 #f59e0b; }
.mw-badge-warn { background: #fef3c7 !important; color: #92400e !important; }
.mw-badge-ok { background: #dcfce7 !important; color: #166534 !important; }

/* Дашборд */
.dash-people { display: flex; flex-wrap: wrap; gap: 8px; }
.dash-person { min-width: 150px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.dash-person.green { border-left: 4px solid var(--green); }
.dash-person.red { border-left: 4px solid var(--danger); }
.dash-person-name { font-weight: 600; }
.dash-person-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.dash-orders { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.dash-order-num { font-size: 22px; font-weight: 700; line-height: 1.2; }
.dash-cats { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 6px; }
.dash-cat { font-size: 12px; font-weight: 600; }

/* Вход, восстановление пароля */
.login-forgot { display: block; text-align: center; margin-top: 14px; color: var(--primary); text-decoration: none; font-size: 13px; }
.login-forgot:hover { text-decoration: underline; }

/* Мобильная шапка (на десктопе скрыта) */
.topbar { display: none; }
.sidebar-backdrop { display: none; }
.sidebar { z-index: 60; }

/* Сканер QR */
.scan-wrap { position: relative; width: 100%; max-width: 420px; margin: 0 auto; aspect-ratio: 1 / 1; background: #000; border-radius: 14px; overflow: hidden; }
.scan-wrap video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame { position: absolute; inset: 18%; border: 3px solid rgba(255,255,255,.9); border-radius: 14px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); pointer-events: none; }
.install-steps { padding-left: 20px; line-height: 1.7; margin: 0 0 12px; }

@media (max-width: 900px) {
  body { font-size: 15px; }
  .topbar {
    display: flex; align-items: center; gap: 6px; position: fixed; top: 0; left: 0; right: 0; z-index: 50;
    height: calc(54px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 6px 0;
    background: #111827; color: #fff;
  }
  .topbar-title { flex: 1; min-width: 0; font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; }
  .topbar-btn { width: 44px; height: 44px; flex: none; border: 0; background: transparent; color: #fff; font-size: 22px; border-radius: 10px; cursor: pointer; }
  .topbar-btn:active { background: #1f2937; }

  .sidebar {
    width: min(84vw, 300px); transform: translateX(-100%); transition: transform .22s ease;
    padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom);
  }
  body.menu-open .sidebar { transform: none; box-shadow: 8px 0 30px rgba(0,0,0,.35); }
  body.menu-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(17,24,39,.45); z-index: 55; }
  body.menu-open { overflow: hidden; }
  .menu-item { padding: 14px 18px; font-size: 15px; }
  .sidebar-footer .btn { padding: 11px 14px; }

  .content {
    margin-left: 0; padding: calc(66px + env(safe-area-inset-top)) 10px calc(16px + env(safe-area-inset-bottom));
  }
  .card { border-radius: 10px; margin-bottom: 12px; }
  .card-head { padding: 12px 14px; }
  .card-head h2 { font-size: 16px; }
  .card-head > .flex { width: 100%; }
  .card-body { padding: 14px; }

  /* Поля ввода от 16px — иначе iPhone увеличивает страницу при фокусе. */
  input, select, textarea { font-size: 16px; padding: 10px 12px; }
  .btn { padding: 10px 14px; min-height: 40px; }
  .btn-sm { min-height: 34px; padding: 6px 10px; }
  .form-row { grid-template-columns: 1fr; gap: 0; }
  .form-actions { flex-wrap: wrap; }
  .form-actions .btn { flex: 1 1 auto; }

  .grid-2 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .table-wrap { -webkit-overflow-scrolling: touch; }
  th, td { padding: 8px 10px; }

  .tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { white-space: nowrap; flex: none; }

  .modal-backdrop { padding: 0; place-items: end stretch; }
  .modal { max-width: none !important; max-height: 92vh; border-radius: 16px 16px 0 0; padding-bottom: env(safe-area-inset-bottom); }
  .modal-head { position: sticky; top: 0; background: #fff; z-index: 2; padding: 12px 16px; }
  .modal-body { padding: 16px; }
  .modal-close { width: 40px; height: 40px; }

  #toast-root { left: 10px; right: 10px; bottom: calc(14px + env(safe-area-inset-bottom)); }
  .toast { text-align: center; }

  .pf-wrap { max-height: calc(100vh - 200px); }
  .gantt-row { grid-template-columns: 150px 1fr; }
  .dash-person { flex: 1 1 140px; min-width: 0; }
  .dash-orders { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .qr-img { max-width: 220px; }
}

@media (max-width: 420px) {
  .login-card { padding: 28px 20px; border-radius: 16px; }
  .grid-4 { grid-template-columns: 1fr 1fr; gap: 10px; }
}

/* Зарплата сотрудника */
.sal-total { background: linear-gradient(135deg, #4f46e5, #6366f1); color: #fff; border-radius: 16px; padding: 18px 20px; margin-bottom: 14px; }
.sal-total .muted { color: rgba(255,255,255,.8); }
.sal-total-sum { font-size: 36px; font-weight: 700; line-height: 1.15; margin: 4px 0 6px; letter-spacing: -.5px; }
.sal-sec { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); margin-bottom: 10px; overflow: hidden; }
.sal-sec-head { width: 100%; display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: none; border: 0; cursor: pointer; text-align: left; font: inherit; color: inherit; }
.sal-sec-head:hover { background: #f9fafb; }
.sal-sec-title { flex: 1; display: flex; flex-direction: column; gap: 2px; font-size: 15px; font-weight: 600; min-width: 0; }
.sal-sec-title .muted { font-weight: 400; }
.sal-sec-total { font-size: 17px; font-weight: 700; white-space: nowrap; }
.sal-sec-arrow { font-size: 22px; color: var(--muted); transition: transform .2s; line-height: 1; }
.sal-sec.open .sal-sec-arrow { transform: rotate(90deg); }
.sal-sec-body { border-top: 1px solid var(--border); }
.sal-list { list-style: none; margin: 0; padding: 0; }
.sal-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.sal-row:last-child { border-bottom: 0; }
.sal-row-main { min-width: 0; overflow-wrap: anywhere; }
.sal-row-val { text-align: right; white-space: nowrap; font-weight: 600; }
.sal-row-val .muted { font-weight: 400; }
.sal-empty { padding: 12px 16px; }
@media (max-width: 420px) { .sal-total-sum { font-size: 32px; } }
.me-summary { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 0 2px 10px; font-size: 16px; }
.me-list { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); }
.me-item { border-bottom: 1px solid var(--border); }
.me-item:last-child { border-bottom: 0; }
.me-item .sal-row { border-bottom: 0; padding-bottom: 6px; }
.me-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 0 16px 10px; }
.me-actions .btn { margin: 0; }

/* Календарь графика сотрудника */
.msc-card { padding: 14px; max-width: 760px; }
.msc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.msc-head h2 { margin: 0; font-size: 18px; text-align: center; flex: 1; }
.msc-nav { min-width: 40px; font-size: 20px; line-height: 1; padding: 6px 10px; margin: 0; }
.msc-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.msc-wd { text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); padding: 2px 0; }
.msc-wd.msc-we { color: #dc2626; }
.msc-cell { display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 0; min-height: 70px; padding: 4px 2px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); font: inherit; color: inherit; cursor: pointer; text-align: center; overflow: hidden; }
.msc-cell:hover { border-color: var(--primary); }
.msc-empty { border: 0; background: transparent; cursor: default; }
.msc-num { font-weight: 700; font-size: 14px; }
.msc-t { font-size: 11px; line-height: 1.25; color: #374151; white-space: nowrap; }
.msc-off { background: #f3f4f6; }
.msc-offlbl { font-size: 11px; color: #9ca3af; margin-top: 2px; flex: 1; }
.msc-fact { font-size: 10px; color: #059669; font-weight: 600; margin-top: auto; white-space: nowrap; }
.msc-today { border: 2px solid var(--primary); }
.msc-today .msc-num { color: var(--primary); }
.msc-changed { box-shadow: inset 0 0 0 2px #f59e0b; }
.msc-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.msc-totals { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--muted); }
.msc-totals b { color: #111827; }
.msc-foot .btn { margin: 0; }
.msc-save-dirty { background: #f59e0b; border-color: #f59e0b; }
.msc-hint { margin-top: 8px; }
.msc-offrow { display: flex; align-items: center; gap: 8px; font-weight: 600; margin-bottom: 12px; }
.msc-offrow input { width: 20px; height: 20px; }
.msd-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 480px) {
  .msc-card { padding: 10px 8px; }
  .msc-grid { gap: 3px; }
  .msc-cell { min-height: 62px; padding: 3px 1px; border-radius: 6px; }
  .msc-num { font-size: 13px; }
  .msc-t { font-size: 10px; }
  .msc-fact { font-size: 9px; }
  .msc-foot .btn { width: 100%; }
}

/* ---- Мои заказы / Мои маршрутники (карточки вместо таблиц) ---- */
.mw-warn { color: #b45309; font-weight: 600; }
.mw-meta { font-size: 12px; margin-top: 2px; }
.mw-total-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; margin-bottom: 10px; border-radius: 12px; background: #eef2ff; color: #3730a3; font-size: 15px; }
.mw-total-bar > b { font-size: 18px; }
.mw-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 12px 16px; background: #f9fafb; border-bottom: 1px solid var(--border); }
.mw-item-title { padding: 8px 16px 4px; font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.mw-route { display: block; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; padding: 0; }
.mw-route:hover { border-color: var(--primary); }
.mw-short-card { border-left: 4px solid #f59e0b; }
.mw-route-body { padding: 10px 16px 12px; overflow-wrap: anywhere; }
.mw-route-item { font-weight: 500; }
.mw-route-stats { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: 13px; }
.mw-ops { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.mw-op { padding: 10px 14px; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.mw-op:last-child { border-bottom: 0; }
.mw-short-op { background: #fffbeb; box-shadow: inset 3px 0 0 #f59e0b; }
.mw-op-name { font-weight: 500; }
.mw-op-edit { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-top: 8px; }
.mw-op-label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.mw-op-label input { width: 110px; font-size: 16px; padding: 8px 10px; }
.mw-op-edit .mw-sum { font-size: 16px; white-space: nowrap; }
