:root {
  --ink: #1f3021;
  --muted: #5d7160;
  --paper: #ffffff;
  --background: #f2f6f1;
  --line: #d5e1d4;
  --primary: #306334;
  --primary-dark: #244a27;
  --accent: #4b7e50;
  --accent-soft: #edf4ec;
  --danger: #b33434;
  --shadow: 0 10px 32px rgba(36, 74, 39, .08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--background);
  color: var(--ink);
  font: 15px/1.45 "Segoe UI", Arial, sans-serif;
}

.language-picker {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 14px max(calc((100% - 1320px) / 2), 26px) 0;
}
.language-picker select {
  height: 36px;
  min-width: 120px;
}

.hero {
  align-items: flex-end;
  background: var(--primary-dark);
  color: white;
  display: flex;
  gap: 40px;
  justify-content: space-between;
  padding: 34px max(calc((100% - 1320px) / 2), 26px) 38px;
}

.brand {
  align-items: center;
  display: flex;
  gap: 20px;
  margin-bottom: 24px;
}
.brand-logo {
  display: block;
  height: auto;
  max-height: 46px;
  max-width: 66px;
  object-fit: contain;
  width: 66px;
}
.brand span {
  font-size: clamp(25px, 2.4vw, 31px);
  font-weight: 750;
  letter-spacing: .01em;
  line-height: 1.1;
}

.eyebrow {
  color: #b8d6b6;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .14em;
  margin: 0 0 7px;
  text-transform: uppercase;
}

h1 { font-size: clamp(30px, 4vw, 42px); line-height: 1.1; margin: 0 0 9px; }
h2 { font-size: 21px; margin: 0; }
.subtitle { color: #e1eee0; margin: 0; max-width: 560px; }

.stats {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  color: var(--primary-dark);
  display: flex;
  flex-shrink: 0;
  overflow: hidden;
}

.stats div { min-width: 96px; padding: 13px 18px; text-align: center; }
.stats div + div { border-left: 1px solid var(--line); }
.stats strong { display: block; font-size: 25px; }
.stats span { color: var(--muted); font-size: 12px; }

.auth-shell {
  display: flex;
  justify-content: center;
  padding: clamp(44px, 10vh, 92px) 20px;
}
.auth-card { max-width: 420px; overflow: hidden; width: 100%; }
.login-brand {
  align-items: center;
  background: var(--primary);
  color: white;
  display: flex;
  gap: 13px;
  margin: -22px -22px 20px;
  padding: 17px 22px;
}
.login-brand img {
  display: block;
  height: auto;
  max-height: 38px;
  object-fit: contain;
  width: 55px;
}
.login-brand strong { font-size: 20px; line-height: 1.15; }

.back-link {
  color: var(--primary);
  display: inline-block;
  font-weight: 600;
  margin-bottom: 18px;
  text-decoration: none;
}
.back-link:hover { text-decoration: underline; }
.auth-title { color: var(--ink); font-size: 29px; margin: 0 0 23px; }
.auth-form { display: grid; gap: 15px; }
.auth-form .primary { margin-top: 4px; }
.setup-helper { margin: 0 0 2px; }
.user-session {
  align-items: center;
  display: flex;
  flex-shrink: 0;
  gap: 12px;
}
.user-session span { font-weight: 600; }
.public-link {
  color: #e1eee0;
  font-weight: 600;
  text-decoration: none;
}
.public-link:hover { color: white; }
.user-session .secondary {
  background: transparent;
  border-color: rgba(255, 255, 255, .34);
  color: white;
}
.user-session .secondary:hover { background: rgba(255, 255, 255, .09); }

main {
  margin: 0 auto;
  max-width: 1372px;
  padding: 25px 26px 40px;
}

.tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.tab {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  padding: 11px 17px;
}
.tab:hover { background: white; }
.tab.active { background: var(--paper); border-color: var(--line); color: var(--primary); }

.panel { display: none; }
.panel.active { display: block; }
.split { max-width: 420px; }
.card {
  background: var(--paper);
  border: 1px solid #e1e5e2;
  border-radius: 15px;
  box-shadow: var(--shadow);
  padding: 22px;
}
.card-title {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 21px;
}
.entry-card form { display: grid; gap: 15px; }

label {
  color: var(--muted);
  display: grid;
  font-size: 13px;
  font-weight: 600;
  gap: 6px;
}
input, select {
  background: var(--paper);
  border: 1px solid #ccd5d1;
  border-radius: 8px;
  color: var(--ink);
  font: inherit;
  height: 42px;
  padding: 0 12px;
}
input:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(48, 99, 52, .16);
  outline: none;
}
.fields.two { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.category-box {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 9px;
  display: flex;
  flex-direction: column;
  padding: 12px 14px;
}
.category-box span { color: #506b52; font-size: 12px; font-weight: 600; }
.category-box strong { color: var(--primary); font-size: 19px; margin-top: 2px; text-transform: uppercase; }

button { font: inherit; }
.primary, .secondary, .row-button {
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  height: 42px;
  padding: 0 16px;
}
.primary { background: var(--primary); border: 1px solid var(--primary); color: white; }
.primary:hover { background: var(--primary-dark); }
.secondary { background: white; border: 1px solid #cbd4d0; color: var(--ink); }
.secondary:hover { background: #f6f8f7; }
.actions { display: flex; gap: 9px; margin-top: 3px; }
.actions .primary { flex: 1; }
.hidden { display: none; }
.error { color: var(--danger); font-size: 13px; font-weight: 600; margin: 0; min-height: 0; }
.error:not(:empty) { margin-bottom: 2px; }
.helper { color: var(--muted); font-size: 13px; margin: -12px 0 18px; }
.status { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; color: var(--primary-dark); margin: 0 0 18px; padding: 11px 13px; }
.status.failure { background: #fbeaea; border-color: #f2c9c9; color: var(--danger); }
.import-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.file-button { align-items: center; display: inline-flex; }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; min-width: 100%; }
th {
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .04em;
  padding: 9px 10px;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
td { border-bottom: 1px solid #ebeeec; padding: 12px 10px; white-space: nowrap; }
td strong { color: var(--primary-dark); }
.row-actions { text-align: right; white-space: nowrap; }
.row-button {
  background: transparent;
  border: 0;
  color: var(--primary);
  height: auto;
  padding: 5px 8px;
}
.row-button.danger { color: var(--danger); }
.empty { color: var(--muted); margin: 20px 4px 4px; text-align: center; }

.management { max-width: 1050px; }
.marks-management { max-width: 1120px; }
.marks-search { margin-bottom: 20px; max-width: 420px; }
.inline-form {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}
.inline-form label { flex: 1; min-width: 190px; }
.inline-form .checkbox-field {
  align-items: center;
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
  height: 42px;
  min-width: auto;
}
.checkbox-field input { height: 18px; padding: 0; width: 18px; }
.state {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 20px;
  color: var(--primary-dark);
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
}
.state.inactive { background: var(--paper); color: var(--muted); }
.management .table-wrap { margin-top: 20px; }
footer { color: var(--muted); font-size: 13px; padding: 0 26px 28px; text-align: center; }

@media (max-width: 960px) {
  .hero { align-items: stretch; flex-direction: column; }
  .stats { width: max-content; }
  .user-session { justify-content: space-between; }
  .entry-card { max-width: 520px; }
}

@media (max-width: 600px) {
  .language-picker,
  .hero, main { padding-left: 16px; padding-right: 16px; }
  .stats div { min-width: 82px; padding: 12px; }
  .tabs { overflow-x: auto; }
  .tab { white-space: nowrap; }
  .card { padding: 17px; }
  .fields.two { grid-template-columns: 1fr; }
}
