:root {
  --peach: #fde2ea;
  --peach-deep: #f4b9ca;
  --peach-text: #8b3a55;
  --cream: #fff8ef;
  --babyblue: #e3f0fb;
  --mint: #e6f6ec;
  --butter: #fff6d8;
  --yellow: #fff3cd;
  --green: #d1e7dd;
  --blue: #cfe2ff;
  --pink: #f8d7da;
  --shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Segoe UI", "Microsoft JhengHei", "PingFang TC", "Noto Sans TC", sans-serif;
  background: linear-gradient(160deg, #fdeef3 0%, #eef4fb 55%, #f3f7ea 100%);
  background-attachment: fixed;
  color: #4a3f44;
  line-height: 1.6;
  min-height: 100vh;
}

.page-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px 60px;
}

.site-header {
  text-align: center;
  padding-top: 28px;
  margin-bottom: 52px;
}

.site-header h1 {
  margin: 0 0 8px;
  font-size: 2.5rem;
  font-weight: 800;
  color: #7c4a5a;
  letter-spacing: 2px;
}

.site-header .subtitle {
  margin: 0;
  color: #a8788a;
  font-size: 1.125rem;
  letter-spacing: 1px;
}

.container {
  max-width: 1080px;
  margin: 0 auto;
}

.hidden {
  display: none !important;
}

/* ---------- Cards ---------- */
.card {
  background: rgba(255, 255, 255, 0.92);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 24px;
}

.panel-parent {
  background: linear-gradient(135deg, #fde2ea, #fff3ec);
  border: 1px solid #f6c9d6;
}

.panel-manage {
  background: linear-gradient(135deg, #e3f0fb, #eef7ec);
  border: 1px solid #c4ddef;
}

.card h2 {
  margin: 0 0 16px;
  font-size: 1.25rem;
  color: #5c4450;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  margin-bottom: 16px;
}

.card-header h3 {
  margin: 0;
  font-size: 1.1rem;
  color: #5c4450;
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ---------- Home ---------- */
.home-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 40px;
  max-width: 800px;
  margin: 0 auto;
}

.home-card {
  flex: 1 1 320px;
  max-width: 360px;
  min-width: 0;
  display: block;
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.home-card:hover,
.home-card:focus-visible {
  transform: translateY(-4px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
}

.home-card img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  background: #fff;
}

.home-footer {
  margin-top: 40px;
  text-align: center;
  color: #7a6a73;
  font-size: 14px;
}

/* ---------- Forms ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.field label {
  font-weight: 600;
  font-size: 0.9rem;
  color: #6b5360;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e0cfd6;
  border-radius: 10px;
  font-size: 1rem;
  background: #fff;
  color: #4a3f44;
}

input:focus,
select:focus {
  outline: none;
  border-color: #e79ab5;
  box-shadow: 0 0 0 3px rgba(231, 154, 181, 0.2);
}

.label-strong {
  font-weight: 700;
  color: #7c4a5a;
}

.info-box {
  background: #e3f0fb;
  border: 1px solid #c4ddef;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 0.95rem;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 10px 18px;
  border: none;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.1s ease;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: #e98bab;
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(0.94);
}

.btn-success {
  background: #7fb98f;
  color: #fff;
}

.btn-success:hover:not(:disabled) {
  filter: brightness(0.94);
}

.btn-secondary {
  background: #e3f0fb;
  color: #3d6b96;
  border: 1px solid #c4ddef;
}

.btn-outline {
  background: transparent;
  border: 1px solid #d9c6cd;
  color: #7a5f6b;
}

.btn-danger {
  background: #e99aa4;
  color: #fff;
}

.btn-link {
  background: transparent;
  border: none;
  color: #9a7d8a;
  text-decoration: underline;
  padding: 6px 8px;
}

.btn-block {
  width: 100%;
  margin-top: 8px;
}

.btn-add,
.btn-remove {
  flex: 0 0 auto;
  width: 46px;
  padding: 0;
  font-size: 1.2rem;
  font-weight: 800;
  border-radius: 10px;
}

.btn-add {
  background: #cdeedd;
  color: #2f6b47;
  border: 1px solid #9fd6b8;
}

.btn-remove {
  background: #fad9dc;
  color: #a04a55;
  border: 1px solid #f0b9be;
}

.btn-remove-sm {
  background: #fad9dc;
  color: #a04a55;
  border: 1px solid #f0b9be;
  padding: 4px 10px;
  font-size: 0.82rem;
  border-radius: 8px;
}

.btn-secondary-sm {
  background: #eef0f3;
  color: #5c6672;
  border: 1px solid #d8dde3;
  padding: 5px 12px;
  font-size: 0.82rem;
  border-radius: 8px;
}

/* ---------- Toast ---------- */
.toast-root {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  width: min(92vw, 520px);
  pointer-events: none;
}

.toast {
  padding: 14px 22px;
  border-radius: 14px;
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  text-align: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  opacity: 0;
  transform: translateY(-12px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  max-width: 100%;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-success {
  background: #7fb98f;
}

.toast-error {
  background: #e98b9c;
}

/* ---------- Dashboard ---------- */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.dashboard-header h2 {
  margin: 0;
  font-size: 1.3rem;
  color: #5c4450;
}

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

.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
}

.badge-admin {
  background: #f9d9dc;
  color: #a04a55;
}

.badge-teacher {
  background: #cfe2ff;
  color: #2f5d9e;
}

.filter-bar {
  display: flex;
  gap: 14px;
  align-items: flex-end;
  flex-wrap: wrap;
  background: #eef4fb;
  border: 1px solid #d6e4f2;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
}

.filter-bar .field {
  flex: 1 1 200px;
  margin-bottom: 0;
}

/* ---------- Class cards ---------- */
.class-card {
  background: linear-gradient(160deg, #fdf8ef, #f6f9fb);
}

.meeting-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 12px;
}

.meeting-grid > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.meeting-grid label {
  font-weight: 600;
  font-size: 0.85rem;
  color: #6b5360;
}

.span-4 {
  grid-column: span 4;
}

.span-3 {
  grid-column: span 3;
}

.input-group {
  display: flex;
  gap: 8px;
}

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ---------- Tables ---------- */
.table-scroll {
  overflow-x: auto;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 12px;
  border: 1px solid #e9e2e5;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 780px;
}

.data-table th,
.data-table td {
  border: 1px solid #eee5e9;
  padding: 8px 10px;
  vertical-align: middle;
  text-align: left;
}

.data-table thead th {
  background: #f4edf0;
  font-size: 0.85rem;
  color: #6b5360;
}

.data-table tr.status-unprocessed {
  background: #fff8e1;
}

.data-table tr.status-teacher {
  background: #e9f7ee;
}

.data-table tr.status-admin {
  background: #e9f2fd;
}

.data-table tr.status-deleted {
  background: #fdeef0;
}

.data-table .cell-select,
.data-table .cell-number {
  min-width: 90px;
  padding: 6px 8px;
  border: 1px solid #d9cdd4;
  border-radius: 8px;
  background: #fff;
  color: #4a3f44;
  font-size: 0.9rem;
}

.suggestion-content {
  white-space: pre-line;
  word-break: break-word;
  min-width: 220px;
}

.bold {
  font-weight: 700;
}

.center {
  text-align: center;
}

.empty-cell {
  text-align: center;
  color: #9b8a92;
  padding: 18px !important;
}

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
}

.radio-item {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.radio-item label {
  font-size: 0.82rem;
  font-weight: 600;
}

.card-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.card-actions .btn {
  flex: 1 1 200px;
}

/* ---------- History ---------- */
.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid #eedfe5;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 8px;
}

.history-text {
  word-break: break-word;
}

.status-chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  margin-left: 4px;
}

.status-chip.status-unprocessed {
  background: #fff3cd;
  color: #8a6d1a;
}

.status-chip.status-teacher {
  background: #d1e7dd;
  color: #2f6b47;
}

.status-chip.status-admin {
  background: #cfe2ff;
  color: #2f5d9e;
}

.status-chip.status-deleted {
  background: #f8d7da;
  color: #a04a55;
}

/* ---------- Suggestion input rows ---------- */
.suggestion-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.suggestion-row input {
  flex: 1;
}

/* ---------- Settings ---------- */
.settings-group {
  background: #eef4fb;
  border: 1px solid #d6e4f2;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 14px;
}

.settings-group h4 {
  margin: 0 0 10px;
  font-size: 0.95rem;
  color: #3d6b96;
}

/* ---------- Modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(60, 40, 50, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}

.modal-box {
  background: #fff;
  border-radius: 16px;
  padding: 22px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

/* ---------- Misc ---------- */
.empty-note {
  background: #fff3cd;
  border: 1px solid #ffe69c;
  border-radius: 12px;
  padding: 18px;
  text-align: center;
  font-weight: 600;
  color: #8a6d1a;
}

.text-muted {
  color: #9b8a92;
}

.fw-bold {
  font-weight: 700;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .span-4 {
    grid-column: span 6;
  }
  .span-3 {
    grid-column: span 6;
  }
}

@media (max-width: 600px) {
  .page-wrap {
    padding: 16px 12px 48px;
  }
  .site-header {
    padding-top: 16px;
    margin-bottom: 36px;
  }
  .site-header h1 {
    font-size: 1.9rem;
    letter-spacing: 1px;
  }
  .site-header .subtitle {
    font-size: 0.95rem;
  }
  .card {
    padding: 16px;
  }
  .span-4,
  .span-3 {
    grid-column: span 12;
  }
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .card-actions .btn {
    flex: 1 1 100%;
  }
}