:root {
  --bg: #f4f6fb; --surface: #fff; --text: #1e2440; --muted: #6a7192; --border: #e3e7f2;
  --accent: #4f46e5; --accent-dark: #4338ca; --accent-soft: #eef0ff;
  --danger: #d92d4a; --danger-soft: #fff1f3; --success: #16a34a;
  --radius: 14px; --shadow: 0 1px 3px rgba(30,36,64,.06), 0 8px 24px rgba(30,36,64,.07);
}
* { box-sizing: border-box; }
body {
  margin: 0; color: var(--text); font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: radial-gradient(900px 500px at 90% -10%, #e0e4ff 0%, transparent 60%),
              radial-gradient(700px 400px at -10% 110%, #e6f3ff 0%, transparent 60%), var(--bg);
  min-height: 100vh; line-height: 1.55; -webkit-font-smoothing: antialiased;
}
h1, h2 { margin: 0; letter-spacing: -.02em; }
button, input, textarea, select { font: inherit; }

/* ---------- Public page ---------- */
.shell { max-width: 1040px; margin: 0 auto; padding: 56px 24px; display: grid; grid-template-columns: 1fr 1.05fr; gap: 56px; align-items: center; min-height: 100vh; }
.badge { display: inline-block; background: var(--accent-soft); color: var(--accent); font-size: .78rem; font-weight: 600; padding: 5px 12px; border-radius: 999px; margin-bottom: 18px; }
.intro h1 { font-size: 2.5rem; line-height: 1.15; font-weight: 700; }
.intro p { color: var(--muted); margin: 16px 0 24px; max-width: 420px; }
.points { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; color: var(--muted); font-size: .92rem; }
.points span { display: inline-grid; place-items: center; width: 20px; height: 20px; margin-right: 8px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: .7rem; font-weight: 700; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 36px; box-shadow: var(--shadow); }
.card h2 { font-size: 1.35rem; margin-bottom: 22px; }
.field { margin-bottom: 18px; }
label { display: block; font-size: .85rem; font-weight: 500; margin-bottom: 6px; }
input, textarea, select {
  width: 100%; padding: 11px 14px; color: var(--text); background: #fbfcff;
  border: 1.5px solid var(--border); border-radius: 10px; outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input::placeholder, textarea::placeholder { color: #a6acc7; }
input:hover, textarea:hover, select:hover { border-color: #c9cfe6; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 4px rgba(79,70,229,.14); }
input.invalid, textarea.invalid { border-color: var(--danger); background: var(--danger-soft); }
input.invalid:focus, textarea.invalid:focus { box-shadow: 0 0 0 4px rgba(217,45,74,.14); }
textarea { resize: vertical; min-height: 110px; }
.error { color: var(--danger); font-size: .8rem; margin-top: 5px; display: block; }
.error[hidden] { display: none; }
.banner { background: var(--danger-soft); padding: 10px 14px; border-radius: 10px; margin-top: 14px; text-align: center; }
.meta { display: flex; justify-content: space-between; gap: 12px; }
.count { margin: 5px 0 0 auto; font-size: .78rem; color: var(--muted); }
.count.warn { color: var(--danger); font-weight: 600; }

button {
  cursor: pointer; border: 0; border-radius: 10px; padding: 12px 20px; font-weight: 600;
  background: var(--accent); color: #fff; transition: background .15s, transform .1s, box-shadow .15s;
}
form button[type=submit] { width: 100%; display: flex; gap: 10px; justify-content: center; align-items: center; box-shadow: 0 6px 16px rgba(79,70,229,.28); }
button:hover { background: var(--accent-dark); transform: translateY(-1px); }
button:active { transform: translateY(0) scale(.98); }
button:disabled { opacity: .7; cursor: wait; transform: none; }
button.ghost { background: var(--accent-soft); color: var(--accent); box-shadow: none; }
button.ghost:hover { background: #e2e5ff; }
.spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.spinner[hidden] { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.success { text-align: center; padding: 24px 0; animation: pop .35s ease both; }
.success[hidden], form[hidden] { display: none; }
.check { width: 64px; height: 64px; margin: 0 auto 18px; border-radius: 50%; display: grid; place-items: center; background: #dcfce7; color: var(--success); font-size: 1.8rem; font-weight: 700; }
.success p { color: var(--muted); margin: 8px 0 24px; }
@keyframes pop { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }

/* ---------- Admin ---------- */
.admin { max-width: 1120px; margin: 0 auto; padding: 40px 24px 64px; }
.admin-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.admin-head h1 { font-size: 1.8rem; }
.admin-head p { margin: 4px 0 0; color: var(--muted); font-size: .92rem; }
.actions { display: flex; gap: 10px; }
.actions button { padding: 9px 16px; font-size: .88rem; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 1.9rem; letter-spacing: -.02em; }
.stat span { color: var(--muted); font-size: .82rem; }
.toolbar { display: flex; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar input { flex: 1 1 260px; }
.toolbar select { flex: 0 0 auto; width: auto; min-width: 170px; }
.list { display: grid; gap: 14px; }
.item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 22px; box-shadow: var(--shadow); transition: transform .15s, border-color .15s; animation: pop .3s ease both; }
.item:hover { transform: translateY(-2px); border-color: #c7cbf5; }
.item-top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; flex: none; }
.who { flex: 1 1 200px; min-width: 0; }
.who b { display: block; }
.who a { color: var(--muted); font-size: .84rem; text-decoration: none; word-break: break-all; }
.who a:hover { color: var(--accent); }
.tag { background: var(--accent-soft); color: var(--accent); font-size: .78rem; font-weight: 600; padding: 4px 11px; border-radius: 999px; }
.when { color: var(--muted); font-size: .8rem; }
.item p { margin: 12px 0 0; padding-top: 12px; border-top: 1px solid var(--border); white-space: pre-wrap; overflow-wrap: anywhere; }
.empty-state { text-align: center; color: var(--muted); padding: 48px 20px; background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); }

@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; gap: 32px; padding: 32px 18px; }
  .intro h1 { font-size: 1.9rem; }
  .card { padding: 26px 22px; }
  .stats { grid-template-columns: 1fr; }
}

/* ---------- Admin login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 400px; }
.login-card h2 { margin-bottom: 6px; }
.login-card .sub { color: var(--muted); font-size: .9rem; margin: 0 0 22px; }
.login-card button[type=submit] { width: 100%; display: flex; gap: 10px; justify-content: center; align-items: center; }

/* ---------- Institute header ---------- */
.site-header { background: #fff; border-bottom: 1px solid var(--border); box-shadow: 0 1px 8px rgba(30,36,64,.05); position: sticky; top: 0; z-index: 10; }
.brand { max-width: 1120px; margin: 0 auto; padding: 10px 24px; display: flex; align-items: center; gap: 16px; text-decoration: none; color: var(--text); }
.brand img { height: 52px; width: auto; display: block; }
.brand-text { border-left: 1.5px solid var(--border); padding-left: 16px; line-height: 1.25; }
.brand-text b { display: block; font-size: .95rem; letter-spacing: -.01em; }
.brand-text span { color: var(--muted); font-size: .8rem; }
.shell { min-height: calc(100vh - 73px); }
.login-wrap { min-height: calc(100vh - 73px); }
@media (max-width: 640px) {
  .brand img { height: 40px; }
  .brand-text b { font-size: .8rem; }
  .brand-text span { font-size: .72rem; }
  .brand { gap: 12px; padding: 8px 16px; }
  .brand-text { padding-left: 12px; }
}
