/* ============================================================
   fursona.io · 管理后台样式
   与主站同一套色板：暗色 #0d1117 / 亮色 #ffffff，主色琥珀 #f59e0b
   ============================================================ */

:root {
  --bg:        #0d1117;
  --bg-elevated: #161b22;
  --bg-inset:  #0a0d12;

  --fg:        #e6edf3;
  --fg-muted:  #8b949e;
  --fg-dim:    #6e7681;

  --border:        #21262d;
  --border-strong: #30363d;

  --accent:      #f59e0b;
  --accent-hover:#fbbf24;
  --accent-soft: rgba(245, 158, 11, 0.12);

  --ok:         #22c55e;
  --ok-soft:    rgba(34, 197, 94, 0.12);
  --warn:       #eab308;
  --warn-soft:  rgba(234, 179, 8, 0.12);
  --danger:     #ef4444;
  --danger-soft:rgba(239, 68, 68, 0.12);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", sans-serif;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --t-fast: 120ms;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

code, .mono { font-family: var(--mono); }

/* ---------------- 图钉 ---------------- */
.logo-mark {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #1a1206;
  font-weight: 800;
  font-size: 13px;
}

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: var(--bg-elevated);
  color: var(--fg);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease),
              opacity var(--t-fast) var(--ease);
}

.btn:hover:not(:disabled) { border-color: var(--border-strong); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: #1a1206;
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: transparent;
}

.btn-ghost { background: transparent; }
.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: transparent;
}
.btn-danger:hover:not(:disabled) { background: var(--danger-soft); }

.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-xs { padding: 4px 9px; font-size: 12px; font-weight: 550; }

/* ---------------- 表单 ---------------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field > span {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--fg-muted);
}

.field small {
  font-size: 11.5px;
  color: var(--fg-dim);
}

.field input {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--bg-inset);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 13.5px;
  transition: border-color var(--t-fast) var(--ease),
              box-shadow var(--t-fast) var(--ease);
}

.field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field input::placeholder { color: var(--fg-dim); font-family: var(--font); }

.field-wide { grid-column: 1 / -1; }

/* ============================================================
   登录
   ============================================================ */
.login-view {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 28px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.2px;
}

.login-sub {
  margin: 0;
  font-size: 13px;
  color: var(--fg-muted);
}

.login-error,
.form-error {
  padding: 9px 12px;
  border-radius: var(--radius-md);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 12.5px;
  line-height: 1.5;
}

.form-ok {
  padding: 9px 12px;
  border-radius: var(--radius-md);
  background: var(--ok-soft);
  color: var(--ok);
  font-size: 12.5px;
}

/* ============================================================
   主界面
   ============================================================ */
.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border);
  background: rgba(13, 17, 23, 0.85);
  backdrop-filter: blur(12px);
}

.app-header-inner {
  display: flex;
  align-items: center;
  gap: 28px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
}

.app-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 14.5px;
  letter-spacing: -0.2px;
  white-space: nowrap;
}

.app-nav { flex: 1 1 auto; display: flex; gap: 4px; }

.app-nav-item {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 550;
}

.app-nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.app-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-user-email {
  font-size: 12.5px;
  color: var(--fg-muted);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 24px 80px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ---------------- 面板 ---------------- */
.panel {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.panel-head h2 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 650;
}

.panel-head-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.search-input {
  padding: 7px 12px;
  width: 200px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--bg-inset);
  color: var(--fg);
  font-family: inherit;
  font-size: 13px;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ---------------- 新建表单 ---------------- */
.create-form {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 20px;
}

.pct-input {
  display: flex;
  align-items: center;
  gap: 0;
}

.pct-input input {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right: 0;
}

.pct-input span {
  display: grid;
  place-items: center;
  padding: 0 14px;
  align-self: stretch;
  border: 1px solid var(--border-strong);
  border-left: 0;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  background: var(--bg-inset);
  color: var(--fg-muted);
  font-size: 13px;
}

.create-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
}

#createError, #createOk { margin: 0 20px 20px; }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow-x: auto; }

.promo-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.promo-table th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--fg-dim);
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

.promo-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.promo-table tr:last-child td { border-bottom: 0; }

.promo-table tbody tr:hover { background: var(--bg-inset); }

.num { text-align: right; font-variant-numeric: tabular-nums; }

.code {
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  background: var(--bg-inset);
  border: 1px solid var(--border);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.note {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--fg-muted);
}

.dim { color: var(--fg-dim); }

.actions-col {
  text-align: right;
  white-space: nowrap;
}

.actions-col .btn + .btn { margin-left: 4px; }

/* ---------------- 状态标签 ---------------- */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 650;
  white-space: nowrap;
}

.badge-ok   { background: var(--ok-soft);     color: var(--ok); }
.badge-warn { background: var(--warn-soft);   color: var(--warn); }
.badge-off  { background: var(--bg-inset);    color: var(--fg-dim); }

/* ---------------- 空状态 ---------------- */
.empty, .loading {
  padding: 40px 20px;
  text-align: center;
  font-size: 13px;
  color: var(--fg-dim);
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 900px) {
  .create-form { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .app-header-inner { gap: 14px; padding: 0 16px; }
  .app-nav { display: none; }
  .app-user-email { display: none; }
  .wrap { padding: 20px 16px 60px; }
  .create-form { grid-template-columns: 1fr; }
  .panel-head { flex-wrap: wrap; }
  .search-input { width: 100%; }
}
