:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --line: #e5ebf5;
  --text: #18212f;
  --muted: #6e7b91;
  --blue: #316dff;
  --blue-soft: #e8f0ff;
  --green: #14b86a;
  --red: #ef5350;
  --shadow: 0 10px 30px rgba(35, 58, 115, 0.08);
  --radius-lg: 18px;
  --radius-md: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, "Pretendard", "Noto Sans KR", system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
}

.admin-app {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.admin-header h1 {
  margin: 0;
  font-size: 24px;
}

.admin-header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.header-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn:hover { border-color: #c9d6ef; }

.btn-primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.btn-danger {
  background: #fff5f5;
  border-color: #f5c4c4;
  color: var(--red);
}

.meta-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.chip {
  background: var(--blue-soft);
  color: var(--blue);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.tab-btn {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 12px;
  padding: 10px 16px;
  cursor: pointer;
  font-size: 14px;
}

.tab-btn.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.card-head h2 {
  margin: 0;
  font-size: 18px;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search {
  min-width: 260px;
  flex: 1;
  max-width: 420px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
}

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th, td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  background: #f9fbff;
  font-size: 13px;
  color: var(--muted);
}

.row-actions {
  display: flex;
  gap: 6px;
}

.btn-sm {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 8px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.full { grid-column: 1 / -1; }

.form-group label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

.form-group input,
.form-group select,
.form-group textarea {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
}

.form-group textarea {
  min-height: 80px;
  resize: vertical;
}

.section-title {
  margin: 24px 0 12px;
  font-size: 15px;
  font-weight: 700;
}

.monthly-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.monthly-grid label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
  display: block;
}

.monthly-grid input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
}

.list-editor {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.list-item {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  align-items: start;
}

.list-item-4 {
  grid-template-columns: 120px 1fr 1fr 100px auto;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}

.modal-backdrop.open { display: flex; }

.modal {
  background: var(--panel);
  border-radius: var(--radius-lg);
  width: min(920px, 100%);
  max-height: 90vh;
  overflow: auto;
  box-shadow: var(--shadow);
}

.modal-header,
.modal-footer {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.modal-footer {
  border-bottom: none;
  border-top: 1px solid var(--line);
  justify-content: flex-end;
}

.modal-body { padding: 20px; }

.modal-header h3 { margin: 0; }

.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #1e293b;
  color: #fff;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 32px;
}

.field-hint {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.status-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.status-good { background: #dcfce7; color: #15803d; }
.status-warn { background: #fef3c7; color: #b45309; }
.status-bad { background: #fee2e2; color: #b91c1c; }

@media (max-width: 900px) {
  .form-grid,
  .form-grid-3,
  .monthly-grid,
  .list-item,
  .list-item-4 {
    grid-template-columns: 1fr;
  }
}
