:root {
  --bg: #f5f5f7;
  --paper: rgba(255, 255, 255, 0.82);
  --paper-strong: #ffffff;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: rgba(29, 29, 31, 0.08);
  --line-strong: rgba(29, 29, 31, 0.12);
  --accent: #0071e3;
  --accent-soft: #eef5ff;
  --danger: #d92d20;
  --radius: 28px;
  --radius-sm: 20px;
  --shadow: 0 18px 48px rgba(15, 23, 42, 0.06);
  --shadow-hover: 0 22px 60px rgba(15, 23, 42, 0.10);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Helvetica Neue", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.95), transparent 24%),
    radial-gradient(circle at bottom right, rgba(235, 235, 240, 0.78), transparent 28%),
    linear-gradient(180deg, #fbfbfd 0%, #f5f5f7 54%, #f1f1f3 100%);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.modal-open {
  overflow: hidden;
}

.bg-shape {
  position: fixed;
  border-radius: 999px;
  filter: blur(54px);
  opacity: 0.55;
  pointer-events: none;
}

.bg-shape-a {
  width: 340px;
  height: 340px;
  background: rgba(255, 255, 255, 0.95);
  top: -90px;
  left: -70px;
}

.bg-shape-b {
  width: 360px;
  height: 360px;
  background: rgba(230, 232, 237, 0.95);
  right: -120px;
  bottom: -120px;
}

.page {
  position: relative;
  z-index: 2;
  padding: 32px;
}

.env-banner {
  position: sticky;
  top: 0;
  z-index: 12;
  padding: 12px 18px;
  text-align: center;
  background: linear-gradient(90deg, rgba(176, 45, 32, 0.96), rgba(211, 63, 43, 0.98));
  color: #fff7f5;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: 0 12px 30px rgba(136, 35, 24, 0.18);
}

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  animation: rise-in 0.5s ease;
}

.login-card {
  margin: 4vh auto 0;
  max-width: 840px;
  padding: 42px;
  background:
    radial-gradient(circle at top right, rgba(0, 113, 227, 0.10), transparent 24%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 249, 252, 0.9));
}

.login-brand {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 20px;
  align-items: center;
  margin-bottom: 10px;
}

.brand-logo {
  position: relative;
  width: 92px;
  height: 92px;
  border-radius: 28px;
  background:
    radial-gradient(circle at 28% 24%, rgba(255, 255, 255, 0.92), transparent 30%),
    linear-gradient(145deg, #08111f 10%, #0e294a 52%, #0071e3 100%);
  box-shadow: 0 26px 50px rgba(0, 54, 122, 0.18);
  overflow: hidden;
}

.brand-logo span {
  position: absolute;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
}

.brand-logo span:nth-child(1) {
  width: 48px;
  height: 10px;
  left: 22px;
  top: 24px;
}

.brand-logo span:nth-child(2) {
  width: 10px;
  height: 48px;
  left: 22px;
  top: 24px;
}

.brand-logo span:nth-child(3) {
  width: 36px;
  height: 10px;
  right: 20px;
  bottom: 26px;
}

.title-wrap h1 {
  margin: 10px 0 8px;
  font-size: clamp(32px, 4vw, 54px);
  line-height: 1.08;
  font-weight: 600;
  letter-spacing: -0.04em;
}

.eyebrow {
  color: var(--muted);
  font-weight: 500;
  margin: 0;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-size: 12px;
}

.subtitle {
  margin: 0 0 20px;
  color: var(--muted);
  line-height: 1.7;
}

.form-grid {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
}

.check-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

input,
select,
textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid rgba(29, 29, 31, 0.10);
  border-radius: 18px;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(0, 113, 227, 0.35);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.10);
}

textarea {
  min-height: 140px;
  resize: vertical;
}

.fields-block {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.btn {
  border: 0;
  border-radius: 999px;
  padding: 13px 18px;
  cursor: pointer;
  font-weight: 500;
  font-family: inherit;
  transition: transform 0.22s ease, box-shadow 0.22s ease, opacity 0.22s ease, background 0.22s ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: var(--shadow-hover);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.btn.primary,
.btn.secondary {
  background: #1d1d1f;
  color: #fff;
}

.btn.warn {
  background: #d92d20;
  color: #fff;
}

.btn.ghost {
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.76);
  color: var(--text);
}

.form-msg {
  margin: 0;
  min-height: 20px;
  color: var(--danger);
}

.app-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 18px;
  min-height: calc(100vh - 64px);
}

.sidebar {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  padding: 18px;
  gap: 14px;
}

.brand p {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.brand small {
  color: var(--muted);
}

#nav {
  display: grid;
  gap: 10px;
  align-content: flex-start;
}

.nav-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-align: left;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid transparent;
  color: var(--muted);
}

.nav-btn.active {
  color: var(--text);
  border-color: var(--line);
  background: #ffffff;
}

.nav-btn-label {
  min-width: 0;
}

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #d92d20;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  box-shadow: 0 10px 24px rgba(217, 45, 32, 0.18);
}

.content {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 16px;
}

.content-header {
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow);
}

.content-header-main {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.content-header h2 {
  margin: 0;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 600;
}

.content-header p {
  margin: 8px 0 0;
  color: var(--muted);
}

.page-badges {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.env-badge,
.reminder-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.env-badge {
  padding: 6px 10px;
  background: rgba(176, 45, 32, 0.10);
  color: #ab2c22;
  border: 1px solid rgba(176, 45, 32, 0.16);
}

.reminder-pill {
  padding: 6px 10px;
  background: rgba(0, 113, 227, 0.10);
  color: var(--accent);
  border: 1px solid rgba(0, 113, 227, 0.14);
}

.panel {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  overflow: auto;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.quick-cards {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.quick-card {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  border-radius: 24px;
  padding: 18px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.04);
}

.quick-card strong {
  display: block;
  font-size: 24px;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.quick-card p {
  margin: 8px 0 0;
  color: var(--muted);
}

.profile-hero {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 18px;
  align-items: start;
}

.profile-avatar-wrap {
  display: grid;
  gap: 14px;
}

.profile-avatar,
.pass-avatar {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 28px;
  border: 1px solid var(--line);
  background: #f0f0f2;
}

.avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 42px;
  font-weight: 600;
  color: var(--text);
}

.avatar-form {
  display: grid;
  gap: 10px;
}

.section-card {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.90);
}

.section-card h3 {
  margin: 0 0 12px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.94);
}

.hint-banner {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 16px 18px;
  border: 1px solid rgba(0, 113, 227, 0.12);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(248, 251, 255, 0.98), rgba(239, 246, 255, 0.92));
  margin-bottom: 14px;
}

.hint-banner strong {
  display: block;
  margin-bottom: 4px;
  font-size: 16px;
}

.hint-banner p {
  margin: 0;
  color: var(--muted);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

th,
td {
  border-bottom: 1px solid rgba(29, 29, 31, 0.06);
  padding: 14px 16px;
  font-size: 14px;
  text-align: left;
  vertical-align: top;
}

th {
  background: rgba(245, 245, 247, 0.92);
  color: var(--muted);
  font-weight: 500;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.row-actions .btn {
  padding: 9px 13px;
  font-size: 13px;
}

.flex-row-inline {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.history-topbar {
  flex-wrap: wrap;
}

.leave-contact-card {
  margin-bottom: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(246, 246, 248, 0.92));
}

.tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: #f0f0f2;
  color: var(--muted);
}

.status-tag {
  font-weight: 600;
  letter-spacing: 0.01em;
}

.status-pending {
  background: rgba(0, 113, 227, 0.12);
  color: #0b63ce;
}

.status-success {
  background: rgba(35, 144, 92, 0.14);
  color: #1d7a4f;
}

.status-warning {
  background: rgba(243, 137, 32, 0.16);
  color: #b85d00;
}

.status-danger {
  background: rgba(217, 45, 32, 0.14);
  color: #b42318;
}

.status-neutral {
  background: rgba(29, 29, 31, 0.08);
  color: #4d4d51;
}

.muted-inline {
  color: var(--muted);
}

.leave-opinion {
  display: inline-block;
  max-width: 280px;
  line-height: 1.6;
  color: var(--text);
  white-space: normal;
  word-break: break-word;
}

.leave-opinion.is-rejected {
  color: #b42318;
  font-weight: 600;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: #374151;
}

.sql-result {
  margin-top: 12px;
}

.pass-shell {
  display: grid;
  gap: 14px;
}

.pass-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(240px, 0.72fr);
  gap: 16px;
}

.pass-main-card,
.pass-side-card {
  border-radius: 32px;
  overflow: hidden;
  position: relative;
}

.pass-main-card {
  padding: 26px;
  color: #f5f5f7;
  background:
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.16), transparent 24%),
    linear-gradient(160deg, #1a1a1c, #0f1012 72%, #060607);
}

.pass-side-card {
  padding: 20px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  display: grid;
  gap: 14px;
  align-content: start;
}

.pass-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.pass-kicker {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.58);
}

.pass-header h3 {
  margin: 0;
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.pass-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #f5f5f7;
  font-size: 13px;
  font-weight: 500;
}

.pass-status-badge.is-valid {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.14);
  color: #f5f5f7;
}

.pass-status-badge.is-invalid {
  background: rgba(217, 45, 32, 0.14);
  border-color: rgba(217, 45, 32, 0.2);
  color: #ffd5d2;
}

.pass-identity {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 18px;
  margin-top: 22px;
  align-items: center;
}

.pass-avatar {
  width: 120px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
}

.pass-identity-text strong {
  display: block;
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.pass-identity-text p {
  margin: 8px 0 0;
  color: rgba(255, 255, 255, 0.72);
}

.pass-timeline {
  margin-top: 24px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.pass-timeline div {
  padding: 16px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.pass-timeline span {
  display: block;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.54);
  margin-bottom: 6px;
}

.pass-timeline strong {
  font-size: 15px;
  line-height: 1.4;
}

.pass-watermark-strip {
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: 18px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.84);
}

.pass-qr-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 24px;
  display: block;
  object-fit: cover;
  background: #fff;
  border: 1px solid rgba(29, 29, 31, 0.08);
}

.pass-side-meta p {
  margin: 0 0 6px;
  color: var(--muted);
}

.pass-side-meta strong {
  display: block;
  margin-bottom: 12px;
  color: var(--text);
}

.public-pass-card {
  max-width: 960px;
  margin: 0 auto;
  padding: 26px;
}

.public-pass-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.public-pass-body {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.public-pass-student {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 18px;
  align-items: center;
}

.public-pass-avatar {
  width: 140px;
  border-radius: 28px;
}

.public-pass-student strong {
  display: block;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.public-pass-student p {
  margin: 8px 0 0;
  color: var(--muted);
}

.public-pass-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.public-approvals {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.form-actions-inline {
  display: flex;
  align-items: flex-end;
}

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 40;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 12, 16, 0.48);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.modal-dialog {
  position: relative;
  width: min(1120px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  margin: 24px auto;
  overflow: auto;
  border-radius: 32px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 30px 90px rgba(15, 23, 42, 0.24);
}

.modal-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 24px 24px 16px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}

.modal-header h3 {
  margin: 0;
  font-size: clamp(24px, 2.8vw, 34px);
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.modal-body {
  padding: 20px 24px 24px;
}

.modal-stack {
  display: grid;
  gap: 18px;
}

.confirm-copy {
  display: grid;
  gap: 10px;
  color: var(--text);
  line-height: 1.7;
}

.confirm-copy p {
  margin: 0;
}

.confirm-actions {
  justify-content: flex-end;
}

.toast-root {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 60;
  display: grid;
  gap: 10px;
  pointer-events: none;
}

.toast {
  min-width: 280px;
  max-width: min(420px, calc(100vw - 36px));
  padding: 14px 16px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 24px 54px rgba(15, 23, 42, 0.18);
  background: rgba(255, 255, 255, 0.94);
  color: var(--text);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  transform: translateY(12px);
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
  pointer-events: auto;
  cursor: pointer;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

.toast-success {
  border-color: rgba(35, 144, 92, 0.18);
  background: rgba(246, 255, 250, 0.95);
}

.toast-error {
  border-color: rgba(217, 45, 32, 0.2);
  background: rgba(255, 247, 245, 0.96);
}

.toast-info {
  border-color: rgba(0, 113, 227, 0.16);
  background: rgba(246, 250, 255, 0.96);
}

.empty-state-card {
  text-align: left;
}

.empty-state-card h3 {
  margin-bottom: 8px;
}

.hidden {
  display: none !important;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .page {
    padding: 18px;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .fields-block,
  .grid-2,
  .profile-hero,
  .pass-grid,
  .pass-identity,
  .pass-timeline,
  .public-pass-student,
  .public-pass-top {
    grid-template-columns: 1fr;
  }

  .public-pass-top {
    display: grid;
  }

  .flex-row-inline {
    align-items: stretch;
    flex-direction: column;
  }

  .login-card,
  .panel,
  .content-header,
  .sidebar {
    padding: 20px;
  }

  .content-header-main,
  .hint-banner,
  .modal-header {
    flex-direction: column;
    align-items: stretch;
  }

  .login-brand {
    grid-template-columns: 1fr;
  }

  .modal-dialog {
    width: calc(100vw - 18px);
    margin: 9px;
    max-height: calc(100vh - 18px);
    border-radius: 24px;
  }

  .modal-body {
    padding: 16px;
  }

  .toast-root {
    right: 12px;
    left: 12px;
    bottom: 12px;
  }

  .toast {
    min-width: 0;
    max-width: none;
  }
}
