:root {
  color-scheme: light;
  --ink: #172331;
  --muted: #667487;
  --line: #d8dedf;
  --paper: #f5f1e9;
  --panel: #ffffff;
  --brand: #17324d;
  --brand-2: #2f6f73;
  --ok: #19784f;
  --warn: #b15d1b;
  --danger: #b73535;
  --shadow: 0 18px 46px rgba(36, 44, 54, 0.12);
  font-family: "Pretendard", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.kiosk-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
}

.kiosk-main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
  padding: 36px clamp(24px, 5vw, 72px);
}

.topbar,
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--brand-2);
  font-size: 15px;
  font-weight: 800;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(36px, 6vw, 72px);
  line-height: 1.02;
}

.branch-badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  margin-top: 14px;
  padding: 0 12px;
  border-radius: 999px;
  background: #e6ece9;
  color: var(--brand);
  font-weight: 900;
}

h2 {
  font-size: 22px;
}

.icon-button,
.secondary-button,
.primary-button,
.small-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}

.icon-button {
  width: 72px;
  height: 52px;
}

.status-panel,
.toast {
  min-height: 64px;
  display: flex;
  align-items: center;
  padding: 18px 22px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  font-size: 24px;
  font-weight: 800;
}

.status-panel.success,
.toast.success {
  color: var(--ok);
  border-color: rgba(25, 120, 79, 0.35);
}

.status-panel.error,
.toast.error {
  color: var(--danger);
  border-color: rgba(183, 53, 53, 0.35);
}

.status-panel.warn {
  color: var(--warn);
}

.code-display {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.code-display span {
  height: 92px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #fff;
  border: 2px solid var(--line);
  font-size: 42px;
  color: var(--brand);
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, minmax(86px, 1fr));
  gap: 14px;
}

.key {
  height: clamp(72px, 11vh, 112px);
  border: 0;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
  color: var(--ink);
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 900;
}

.key:active {
  transform: translateY(1px);
}

.key.subtle {
  background: #e6ece9;
  font-size: 28px;
}

.key.accent {
  background: var(--brand);
  color: #fff;
  font-size: 28px;
}

.recent-panel {
  padding: 38px 28px;
  background: #17324d;
  color: #fff;
}

.recent-panel h2 {
  margin-bottom: 18px;
}

.recent-panel ul {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.recent-panel li {
  min-height: 56px;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
}

.recent-panel .empty {
  display: block;
  color: rgba(255, 255, 255, 0.7);
}

.in {
  color: #47d39b;
}

.out {
  color: #f7c66a;
}

.admin-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 22px 60px;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 22px;
}

.login-panel {
  width: min(100%, 440px);
  display: grid;
  gap: 18px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.login-panel h1 {
  font-size: 34px;
}

.login-panel form {
  display: grid;
  gap: 14px;
}

.branch-select-panel {
  width: min(100%, 540px);
}

.branch-list {
  display: grid;
  gap: 10px;
}

.branch-choice {
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 900;
  text-align: left;
  padding: 0 18px;
}

.branch-choice:hover {
  border-color: var(--brand-2);
  background: #eef3f2;
}

.admin-header {
  margin-bottom: 22px;
}

.admin-header h1 {
  font-size: 36px;
}

.header-actions,
.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-button,
.secondary-button,
.small-button {
  min-height: 42px;
  padding: 0 16px;
}

.primary-button {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.small-button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 14px;
}

.small-button.danger {
  color: var(--danger);
}

.danger-text {
  color: var(--danger);
}

tr.needs-password {
  background: #fff6f3;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.form-panel,
.table-panel {
  padding: 20px;
}

.upload-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px;
  margin-bottom: 16px;
}

.upload-panel p {
  max-width: 720px;
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.upload-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.report-panel {
  padding: 20px;
  margin-bottom: 16px;
  overflow-x: auto;
}

.report-page-panel {
  margin-bottom: 0;
}

.report-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.report-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-weight: 800;
}

.report-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(110px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.report-summary div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.report-summary strong {
  display: block;
  font-size: 28px;
  line-height: 1;
}

.report-summary span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-weight: 800;
}

.scheduled-row {
  background: #f7fbfa;
}

.class-report-list {
  display: grid;
  gap: 14px;
}

.class-report {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow-x: auto;
  background: #fff;
}

.class-report-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.class-report-head h3 {
  margin: 0;
  font-size: 18px;
}

.class-report-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-weight: 800;
}

.class-report table th:first-child,
.class-report table td:first-child {
  padding-left: 16px;
}

.empty-report {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-weight: 800;
}

.form-panel {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
}

.table-panel {
  margin-top: 16px;
  overflow-x: auto;
}

.table-panel h2 {
  margin-bottom: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.class-cell {
  white-space: normal;
  min-width: 180px;
}

.class-line + .class-line {
  margin-top: 4px;
}

th {
  color: var(--muted);
  font-size: 13px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef3f2;
  font-weight: 900;
}

.pill.none {
  color: var(--danger);
}

@media (max-width: 860px) {
  .kiosk-shell {
    grid-template-columns: 1fr;
  }

  .recent-panel {
    min-height: 220px;
  }

  .admin-grid {
    grid-template-columns: 1fr;
  }

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

  .upload-actions {
    justify-content: flex-start;
  }

  .report-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .kiosk-main {
    padding: 22px 14px;
  }

  .topbar,
  .admin-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .status-panel {
    font-size: 18px;
  }

  .code-display span {
    height: 72px;
  }

  .key {
    min-width: 0;
  }
}
