:root {
  --bg: #f4f6fa;
  --card: #ffffff;
  --text: #1c2333;
  --muted: #6b7686;
  --accent: #2f6df6;
  --accent-dark: #1f53c9;
  --border: #e3e8f0;
  --green: #1a9e5c;
  --orange: #e08600;
  --red: #d64545;
  --radius: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg); color: var(--text); min-height: 100vh;
}

/* ---------- логин ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: linear-gradient(135deg, #1e3a8a 0%, #2f6df6 55%, #5b9dff 100%); }
.login-card { background: var(--card); border-radius: 20px; padding: 40px 36px; width: 100%; max-width: 400px;
  box-shadow: 0 24px 60px rgba(10,30,80,.35); }
.login-card h1 { font-size: 22px; margin-bottom: 4px; }
.login-card .sub { color: var(--muted); font-size: 14px; margin-bottom: 28px; }
.login-card label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; }
.login-card input { width: 100%; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: 10px; font-size: 15px; outline: none; transition: border-color .15s; }
.login-card input:focus { border-color: var(--accent); }
.login-card button { width: 100%; margin-top: 24px; padding: 13px; background: var(--accent); color: #fff; border: 0;
  border-radius: 10px; font-size: 16px; font-weight: 600; cursor: pointer; transition: background .15s; }
.login-card button:hover { background: var(--accent-dark); }
.login-err { color: var(--red); font-size: 14px; margin-top: 14px; min-height: 18px; }
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.brand .logo { width: 40px; height: 40px; border-radius: 12px; background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px; }
.brand .name { font-weight: 700; font-size: 17px; }
.brand .tag { font-size: 12px; color: var(--muted); }

/* ---------- каркас ---------- */
.topbar { background: var(--card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.topbar-in { max-width: 1200px; margin: 0 auto; padding: 0 20px; display: flex; align-items: center; gap: 18px; height: 60px; }
.topbar .brand { margin: 0; }
.topbar .brand .logo { width: 32px; height: 32px; font-size: 13px; border-radius: 9px; }
nav.tabs { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
nav.tabs a { padding: 8px 14px; border-radius: 9px; color: var(--muted); text-decoration: none; font-size: 14.5px; font-weight: 500; white-space: nowrap; }
nav.tabs a.active { background: #eaf1ff; color: var(--accent); }
.userbox { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.userbox .who { color: var(--text); font-weight: 600; white-space: nowrap; }
.userbox button { background: none; border: 1px solid var(--border); border-radius: 8px; padding: 6px 12px; cursor: pointer; color: var(--muted); font-size: 13px; }
.userbox button:hover { color: var(--red); border-color: var(--red); }

main { max-width: 1200px; margin: 0 auto; padding: 26px 20px 60px; }
.page-title { font-size: 24px; font-weight: 700; margin-bottom: 4px; }
.page-sub { color: var(--muted); font-size: 14px; margin-bottom: 22px; }

/* ---------- карточки сводки ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 28px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.card .num { font-size: 30px; font-weight: 800; margin: 6px 0 2px; }
.card .lbl { color: var(--muted); font-size: 13px; }
.card .icon { font-size: 20px; }
.card a { color: var(--accent); font-size: 13px; text-decoration: none; }

/* ---------- таблицы ---------- */
.panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.panel-head { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.panel-head input, .panel-head select { padding: 9px 12px; border: 1.5px solid var(--border); border-radius: 9px; font-size: 14px; outline: none; background: #fff; }
.panel-head input:focus, .panel-head select:focus { border-color: var(--accent); }
.panel-head input[type=text] { min-width: 220px; flex: 1; max-width: 340px; }
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; padding: 12px 16px; color: var(--muted); font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: .03em; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 12px 16px; border-bottom: 1px solid #f0f3f8; vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: #f8fafd; }
.empty { padding: 44px 20px; text-align: center; color: var(--muted); }

.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.b-new { background: #eef2ff; color: #4353c9; }
.b-assembled { background: #fff4de; color: #b06f00; }
.b-packed { background: #e6f7ee; color: var(--green); }
.b-shipped { background: #e8f1ff; color: var(--accent-dark); }
.b-doslat { background: #e0f5f9; color: #0e7f96; }
.b-cancelled { background: #fdecec; color: var(--red); }
.b-neutral { background: #eef1f6; color: var(--muted); }
.b-paid { background: #e6f7ee; color: var(--green); }
.b-issued { background: #fff4de; color: #b06f00; }

.money { font-weight: 700; white-space: nowrap; }
.dim { color: var(--muted); }
.btn { display: inline-block; padding: 8px 14px; border-radius: 9px; border: 1.5px solid var(--border); background: #fff; color: var(--text); font-size: 14px; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); color: #fff; }

/* ---------- модалка ---------- */
.overlay { position: fixed; inset: 0; background: rgba(15,25,50,.45); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 100; }
.modal { background: #fff; border-radius: 16px; max-width: 640px; width: 100%; max-height: 85vh; overflow-y: auto; padding: 26px; }
.modal h3 { margin-bottom: 4px; }
.modal .m-sub { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.modal .m-actions { display: flex; gap: 10px; margin-top: 20px; justify-content: flex-end; }
.total-row td { font-weight: 800; border-top: 2px solid var(--border); }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #222c40; color: #fff; padding: 12px 22px; border-radius: 10px; font-size: 14px; z-index: 200; box-shadow: 0 8px 24px rgba(0,0,0,.25); }

@media (max-width: 720px) {
  .topbar-in { flex-wrap: wrap; height: auto; padding: 10px 14px; gap: 10px; }
  nav.tabs { order: 3; width: 100%; }
  .userbox .who { display: none; }
  main { padding: 18px 12px 50px; }
  .login-card { padding: 30px 22px; }
}
