:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --panel-soft: #f9fafb;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --black: #111111;
  --black-soft: #222222;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --success: #15803d;
  --success-soft: #f0fdf4;
  --warning: #b45309;
  --warning-soft: #fffbeb;
  --blue: #2563eb;
  --blue-soft: #eff6ff;
  --radius: 18px;
  --shadow: 0 14px 40px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

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

a {
  color: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

.sidebar {
  background: #111111;
  color: #ffffff;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  padding: 8px 8px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.14);
}

.brand-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.brand-sub {
  margin-top: 6px;
  color: rgba(255,255,255,0.62);
  font-size: 13px;
}

.profile-card {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  padding: 14px;
}

.profile-name {
  font-weight: 700;
  margin-bottom: 4px;
}

.profile-meta {
  color: rgba(255,255,255,0.64);
  font-size: 13px;
  line-height: 1.5;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav button {
  width: 100%;
  border: 0;
  background: transparent;
  color: rgba(255,255,255,0.72);
  text-align: left;
  padding: 12px 14px;
  border-radius: 14px;
  cursor: pointer;
}

.nav button:hover,
.nav button.active {
  background: #ffffff;
  color: #111111;
}

.logout-btn {
  margin-top: auto;
  border: 1px solid rgba(255,255,255,0.2);
  background: transparent;
  color: #ffffff;
  padding: 12px 14px;
  border-radius: 14px;
  cursor: pointer;
}

.main {
  padding: 34px;
  max-width: 1440px;
  width: 100%;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 24px;
}

.page-title {
  font-size: 30px;
  font-weight: 850;
  letter-spacing: -0.04em;
  margin: 0;
}

.page-desc {
  color: var(--muted);
  margin-top: 8px;
  font-size: 14px;
}

.grid {
  display: grid;
  gap: 18px;
}

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

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

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

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

.card.soft {
  background: var(--panel-soft);
  box-shadow: none;
}

.metric-label {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}

.metric-value {
  font-size: 28px;
  font-weight: 850;
  letter-spacing: -0.04em;
}

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

.form-row.full {
  grid-column: 1 / -1;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
}

input, select, textarea {
  width: 100%;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: var(--text);
  border-radius: 14px;
  padding: 13px 14px;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: #111111;
  box-shadow: 0 0 0 3px rgba(17,17,17,0.08);
}

textarea {
  min-height: 94px;
  resize: vertical;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.btn {
  border: 0;
  border-radius: 14px;
  padding: 13px 18px;
  cursor: pointer;
  font-weight: 800;
  background: #111111;
  color: #ffffff;
}

.btn.secondary {
  background: #f3f4f6;
  color: #111827;
  border: 1px solid var(--line);
}

.btn.danger {
  background: var(--danger);
}

.btn.success {
  background: var(--success);
}

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

.text-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
  text-align: left;
  padding: 6px 0;
}

.text-btn:hover {
  color: var(--text);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  background: #f3f4f6;
  color: #374151;
}

.badge.blue { background: var(--blue-soft); color: var(--blue); }
.badge.green { background: var(--success-soft); color: var(--success); }
.badge.red { background: var(--danger-soft); color: var(--danger); }
.badge.yellow { background: var(--warning-soft); color: var(--warning); }
.badge.black { background: #111111; color: #ffffff; }

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #ffffff;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
}

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

th {
  background: #f9fafb;
  color: #374151;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

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

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 460px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 30px;
}

.auth-title {
  font-size: 28px;
  font-weight: 850;
  letter-spacing: -0.04em;
  margin-bottom: 8px;
}

.auth-desc {
  color: var(--muted);
  margin-bottom: 22px;
  font-size: 14px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #f3f4f6;
  border-radius: 14px;
  padding: 4px;
  margin-bottom: 20px;
}

.auth-tabs button {
  border: 0;
  background: transparent;
  border-radius: 11px;
  padding: 10px;
  cursor: pointer;
  font-weight: 800;
}

.auth-tabs button.active {
  background: #111111;
  color: #ffffff;
}

.summary-box {
  background: #111111;
  color: #ffffff;
  border-radius: 18px;
  padding: 18px;
  display: grid;
  gap: 12px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  font-size: 14px;
  color: rgba(255,255,255,0.78);
}

.summary-row strong {
  color: #ffffff;
}

.summary-total {
  border-top: 1px solid rgba(255,255,255,0.16);
  padding-top: 14px;
  font-size: 18px;
  font-weight: 850;
}

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.admin-tabs button {
  border: 1px solid var(--line);
  background: #ffffff;
  padding: 10px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 800;
}

.admin-tabs button.active {
  background: #111111;
  color: #ffffff;
  border-color: #111111;
}

.help-text {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

.config-warning {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.config-warning pre {
  white-space: pre-wrap;
  background: #111111;
  color: #ffffff;
  padding: 18px;
  border-radius: 14px;
  overflow: auto;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  background: #111111;
  color: #ffffff;
  padding: 13px 18px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  z-index: 9999;
  font-weight: 700;
  max-width: calc(100vw - 32px);
}

.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: relative;
    height: auto;
  }
  .main {
    padding: 22px;
  }
  .grid-2, .grid-3, .grid-4, .form-grid {
    grid-template-columns: 1fr;
  }
}
