:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #20242c;
  --muted: #667085;
  --line: #d9dee8;
  --primary: #1f7a5a;
  --danger: #b42318;
  --vip: #f6c944;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
}

input, select, textarea, button, .button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  background: #fff;
}

button, .button {
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.primary { background: var(--primary); color: #fff; border-color: var(--primary); }

.student-shell, .admin-shell { max-width: 1180px; margin: 0 auto; padding: 24px; }
.screen-shell { min-height: 100vh; display: grid; grid-template-columns: 1fr 340px; gap: 18px; padding: 18px; }

.hero { text-align: center; padding: 24px 0; }
.hero h1, .screen-title h1, .admin-header h1 { margin: 0; }
.hero p, .screen-title p, .admin-header p, .muted { color: var(--muted); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  margin-bottom: 18px;
}
.form-grid, .filter-grid { display: grid; gap: 12px; }
.filter-grid { grid-template-columns: repeat(4, minmax(150px, 1fr)); align-items: center; }
.inline-form, .button-row, .toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.inline-form input, .inline-form select { flex: 1; min-width: 120px; }
.compact { margin-top: 8px; }
.toolbar { justify-content: space-between; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin-bottom: 16px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.tabs { display: grid; gap: 16px; }
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.metrics div { background: #f3f8f6; border-radius: 8px; padding: 12px; }
.metrics strong { display: block; font-size: 28px; }

.notice, .flash { border-radius: 8px; padding: 12px; margin: 12px 0; background: #eef4ff; }
.success { background: #ecfdf3; color: #067647; }
.error { background: #fef3f2; color: var(--danger); }
.danger { border-color: #fda29b; }
.danger h2 { color: var(--danger); }

.screen-main, .screen-side { background: #fff; border-radius: 8px; padding: 18px; border: 1px solid var(--line); }
.screen-title { text-align: center; }
.pin { color: #d32f2f; font-size: 28px; font-weight: 800; margin: 10px 0 18px; }
.pin.closed { color: #667085; }
.seat-grid { display: grid; gap: 8px; }
.seat {
  min-height: 54px;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  padding: 4px;
}
.seat.empty { background: #e5e7eb; color: #475467; }
.seat.empty.vip { background: #fff59d; }
.seat.occupied { background: #4caf50; color: #fff; }
.seat.occupied.vip { background: #f59e0b; color: #111827; }
.seat.occupied.hot-pink { background: #ec4899; color: #fff; }
.seat.occupied.hot-red { background: #dc2626; color: #fff; }
.seat.occupied.hot-pink.vip,
.seat.occupied.hot-red.vip { color: #fff; }
.seat small { font-size: 11px; opacity: 0.92; }

.rank-list { padding-left: 24px; }
.rank-list li { margin: 10px 0; display: flex; justify-content: space-between; gap: 12px; }
.rank-list.big li { background: #f9fafb; border-radius: 8px; padding: 10px; }
.activity { border-left: 4px solid #1e88e5; background: #f9fafb; padding: 8px; margin-bottom: 8px; border-radius: 6px; }
.activity span { display: block; color: var(--muted); }

.table-wrap { overflow: auto; max-height: 420px; border: 1px solid var(--line); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; background: #fff; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; text-align: left; }
th { background: #f8fafc; position: sticky; top: 0; }

.admin-login { max-width: 420px; margin: 12vh auto; padding: 24px; }
.admin-header { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 18px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.check input { min-height: auto; }

@media (max-width: 860px) {
  .screen-shell, .grid-2, .grid-3, .filter-grid { grid-template-columns: 1fr; }
  .student-shell, .admin-shell { padding: 14px; }
}
