:root {
  color-scheme: dark;
  --bg: #06070a;
  --panel: #16181f;
  --panel-2: #1f222c;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f6f7fb;
  --muted: #b6bbc8;
  --soft: #777f91;
  --discord: #5865f2;
  --discord-hover: #6975ff;
  --success: #3fd182;
  --danger: #ff6678;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

button,
input,
textarea {
  font: inherit;
}

body {
  margin: 0;
  font-family: Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
  background:
    radial-gradient(circle at 50% -12%, rgba(88, 101, 242, 0.2), transparent 24rem),
    radial-gradient(circle at 50% 110%, rgba(63, 209, 130, 0.08), transparent 28rem),
    linear-gradient(180deg, #11131a 0%, var(--bg) 58%, #030407 100%);
  color: var(--text);
}

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

.auth-card {
  position: relative;
  isolation: isolate;
  width: min(100%, 376px);
  min-height: 482px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 13px;
  padding: 38px 26px 28px;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.018)),
    var(--panel);
  border: 1px solid var(--line);
  border-radius: 30px;
  box-shadow:
    0 34px 90px rgba(0, 0, 0, 0.58),
    0 0 0 1px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.auth-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.65), transparent 68%);
}

.card-glow {
  position: absolute;
  top: -74px;
  left: 50%;
  z-index: -1;
  width: 230px;
  height: 230px;
  border-radius: 999px;
  background: rgba(88, 101, 242, 0.28);
  filter: blur(46px);
  transform: translateX(-50%);
}

.server-avatar,
.status-icon {
  width: 128px;
  height: 128px;
  display: grid;
  place-items: center;
  margin-bottom: 8px;
  border-radius: 36px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.12), transparent 42%),
    var(--panel-2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    0 18px 46px rgba(0, 0, 0, 0.42),
    0 0 0 8px rgba(255, 255, 255, 0.025);
  overflow: hidden;
}

.server-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.server-avatar span,
.status-icon {
  font-size: 52px;
  font-weight: 800;
  color: var(--text);
}

.status-icon {
  color: var(--success);
}

.error .status-icon {
  color: var(--danger);
}

.eyebrow {
  margin: 0;
  color: #8f98ff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  max-width: 100%;
  margin: 0;
  font-size: clamp(30px, 8vw, 38px);
  line-height: 1.1;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.subcopy {
  max-width: 286px;
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.primary-button,
.ghost-button {
  width: 100%;
  min-height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 18px;
  border-radius: 18px;
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  text-decoration: none;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.primary-button {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.13), transparent),
    var(--discord);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    0 16px 34px rgba(88, 101, 242, 0.36),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.primary-button:hover {
  background: var(--discord-hover);
  transform: translateY(-1px);
}

.ghost-button {
  background: transparent;
  border: 1px solid var(--line);
}

.ghost-button:hover {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.04);
}

.compact {
  width: auto;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 12px;
  font-size: 14px;
}

.staff-card {
  min-height: auto;
  justify-content: flex-start;
}

.form-stack,
.settings-form,
.admin-form {
  width: 100%;
  display: grid;
  gap: 12px;
}

.form-stack label,
.settings-form label,
.admin-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-align: left;
}

input {
  width: 100%;
  min-height: 46px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
}

textarea {
  width: 100%;
  min-height: 132px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  resize: vertical;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
}

input:focus {
  border-color: rgba(88, 101, 242, 0.75);
  box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.16);
}

.alert {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid rgba(255, 102, 120, 0.35);
  border-radius: 12px;
  background: rgba(255, 102, 120, 0.12);
  color: #ffd9de;
  font-size: 13px;
  font-weight: 700;
}

.dashboard {
  width: min(100%, 1320px);
  display: grid;
  gap: 16px;
  margin-inline: auto;
  min-width: 0;
}

.dashboard-head,
.panel,
.metric {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.018)),
    var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 20px 54px rgba(0, 0, 0, 0.34);
}

.dashboard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px;
}

.dashboard-head h1 {
  font-size: 30px;
}

.dashboard-head .subcopy {
  margin: 6px 0 0;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.metric {
  display: grid;
  gap: 8px;
  padding: 18px;
}

.metric span,
.panel-title span,
.empty,
.table-row small {
  color: var(--soft);
}

.metric strong {
  font-size: 32px;
  line-height: 1;
}

.panel {
  padding: 18px;
  min-width: 0;
  overflow: hidden;
}

.chart-panel {
  padding-bottom: 12px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-title h2 {
  margin: 0;
  font-size: 17px;
}

.line-chart {
  position: relative;
  height: 154px;
  min-height: 0;
  padding: 10px 0 28px 36px;
  overflow-x: auto;
}

.line-chart::before,
.line-chart::after {
  content: "";
  position: absolute;
  left: 36px;
  right: 0;
  height: 1px;
  background: var(--line);
}

.line-chart::before {
  top: 10px;
}

.line-chart::after {
  top: 112px;
}

.line-chart svg {
  position: relative;
  z-index: 1;
  width: 100%;
  min-width: max(360px, calc(var(--chart-days, 1) * 68px));
  height: 112px;
  display: block;
  overflow: visible;
}

.line-path,
.line-area {
  vector-effect: non-scaling-stroke;
}

.line-path {
  fill: none;
  stroke: var(--success);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.line-area {
  fill: none;
  stroke: rgba(63, 209, 130, 0.12);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-scale {
  position: absolute;
  top: 5px;
  bottom: 30px;
  left: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: var(--soft);
  font-size: 11px;
  font-weight: 800;
}

.line-point {
  position: absolute;
  z-index: 2;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  border: 2px solid var(--panel);
  border-radius: 999px;
  background: var(--success);
  box-shadow: none;
}

.line-point span {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.chart-labels {
  position: relative;
  z-index: 1;
  width: 100%;
  min-width: max(360px, calc(var(--chart-days, 1) * 68px));
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 8px;
  color: var(--soft);
  font-size: 11px;
}

.zero-state {
  position: absolute;
  left: calc(50% + 18px);
  top: 78px;
  transform: translate(-50%, -50%);
  color: rgba(255, 255, 255, 0.1);
  font-size: 34px;
  line-height: 1;
  pointer-events: none;
}

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

.table-list {
  display: grid;
  gap: 8px;
}

.table-row {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.table-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.table-row.stacked {
  display: grid;
  justify-content: stretch;
}

.settings-form {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: end;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.95fr) minmax(260px, 1.05fr);
  gap: 16px;
}

.admin-grid .panel:nth-child(3) {
  grid-column: 1 / -1;
}

.admin-form {
  grid-template-columns: minmax(130px, 1fr) minmax(130px, 1fr) minmax(130px, 1fr) minmax(120px, 0.8fr) auto auto auto;
  align-items: end;
}

.license-form {
  display: grid;
  grid-template-columns: minmax(120px, 180px) minmax(120px, 180px) auto;
  align-items: end;
  gap: 12px;
}

.license-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.copy-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.copy-box input {
  overflow: hidden;
  text-overflow: ellipsis;
}

.generated-box {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.generated-box span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.license-list {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
}

.license-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.license-list code {
  color: var(--text);
  overflow-wrap: anywhere;
}

.license-list code small {
  display: block;
  margin-top: 4px;
  color: var(--soft);
  font-size: 11px;
}

.license-row strong {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.check-line {
  min-height: 46px;
  grid-auto-flow: column;
  align-items: center;
  justify-content: start;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
}

.check-line input {
  width: 18px;
  min-height: 18px;
  padding: 0;
}

.report-table {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  display: grid;
  gap: 8px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

.report-row {
  min-width: 760px;
  display: grid;
  grid-template-columns: 1.4fr 0.65fr 0.65fr 1.1fr 0.85fr;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.report-row.detail,
.detail .report-row {
  grid-template-columns: 1.1fr 1.1fr 1.35fr 1fr 0.95fr;
}

.server-table .report-row {
  min-width: 1180px;
  grid-template-columns: 1.2fr 0.55fr 1.25fr 0.9fr 0.85fr 1.05fr;
}

.event-table .report-row {
  min-width: 980px;
  grid-template-columns: 1.05fr 0.85fr 1.1fr 1.15fr 1.15fr 1.25fr;
}

.staff-table .report-row {
  min-width: 1500px;
  grid-template-columns: 1.05fr 0.55fr 0.42fr 0.42fr 0.62fr 0.55fr 2.5fr 1.2fr;
}

.staff-server-table .report-row,
.staff-recent-table .report-row {
  min-width: 680px;
  grid-template-columns: 1.35fr 0.55fr 1fr;
}

.report-head {
  min-height: 36px;
  background: rgba(255, 255, 255, 0.075);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.report-row span,
.report-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.report-row small {
  display: block;
  margin-top: 4px;
  color: var(--soft);
  font-size: 11px;
}

.button-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.danger-button {
  border-color: rgba(255, 102, 120, 0.35);
  color: #ffd9de;
}

.inline-result {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.inline-result span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.mini-password-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.mini-password-form input {
  min-height: 40px;
}

.staff-manage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 62px;
  gap: 8px;
  align-items: stretch;
}

.staff-profile-form {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(126px, 0.9fr) 76px 58px;
  gap: 8px;
  align-items: center;
}

.staff-profile-form input {
  min-height: 40px;
}

.mini-check {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.mini-check input {
  width: 15px;
  min-height: 15px;
  padding: 0;
}

.expiry-form {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.expiry-form input {
  min-height: 40px;
}

.link-form {
  display: inline;
}

.text-link {
  max-width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-weight: 800;
  text-align: left;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.text-link:hover {
  color: #9ea7ff;
}

.discord-mark {
  display: inline-grid;
  place-items: center;
  height: 24px;
  min-width: 58px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.9);
  font-size: 10px;
  font-weight: 800;
}

.fineprint {
  margin: 2px 0 0;
  color: var(--soft);
  font-size: 12px;
  line-height: 1.5;
}

.user-info {
  width: 100%;
  display: grid;
  gap: 8px;
  margin: 4px 0 2px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
}

.user-row {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.user-avatar {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #2b2f3a;
  overflow: hidden;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-avatar span {
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.user-row > span {
  min-width: 0;
  color: var(--text);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.user-info strong {
  color: var(--soft);
  font-size: 12px;
  font-weight: 600;
}

@media (max-width: 420px) {
  .auth-card {
    min-height: 456px;
    padding: 32px 20px 24px;
    border-radius: 26px;
  }

  .server-avatar,
  .status-icon {
    width: 112px;
    height: 112px;
    border-radius: 32px;
  }
}

@media (max-width: 760px) {
  .dashboard-head,
  .split,
  .admin-grid,
  .settings-form,
  .admin-form,
  .license-form,
  .copy-box {
    grid-template-columns: 1fr;
  }

  .dashboard-head {
    display: grid;
  }

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

  .compact {
    width: 100%;
  }
}
