:root {
  /* палитра из логотипа ABMK: градиент #00008E → #5E70FF → #010480 */
  --brand-deep: #010480;
  --brand: #00008e;
  --brand-light: #5e70ff;
  --brand-grad: linear-gradient(135deg, #00008e 0%, #2b3ad9 55%, #010480 100%);
  --bg: #f4f6fc;
  --card: #ffffff;
  --text: #1c1e33;
  --heading: #101253;
  --muted: #6b7291;
  --accent: #010480;
  --accent-dark: #00006b;
  --danger: #c0392b;
  --warn-bg: #fff3cd;
  --warn-mark: #e67e22;
  --border: #e2e6f3;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(1, 4, 128, .07);
}
* { box-sizing: border-box; margin: 0; padding: 0; min-width: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  background: var(--bg); color: var(--text); font-size: 16px;
  padding-bottom: env(safe-area-inset-bottom);
}
header {
  position: sticky; top: 0; z-index: 20;
  background: var(--card); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  box-shadow: 0 2px 12px rgba(1, 4, 128, .05);
}
.logo { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.logo img, .hdr-logo { height: 30px; display: block; }
.hdr-sep { width: 1px; height: 24px; background: var(--border); margin: 0 4px; }
.hdr-word {
  font-size: 17px; font-weight: 800; color: var(--heading); letter-spacing: -.01em;
  white-space: nowrap;
}
.hdr-word-sub { font-weight: 600; color: var(--muted); font-size: 15px; }
.hdr-user { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 14px; }
.hdr-user a { color: var(--brand); text-decoration: none; font-weight: 600; }
.lang-sw { display: flex; gap: 4px; }
.lang-sw button {
  border: 1px solid var(--border); background: var(--card); border-radius: 8px;
  padding: 5px 8px; font-size: 13px; cursor: pointer; color: var(--muted); font-weight: 600;
}
.lang-sw button.on { background: var(--brand-grad); border-color: var(--brand-deep); color: #fff; }
.btn-out {
  border: 1px solid var(--border); background: var(--card); color: var(--danger);
  border-radius: 8px; padding: 5px 10px; font-size: 13px; cursor: pointer; white-space: nowrap;
}
main { max-width: 560px; margin: 0 auto; padding: 16px 14px; }
main.wide { max-width: 1100px; }

.login-logo { display: block; height: 54px; margin: 4px auto 18px; }

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow);
}
h1 { font-size: 20px; margin-bottom: 12px; color: var(--heading); }
h2 { font-size: 17px; margin-bottom: 10px; color: var(--heading); }
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; font-weight: 600; }
input, select, textarea {
  -webkit-appearance: none; appearance: none;
  width: 100%; min-height: 48px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 10px;
  font-size: 16px; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand-light);
  box-shadow: 0 0 0 3px rgba(94, 112, 255, .18);
}
input[type="date"] { min-width: 0; }
input[type="checkbox"] {
  -webkit-appearance: checkbox; appearance: auto;
  width: 22px; height: 22px; min-height: 22px; min-width: 22px;
  accent-color: var(--brand); cursor: pointer;
}
input[type="checkbox"]:focus { box-shadow: none; }
textarea { min-height: 110px; font-family: inherit; }
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7291' stroke-width='2' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px;
}
.grid2 { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 10px; }

.btn {
  display: block; width: 100%; min-height: 50px; margin-top: 16px;
  background: var(--brand-grad); color: #fff; border: 0; border-radius: 12px;
  font-size: 17px; font-weight: 700; cursor: pointer;
  box-shadow: 0 6px 18px rgba(1, 4, 128, .25);
}
.btn:active { filter: brightness(.9); transform: translateY(1px); }
.btn.secondary {
  background: var(--card); color: var(--heading); border: 1px solid var(--border);
  font-weight: 600; box-shadow: none;
}
.btn.slim { min-height: 42px; font-size: 15px; margin-top: 10px; box-shadow: none; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { margin-top: 12px; }

.dir-btn {
  position: relative; display: flex; align-items: center; justify-content: space-between;
  width: 100%; min-height: 62px; margin-bottom: 12px; padding: 0 18px 0 22px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 18px; font-weight: 700; cursor: pointer; color: var(--heading);
  box-shadow: var(--shadow); overflow: hidden;
}
.dir-btn::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 5px;
  background: var(--brand-grad);
}
.dir-btn:active { background: #f7f8ff; }
.dir-btn .arr { color: var(--brand-light); font-size: 22px; }
.dir-btn.fuel::before { background: linear-gradient(180deg, #e67e22, #f4a53f); }

/* выпадающий список имён */
.namebox { position: relative; }
.namelist {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 30;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  margin-top: 4px; max-height: 40vh; overflow-y: auto;
  box-shadow: 0 12px 32px rgba(1, 4, 128, .16);
}
.namelist div { padding: 12px 14px; border-bottom: 1px solid var(--bg); cursor: pointer; }
.namelist div:last-child { border-bottom: 0; }
.namelist div:active { background: #eef0ff; }

.rec-card { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.rec-head { display: flex; justify-content: space-between; gap: 8px; font-weight: 700; color: var(--heading); }
.rec-sub { color: var(--muted); font-size: 14px; margin-top: 3px; word-break: break-word; }
.rec-actions { display: flex; gap: 8px; margin-top: 10px; }
.mini-btn {
  border: 1px solid var(--border); background: #fff; border-radius: 8px;
  padding: 6px 12px; font-size: 14px; cursor: pointer; color: var(--text); font-weight: 600;
}
.mini-btn:active { background: #f2f4ff; }
.mini-btn.danger { color: var(--danger); }
.mini-btn.primary { color: var(--brand); border-color: #b9c2f5; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: var(--brand-deep); color: #fff; padding: 12px 22px; border-radius: 12px;
  font-size: 15px; z-index: 100; opacity: 0; transition: opacity .25s; pointer-events: none;
  max-width: 90vw; text-align: center; box-shadow: 0 10px 30px rgba(1, 4, 128, .35);
}
.toast.show { opacity: .97; }
.err { color: var(--danger); font-size: 14px; margin-top: 8px; min-height: 18px; }
.hint { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* ---------- админка ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs button {
  border: 1px solid var(--border); background: var(--card); border-radius: 10px;
  padding: 9px 15px; font-size: 14px; cursor: pointer; color: var(--muted); font-weight: 600;
}
.tabs button.on { background: var(--brand-grad); border-color: var(--brand-deep); color: #fff; }
.subtabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.subtabs button {
  border: 1px solid var(--border); background: #fff; border-radius: 8px;
  padding: 7px 13px; font-size: 13px; cursor: pointer; color: var(--muted); font-weight: 600;
}
.subtabs button.on { border-color: var(--brand); color: var(--brand); background: #eef0ff; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.filters input, .filters select { width: auto; min-height: 40px; font-size: 14px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
tr.missing { background: var(--warn-bg); }
.mark { color: var(--warn-mark); font-weight: 800; margin-right: 4px; }
.badge {
  display: inline-block; background: #f0f2fb; border: 1px solid var(--border);
  border-radius: 6px; padding: 2px 7px; font-size: 12px; margin: 1px 3px 1px 0; white-space: nowrap;
}
.badge.b-ok { border-color: #2e9e5b; color: #2e9e5b; background: #f0faf4; }
.badge.b-err { border-color: var(--danger); color: var(--danger); background: #fdf2f0; }
.badge.b-warn { border-color: var(--warn-mark); color: var(--warn-mark); background: #fdf7ef; }
.muted { color: var(--muted); }
.tbl-wrap { overflow-x: auto; }

/* модалка */
.overlay {
  position: fixed; inset: 0; background: rgba(10, 12, 60, .5); z-index: 50;
  display: flex; align-items: flex-start; justify-content: center; padding: 20px 12px; overflow-y: auto;
}
.modal {
  background: var(--card); border-radius: var(--radius); padding: 20px;
  width: 100%; max-width: 480px; margin-top: 4vh; box-shadow: 0 20px 60px rgba(1, 4, 128, .3);
}
.modal h2 { display: flex; justify-content: space-between; }
.modal .x { cursor: pointer; color: var(--muted); font-size: 22px; line-height: 1; }
.chk { display: flex; align-items: center; gap: 8px; margin: 10px 0 2px; }
.chk input { width: 22px; min-height: 22px; height: 22px; accent-color: var(--brand); }
.chk span { font-size: 15px; font-weight: 600; color: var(--heading); }
.alias-row { display: grid; grid-template-columns: 110px minmax(0,1fr); gap: 8px; align-items: center; margin-top: 6px; }
.alias-row label { margin: 0; }

@media (max-width: 480px) {
  .hdr-user .role-note { display: none; }
  main { padding: 10px; }
  th, td { padding: 6px 6px; }
  .logo img, .hdr-logo { height: 26px; }
}
