* { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #1a1d29;
  color: #e4e6eb;
  margin: 0;
}
a { color: #6aa8ec; }
main { max-width: 1000px; margin: 0 auto; padding: 24px 20px; }
main.wide { max-width: 1140px; }

/* ===== Верхняя панель ===== */
.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 12px 24px;
  background: #1f2331;
  border-bottom: 1px solid #2e3548;
}
.topbar .brand { font-weight: 800; color: #e4e6eb; text-decoration: none; font-size: 16px; }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a {
  color: #9aa0b0; text-decoration: none; font-size: 14px; font-weight: 600;
  padding: 6px 12px; border-radius: 8px;
}
.topbar nav a:hover { color: #e4e6eb; background: #2a2f3e; }
.topbar nav a.on { color: #fff; background: #2e3a4f; }
.topbar .who { display: flex; align-items: center; gap: 12px; font-size: 13px; color: #9aa0b0; }
.topbar .who form { margin: 0; }
.link-btn {
  background: none; border: 1px solid #3a4152; color: #c0c6d4;
  padding: 5px 12px; border-radius: 8px; cursor: pointer; font-size: 13px;
}
.link-btn:hover { border-color: #f87171; color: #f87171; }

h1 { font-size: 22px; margin: 0 0 18px; }
h2 { font-size: 15px; margin: 0 0 12px; font-weight: 600; color: #9aa0b0; text-transform: uppercase; letter-spacing: 0.5px; }
.muted { color: #6b7285; font-size: 13px; }

/* ===== Карточки ===== */
.card {
  background: #222736;
  border: 1px solid #2e3548;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
}

/* ===== Сетка инструментов ===== */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}
.tool-card {
  display: block;
  background: #222736;
  border: 1px solid #2e3548;
  border-radius: 14px;
  padding: 18px;
  color: inherit;
  text-decoration: none;
  transition: border-color .15s, transform .1s;
}
.tool-card:hover { border-color: #4a90d9; transform: translateY(-1px); }
.tool-card .icon { font-size: 28px; }
.tool-card .name { font-weight: 700; font-size: 16px; margin: 8px 0 4px; }
.tool-card .desc { font-size: 13px; color: #8a92a6; line-height: 1.45; }
.tool-card.soon { opacity: .5; pointer-events: none; }
.tool-card .badge {
  display: inline-block; font-size: 10px; font-weight: 700; text-transform: uppercase;
  background: #3a4152; color: #c0c6d4; padding: 2px 8px; border-radius: 6px; margin-top: 10px;
}

/* ===== Формы ===== */
label.field { display: block; font-size: 13px; color: #c0c6d4; margin-bottom: 12px; }
label.field span { display: block; margin-bottom: 5px; }
input[type=text], input[type=password], select, textarea {
  width: 100%;
  padding: 9px 11px;
  border-radius: 8px;
  border: 1px solid #3a4152;
  background: #2a2f3e;
  color: #e4e6eb;
  font-size: 14px;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: #4a90d9; }
.btn {
  display: inline-block;
  padding: 9px 16px;
  border-radius: 8px;
  border: none;
  background: linear-gradient(135deg, #3d7ab8, #2d5f95);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { filter: brightness(1.1); }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn.gray { background: #3a4152; }
.btn.red { background: #8b2c2c; }
.btn.green { background: #2f7a50; }

.alert { padding: 10px 14px; border-radius: 10px; font-size: 14px; margin-bottom: 16px; }
.alert.err { background: rgba(248,113,113,.12); border: 1px solid rgba(248,113,113,.4); color: #fca5a5; }
.alert.ok { background: rgba(74,222,128,.10); border: 1px solid rgba(74,222,128,.35); color: #86efac; }
.alert code { background: rgba(0,0,0,.3); padding: 2px 6px; border-radius: 4px; font-size: 15px; user-select: all; }

/* ===== Вход ===== */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-box { width: 100%; max-width: 360px; }
.login-box h1 { text-align: center; }
.login-box .btn { width: 100%; margin-top: 6px; padding: 11px; }

/* ===== Таблица пользователей ===== */
.users-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.users-table th {
  text-align: left; color: #8a92a6; font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: .5px;
  padding: 8px; border-bottom: 1px solid #3a4152;
}
.users-table td { padding: 10px 8px; border-bottom: 1px dashed #2e3548; vertical-align: middle; }
.users-table tr.off td { opacity: .5; }
.users-table .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.users-table .actions form { margin: 0; }
.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.tag.admin { background: #2e3a4f; color: #8bbcf0; }
.tag.student { background: #2a3040; color: #9aa0b0; }
.tag.on { background: rgba(74,222,128,.12); color: #4ade80; }
.tag.off { background: rgba(248,113,113,.12); color: #f87171; }

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 180px; }
