/* Учебный проект. Один файл стилей, без фреймворков. */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&display=swap');

:root {
  --green: #2e7d5b;
  --green-dark: #246349;
  --green-soft: #e8f3ee;
  --ink: #1f2933;
  --muted: #6b7684;
  --line: #e6e9ec;
  --bg: #eef2f5;
  --card: #ffffff;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 6px 16px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Nunito', -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1100px 500px at 100% -10%, #e4f0ea 0, rgba(238, 242, 245, 0) 60%),
    var(--bg);
  line-height: 1.55;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}
a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Верхняя панель */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  padding: 12px 22px;
  background: linear-gradient(90deg, var(--green), #35936b);
  color: #fff;
  box-shadow: 0 2px 10px rgba(16, 24, 40, .12);
}
.topbar .brand { color: #fff; font-weight: 800; font-size: 19px; margin-right: 10px; letter-spacing: .2px; }
.topbar .brand:hover { text-decoration: none; opacity: .92; }
.topbar .nav { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.topbar .nav a {
  color: #eafaf2; padding: 6px 12px; border-radius: 999px; font-weight: 600; font-size: 14px;
  transition: background .15s ease;
}
.topbar .nav a:hover { background: rgba(255, 255, 255, .16); text-decoration: none; }
.topbar .user { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.topbar .user span { opacity: .95; }
.link { background: none; border: none; color: #fff; cursor: pointer; font: inherit; text-decoration: underline; padding: 0; opacity: .95; }
.link:hover { opacity: 1; }

.content { width: 100%; max-width: 980px; margin: 26px auto; padding: 0 18px; flex: 1; }
.foot { text-align: center; color: var(--muted); font-size: 13px; padding: 26px 0; }

h1 { font-size: 26px; font-weight: 800; margin: 0 0 16px; }
h2 { font-size: 20px; font-weight: 700; margin: 26px 0 10px; }
h3 { font-size: 16px; font-weight: 700; margin: 0 0 12px; }
.muted { color: var(--muted); }

.head-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }

/* Карточки */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin: 14px 0;
  box-shadow: var(--shadow);
}
.card.narrow { max-width: 480px; }
.card p { margin: 7px 0; }

/* Плитки-счётчики на главной */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-top: 12px; }
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--green);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex; flex-direction: column; gap: 2px;
  color: var(--ink);
  box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease;
}
.stat:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(16, 24, 40, .1); text-decoration: none; }
.stat .num { font-size: 36px; font-weight: 800; color: var(--green); line-height: 1.1; }

/* Таблицы */
.table {
  width: 100%; border-collapse: collapse; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  margin: 14px 0; box-shadow: var(--shadow);
}
.table th, .table td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
.table th { background: var(--green-soft); color: #20563f; font-weight: 700; }
.table tbody tr:nth-child(even) td, .table tr:nth-child(even) td { background: #fafcfb; }
.table tr:hover td { background: #f2f8f5; }
.table tr:last-child td { border-bottom: none; }

/* Поиск и формы */
.search { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.search input, .search select { flex: 1; min-width: 170px; }

input, select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #cfd8dc; border-radius: 10px;
  font-size: 14px; font-family: inherit; background: #fff; color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(46, 125, 91, .15);
}
input[type="radio"] { width: auto; accent-color: var(--green); transform: scale(1.25); }
form p { margin: 12px 0; }
label { display: block; font-size: 14px; font-weight: 600; margin: 12px 0; color: #374151; }
label input, label select { margin-top: 5px; font-weight: 400; }

/* Кнопки */
.btn {
  display: inline-block; background: var(--green); color: #fff; border: none;
  border-radius: 10px; padding: 10px 18px; font-size: 14px; font-weight: 700; font-family: inherit;
  cursor: pointer; text-decoration: none; box-shadow: 0 2px 6px rgba(46, 125, 91, .25);
  transition: background .15s ease, transform .1s ease, box-shadow .15s ease;
}
.btn:hover { background: var(--green-dark); transform: translateY(-1px); text-decoration: none; box-shadow: 0 6px 14px rgba(46, 125, 91, .3); }
.btn:active { transform: translateY(0); }
.btn.ghost { background: #fff; color: var(--green); border: 1px solid var(--green); box-shadow: none; }
.btn.ghost:hover { background: var(--green-soft); }
.btn.danger { background: #d6453a; box-shadow: 0 2px 6px rgba(214, 69, 58, .25); }
.btn.danger:hover { background: #b93a30; }

/* Сообщения */
.flash { padding: 12px 16px; border-radius: 10px; margin: 12px 0; font-size: 14px; font-weight: 600; border: 1px solid; }
.flash.success { background: #e6f6ec; color: #1e6b3a; border-color: #bce3c9; }
.flash.error { background: #fdeceb; color: #a5342b; border-color: #f4c7c3; }

/* Центрируем страницу входа */
body.login-page .content { display: flex; align-items: center; justify-content: center; }

@media (max-width: 640px) {
  .topbar { flex-direction: column; align-items: flex-start; }
  .topbar .user { width: 100%; justify-content: space-between; }
  .table { display: block; overflow-x: auto; }
  h1 { font-size: 22px; }
}
