* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif; background: #f5f2ec; color: #181512; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1fr 420px; gap: 64px; align-items: center; max-width: 1180px; margin: 0 auto; padding: 48px; }
.login-copy h1 { font-size: 56px; line-height: 1.08; margin: 18px 0; }
.login-copy p { color: #6b6258; line-height: 1.9; font-size: 17px; }
.eyebrow { color: #9a6a2f; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.login-card, .panel { border: 1px solid #ddd4c7; background: #fff; border-radius: 24px; padding: 28px; box-shadow: 0 24px 70px rgba(66,50,28,.08); }
.login-card form { display: grid; gap: 12px; margin-top: 20px; }
input, select, textarea { width: 100%; border: 1px solid #d9cebe; border-radius: 12px; background: #fff; padding: 12px 14px; outline: none; }
label { display: block; margin: 16px 0 8px; font-weight: 700; font-size: 14px; color: #4f463c; }
.primary, .dark { border: 0; border-radius: 12px; background: #181512; color: white; height: 44px; padding: 0 18px; font-weight: 700; cursor: pointer; }
.secondary { border: 1px solid #d9cebe; border-radius: 12px; background: #fbf8f2; height: 44px; padding: 0 18px; font-weight: 700; cursor: pointer; }
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: #171411; color: #f8f2e8; padding: 20px 14px; display: flex; flex-direction: column; gap: 8px; }
.brand { font-weight: 800; padding: 12px; margin-bottom: 10px; }
.side a, .side button { width: 100%; border: 0; border-radius: 10px; background: transparent; color: rgba(255,255,255,.72); padding: 11px 12px; text-align: left; cursor: pointer; }
.side a.active, .side a:hover, .side button:hover { background: rgba(255,255,255,.12); color: #fff; }
.logout { margin-top: auto; }
.main { padding: 28px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.topbar h1 { margin: 4px 0 0; font-size: 30px; }
.muted { color: #756958; font-size: 13px; }
.pill { border-radius: 999px; background: #181512; color: white; padding: 8px 14px; font-weight: 700; }
.grid { display: grid; gap: 22px; }
.grid.two { grid-template-columns: 1fr 1fr; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.actions { display: flex; gap: 10px; margin-top: 14px; }
.preview { min-height: 520px; }
.image-box { min-height: 420px; border: 1px dashed #c9bba8; border-radius: 20px; background: #fbf8f2; display: flex; align-items: center; justify-content: center; color: #756958; overflow: hidden; }
.image-box img { max-width: 100%; max-height: 100%; object-fit: contain; }
.qr-box { min-height: 280px; border: 1px solid #e5ddcf; border-radius: 18px; background: #faf8f4; display: flex; align-items: center; justify-content: center; margin: 22px 0 12px; }
.qr-box img { width: 230px; height: 230px; border-radius: 14px; background: #fff; padding: 8px; box-shadow: 0 10px 30px rgba(66,50,28,.12); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px; border-bottom: 1px solid #eee6da; text-align: left; font-size: 14px; }
th { color: #756958; font-size: 12px; text-transform: uppercase; }
.inline-form { display: flex; gap: 8px; align-items: center; margin: 4px 0; }
.inline-form input { width: 96px; padding: 8px 10px; border-radius: 9px; }
.inline-form button { height: 34px; padding: 0 12px; }
.panel h2 { margin: 0 0 10px; font-size: 18px; }
.channel-form { display: grid; gap: 12px; margin-top: 18px; }
.channel-card { border: 1px solid #ece3d7; border-radius: 16px; padding: 18px; margin-top: 16px; display: grid; gap: 12px; background: #fffdf9; }
.channel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.channel-meta { display: flex; flex-wrap: wrap; gap: 14px; color: #756958; font-size: 13px; }
.checkline { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-weight: 600; }
.checkline input { width: auto; }
.error-note { margin: 0; padding: 10px 12px; border-radius: 12px; background: #fff0ed; color: #9b2c1f; font-size: 13px; line-height: 1.6; }
.delete-form { margin: 8px 0 20px; text-align: right; }
.admin-generation-list { display: grid; gap: 16px; }
.admin-generation-card { display: grid; grid-template-columns: 220px 1fr; gap: 18px; border: 1px solid #ece3d7; border-radius: 16px; padding: 16px; background: #fffdf9; }
.admin-generation-image img, .admin-generation-image .empty-image { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; background: #f5f2ec; display: flex; align-items: center; justify-content: center; color: #756958; }
.admin-generation-body { display: grid; gap: 10px; min-width: 0; }
.admin-meta-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; color: #756958; font-size: 12px; }
.admin-generation-body textarea { width: 100%; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; line-height: 1.6; }
@media (max-width: 900px) {
  .login-page, .shell, .grid.two { grid-template-columns: 1fr; }
  .side { position: static; }
  .admin-generation-card, .admin-meta-grid { grid-template-columns: 1fr; }
}

/* SaaS UI consistency refresh */
:root {
  --app-bg: #f4f6f8;
  --app-surface: #ffffff;
  --app-surface-soft: #f8fafc;
  --app-ink: #14171f;
  --app-muted: #697386;
  --app-line: #dfe5ec;
  --app-line-strong: #cbd5e1;
  --app-brand: #0f172a;
  --app-accent: #2f6bff;
  --app-accent-soft: #eaf0ff;
  --app-success: #147d4f;
  --app-danger: #b42318;
  --app-shadow: 0 18px 48px rgba(15, 23, 42, .08);
  --app-radius: 8px;
}

body {
  background:
    radial-gradient(circle at 20% -10%, rgba(47, 107, 255, .08), transparent 28%),
    linear-gradient(180deg, #f8fafc 0%, var(--app-bg) 100%);
  color: var(--app-ink);
}

input, select, textarea {
  border-color: var(--app-line);
  border-radius: var(--app-radius);
  background: #fff;
  color: var(--app-ink);
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

input:focus, select:focus, textarea:focus {
  border-color: rgba(47, 107, 255, .72);
  box-shadow: 0 0 0 3px rgba(47, 107, 255, .12);
}

label { color: #334155; }

.primary, .dark, .secondary {
  border-radius: var(--app-radius);
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease, background .16s ease;
}

.primary, .dark {
  background: var(--app-brand);
  box-shadow: 0 10px 22px rgba(15, 23, 42, .12);
}

.secondary {
  background: #fff;
  border-color: var(--app-line-strong);
  color: #334155;
}

.primary:hover, .dark:hover, .secondary:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(15, 23, 42, .12);
}

.shell {
  background:
    linear-gradient(90deg, #0f172a 0 240px, transparent 240px),
    var(--app-bg);
}

.side {
  background: #0f172a;
  border-right: 1px solid rgba(255,255,255,.08);
  gap: 4px;
}

.brand {
  letter-spacing: .02em;
  display: flex;
  align-items: center;
  min-height: 44px;
}

.side a, .side button {
  border-radius: var(--app-radius);
  color: rgba(226,232,240,.72);
  font-weight: 650;
}

.side a.active, .side a:hover, .side button:hover {
  background: rgba(255,255,255,.10);
  color: #fff;
}

.main {
  padding: 28px 32px 40px;
  min-width: 0;
}

.topbar {
  min-height: 64px;
  align-items: flex-start;
  border-bottom: 1px solid var(--app-line);
  padding-bottom: 18px;
}

.topbar h1 {
  font-size: 28px;
  line-height: 1.2;
  color: var(--app-ink);
}

.muted {
  color: var(--app-muted);
  line-height: 1.55;
}

.pill {
  background: var(--app-accent-soft);
  color: #1d4ed8;
  border: 1px solid #c7d7fe;
  border-radius: 999px;
  box-shadow: none;
}

.panel {
  border-color: var(--app-line);
  border-radius: var(--app-radius);
  box-shadow: var(--app-shadow);
  background: rgba(255,255,255,.96);
}

.panel h2 {
  color: var(--app-ink);
  letter-spacing: 0;
}

.grid { gap: 18px; }
.grid.two { align-items: start; }

.actions {
  align-items: center;
  flex-wrap: wrap;
}

.table-panel {
  padding: 0;
  overflow: hidden;
}

.admin-table {
  border-collapse: separate;
  border-spacing: 0;
}

.admin-table thead th {
  background: var(--app-surface-soft);
  border-bottom-color: var(--app-line);
  color: #475569;
  font-size: 12px;
  letter-spacing: .04em;
}

.admin-table th, .admin-table td {
  border-bottom-color: var(--app-line);
  vertical-align: top;
}

.admin-table tbody tr:hover td {
  background: #fbfdff;
}

.inline-form {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.inline-form input {
  width: 112px;
  border-radius: 7px;
}

.inline-form input[name="reason"] { width: 150px; }

.channel-editor-panel, .channel-list-panel, .admin-audit-panel {
  margin-bottom: 18px;
}

.channel-card, .admin-generation-card {
  border-color: var(--app-line);
  border-radius: var(--app-radius);
  background: var(--app-surface-soft);
}

.channel-head {
  align-items: center;
}

.channel-meta {
  color: var(--app-muted);
}

.checkline {
  color: #334155;
}

.error-note {
  border: 1px solid #ffd5cf;
  background: #fff4f2;
  color: var(--app-danger);
}

.delete-form {
  margin: -8px 0 18px;
}

.admin-generation-list {
  gap: 14px;
}

.admin-generation-image img,
.admin-generation-image .empty-image,
.empty-image {
  border: 1px solid var(--app-line);
  background: #eef2f7;
}

.admin-meta-grid {
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
}

.admin-meta-grid span {
  background: #fff;
  border: 1px solid var(--app-line);
  border-radius: 7px;
  padding: 8px 10px;
  color: #475569;
}

.admin-generation-body textarea {
  background: #fff;
  border-color: var(--app-line);
}

.qr-box, .image-box {
  border-color: var(--app-line);
  border-radius: var(--app-radius);
  background: var(--app-surface-soft);
}

@media (max-width: 900px) {
  .shell { background: var(--app-bg); }
  .side {
    flex-direction: row;
    overflow-x: auto;
    padding: 12px;
  }
  .side .brand { min-width: max-content; }
  .side a, .side button { white-space: nowrap; }
  .main { padding: 18px; }
  .topbar { gap: 14px; flex-wrap: wrap; }
  .admin-table { min-width: 760px; }
  .table-panel { overflow-x: auto; }
}
