:root {
  --bg: #eaf4ff;
  --card: rgba(255, 255, 255, 0.82);
  --text: #0f172a;
  --muted: #475569;
  --primary: #38bdf8;
  --primary-dark: #2563eb;
  --border: rgba(37, 99, 235, 0.18);
  --success: #10b981;
  --error: #f43f5e;
  --danger: #ef4444;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 12% 5%, #dbeafe 0, #eef6ff 38%),
    radial-gradient(circle at 88% 10%, #bfdbfe 0, transparent 35%),
    linear-gradient(150deg, #f8fbff, #edf5ff 55%, #eaf2ff);
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 20px 14px;
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.85);
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.75);
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.2);
}

.brand-logo.placeholder {
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #2563eb;
  background: rgba(59, 130, 246, 0.15);
}

.brand-title {
  font-size: 34px;
  font-weight: 900;
  letter-spacing: 1px;
  text-align: center;
  background: linear-gradient(135deg, #2563eb, #0ea5e9 55%, #0284c7);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 8px 20px rgba(37, 99, 235, 0.2);
}

nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  width: 100%;
}

nav a {
  color: var(--text);
  text-decoration: none;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.2px;
  padding: 9px 14px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.6);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s, background 0.2s, color 0.2s;
}

nav a:hover {
  transform: translateY(-2px) scale(1.02);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.16), rgba(14, 165, 233, 0.22));
  border-color: rgba(37, 99, 235, 0.35);
  color: #0b3aa3;
  box-shadow: 0 10px 20px rgba(59, 130, 246, 0.22);
}

.container {
  max-width: 1160px;
  margin: 26px auto;
  padding: 0 18px 36px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.12);
}

.card-sub {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  background: rgba(248, 252, 255, 0.92);
}

.hero h1 { margin-top: 0; }
.notice-content :first-child { margin-top: 0; }

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

.auth-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  margin-top: 12px;
}

.auth-pane {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  background: rgba(248, 252, 255, 0.9);
}

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

.grid-2-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 12px;
}

.col-span-2 { grid-column: span 2; }

label {
  margin-top: 4px;
  color: #1e3a8a;
  font-size: 14px;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  border-radius: 12px;
  padding: 11px;
  font-size: 14px;
  outline: none;
}

input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: #1e3a8a;
  font-size: 14px;
}

textarea { resize: vertical; }

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.18);
}

.btn {
  display: inline-block;
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  padding: 9px 13px;
  font-size: 14px;
  cursor: pointer;
  transition: 0.2s;
}

.btn:hover { transform: translateY(-1px); }

.btn.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #ffffff;
  font-weight: 700;
  border: none;
}

.btn.danger {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.6);
  color: #b91c1c;
}

.actions {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

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

.cancel-form { margin-top: 14px; }

.helper-text {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.alerts { margin-bottom: 14px; }

.alert {
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 8px;
  font-size: 14px;
}

.alert.success {
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid rgba(16, 185, 129, 0.5);
}

.alert.error {
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.4);
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

th, td {
  text-align: left;
  padding: 10px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  vertical-align: top;
}

th { color: #1d4ed8; font-weight: 700; }

.editor-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

.pdf-embed {
  width: 100%;
  min-height: 260px;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.9);
  margin: 10px 0;
}

.pdf-embed iframe {
  width: 100%;
  height: 100%;
  min-height: 260px;
  border: none;
}

.notice-image {
  margin: 12px 0;
}

.notice-image img,
.notice-content img {
  max-width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.media-modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 999;
}

.media-modal.open {
  display: block;
}

.media-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.8);
}

.media-panel {
  position: absolute;
  inset: 4vh 4vw;
  background: rgba(245, 250, 255, 0.97);
  border: 1px solid var(--border);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.media-panel.minimal {
  border-radius: 12px;
}

.media-stage {
  flex: 1;
  overflow: hidden;
  display: grid;
  place-items: center;
  cursor: grab;
}

.media-stage:active {
  cursor: grabbing;
}

.modal-image {
  max-width: 92%;
  max-height: 86%;
  transform-origin: center center;
  user-select: none;
}

@media (max-width: 900px) {
  .topbar {
    align-items: center;
  }

  .brand-title { font-size: 28px; }

  nav a {
    font-size: 16px;
    padding: 8px 11px;
  }

  .grid-2-form { grid-template-columns: 1fr; }
  .col-span-2 { grid-column: span 1; }
}
