/* ================== Базовые настройки ================== */
* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.55;
  color: #1c2430;
  background: #eef2f7;
}

h1 { font-size: 1.5rem; margin: 0 0 10px; }
h2 { font-size: 1.2rem; margin: 0 0 10px; }
a  { color: #1e5aa8; }

/* ================== Шапка ================== */
.topbar {
  background: #1e5aa8;
  color: #fff;
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo {
  background: #fff; color: #1e5aa8;
  font-weight: 800; padding: 4px 10px;
  border-radius: 8px; letter-spacing: 1px;
}
.brand-text { font-weight: 700; font-size: 1.05rem; }
.userbox { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.uname { font-weight: 700; }
.urole { font-size: .85rem; opacity: .85; }

/* ================== Навигация ================== */
.mainnav {
  display: flex; flex-wrap: wrap; gap: 6px;
  background: #fff; padding: 10px 16px;
  border-bottom: 2px solid #d8e0ea;
  position: sticky; top: 0; z-index: 5;
}
.mainnav a {
  padding: 10px 14px; border-radius: 8px;
  text-decoration: none; color: #1e5aa8;
  font-weight: 600; background: #eef4fb;
  transition: .15s;
}
.mainnav a:hover { background: #dbe8f7; }
.mainnav a.active { background: #1e5aa8; color: #fff; }

/* ================== Контейнер ================== */
.container { max-width: 1100px; margin: 0 auto; padding: 16px; }

/* ================== Карточки ================== */
.card {
  background: #fff; border-radius: 14px;
  padding: 18px; margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(15,30,60,.08);
}
.card-narrow { max-width: 520px; margin-left: auto; margin-right: auto; }

/* ================== Формы ================== */
label {
  display: block; font-weight: 600;
  margin-bottom: 12px; font-size: .95rem;
}
input[type=text], input[type=password], input[type=number],
input[type=date], select, textarea {
  width: 100%;
  padding: 12px;
  border: 2px solid #c9d4e2;
  border-radius: 10px;
  background: #fff;
  font: inherit;
  margin-top: 4px;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: #1e5aa8;
  box-shadow: 0 0 0 3px rgba(30,90,168,.15);
}
.check {
  display: flex; align-items: flex-start; gap: 10px;
  font-weight: 500; background: #f6f9fd;
  padding: 10px 12px; border-radius: 10px;
}
.check input { width: 22px; height: 22px; margin: 2px 0 0; flex: 0 0 auto; }
.cat-block { display: none; }
.cat-block.visible { display: block; }

/* ================== Кнопки ================== */
.btn {
  display: inline-block;
  padding: 12px 18px;
  border-radius: 10px;
  border: none;
  background: #1e5aa8; color: #fff;
  font: inherit; font-weight: 700;
  cursor: pointer; text-decoration: none;
  transition: .15s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn-block { display: block; width: 100%; }
.btn-small { padding: 8px 12px; font-size: .9rem; }
.btn-light { background: rgba(255,255,255,.18); }
.btn.green { background: #2e7d32; }
.btn.red   { background: #c62828; }
.btn.gray  { background: #607d8b; }

/* ================== Таблицы ================== */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; min-width: 480px; }
th, td { padding: 10px 12px; border-bottom: 1px solid #e5ebf2; text-align: left; }
th { background: #f1f5f9; font-size: .9rem; text-transform: uppercase; letter-spacing: .4px; }
.right { text-align: right; }
.row-gold { background: #fff9e0; }
.row-gold td:first-child { font-weight: 800; color: #b8860b; }
.pos { color: #2e7d32; }
.neg { color: #c62828; }

/* ================== Бейджи ================== */
.tag {
  display: inline-block;
  padding: 3px 9px; border-radius: 20px;
  font-size: .78rem; font-weight: 700;
}
.tag-pending  { background: #fff3cd; color: #8a6400; }
.tag-approved { background: #d8f0da; color: #235c28; }
.tag-rejected { background: #f9d8d8; color: #8b1c1c; }

/* ================== Алерты ================== */
.alert {
  padding: 12px 16px; border-radius: 10px;
  margin-bottom: 14px; font-weight: 600;
}
.alert-ok  { background: #d8f0da; color: #1e4620; border-left: 6px solid #2e7d32; }
.alert-err { background: #fbe0e0; color: #7a1717; border-left: 6px solid #c62828; }

/* ================== Разное ================== */
.muted { color: #67748a; }
.center { text-align: center; }
.big-number { font-size: 2.6rem; font-weight: 800; color: #1e5aa8; margin: 4px 0; }

.stats { display: flex; flex-wrap: wrap; gap: 14px; margin: 10px 0 16px; }
.stat {
  flex: 1 1 150px; background: #f1f5f9;
  border-radius: 12px; padding: 14px; text-align: center;
}
.stat-num { font-size: 2rem; font-weight: 800; color: #1e5aa8; }

.tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.tabs a {
  padding: 10px 16px; border-radius: 10px;
  background: #eef4fb; text-decoration: none;
  color: #1e5aa8; font-weight: 700;
}
.tabs a.active { background: #1e5aa8; color: #fff; }

.pending-item {
  border: 2px solid #e5ebf2;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
  background: #fbfdff;
}
.pending-head {
  display: flex; flex-wrap: wrap;
  gap: 10px; align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.pending-meta { font-size: .93rem; color: #4a5568; margin-bottom: 6px; }

.inline-form {
  display: flex; flex-wrap: wrap;
  gap: 8px; align-items: center;
  margin-top: 8px;
}
.inline-form input[type=text],
.inline-form select { flex: 1 1 160px; width: auto; margin-top: 0; }

.filter-bar {
  display: flex; flex-wrap: wrap;
  gap: 10px; align-items: flex-end;
}
.filter-bar label { margin-bottom: 0; }
.filter-bar select,
.filter-bar input { width: auto; min-width: 110px; }

/* ================== Футер ================== */
.footer {
  text-align: center; padding: 24px 16px;
  color: #7b8798; font-size: .88rem;
}

/* ================== Мобильная адаптация ================== */
@media (max-width: 600px) {
  body { font-size: 16px; }
  .container { padding: 10px; }
  .card { padding: 14px; border-radius: 12px; }
  .brand-text { display: none; }
  .mainnav { padding: 8px; gap: 4px; }
  .mainnav a { padding: 9px 11px; font-size: .92rem; }
  h1 { font-size: 1.25rem; }
  h2 { font-size: 1.08rem; }
  .btn { width: 100%; text-align: center; }
  .inline-form .btn { width: auto; flex: 1 1 auto; }
  .tabs a { flex: 1 1 auto; text-align: center; }
  .stat-num { font-size: 1.6rem; }
}