/* QWAI — 管理端 / 门户共用样式 */
:root {
  --bg-base: #0b0f17;
  --bg-elevated: #121826;
  --bg-card: #161d2e;
  --bg-input: #0d111c;
  --border: rgba(148, 163, 184, 0.12);
  --border-strong: rgba(148, 163, 184, 0.22);
  --text: #e8edf5;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;
  --accent: #38bdf8;
  --accent-dim: rgba(56, 189, 248, 0.15);
  --accent-hover: #7dd3fc;
  --success: #34d399;
  --danger: #f87171;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 0 1px rgba(56, 189, 248, 0.12), 0 8px 40px rgba(0, 0, 0, 0.45);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text);
  line-height: 1.6;
}

/* —— 门户首页 —— */
.qwai-portal {
  min-height: 100vh;
  background: radial-gradient(ellipse 120% 80% at 50% -30%, rgba(56, 189, 248, 0.12), transparent),
    radial-gradient(ellipse 80% 50% at 100% 50%, rgba(99, 102, 241, 0.06), transparent),
    var(--bg-base);
}

.qwai-portal__header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  background: rgba(11, 15, 23, 0.75);
  position: sticky;
  top: 0;
  z-index: 10;
}

.qwai-portal__brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: 1100px;
  margin: 0 auto;
}

.qwai-portal__logo {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #38bdf8, #6366f1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  letter-spacing: -0.02em;
}

.qwai-portal__title {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.qwai-portal__subtitle {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 0.125rem;
}

.qwai-portal__main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}

.qwai-hero {
  text-align: center;
  margin-bottom: 3rem;
}

.qwai-hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: 500;
  margin-bottom: 1.25rem;
}

.qwai-hero__badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}

.qwai-hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 0.75rem;
  line-height: 1.2;
}

.qwai-hero p {
  color: var(--text-muted);
  font-size: 1.0625rem;
  max-width: 36rem;
  margin: 0 auto;
}

.qwai-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
}

.qwai-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.qwai-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

.qwai-card__icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--accent-dim);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-bottom: 1rem;
}

.qwai-card h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
  letter-spacing: -0.02em;
}

.qwai-card p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.qwai-card__actions {
  margin-top: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.qwai-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.qwai-btn--primary {
  background: linear-gradient(135deg, #0ea5e9, #6366f1);
  color: #fff;
}

.qwai-btn--primary:hover {
  filter: brightness(1.08);
}

.qwai-btn--ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text);
}

.qwai-btn--ghost:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--text-subtle);
}

.qwai-code {
  display: block;
  margin-top: 0.75rem;
  padding: 0.65rem 0.85rem;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--accent-hover);
  word-break: break-all;
  border: 1px solid var(--border);
}

.qwai-portal__footer {
  text-align: center;
  padding: 2rem 1.5rem;
  color: var(--text-subtle);
  font-size: 0.8125rem;
  border-top: 1px solid var(--border);
}

/* —— 管理端布局 —— */
.qwai-admin {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-base);
}

.qwai-admin__top {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.qwai-admin__brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.qwai-admin__logo {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #38bdf8, #6366f1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  color: #fff;
}

.qwai-admin__meta {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.qwai-admin__wrap {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem;
}

.qwai-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}

.qwai-panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.qwai-panel__head h2 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.qwai-panel__hint {
  margin: 0.35rem 0 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.qwai-field {
  margin-bottom: 1.25rem;
}

.qwai-field label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text);
  cursor: pointer;
  margin-bottom: 0.5rem;
}

.qwai-field input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
}

.qwai-textarea {
  width: 100%;
  min-height: 140px;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--bg-input);
  color: var(--text);
  font-family: inherit;
  font-size: 0.875rem;
  line-height: 1.55;
  resize: vertical;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.qwai-textarea:focus {
  outline: none;
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.qwai-textarea::placeholder {
  color: var(--text-subtle);
}

.qwai-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.qwai-btn--lg {
  padding: 0.65rem 1.35rem;
  font-size: 0.9375rem;
}

.qwai-alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.qwai-alert--success {
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.25);
  color: var(--success);
}

.qwai-alert--error {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.25);
  color: var(--danger);
}

/* 表格 */
.qwai-table-wrap {
  overflow-x: auto;
  margin: 0 -0.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.qwai-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.qwai-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-input);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.qwai-table td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  max-width: 280px;
  word-break: break-word;
}

.qwai-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.qwai-table tbody tr:last-child td {
  border-bottom: none;
}

.qwai-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 500;
}

.qwai-badge--in {
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent);
}

.qwai-badge--out {
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-muted);
}

/* 登录页 */
.qwai-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: radial-gradient(ellipse 100% 80% at 50% -20%, rgba(56, 189, 248, 0.14), transparent),
    var(--bg-base);
}

.qwai-login__card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-glow);
}

.qwai-login__card h1 {
  margin: 0 0 0.5rem;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.qwai-login__card > p {
  margin: 0 0 1.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.qwai-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--bg-input);
  color: var(--text);
  font-size: 0.9375rem;
  margin-bottom: 1rem;
  font-family: inherit;
}

.qwai-input:focus {
  outline: none;
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.qwai-login__card .qwai-btn {
  width: 100%;
}

@media (max-width: 640px) {
  .qwai-portal__main {
    padding: 2rem 1rem 3rem;
  }

  .qwai-admin__wrap {
    padding: 1rem;
  }

  .qwai-table td,
  .qwai-table th {
    padding: 0.5rem 0.65rem;
    font-size: 0.75rem;
  }
}
