* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --bg: #f4f6fb;
  --card: #fff;
  --border: #e3e7ef;
  --text: #1f2937;
  --muted: #6b7280;
  --green: #16a34a;
  --red: #dc2626;
  --amber: #d97706;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  background: #0f172a;
  color: #fff;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar .brand { font-weight: 700; font-size: 18px; letter-spacing: .3px; }
.topbar .brand span { color: #60a5fa; }
.topbar nav { display: flex; align-items: center; gap: 18px; }
.topbar nav a, .topbar nav form button { color: #cbd5e1; font-size: 14px; }
.topbar .who { color: #94a3b8; font-size: 13px; }

.container { max-width: 1100px; margin: 0 auto; padding: 28px 24px 60px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; flex-wrap: wrap; gap: 12px; }
.page-head h1 { font-size: 24px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent); color: #fff;
  border: none; border-radius: 8px;
  padding: 10px 16px; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: background .15s;
  text-decoration: none;
}
.btn:hover { background: var(--accent-dark); text-decoration: none; }
.btn.secondary { background: #e5e7eb; color: #374151; }
.btn.secondary:hover { background: #d1d5db; }
.btn.danger { background: var(--red); }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--border); }
.btn.small { padding: 6px 12px; font-size: 13px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}

/* Table */
.mag-table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 12px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.mag-table th, .mag-table td { text-align: left; padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: middle; }
.mag-table th { background: #f8fafc; color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.mag-table tr:last-child td { border-bottom: none; }
.mag-cover { width: 46px; height: 60px; object-fit: cover; border-radius: 4px; background: #eef2f7; border: 1px solid var(--border); }
.mag-title-cell { font-weight: 600; }
.mag-slug { color: var(--muted); font-size: 12px; font-family: ui-monospace, monospace; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge.ready { background: #dcfce7; color: var(--green); }
.badge.processing { background: #fef3c7; color: var(--amber); }
.badge.error { background: #fee2e2; color: var(--red); }
.badge.draft { background: #e5e7eb; color: #4b5563; }
.badge.pub { background: #dbeafe; color: var(--accent-dark); }
.badge.unpub { background: #f3f4f6; color: #9ca3af; }

.progress { height: 6px; background: #e5e7eb; border-radius: 4px; overflow: hidden; width: 90px; margin-top: 4px; }
.progress > span { display: block; height: 100%; background: var(--amber); transition: width .4s; }

.actions-cell { display: flex; gap: 6px; flex-wrap: wrap; }

/* Forms */
.form-grid { display: grid; gap: 18px; max-width: 640px; }
.field label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.field .hint { color: var(--muted); font-size: 12px; margin-top: 4px; }
.field input[type=text], .field input[type=password], .field textarea, .field input[type=file] {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; font-family: inherit;
}
.field textarea { min-height: 80px; resize: vertical; }
.slug-row { display: flex; align-items: center; gap: 8px; }
.slug-row .prefix { color: var(--muted); font-size: 14px; font-family: ui-monospace, monospace; }
.color-row { display: flex; gap: 20px; flex-wrap: wrap; }
.color-field { display: flex; align-items: center; gap: 8px; }
.color-field input[type=color] { width: 42px; height: 34px; border: 1px solid var(--border); border-radius: 6px; padding: 0; cursor: pointer; }
.check-row { display: flex; gap: 24px; flex-wrap: wrap; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; }

.error-box { background: #fee2e2; color: var(--red); padding: 12px 16px; border-radius: 8px; font-size: 14px; margin-bottom: 18px; }
.info-box { background: #dbeafe; color: var(--accent-dark); padding: 12px 16px; border-radius: 8px; font-size: 14px; margin-bottom: 18px; }

.empty { text-align: center; padding: 60px 20px; color: var(--muted); }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { width: 360px; max-width: 92vw; }
.login-card h1 { font-size: 22px; margin-bottom: 4px; }
.login-card .sub { color: var(--muted); font-size: 14px; margin-bottom: 22px; }

.upload-note { background: #f0f9ff; border: 1px solid #bae6fd; color: #075985; padding: 12px 16px; border-radius: 8px; font-size: 13px; margin-top: 8px; }

/* ===== Enhancements ===== */
.topbar nav a.on { color: #fff; font-weight: 600; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.stat-num { font-size: 28px; font-weight: 700; color: var(--accent-dark); }
.stat-label { color: var(--muted); font-size: 13px; margin-top: 2px; }

.table-wrap { overflow-x: auto; }
.issue-tag { display: inline-block; background: #eef2ff; color: var(--accent-dark); font-size: 11px; padding: 1px 7px; border-radius: 10px; margin-left: 6px; vertical-align: middle; }
.progress-pct { font-size: 11px; color: var(--amber); margin-top: 2px; }

/* forms layout */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 620px){ .two-col { grid-template-columns: 1fr; } }
.select { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; background: #fff; font-family: inherit; }

/* dropzone */
.dropzone { position: relative; border: 2px dashed var(--border); border-radius: 10px; padding: 26px 16px; text-align: center; transition: border-color .15s, background .15s; cursor: pointer; }
.dropzone.drag { border-color: var(--accent); background: #f0f7ff; }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.dz-label { color: var(--muted); font-size: 14px; pointer-events: none; }

/* upload progress */
.upload-progress { margin-top: 4px; }
.up-label { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.up-bar { height: 10px; background: #e5e7eb; border-radius: 6px; overflow: hidden; }
.up-bar > span { display: block; height: 100%; width: 0; background: linear-gradient(90deg,var(--accent),#60a5fa); transition: width .2s; }

/* asset preview */
.asset-preview { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; padding: 8px; background: #f8fafc; border: 1px solid var(--border); border-radius: 8px; }
.asset-preview img { height: 40px; width: auto; max-width: 120px; object-fit: contain; }
.asset-preview audio { height: 34px; max-width: 220px; }
