:root {
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --canvas: #f8fafc;
  --surface: #ffffff;
  --fill: #f1f5f9;
  --accent: #ff5a1f;
  --accent-deep: #e04810;
  --sidebar: #0f172a;
  --sidebar-text: #94a3b8;
  --ok: #15803d;
  --danger: #b91c1c;
  --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  --mono: "JetBrains Mono", "SF Mono", Consolas, Monaco, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--canvas);
  color: var(--ink);
  font: 14px/1.5 var(--font);
}
button, input, select { font: inherit; }
a { color: inherit; }

.login-page {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(420px, 100%);
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; }
.login-brand img { width: 32px; height: 24px; object-fit: contain; }
.login-brand b { font-size: 20px; }
.login-card h1 { margin: 0 0 8px; font-size: 20px; }
.login-card p { margin: 0 0 24px; color: var(--muted); }
.field { display: grid; gap: 8px; margin-bottom: 16px; }
.field span { color: #334155; font-weight: 600; }
.input {
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
}
.input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 90, 31, 0.2); }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: #fff;
  color: #334155;
  font-weight: 600;
  cursor: pointer;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-deep); }
.btn-outline { border-color: #cbd5e1; background: #fff; }
.btn-ghost { background: transparent; color: #64748b; }
.btn-ghost:hover { background: var(--fill); color: var(--accent); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn-danger { color: var(--danger); }
.login-error { min-height: 20px; margin: 8px 0 16px; color: var(--danger); font-size: 13px; }
.btn-block { width: 100%; }

.app-shell { display: grid; grid-template-columns: 256px 1fr; min-height: 100%; }
.sidebar {
  display: flex;
  flex-direction: column;
  background: var(--sidebar);
  color: var(--sidebar-text);
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 64px;
  padding: 0 20px;
  color: #fff;
  font-weight: 700;
}
.sidebar-brand img { width: 28px; height: 21px; object-fit: contain; }
.nav { display: grid; gap: 4px; padding: 8px; }
.nav-item {
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--sidebar-text);
  text-align: left;
  cursor: pointer;
}
.nav-item:hover { background: #1e293b; color: #f8fafc; }
.nav-item.is-active {
  background: var(--accent);
  color: #fff;
  box-shadow: inset 4px 0 0 #fff;
}
.nav-item:disabled { opacity: .4; cursor: not-allowed; }
.sidebar-user {
  margin-top: auto;
  padding: 16px;
  border-top: 1px solid #1e293b;
}
.sidebar-user b { display: block; color: #fff; margin-bottom: 8px; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 100vh; }
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.page-head h1 { margin: 0; font-size: 20px; }
.workbench { display: grid; grid-template-columns: minmax(420px, 1.1fr) minmax(420px, 1fr); min-height: 0; flex: 1; }
.column { display: flex; flex-direction: column; min-width: 0; border-right: 1px solid var(--line); background: #fff; }
.column:last-child { border-right: 0; }
.column-head, .filters, .batch {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.filters { display: grid; grid-template-columns: 1fr 1fr 140px auto; }
.column-title { font-size: 16px; font-weight: 600; }
.column-count { color: var(--muted); font-family: var(--mono); }
.list { overflow: auto; flex: 1; }
table { width: 100%; border-collapse: collapse; }
th {
  height: 36px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
  text-align: left;
}
td { height: 44px; padding: 0 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:hover td { background: #f1f5f9; }
tr.is-active td { background: #fff7ed; box-shadow: inset 3px 0 0 var(--accent); }
.thumb { width: 40px; height: 40px; object-fit: cover; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.mono { font-family: var(--mono); }
.price { color: var(--accent); font-weight: 600; }
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}
.detail { overflow: auto; padding: 16px 20px 32px; }
.detail-head { display: grid; grid-template-columns: 72px 1fr auto; gap: 16px; margin-bottom: 16px; }
.detail-head img { width: 72px; height: 72px; object-fit: cover; border: 1px solid var(--line); border-radius: 4px; }
.detail-head h2 { margin: 0 0 8px; font-size: 16px; }
.meta { display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted); }
.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--fill);
  font-size: 12px;
}
.section { margin-top: 16px; border: 1px solid var(--line); border-radius: 4px; }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
  font-weight: 600;
}
.section-body { padding: 12px; }
.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
.image-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border: 1px solid var(--line); border-radius: 4px; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 16px; }
.kv b { font-weight: 500; color: var(--muted); }
.empty { display: grid; place-items: center; min-height: 240px; color: var(--muted); text-align: center; padding: 32px; }
.extension-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 16px 24px 0;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}
.extension-banner b { display: block; font-size: 16px; margin-bottom: 4px; }
.extension-banner span { color: var(--muted); }
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.6);
}
.modal-card {
  width: min(480px, calc(100% - 48px));
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line); font-size: 16px; }
.modal-body { padding: 16px 20px; color: var(--muted); line-height: 1.6; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 16px; }
[hidden] { display: none !important; }
