:root {
  --bg: #f3f5f7;
  --card: #ffffff;
  --line: #d8dee5;
  --text: #1b2430;
  --muted: #66788a;
  --accent: #0f766e;
  --accent-strong: #0b5f58;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Pretendard", "Noto Sans KR", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, #f7fafc 10%, transparent 35%),
    linear-gradient(145deg, #eef2f6 0%, #f5f7fa 45%, #ebf0f5 100%);
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

.auth-shell,
.app-shell {
  width: min(1240px, 100% - 2rem);
  margin: 2rem auto;
}

.auth-card,
.form-panel,
.schedule-panel,
.topbar {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 10px 40px rgba(17, 24, 39, 0.07);
}

.auth-card {
  max-width: 460px;
  margin: 6vh auto;
  padding: 2rem;
}

.auth-card h1 {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
}

.auth-card p {
  margin: 0 0 1rem;
  color: var(--muted);
}

.auth-form {
  display: grid;
  gap: 0.6rem;
}

label {
  font-size: 0.88rem;
  color: var(--muted);
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

button {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 0.64rem 0.95rem;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

button:hover {
  background: var(--accent-strong);
}

button.secondary {
  background: #eff5f5;
  color: #154b47;
  border-color: #d5e8e7;
}

button.secondary:hover,
button.ghost:hover {
  background: #dfeaea;
}

button.ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}

button.danger {
  background: #fff3f2;
  color: var(--danger);
  border-color: #fed9d6;
}

.hint {
  margin-top: 0.8rem;
  font-size: 0.84rem;
}

.error {
  margin-top: 0.7rem;
  color: var(--danger);
  font-size: 0.85rem;
}

.topbar {
  padding: 1.1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.topbar h2 {
  margin: 0;
}

.topbar p {
  margin: 0.25rem 0 0;
  color: var(--muted);
}

.top-actions {
  display: flex;
  gap: 0.5rem;
}

.layout {
  display: grid;
  grid-template-columns: minmax(300px, 360px) 1fr;
  gap: 1rem;
}

.form-panel,
.schedule-panel {
  padding: 1rem;
}

.form-panel h3,
.schedule-panel h3 {
  margin-top: 0.3rem;
}

.schedule-form {
  display: grid;
  gap: 0.8rem;
}

.row {
  display: grid;
  gap: 0.35rem;
}

.row.two {
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}

.time-selects {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.admin-panel {
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px dashed var(--line);
}

.admin-panel h3 {
  margin: 0.5rem 0 0.75rem;
}

.admin-form {
  margin-bottom: 0.65rem;
}

.staff-table-wrap {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: auto;
}

.staff-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.staff-table th,
.staff-table td {
  border-bottom: 1px solid var(--line);
  padding: 0.5rem;
  text-align: left;
  white-space: nowrap;
}

.staff-table tr:last-child td {
  border-bottom: 0;
}

.badge {
  display: inline-block;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  border: 1px solid #d5e8e7;
  background: #f1fbfa;
  color: #0f625c;
}

.badge.off {
  border-color: #f8c7c3;
  background: #fff4f3;
  color: #9e2e23;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.8rem;
}

.view-switch,
.date-nav,
.print-actions {
  display: flex;
  gap: 0.4rem;
}

.view-btn {
  background: #eff5f5;
  color: #0b615b;
}

.view-btn.active {
  background: var(--accent);
  color: #fff;
}

#periodTitle {
  margin: 0.4rem 0 0.8rem;
  font-size: 1.15rem;
}

.month-grid {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

.weekday-row,
.month-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(80px, 1fr));
}

.weekday-row div {
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  padding: 0.45rem;
  text-align: center;
  font-weight: 600;
  color: var(--muted);
}

.date-cell {
  min-height: 120px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 0.35rem;
  cursor: pointer;
}

.month-row .date-cell:last-child,
.weekday-row div:last-child {
  border-right: 0;
}

.date-cell.muted {
  background: #f9fbfc;
  color: #9aa8b7;
}

.date-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
  font-size: 0.8rem;
}

.chip-list {
  display: grid;
  gap: 0.25rem;
}

.event-chip {
  border: 1px solid #d4ecea;
  background: #f2fbfa;
  color: #134e4a;
  border-radius: 8px;
  padding: 0.25rem 0.35rem;
  font-size: 0.74rem;
  cursor: pointer;
}

.event-chip:hover {
  filter: brightness(0.96);
}

.list-wrap {
  display: grid;
  gap: 0.75rem;
}

.day-block {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.7rem;
}

.day-block h4 {
  margin: 0 0 0.55rem;
}

.event-row {
  border: 1px solid #d5e8e7;
  background: #f5fbfb;
  border-radius: 12px;
  padding: 0.55rem;
  margin-bottom: 0.45rem;
  cursor: pointer;
}

.event-row:last-child {
  margin-bottom: 0;
}

.event-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  font-weight: 600;
}

.event-sub {
  font-size: 0.84rem;
  color: #446173;
  margin-top: 0.25rem;
}

.empty {
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 0.7rem;
}

.print-current-view {
  display: none;
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .date-cell {
    min-height: 95px;
  }
}

@media (max-width: 700px) {
  .auth-shell,
  .app-shell {
    width: min(1240px, 100% - 1rem);
    margin: 0.8rem auto;
  }

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

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

  .row.two {
    grid-template-columns: 1fr;
  }

  .weekday-row,
  .month-row {
    grid-template-columns: repeat(7, minmax(40px, 1fr));
  }

  .date-cell {
    min-height: 76px;
    padding: 0.25rem;
  }

  .event-chip {
    font-size: 0.68rem;
  }
}

@media print {
  @page {
    size: A4 portrait;
    margin: 8mm;
  }

  body {
    background: #fff;
    font-size: 8.5px;
  }

  .topbar,
  .form-panel,
  .toolbar,
  #printBtn,
  #logoutBtn {
    display: none !important;
  }

  .app-shell {
    width: 100%;
    margin: 0;
  }

  .layout {
    display: block;
  }

  .schedule-panel {
    box-shadow: none;
    border: 0;
    padding: 0;
  }

  body.printing-current-view .schedule-panel {
    display: none;
  }

  body.printing-current-view .print-current-view {
    display: block;
  }

  .print-current-view h2,
  .print-current-view h3 {
    margin: 0 0 0.3rem;
    line-height: 1.15;
  }

  .print-meta {
    margin-bottom: 0.4rem;
    color: #555;
    line-height: 1.2;
  }

  .print-section {
    border: 0;
    padding: 0;
    break-inside: avoid;
  }

  .print-current-view .month-grid,
  .print-current-view .list-wrap,
  .print-current-view .day-block {
    break-inside: avoid;
  }

  .print-current-view.month .print-section {
    transform: scale(0.85);
    transform-origin: top left;
  }

  .print-current-view.week .print-section {
    transform: scale(0.92);
    transform-origin: top left;
  }

  .print-current-view.day .print-section {
    transform: scale(0.96);
    transform-origin: top left;
  }
}
