/* ==========================================================================
   Jem License Server — licensing authority console
   ========================================================================== */

:root {
  --bg: #f2f3ee;
  --surface: #fffdf8;
  --surface-2: #f7f8f3;
  --surface-3: #eef0e9;
  --ink: #17211d;
  --ink-soft: #46514b;
  --muted: #77817b;
  --faint: #a4aba5;
  --line: #e0e5dd;
  --line-strong: #cdd4cb;
  --accent: #d65c3d;
  --accent-deep: #b7482c;
  --accent-soft: #fbece6;
  --green: #2e7d60;
  --green-soft: #e9f3ee;
  --amber: #94661f;
  --amber-soft: #fbf2df;
  --red: #b54433;
  --red-soft: #fbece9;
  --blue: #3f6d8c;
  --blue-soft: #eaf1f6;
  --sidebar: #14211c;
  --sidebar-2: #1c2b25;
  --sidebar-text: #d9dfd9;
  --sidebar-muted: #839188;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 18px 42px rgba(25, 35, 29, .07);
  --shadow-sm: 0 2px 8px rgba(25, 35, 29, .04);
  --font: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", "Noto Serif SC", Georgia, serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg { display: block; }
h1, h2, h3, h4, p { margin: 0; }
code { font-family: var(--mono); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
::selection { color: #fff; background: var(--accent); }

.muted { color: var(--muted); }
.mono, .mono-code { font-family: var(--mono); }
.text-green { color: var(--green); }
.text-link { color: var(--accent-deep); font-weight: 600; }
.text-link:hover { text-decoration: underline; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }

/* Buttons ----------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  background: var(--surface);
  transition: transform .16s ease, background .16s ease, border-color .16s ease, box-shadow .16s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { color: #fff; background: var(--accent); box-shadow: 0 8px 18px rgba(214, 92, 61, .22); }
.btn-primary:hover { background: var(--accent-deep); }
.btn-secondary { border-color: var(--line-strong); background: var(--surface); }
.btn-secondary:hover { border-color: var(--ink-soft); }
.btn-ghost { color: var(--ink-soft); background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { color: #fff; background: var(--red); }
.btn-danger:hover { background: #963728; }
.btn-sm { min-height: 30px; padding: 0 11px; font-size: 12px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.is-danger { color: var(--red) !important; }

.icon-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--ink-soft);
  background: transparent;
}
.icon-btn:hover { border-color: var(--line); background: var(--surface); }
.icon-btn-sm { width: 26px; height: 26px; border-radius: 7px; }

.inline-form { display: inline-flex; margin: 0; }
.row-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* Forms ------------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field-label {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.field > label span { color: var(--faint); font-weight: 500; letter-spacing: 0; text-transform: none; }
.input, .select, .textarea {
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--ink);
  background: var(--surface);
  font-size: 13px;
  transition: border-color .16s ease, box-shadow .16s ease;
}
.textarea { resize: vertical; line-height: 1.7; }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.field-help { color: var(--muted); font-size: 11px; line-height: 1.6; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .span-2, .field-grid .span-2 { grid-column: 1 / -1; }
.form-stack { display: flex; flex-direction: column; gap: 16px; }
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.filter-bar {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 220px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--faint);
  background: var(--surface);
}
.search-field .input { border: 0; padding-left: 0; background: transparent; box-shadow: none; }
.filter-bar .select { width: auto; min-width: 130px; }
.switch-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  cursor: pointer;
}
.switch-row input { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--accent); }
.switch-row strong { display: block; font-size: 13px; }
.switch-row small { display: block; margin-top: 2px; color: var(--muted); font-size: 11.5px; line-height: 1.6; }
.switch-row.compact { margin-top: 0; padding: 0; border: 0; background: transparent; align-items: center; }
.switch-row.compact span { font-size: 13px; }
.section-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 14px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.section-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* Auth / setup ------------------------------------------------------------ */
.auth-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 28px 18px;
  background:
    radial-gradient(circle at 15% 10%, rgba(214, 92, 61, .12), transparent 34%),
    radial-gradient(circle at 88% 82%, rgba(46, 125, 96, .12), transparent 40%),
    #eef0e9;
}
.auth-shell { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 34px 32px 26px;
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 30px 70px rgba(24, 35, 29, .14);
}
.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-brand strong { display: block; font-family: var(--serif); font-size: 20px; letter-spacing: -.01em; }
.auth-brand small { display: block; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(160deg, var(--accent), #b7482c);
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.02em;
  box-shadow: 0 12px 24px rgba(214, 92, 61, .26);
}
.auth-head { margin: 26px 0 22px; }
.eyebrow {
  color: var(--accent-deep);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.auth-head h1 { margin: 7px 0 6px; font-family: var(--serif); font-size: 30px; font-weight: 600; letter-spacing: -.02em; }
.auth-head p { color: var(--muted); font-size: 12.5px; line-height: 1.7; }
.auth-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 10.5px;
}
.auth-foot { color: var(--faint); font-size: 10.5px; letter-spacing: .04em; }
.setup-card {
  width: 100%;
  max-width: 1000px;
  padding: 38px 40px 34px;
  border-radius: 26px;
  background: var(--surface);
  box-shadow: 0 34px 80px rgba(24, 35, 29, .14);
}
.setup-head { max-width: 720px; }
.setup-head h1 { margin: 8px 0 8px; font-family: var(--serif); font-size: 34px; font-weight: 600; letter-spacing: -.02em; }
.setup-head > p:last-child { color: var(--muted); font-size: 13px; line-height: 1.8; }
.setup-head .eyebrow { margin-top: 24px; }
.setup-grid { display: grid; grid-template-columns: .85fr 1.15fr; gap: 38px; margin-top: 30px; }
.setup-checks h2 { margin-bottom: 12px; font-size: 13px; font-weight: 700; letter-spacing: .04em; }
.check-row {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 9px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 12px;
}
.check-row em { color: var(--muted); font-size: 10.5px; font-style: normal; }
.check-icon { width: 19px; height: 19px; display: grid; place-items: center; border-radius: 6px; color: var(--green); background: var(--green-soft); }
.check-row.is-bad .check-icon { color: var(--red); background: var(--red-soft); }
.check-row.is-bad { color: var(--red); }
.hint-box {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  padding: 13px 14px;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  background: var(--surface-2);
  font-size: 11.5px;
  line-height: 1.7;
}
.hint-box svg { flex: none; margin-top: 2px; color: var(--muted); }
.hint-box strong { color: var(--ink); }
.hint-box.is-warn { color: #7c571d; background: var(--amber-soft); }
.hint-box.is-warn svg { color: var(--amber); }

/* Layout ------------------------------------------------------------------ */
.admin-body { background: var(--bg); }
.admin-layout { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px 16px 18px;
  overflow-y: auto;
  color: var(--sidebar-text);
  background:
    radial-gradient(circle at 10% 0%, rgba(214, 92, 61, .18), transparent 34%),
    linear-gradient(170deg, var(--sidebar-2), var(--sidebar) 62%);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px; }
.brand-text strong { display: block; font-family: var(--serif); font-size: 18px; font-weight: 600; letter-spacing: -.01em; color: #f4f0e6; }
.brand-text em { color: var(--accent); font-style: normal; }
.brand-text small { display: block; color: var(--sidebar-muted); font-size: 8.5px; font-weight: 700; letter-spacing: .18em; }
.server-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 6px;
  padding: 8px 11px;
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 9px;
  color: var(--sidebar-muted);
  background: rgba(255, 255, 255, .03);
  font-size: 10.5px;
  white-space: nowrap;
  overflow: hidden;
}
.server-chip i { width: 6px; height: 6px; flex: none; border-radius: 50%; background: #6fbf94; box-shadow: 0 0 0 3px rgba(111, 191, 148, .12); }
.server-chip span { overflow: hidden; text-overflow: ellipsis; }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--sidebar-muted);
  font-size: 12.5px;
  font-weight: 500;
  transition: color .16s ease, background .16s ease;
}
.nav-link:hover { color: var(--sidebar-text); background: rgba(255, 255, 255, .05); }
.nav-link.is-active { color: #fff; background: rgba(214, 92, 61, .18); box-shadow: inset 2px 0 0 var(--accent); }
.nav-link.is-active svg { color: #f0a58f; }
.sidebar-note {
  margin: auto 6px 0;
  padding: 13px 13px 12px;
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 12px;
  background: rgba(255, 255, 255, .03);
}
.sidebar-note-title { display: flex; align-items: center; gap: 6px; color: var(--sidebar-muted); font-size: 9.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.sidebar-note code { display: block; margin: 7px 0 8px; color: #cfd8d1; font-size: 9px; letter-spacing: .02em; word-break: break-all; }
.sidebar-note a { display: inline-flex; align-items: center; gap: 4px; color: #e9a58f; font-size: 10px; }
.sidebar-foot { display: flex; justify-content: space-between; align-items: center; padding: 4px 8px 0; color: var(--sidebar-muted); font-size: 10px; }
.sidebar-foot a { display: inline-flex; align-items: center; gap: 4px; }
.sidebar-foot a:hover { color: var(--sidebar-text); }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 64px;
  padding: 10px 26px;
  border-bottom: 1px solid var(--line);
  background: rgba(242, 243, 238, .86);
  backdrop-filter: blur(12px);
}
.menu-btn { display: none; }
.topbar-title { display: flex; flex-direction: column; line-height: 1.25; }
.topbar-title span { color: var(--muted); font-size: 9.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.topbar-title strong { font-size: 15px; font-weight: 700; }
.topbar-actions { display: flex; align-items: center; gap: 9px; margin-left: auto; }
.admin-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  background: var(--surface);
  font-size: 11px;
  font-weight: 600;
}
.admin-chip i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.content { padding: 28px 30px 46px; max-width: 1320px; width: 100%; margin: 0 auto; }
.scrim { position: fixed; inset: 0; z-index: 30; background: rgba(12, 20, 16, .45); }

/* Page head / alerts ------------------------------------------------------ */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 20px; flex-wrap: wrap; }
.page-kicker { color: var(--accent-deep); font-size: 9.5px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; }
.page-title { margin: 4px 0 5px; font-family: var(--serif); font-size: 29px; font-weight: 600; letter-spacing: -.02em; }
.page-desc { max-width: 720px; color: var(--muted); font-size: 12.5px; line-height: 1.7; }
.page-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.alert {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-bottom: 16px;
  padding: 12px 15px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
}
.alert svg { flex: none; margin-top: 2px; }
.alert.is-success { color: #1f6249; border-color: #c6e2d5; background: var(--green-soft); }
.alert.is-error { color: #8e3325; border-color: #f0c8c1; background: var(--red-soft); }

/* Panels ------------------------------------------------------------------ */
.panel {
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.panel.is-highlight { border-color: #ecc9bd; box-shadow: 0 12px 30px rgba(214, 92, 61, .1); }
.panel.is-danger-zone { border-color: #ecc8c1; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}
.panel-head h2 { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; }
.panel-head h2 svg { color: var(--muted); }
.panel-link { display: inline-flex; align-items: center; gap: 4px; color: var(--accent-deep); font-size: 11px; font-weight: 600; }
.panel-link:hover { text-decoration: underline; }
.panel-note { color: var(--faint); font-size: 10.5px; }
.panel-body { padding: 18px; }
.panel-foot-note { padding: 11px 18px; border-top: 1px solid var(--line); color: var(--muted); background: var(--surface-2); font-size: 10.5px; }
.empty-panel { padding: 38px 22px; text-align: center; color: var(--muted); }
.empty-icon { width: 48px; height: 48px; display: grid; place-items: center; margin: 0 auto 12px; border-radius: 14px; color: var(--accent); background: var(--accent-soft); }
.empty-panel h3 { margin-bottom: 4px; color: var(--ink); font-size: 14px; }
.empty-panel p { margin-bottom: 12px; font-size: 11.5px; }
.prose p { margin-bottom: 10px; color: var(--ink-soft); font-size: 12px; line-height: 1.8; }
.prose p:last-child { margin-bottom: 0; }

/* Stats ------------------------------------------------------------------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card { padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 10.5px; font-weight: 600; letter-spacing: .04em; }
.stat-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; }
.stat-icon.is-accent { color: var(--accent); background: var(--accent-soft); }
.stat-icon.is-green { color: var(--green); background: var(--green-soft); }
.stat-icon.is-blue { color: var(--blue); background: var(--blue-soft); }
.stat-icon.is-amber { color: var(--amber); background: var(--amber-soft); }
.stat-value { display: block; margin: 9px 0 2px; font-family: var(--serif); font-size: 28px; font-weight: 600; letter-spacing: -.02em; }
.stat-meta { color: var(--faint); font-size: 10px; }

/* Dashboard --------------------------------------------------------------- */
.dash-grid { display: grid; grid-template-columns: 1.35fr .85fr; gap: 18px; align-items: start; }
.dash-col { min-width: 0; }
.plan-breakdown { padding: 16px 18px; display: flex; flex-direction: column; gap: 11px; }
.breakdown-row { display: grid; grid-template-columns: 92px 1fr 36px; align-items: center; gap: 10px; }
.breakdown-track { height: 7px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.breakdown-track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), #e9a58f); }
.breakdown-row strong { text-align: right; font-size: 11px; }
.plan-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .08em;
}
.plan-vip { color: #8d3d28; background: var(--accent-soft); }
.plan-svip { color: #74560f; background: linear-gradient(120deg, #f7e7bd, #efd7a0); }
.plan-free { color: var(--muted); background: var(--surface-3); }
.order-mini-list { display: flex; flex-direction: column; }
.order-mini { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.order-mini:last-child { border-bottom: 0; }
.order-mini strong { display: block; font-size: 11px; }
.order-mini span { color: var(--muted); font-size: 10.5px; }
.order-mini-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.event-feed { list-style: none; margin: 0; padding: 8px 18px 14px; }
.event-feed li { display: flex; gap: 11px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.event-feed li:last-child { border-bottom: 0; }
.event-dot { width: 8px; height: 8px; flex: none; margin-top: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.event-dot.event-domain_released { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); }
.event-dot.event-domain_bound { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.event-feed p { color: var(--ink-soft); font-size: 11.5px; line-height: 1.6; }
.event-feed small { color: var(--faint); font-size: 9.5px; }

/* Tables ------------------------------------------------------------------ */
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  background: var(--surface-2);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table tbody tr:hover { background: #fffefb; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.actions-cell { text-align: right; }
.licenses-table .code-cell { display: flex; align-items: center; gap: 6px; }
.mono-code { color: var(--ink); font-size: 10.5px; font-weight: 600; letter-spacing: .01em; white-space: nowrap; }
.row-sub { display: block; margin-top: 2px; color: var(--faint); font-size: 9.5px; }
.quota-cell { min-width: 76px; max-width: 110px; }
.quota-cell strong { display: block; font-size: 10.5px; }
.quota-track { height: 4px; margin-top: 4px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.quota-track i { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 700;
  white-space: nowrap;
}
.badge.is-ok { color: #1f6249; background: var(--green-soft); }
.badge.is-warn { color: #7c571d; background: var(--amber-soft); }
.badge.is-bad { color: #8e3325; background: var(--red-soft); }

/* Pagination -------------------------------------------------------------- */
.pagination-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10.5px; }
.pagination { display: flex; align-items: center; gap: 4px; }
.page-btn {
  min-width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink-soft);
  background: var(--surface);
  font-size: 11px;
}
.page-btn:hover { border-color: var(--line-strong); background: var(--surface-2); }
.page-btn.is-current { color: #fff; border-color: var(--accent); background: var(--accent); }
.page-btn.is-disabled { opacity: .4; pointer-events: none; }
.page-ellipsis { padding: 0 4px; color: var(--faint); }

/* New codes --------------------------------------------------------------- */
.new-code-list { padding: 6px 18px 16px; }
.new-code-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px dashed var(--line); flex-wrap: wrap; }
.new-code-row:last-child { border-bottom: 0; }
.new-code-row code { flex: 1; min-width: 260px; padding: 8px 11px; border: 1px dashed var(--line-strong); border-radius: 8px; background: var(--surface-2); font-size: 12.5px; font-weight: 700; letter-spacing: .02em; }
.new-code-row .muted { font-size: 10.5px; }

/* Detail ------------------------------------------------------------------ */
.detail-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 20px; flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 9px; color: var(--muted); font-size: 10.5px; }
.back-link:hover { color: var(--ink); }
.detail-title-row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.detail-title-row .page-title { margin: 0; font-size: 25px; }
.detail-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 18px; align-items: start; }
.detail-col { min-width: 0; }
.info-list { display: flex; flex-direction: column; }
.info-row { display: flex; align-items: baseline; justify-content: space-between; gap: 18px; padding: 10px 18px; border-bottom: 1px dashed var(--line); font-size: 11.5px; }
.info-row:last-child { border-bottom: 0; }
.info-row > span:first-child { color: var(--muted); flex: none; }
.info-row strong, .info-row code { text-align: right; word-break: break-all; }
.code-box { padding: 3px 7px; border-radius: 6px; background: var(--surface-2); font-size: 10.5px; }
.domain-list { display: flex; flex-direction: column; }
.domain-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-bottom: 1px dashed var(--line); }
.domain-row:last-child { border-bottom: 0; }
.domain-main strong { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.domain-main strong svg { color: var(--green); }
.domain-main span { display: block; margin-top: 2px; color: var(--muted); font-size: 9.5px; word-break: break-all; }
.removed-list { padding: 10px 18px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; display: flex; flex-direction: column; gap: 3px; }
.removed-list p { margin-bottom: 4px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.danger-zone p { margin-bottom: 14px; color: var(--muted); font-size: 11.5px; line-height: 1.7; }

/* Plans ------------------------------------------------------------------- */
.plan-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.plan-grid.is-admin { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.plan-card {
  position: relative;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.plan-card.is-featured { border-color: #e7cfa0; box-shadow: 0 18px 40px rgba(154, 106, 34, .1); }
.plan-card.is-inactive { opacity: .62; }
.plan-card-head { display: flex; align-items: center; gap: 8px; }
.plan-ribbon { margin-left: auto; padding: 3px 8px; border-radius: 999px; color: #74560f; background: #f7e7bd; font-size: 9px; font-weight: 800; letter-spacing: .08em; }
.plan-key { margin-left: auto; font-size: 9.5px; }
.plan-name { margin: 12px 0 4px; font-family: var(--serif); font-size: 21px; font-weight: 600; }
.plan-tagline { color: var(--muted); font-size: 11px; line-height: 1.6; }
.plan-price-row { display: flex; align-items: baseline; gap: 8px; margin: 13px 0 14px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.plan-price-row strong { font-family: var(--serif); font-size: 26px; font-weight: 600; }
.plan-price-row s { color: var(--faint); font-size: 12px; }
.plan-price-row span { margin-left: auto; color: var(--muted); font-size: 10px; }
.plan-perks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.plan-perks li { display: flex; gap: 7px; color: var(--ink-soft); font-size: 11px; line-height: 1.55; }
.plan-perks svg { flex: none; margin-top: 2px; color: var(--green); }
.plan-edit { margin: 14px 0 4px; border: 1px dashed var(--line-strong); border-radius: 10px; background: var(--surface-2); }
.plan-edit summary { display: flex; align-items: center; gap: 6px; padding: 9px 12px; color: var(--ink-soft); font-size: 11px; font-weight: 600; cursor: pointer; list-style: none; }
.plan-edit summary::-webkit-details-marker { display: none; }
.plan-form { padding: 4px 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.plan-form .form-grid { gap: 10px; }
.plan-form .input, .plan-form .select { min-height: 34px; padding: 6px 9px; font-size: 11.5px; }
.plan-form .textarea { font-size: 11.5px; }
.feature-checks { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 8px; }
.feature-checks .field-label { grid-column: 1 / -1; }
.check-line { display: flex; align-items: flex-start; gap: 6px; color: var(--ink-soft); font-size: 10.5px; line-height: 1.5; }
.check-line input { margin-top: 2px; accent-color: var(--accent); }
.check-line code { color: var(--faint); font-size: 8.5px; }

/* Settings ---------------------------------------------------------------- */
.settings-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 18px; align-items: start; }
.settings-col { min-width: 0; }
.fingerprint-box { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin-bottom: 14px; padding: 11px 13px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: 10.5px; }
.fingerprint-box span { color: var(--muted); }
.fingerprint-box code { word-break: break-all; }

/* Responsive -------------------------------------------------------------- */
@media (max-width: 1180px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-grid, .detail-grid, .settings-grid { grid-template-columns: 1fr; }
  .plan-grid.is-admin { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
  .admin-layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    z-index: 40;
    left: 0;
    top: 0;
    width: 268px;
    transform: translateX(-102%);
    transition: transform .24s cubic-bezier(.22, 1, .36, 1);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  .menu-btn { display: grid; }
  .content { padding: 22px 18px 40px; }
  .topbar { padding: 9px 16px; }
  .setup-grid { grid-template-columns: 1fr; gap: 22px; }
  .setup-card { padding: 28px 22px; }
  .plan-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .stat-grid, .form-grid, .field-grid { grid-template-columns: 1fr; }
  .form-grid .span-2, .field-grid .span-2 { grid-column: auto; }
  .page-title { font-size: 24px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .topbar-actions .btn-ghost { display: none; }
  .admin-chip { display: none; }
  .info-row { flex-direction: column; gap: 3px; }
  .info-row strong, .info-row code { text-align: left; }
  .filter-bar { align-items: stretch; }
  .filter-bar .search-field, .filter-bar .select { width: 100%; }
  .feature-checks { grid-template-columns: 1fr; }
  .auth-card { padding: 28px 22px 22px; }
}

/* ==========================================================================
   Marketplace administration (v1.2)
   ========================================================================== */
.market-stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.product-table .product-cell { display: flex; align-items: center; gap: 10px; min-width: 190px; }
.product-mini {
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: #fff;
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 600;
}
.product-mini-theme { background: linear-gradient(150deg, #2fa373, #1f6f52); }
.product-mini-plugin { background: linear-gradient(150deg, #6f8fc4, #405c8c); }
.product-name { display: block; color: var(--ink); font-size: 12.5px; font-weight: 700; }
.product-name:hover { color: var(--accent-deep); text-decoration: underline; }
.pricing-text { display: block; font-size: 11px; font-weight: 600; }
.badge svg { margin-right: 3px; }
.hint-box a.text-link { color: var(--accent-deep); font-weight: 700; }

.product-editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
.product-editor-main, .product-editor-side { min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.product-editor-side { position: sticky; top: 84px; }
.product-editor .panel { margin-bottom: 0; }
.product-editor .panel-body .field + .field { margin-top: 12px; }
.package-current {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px 15px;
  border: 1px solid #cbe3d6;
  border-radius: var(--radius-sm);
  background: var(--green-soft);
}
.package-icon { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 10px; color: var(--green); background: #fff; }
.package-info { min-width: 0; flex: 1; }
.package-info strong { display: block; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.package-info span { display: block; margin: 2px 0; color: var(--ink-soft); font-size: 10px; }
.package-info code { display: block; overflow: hidden; color: var(--faint); font-size: 8.5px; text-overflow: ellipsis; white-space: nowrap; }
.manifest-example { margin-top: 15px; padding: 12px 14px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); background: var(--surface-2); }
.manifest-example > span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.manifest-example pre { margin: 0; overflow-x: auto; color: var(--ink-soft); font-size: 10px; line-height: 1.7; }
.file-input { padding: 7px 9px; font-size: 11px; background: var(--surface-2); }
.cover-preview { width: 100%; margin-top: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); object-fit: cover; }
.publish-checklist { display: flex; flex-direction: column; gap: 6px; margin: 14px 0; padding: 12px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); background: var(--surface-2); }
.publish-checklist span { display: flex; align-items: center; gap: 6px; color: var(--faint); font-size: 10.5px; }
.publish-checklist span svg { width: 11px; height: 11px; padding: 2px; border-radius: 50%; color: #fff; background: var(--line-strong); }
.publish-checklist span.is-ok { color: var(--ink-soft); }
.publish-checklist span.is-ok svg { background: var(--green); }
.security-checklist { list-style: none; display: flex; flex-direction: column; gap: 7px; }
.security-checklist li { position: relative; padding-left: 15px; color: var(--ink-soft); font-size: 10.5px; line-height: 1.5; }
.security-checklist li::before { content: ""; position: absolute; left: 2px; top: 6px; width: 5px; height: 5px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }

@media (max-width: 1180px) {
  .market-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .product-editor-grid { grid-template-columns: 1fr; }
  .product-editor-side { position: static; }
}
@media (max-width: 640px) {
  .market-stat-grid { grid-template-columns: 1fr; }
  .package-current { flex-wrap: wrap; }
}

/* ==========================================================================
   Collapsible sidebar groups (EMLOG-style)
   ========================================================================== */
.nav-group { display: flex; flex-direction: column; }
.nav-group-toggle {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  color: var(--sidebar-muted);
  background: none;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: color .16s ease, background .16s ease;
}
.nav-group-toggle:hover { color: var(--sidebar-text); background: rgba(255, 255, 255, .05); }
.nav-group-toggle > span { flex: 1; min-width: 0; }
.nav-group-toggle > svg:last-child { flex: none; opacity: .55; transition: transform .2s ease; }
.nav-group.is-open .nav-group-toggle > svg:last-child { transform: rotate(180deg); }
.nav-group.is-current > .nav-group-toggle { color: var(--sidebar-text); }
.nav-children {
  /* Animate max-height: the 0fr grid trick keeps children measurable in some
     browsers, which left collapsed groups visibly expanded. */
  display: block;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transition: max-height .22s ease, opacity .18s ease, visibility .22s;
}
.nav-group.is-open > .nav-children {
  max-height: 420px;
  opacity: 1;
  visibility: visible;
}
.nav-sublink {
  display: flex;
  align-items: center;
  margin-left: 29px;
  padding: 8px 12px;
  border-left: 1px solid rgba(255, 255, 255, .1);
  color: var(--sidebar-muted);
  font-size: 12px;
  transition: color .16s ease, border-color .16s ease;
}
.nav-sublink:hover { color: var(--sidebar-text); border-color: rgba(255, 255, 255, .28); }
.nav-sublink.is-active { color: #fff; font-weight: 600; border-color: var(--accent); }
.nav-sublink.is-active::before {
  content: "";
  width: 5px;
  height: 5px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--accent);
}

/* ==========================================================================
   Package upload screen
   ========================================================================== */
.upload-type-switch { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.upload-type-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.upload-type-card:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.upload-type-card.is-active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset, 0 6px 18px rgba(214, 92, 61, .08); }
.upload-type-card strong { font-size: 13px; }
.upload-type-card small { color: var(--muted); font-size: 10.5px; }
.upload-type-icon { display: grid; place-items: center; width: 34px; height: 34px; margin-bottom: 5px; border-radius: 9px; color: var(--accent-deep); background: var(--accent-soft); }

.upload-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
.upload-main, .upload-side { min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.upload-side { position: sticky; top: 84px; }
.upload-layout .panel { margin-bottom: 0; }
.upload-layout .panel-body .field + .field { margin-top: 12px; }
.upload-layout .panel-body .field + .publish-checklist { margin-top: 14px; }

.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 30px 22px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  text-align: center;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.dropzone-icon { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 4px; border-radius: 12px; color: var(--accent-deep); background: #fff; }
.dropzone-title { font-size: 12.5px; }
.dropzone-hint { max-width: 340px; color: var(--muted); font-size: 10.5px; line-height: 1.6; word-break: break-all; }

.inspect-status { display: block; margin-top: 12px; padding: 9px 12px; border-radius: var(--radius-sm); font-size: 10.5px; line-height: 1.6; background: var(--surface-2); color: var(--ink-soft); }
.inspect-status.is-busy { color: var(--ink-soft); background: var(--blue-soft, #eef2fb); }
.inspect-status.is-ok { color: var(--green); background: var(--green-soft); }
.inspect-status.is-error { color: var(--red); background: var(--red-soft, #fdecea); }

.manifest-result { margin-top: 14px; padding: 14px 15px; border: 1px solid #cbe3d6; border-radius: var(--radius-sm); background: var(--green-soft); }
.manifest-result-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.manifest-meta { color: var(--muted); font-size: 10px; }
.manifest-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; }
.manifest-list div { min-width: 0; }
.manifest-list dt { color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.manifest-list dd { margin: 2px 0 0; overflow: hidden; font-size: 11.5px; text-overflow: ellipsis; white-space: nowrap; }

.type-lock { display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--ink-soft); background: var(--surface-2); font-size: 11.5px; font-weight: 600; }
.empty-actions { display: flex; justify-content: center; gap: 8px; }

@media (max-width: 1180px) {
  .upload-layout { grid-template-columns: 1fr; }
  .upload-side { position: static; }
}
@media (max-width: 640px) {
  .upload-type-switch { grid-template-columns: 1fr; }
  .manifest-list { grid-template-columns: 1fr; }
}

/* 品牌标识（官网 LOGO 与 favicon）------------------------------------------ */
.brand-preview {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  padding: 16px 18px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.brand-preview-label { color: var(--muted); font-size: 9.5px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.brand-preview-card { gap: 11px; }
.brand-preview-card .brand-mark {
  width: 42px; height: 42px; display: grid; place-items: center;
  border-radius: 13px; color: #fdfcf7;
  background: linear-gradient(150deg, #2fa373, #15573f);
  font-family: var(--serif); font-size: 20px; font-weight: 700;
}
.brand-preview-card .brand-word strong { display: block; font-family: var(--serif); font-size: 20px; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; color: var(--ink); }
.brand-preview-card .brand-word em { color: #2fa373; font-style: normal; }
.brand-preview-card .brand-word small { display: block; margin-top: 2px; color: var(--faint); font-size: 8.5px; font-weight: 800; letter-spacing: .18em; }
.brand-preview-card .brand-logo { max-width: 220px; object-fit: contain; }

.brand-mode { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.brand-mode-option {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  transition: border-color .16s ease, box-shadow .16s ease;
}
.brand-mode-option:hover { border-color: var(--line-strong); }
.brand-mode-option:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.brand-mode-option input { margin-top: 2px; accent-color: var(--accent); }
.brand-mode-option strong { display: block; font-size: 12px; }
.brand-mode-option small { display: block; margin-top: 2px; color: var(--muted); font-size: 10.5px; line-height: 1.6; }

.brand-field-group { margin-bottom: 16px; }
.brand-field-group[hidden] { display: none; }
.brand-field-group .field + .field { margin-top: 12px; }

.upload-box { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }
.upload-box .field-label { margin-bottom: 0; }
.upload-box .field-label span { color: var(--faint); font-weight: 500; letter-spacing: 0; text-transform: none; }
.brand-file-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 7px; font-size: 10.5px; }
.brand-file-row code { padding: 2px 6px; border-radius: 5px; background: var(--surface-2); font-size: 10px; }
.inline-check { display: inline-flex; align-items: center; gap: 5px; color: var(--red); font-size: 10.5px; cursor: pointer; }
.inline-check input { accent-color: var(--red); }
.brand-favicon-preview { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; color: var(--muted); font-size: 10.5px; }
.brand-favicon-preview img { padding: 4px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }

@media (max-width: 640px) {
  .brand-mode { grid-template-columns: 1fr; }
  .brand-preview { flex-direction: column; align-items: flex-start; gap: 10px; }
}
