:root {
  --bg: #0b1020;
  --panel: rgba(18, 24, 45, 0.78);
  --line: rgba(255, 255, 255, 0.08);
  --text: #eef2ff;
  --muted: #9aa4c7;
  --accent: #4f8cff;
  --accent-2: #7b61ff;
  --success: #2dd4bf;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Pretendard", "Noto Sans KR", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(79, 140, 255, 0.22), transparent 28%),
    radial-gradient(circle at top right, rgba(123, 97, 255, 0.18), transparent 30%),
    linear-gradient(135deg, #070b16 0%, #10172c 48%, #090d1a 100%);
  min-height: 100vh;
}

.app {
  width: min(1440px, calc(100% - 40px));
  margin: 28px auto;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
}

.sidebar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  padding: 24px 18px;
  position: sticky;
  top: 28px;
  height: calc(100vh - 56px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px 24px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
}

.brand-badge {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid;
  place-items: center;
  font-weight: 800;
  box-shadow: 0 12px 24px rgba(79, 140, 255, 0.35);
}

.brand h1 {
  margin: 0;
  font-size: 18px;
}

.brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nav-btn {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  padding: 14px 16px;
  border-radius: 18px;
  text-align: left;
  cursor: pointer;
  transition: .25s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 15px;
}

.nav-btn:hover {
  background: rgba(255,255,255,0.05);
  transform: translateX(4px);
}

.nav-btn.active {
  background: linear-gradient(135deg, rgba(79,140,255,0.20), rgba(123,97,255,0.18));
  border-color: rgba(111, 151, 255, 0.24);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 12px 28px rgba(26, 57, 138, 0.22);
}

.main {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.topbar, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 24px;
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

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

.title-box h2 {
  margin: 0;
  font-size: 28px;
}

.title-box p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.top-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.action-btn {
  border: 0;
  border-radius: 16px;
  padding: 12px 18px;
  font-weight: 600;
  cursor: pointer;
  transition: .25s ease;
}

.action-btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  box-shadow: 0 12px 24px rgba(79, 140, 255, 0.35);
}

.action-btn.ghost {
  background: rgba(255,255,255,0.04);
  color: var(--text);
  border: 1px solid var(--line);
}

.action-btn:hover {
  transform: translateY(-2px);
}

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

.stat-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 22px;
  padding: 20px;
}

.stat-label {
  color: var(--muted);
  font-size: 13px;
}

.stat-value {
  margin-top: 10px;
  font-size: 28px;
  font-weight: 800;
}

.stat-foot {
  margin-top: 8px;
  font-size: 12px;
  color: var(--success);
}

.content-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 20px;
  margin-top: 20px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.section-title h3 {
  margin: 0;
}

.section-title span {
  color: var(--muted);
  font-size: 13px;
}

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

th, td {
  padding: 14px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  text-align: left;
  font-size: 14px;
}

th {
  color: var(--muted);
  background: rgba(255,255,255,0.03);
}

tr:hover td {
  background: rgba(255,255,255,0.03);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.badge.maker {
  background: rgba(79,140,255,0.16);
  color: #a8c5ff;
}

.badge.service {
  background: rgba(45,212,191,0.16);
  color: #94f2e4;
}

.badge.waiting {
  background: rgba(251,191,36,0.18);
  color: #fde68a;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.list-item {
  padding: 16px 18px;
  border-radius: 20px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.list-item strong {
  display: block;
  margin-bottom: 6px;
}

.list-item p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: fade .25s ease;
}

@keyframes fade {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

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

  .sidebar {
    position: relative;
    height: auto;
    top: 0;
  }

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

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

@media (max-width: 768px) {
  .app {
    width: calc(100% - 20px);
    margin: 10px auto;
  }

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

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

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

.user-chip {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 14px;
  border-radius: 16px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  min-width: 160px;
}

.user-chip strong {
  font-size: 14px;
  color: var(--text);
}

.user-chip span {
  font-size: 12px;
  color: var(--muted);
}

.action-btn.danger {
  background: rgba(251, 113, 133, 0.14);
  color: #ffd5dd;
  border: 1px solid rgba(251, 113, 133, 0.28);
}

.action-btn.danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(251, 113, 133, 0.18);
}

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: rgba(18, 24, 45, 0.82);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 28px;
  padding: 32px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(18px);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.login-card h2 {
  margin: 0 0 20px;
  font-size: 28px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-form input {
  width: 100%;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  border-radius: 16px;
  padding: 14px 16px;
  font-size: 15px;
  outline: none;
}

.login-form input::placeholder {
  color: var(--muted);
}

.login-form input:focus {
  border-color: rgba(79, 140, 255, 0.45);
  box-shadow: 0 0 0 4px rgba(79, 140, 255, 0.12);
}

.login-btn {
  width: 100%;
  margin-top: 6px;
}

.filter-bar {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: end;
  margin-bottom: 18px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 180px;
}

.filter-group label {
  font-size: 13px;
  color: var(--muted);
}

.filter-group input,
.filter-group select {
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 14px;
  outline: none;
}

.filter-group input::placeholder {
  color: var(--muted);
}

.filter-group input:focus,
.filter-group select:focus {
  border-color: rgba(79, 140, 255, 0.45);
  box-shadow: 0 0 0 4px rgba(79, 140, 255, 0.12);
}

.filter-actions {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  min-width: auto;
}

body.auth-pending #loginScreen,
body.auth-pending #mainScreen {
  visibility: hidden;
}

body.auth-ready #loginScreen,
body.auth-ready #mainScreen {
  visibility: visible;
}
