:root {
  --bg: #09111a;
  --bg-soft: #101a25;
  --panel: rgba(12, 20, 31, 0.9);
  --panel-strong: rgba(18, 27, 41, 0.98);
  --line: rgba(255, 255, 255, 0.08);
  --text: #eef4ff;
  --muted: #9eaab9;
  --accent: #0fb7ff;
  --accent-soft: rgba(15, 183, 255, 0.16);
  --success: #38d39f;
  --warning: #ffcb58;
  --danger: #ff6576;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top, rgba(10, 127, 183, 0.2), transparent 30%),
    radial-gradient(circle at 80% 20%, rgba(255, 101, 118, 0.12), transparent 25%),
    var(--bg);
  color: var(--text);
  font-family: "Avenir Next", "PingFang SC", "Helvetica Neue", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.admin-body {
  padding: 28px;
}

.admin-login {
  padding: 0;
}

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

.login-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(12, 18, 28, 0.96), rgba(9, 14, 22, 0.96));
  box-shadow: var(--shadow);
}

.login-card {
  width: min(100%, 440px);
  padding: 28px;
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

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

h1 {
  font-size: clamp(32px, 5vw, 46px);
}

h2 {
  font-size: 28px;
}

.muted {
  color: var(--muted);
}

.warning-box {
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 203, 88, 0.18);
  border-radius: 16px;
  background: rgba(255, 203, 88, 0.08);
  color: #ffe28e;
}

.inline-link {
  color: #b7ebff;
}

.stack-form {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

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

.field-group,
.folder-input-stack {
  display: grid;
  gap: 12px;
}

.field span {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.84);
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.field small {
  color: var(--muted);
}

.field-inline-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.folder-add-btn,
.folder-remove-btn {
  padding: 10px 14px;
  border-radius: 14px;
}

.folder-remove-btn {
  min-width: 72px;
}

.primary-btn,
.ghost-btn,
.secondary-btn {
  border: 0;
  border-radius: 16px;
  padding: 14px 18px;
  transition: transform 160ms ease, background 160ms ease, opacity 160ms ease;
}

.primary-btn {
  background: linear-gradient(135deg, var(--accent), #0278ff);
  color: white;
  font-weight: 700;
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.ghost-btn {
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.danger-btn {
  color: #ffb7c0;
  border-color: rgba(255, 101, 118, 0.2);
  background: rgba(255, 101, 118, 0.08);
}

.primary-btn:hover,
.ghost-btn:hover,
.secondary-btn:hover {
  transform: translateY(-1px);
}

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

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-user {
  color: rgba(255, 255, 255, 0.76);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.panel {
  padding: 22px;
}

.panel-divider {
  height: 1px;
  margin: 26px 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
}

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

.panel-head--compact {
  margin-bottom: 10px;
}

.panel-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.progress-block {
  display: flex;
  align-items: center;
  gap: 14px;
}

.progress-bar {
  flex: 1;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #34d399);
}

.case-list {
  display: grid;
  gap: 16px;
}

.case-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
}

.case-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.case-title {
  margin: 0;
  font-size: 22px;
}

.case-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}

.case-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 78px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.case-badge.is-ready {
  background: rgba(56, 211, 159, 0.14);
  color: #8ff2cb;
}

.case-badge.is-processing,
.case-badge.is-uploaded {
  background: rgba(15, 183, 255, 0.14);
  color: #8ddfff;
}

.case-badge.is-failed {
  background: rgba(255, 101, 118, 0.16);
  color: #ffb1bc;
}

.case-description {
  margin: 0;
  color: rgba(255, 255, 255, 0.8);
}

.case-links {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.case-links a,
.case-links span {
  word-break: break-all;
}

.case-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.case-editor {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
}

.case-editor[hidden] {
  display: none;
}

.editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.security-panel {
  display: grid;
}

.mini-btn {
  border: 0;
  border-radius: 14px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.qr-preview {
  width: 116px;
  height: 116px;
  object-fit: cover;
  border-radius: 16px;
  background: white;
  padding: 8px;
}

.empty-state {
  padding: 24px;
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(16px);
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(8, 12, 18, 0.94);
  color: white;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
  box-shadow: var(--shadow);
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

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

  .topbar {
    flex-direction: column;
  }
}

@media (max-width: 600px) {
  .admin-body {
    padding: 16px;
  }

  .panel,
  .login-card {
    padding: 18px;
    border-radius: 20px;
  }
}
