:root {
  --ink: #17312b;
  --muted: #687c76;
  --cream: #f7f6f0;
  --paper: #fffefa;
  --green: #17745c;
  --green-dark: #0c5542;
  --green-soft: #dff1e9;
  --red: #c3443f;
  --red-soft: #fde8e4;
  --amber: #c98016;
  --line: #dfe6e1;
  --shadow: 0 18px 55px rgba(30, 67, 57, .10);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--cream); }
body {
  margin: 0; min-height: 100vh; color: var(--ink); background:
    radial-gradient(circle at 9% 12%, rgba(222, 184, 105, .17), transparent 26rem),
    radial-gradient(circle at 94% 93%, rgba(31, 131, 102, .12), transparent 30rem), var(--cream);
  font-family: "Tahoma", "Arial", sans-serif;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

.shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding-bottom: 56px; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 24px 0 18px; gap: 18px; }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 20px; }
.brand-mark { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 15px; color: white; background: var(--green); box-shadow: 0 8px 18px rgba(23,116,92,.25); }
.brand-mark svg { width: 24px; }
.nav-actions { display: flex; gap: 8px; align-items: center; }
.nav-link, .icon-button { border: 1px solid transparent; background: transparent; border-radius: 12px; padding: 10px 14px; color: var(--muted); }
.nav-link:hover, .nav-link.active { background: var(--paper); border-color: var(--line); color: var(--green-dark); }
.icon-button { width: 42px; height: 42px; display:grid; place-items:center; padding:0; border-color: var(--line); background: rgba(255,255,255,.65); }

.hero { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: end; margin: 26px 0; }
.eyebrow { color: var(--green); font-size: 13px; font-weight: 800; letter-spacing: .08em; margin: 0 0 8px; }
h1 { font-size: clamp(30px, 5vw, 52px); line-height: 1.15; letter-spacing: -.04em; margin: 0; }
.subtitle { color: var(--muted); font-size: 16px; margin: 12px 0 0; }
.date-card { min-width: 250px; background: var(--paper); padding: 14px 16px; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.field-label { display:block; color: var(--muted); font-size: 12px; font-weight: 700; margin: 0 0 7px; }
input, select, textarea { width: 100%; border: 1px solid var(--line); background: white; color: var(--ink); border-radius: 12px; padding: 11px 13px; outline: none; transition: .2s; }
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(23,116,92,.1); }
textarea { resize: vertical; min-height: 88px; }

.stats { display:grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 24px 0; }
.stat { border-radius: 20px; padding: 20px; border: 1px solid var(--line); background: rgba(255,255,255,.78); position:relative; overflow:hidden; }
.stat::after { content:""; width:72px; height:72px; border-radius:50%; position:absolute; left:-18px; bottom:-28px; background: currentColor; opacity:.07; }
.stat strong { display:block; font-size: 32px; line-height:1; margin-bottom:7px; }
.stat span { color: var(--muted); font-size: 13px; }
.stat.present { color: var(--green); }
.stat.away { color: var(--red); }
.stat.total { color: var(--amber); }

.toolbar { display: flex; justify-content: space-between; align-items:end; gap: 12px; margin: 28px 0 16px; }
.toolbar h2 { margin:0 0 6px; font-size:22px; }
.toolbar p { margin:0; color:var(--muted); font-size:13px; }
.filters { display:flex; gap:10px; }
.filters .field { min-width: 185px; }
.student-grid { display:grid; grid-template-columns: repeat(3, 1fr); gap:14px; }
.student-card { background: var(--paper); border:1px solid var(--line); border-radius:18px; padding:18px; display:flex; align-items:center; gap:14px; transition:.2s; }
.student-card:hover { transform:translateY(-2px); box-shadow:var(--shadow); }
.avatar { flex:0 0 auto; width:44px; height:44px; border-radius:14px; display:grid; place-items:center; font-weight:800; background:var(--green-soft); color:var(--green-dark); }
.student-card.away .avatar { background:var(--red-soft); color:var(--red); }
.student-info { min-width:0; flex:1; }
.student-name { font-weight:800; margin:0 0 5px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.student-meta { font-size:12px; color:var(--muted); margin:0; }
.status { flex:0 0 auto; font-size:11px; font-weight:800; border-radius:99px; padding:6px 9px; background:var(--green-soft); color:var(--green); }
.student-card.away { border-color:#f1c8c1; }
.student-card.away .student-name { color:var(--red); }
.student-card.away .status { background:var(--red-soft); color:var(--red); }
.empty { grid-column:1/-1; text-align:center; border:1px dashed #c6d3cd; border-radius:22px; padding:48px 18px; color:var(--muted); background:rgba(255,255,255,.42); }
.empty-icon { width:56px; height:56px; margin:0 auto 12px; display:grid; place-items:center; border-radius:18px; background:var(--green-soft); color:var(--green); font-size:26px; }

.primary, .secondary, .danger, .text-button { border:0; border-radius:12px; padding:11px 16px; font-weight:800; }
.primary { background:var(--green); color:white; box-shadow:0 8px 18px rgba(23,116,92,.18); }
.primary:hover { background:var(--green-dark); }
.secondary { background:var(--green-soft); color:var(--green-dark); }
.danger { background:var(--red-soft); color:var(--red); }
.text-button { background:transparent; color:var(--muted); }
.small { padding:8px 11px; font-size:12px; }

.management-head { display:flex; justify-content:space-between; align-items:center; gap:16px; margin:28px 0 20px; }
.management-head h1 { font-size:38px; }
.search-row { display:flex; gap:12px; margin-bottom:16px; }
.search-row input { max-width:340px; }
.manage-list { display:grid; gap:12px; }
.manage-card { border:1px solid var(--line); background:var(--paper); border-radius:20px; padding:18px; }
.manage-top { display:flex; align-items:center; gap:13px; }
.manage-top .student-info { flex:1; }
.card-actions { display:flex; gap:7px; }
.trips { margin:16px 58px 0 0; padding-top:14px; border-top:1px solid var(--line); }
.trips-title { display:flex; align-items:center; justify-content:space-between; margin-bottom:9px; }
.trips-title strong { font-size:13px; }
.trip-row { display:flex; align-items:center; gap:10px; padding:9px 0; color:var(--muted); font-size:13px; }
.trip-row + .trip-row { border-top:1px dashed var(--line); }
.trip-dates { flex:1; color:var(--ink); }
.trip-note { color:var(--muted); }

dialog { width:min(520px, calc(100% - 28px)); border:0; padding:0; border-radius:24px; color:var(--ink); box-shadow:0 28px 90px rgba(16,40,34,.28); }
dialog::backdrop { background:rgba(13,38,31,.48); backdrop-filter:blur(3px); }
.dialog-content { padding:24px; }
.dialog-head { display:flex; justify-content:space-between; align-items:center; margin-bottom:20px; }
.dialog-head h2 { margin:0; font-size:22px; }
.dialog-close { border:0; background:#f0f2ef; border-radius:10px; width:36px; height:36px; color:var(--muted); }
.form-grid { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.form-grid .full { grid-column:1/-1; }
.dialog-actions { display:flex; justify-content:flex-end; gap:8px; margin-top:20px; }

.toast { position:fixed; z-index:99; left:24px; bottom:24px; background:var(--ink); color:white; padding:13px 18px; border-radius:13px; opacity:0; transform:translateY(18px); pointer-events:none; transition:.25s; box-shadow:var(--shadow); }
.toast.show { opacity:1; transform:none; }
.toast.error { background:var(--red); }
.loading { opacity:.55; pointer-events:none; }

.login-page { min-height:100vh; display:grid; grid-template-columns:1.05fr .95fr; }
.login-art { padding:64px; background:var(--green-dark); color:white; position:relative; overflow:hidden; display:flex; flex-direction:column; justify-content:space-between; }
.login-art::before, .login-art::after { content:""; position:absolute; border:1px solid rgba(255,255,255,.14); border-radius:50%; }
.login-art::before { width:420px; height:420px; left:-170px; top:-120px; }
.login-art::after { width:300px; height:300px; right:-130px; bottom:-120px; }
.login-art .brand { position:relative; z-index:1; }
.login-quote { position:relative; z-index:1; max-width:570px; }
.login-quote h1 { font-size:clamp(38px,6vw,70px); }
.login-quote p { color:#cde1d9; line-height:1.9; font-size:17px; }
.login-form-wrap { display:grid; place-items:center; padding:32px; }
.login-box { width:min(420px, 100%); }
.login-box h2 { margin:0 0 8px; font-size:32px; }
.login-box > p { margin:0 0 28px; color:var(--muted); }
.login-box .field { margin-bottom:15px; }
.login-box .primary { width:100%; margin-top:8px; padding:13px; }
.setup-note { background:#fff4d9; border:1px solid #ead49c; color:#76591c; border-radius:14px; padding:14px; line-height:1.7; font-size:13px; margin-bottom:18px; }
.login-error { color:var(--red); font-size:13px; min-height:20px; margin:8px 0; }

@media (max-width: 850px) {
  .student-grid { grid-template-columns:repeat(2,1fr); }
  .login-page { grid-template-columns:1fr; }
  .login-art { min-height:280px; padding:32px; }
  .login-art .brand { margin-bottom:70px; }
}
@media (max-width: 620px) {
  .shell { width:min(100% - 20px, 1180px); }
  .topbar { align-items:flex-start; }
  .nav-link span { display:none; }
  .hero { grid-template-columns:1fr; }
  .date-card { min-width:0; }
  .stats { gap:8px; }
  .stat { padding:15px 12px; }
  .stat strong { font-size:26px; }
  .toolbar, .management-head { align-items:stretch; flex-direction:column; }
  .filters { width:100%; }
  .filters .field { min-width:0; flex:1; }
  .student-grid { grid-template-columns:1fr; }
  .manage-top { flex-wrap:wrap; }
  .card-actions { width:100%; margin-right:57px; }
  .trips { margin-right:0; }
  .trip-row { flex-wrap:wrap; }
  .form-grid { grid-template-columns:1fr; }
  .form-grid .full { grid-column:auto; }
  .login-art { display:none; }
  .login-form-wrap { min-height:100vh; }
}

