:root {
  --navy: #0b2545;
  --navy-2: #13315c;
  --gold: #d4a017;
  --gold-light: #f2c94c;
  --bg: #f4f6fa;
  --card: #ffffff;
  --text: #1a1f36;
  --muted: #6b7280;
  --success: #1e8e5a;
  --warning: #d97706;
  --danger: #dc2626;
  --radius: 14px;
  --shadow: 0 4px 18px rgba(11, 37, 69, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* --- Topbar --- */
.topbar {
  background: linear-gradient(120deg, var(--navy) 0%, var(--navy-2) 100%);
  color: #fff;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
}
.topbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.3px;
}
.topbar .brand .plane { color: var(--gold-light); font-size: 22px; }
.topbar .right { display: flex; align-items: center; gap: 14px; }
.topbar .user-chip {
  background: rgba(255,255,255,0.1);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
}
.lang-switch { display: flex; gap: 4px; background: rgba(255,255,255,0.08); border-radius: 8px; padding: 3px; }
.lang-switch button {
  border: none; background: transparent; color: #cbd5e1;
  padding: 5px 10px; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 12px;
}
.lang-switch button.active { background: var(--gold); color: var(--navy); }

.btn {
  border: none; border-radius: 9px; padding: 10px 18px;
  font-weight: 600; font-size: 14px; cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--gold); color: var(--navy); }
.btn-primary:hover { box-shadow: 0 6px 14px rgba(212,160,23,0.35); }
.btn-outline { background: transparent; border: 1px solid rgba(255,255,255,0.35); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: #eef1f6; color: var(--navy); }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* --- Layout --- */
.container { max-width: 1100px; margin: 0 auto; padding: 28px; }
.grid { display: grid; gap: 20px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: 1.1fr 1.5fr; }
@media (max-width: 800px) {
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}
.card h3 { margin-top: 0; }

.stat-card {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.stat-card .num { font-size: 32px; font-weight: 800; color: var(--gold-light); }
.stat-card .label { font-size: 13px; opacity: 0.85; margin-top: 4px; }

/* --- Auth pages --- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 20% 20%, #16345f, #081a33 70%);
  padding: 20px;
}
.auth-card {
  width: 100%; max-width: 420px;
  background: #fff;
  border-radius: 18px;
  padding: 32px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.35);
}
.auth-card .logo {
  text-align: center; font-size: 30px; margin-bottom: 6px;
}
.auth-card h2 { text-align: center; margin: 0 0 4px; color: var(--navy); }
.auth-card p.sub { text-align: center; color: var(--muted); margin-bottom: 22px; font-size: 13px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--navy); }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 12px; border-radius: 9px;
  border: 1px solid #dbe1ea; font-size: 14px; background: #f9fafc;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--gold); background: #fff;
}
.field textarea { resize: vertical; min-height: 80px; }

.form-msg { font-size: 13px; margin: 8px 0; padding: 8px 12px; border-radius: 8px; }
.form-msg.error { background: #fdecea; color: var(--danger); }
.form-msg.success { background: #e7f7ef; color: var(--success); }

.auth-switch { text-align: center; margin-top: 16px; font-size: 13px; }
.auth-switch a { color: var(--navy); font-weight: 600; cursor: pointer; text-decoration: underline; }

/* --- Requests list --- */
.req-list { display: flex; flex-direction: column; gap: 12px; }
.req-item {
  border: 1px solid #eaeef4; border-radius: 12px; padding: 14px 16px;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  flex-wrap: wrap;
}
.req-item .req-main { flex: 1; min-width: 220px; }
.req-item .req-cat { font-weight: 700; color: var(--navy); font-size: 14px; }
.req-item .req-desc { color: var(--muted); font-size: 13px; margin-top: 4px; }
.req-item .req-meta { font-size: 12px; color: #94a3b8; margin-top: 6px; }

.badge { display: inline-block; padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.badge-new { background: #eaf2ff; color: #1d4ed8; }
.badge-in_progress { background: #fff4e0; color: var(--warning); }
.badge-done { background: #e7f7ef; color: var(--success); }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
table th, table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid #eef1f6; }
table th { color: var(--muted); font-weight: 600; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }

.tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.tab-btn {
  border: none; background: #eef1f6; color: var(--navy); padding: 9px 16px;
  border-radius: 9px; font-weight: 600; cursor: pointer; font-size: 13px;
}
.tab-btn.active { background: var(--navy); color: #fff; }

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }

/* --- Zapros tafsiloti (modal) --- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(11,37,69,0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
}
.modal-box {
  background: #fff; border-radius: 16px; max-width: 600px; width: 100%;
  max-height: 85vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.modal-header {
  background: linear-gradient(120deg, var(--navy) 0%, var(--navy-2) 100%);
  color: #fff; padding: 18px 24px; border-radius: 16px 16px 0 0;
  display: flex; justify-content: space-between; align-items: center;
}
.modal-header h3 { margin: 0; font-size: 17px; }
.modal-close { background: rgba(255,255,255,0.15); border: none; color: #fff; width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-size: 16px; line-height: 1; }
.modal-close:hover { background: rgba(255,255,255,0.3); }
.modal-body { padding: 22px 24px; }
.modal-row { margin-bottom: 16px; }
.modal-row .m-label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; margin-bottom: 5px; }
.modal-row .m-value { font-size: 14px; color: var(--text); line-height: 1.5; }
.modal-row textarea { width: 100%; padding: 10px 12px; border-radius: 9px; border: 1px solid #dbe1ea; font-size: 14px; min-height: 70px; resize: vertical; font-family: inherit; }
.modal-desc-box { background: #f9fafc; border: 1px solid #eaeef4; border-radius: 10px; padding: 14px; font-size: 14px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; padding-top: 16px; border-top: 1px solid #eef1f6; }
.req-clickable { cursor: pointer; }
.req-clickable:hover { border-color: var(--gold); }
tr.req-clickable:hover { background: #f9fafc; }

/* --- Shablon (template) chips --- */
.tpl-label{font-size:12px;font-weight:600;color:var(--muted);margin:12px 0 8px;text-transform:uppercase;letter-spacing:.3px}
.tpl-chips{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:14px}
.tpl-chip{border:1px solid #dbe1ea;background:#f9fafc;color:var(--navy);padding:8px 14px;border-radius:20px;font-size:13px;cursor:pointer;transition:all .12s ease}
.tpl-chip:hover{background:var(--navy);color:#fff;border-color:var(--navy)}
.tpl-chip.selected{background:var(--gold);color:var(--navy);border-color:var(--gold);font-weight:700}
.cat-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(130px,1fr));gap:10px;margin-bottom:16px}
.cat-tile{border:2px solid #eaeef4;background:#fff;border-radius:12px;padding:14px 10px;text-align:center;cursor:pointer;transition:all .12s ease}
.cat-tile:hover{border-color:var(--gold);transform:translateY(-2px)}
.cat-tile.selected{border-color:var(--navy);background:linear-gradient(135deg,#eef3fb,#f7f9fc)}
.cat-tile .cat-icon{font-size:26px;display:block;margin-bottom:6px}
.cat-tile .cat-name{font-size:12px;font-weight:600;color:var(--navy);line-height:1.3}

/* --- Analitika --- */
.bar-row{display:flex;align-items:center;gap:12px;margin-bottom:14px}
.bar-row .bar-label{width:150px;font-size:13px;font-weight:600;color:var(--navy);flex-shrink:0}
.bar-track{flex:1;height:22px;background:#eef1f6;border-radius:11px;overflow:hidden;position:relative}
.bar-fill{height:100%;border-radius:11px;display:flex;align-items:center;justify-content:flex-end;padding-right:8px;transition:width .4s ease}
.bar-fill span{font-size:11px;font-weight:700;color:#fff}
.bar-row .bar-count{width:44px;text-align:right;font-weight:700;color:var(--navy);flex-shrink:0}
.rank-badge{display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;border-radius:50%;background:var(--navy);color:#fff;font-size:11px;font-weight:700;margin-right:8px}
.rank-badge.gold{background:var(--gold)}
