:root {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #6b7280;
  --line: #dfe3ec;
  --primary: #1f6feb;
  --primary-dark: #1557bd;
  --danger: #c93535;
  --shadow: 0 12px 30px rgba(17, 24, 39, .08);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 22px;
  background: #0f172a;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar a { color: #fff; margin-left: 14px; }
.brand { display: flex; align-items: baseline; gap: 10px; }
.logo { font-size: 24px; font-weight: 800; letter-spacing: .5px; }
.sub, .user { color: #cbd5e1; font-size: 13px; }
.container { width: min(1160px, calc(100% - 28px)); margin: 24px auto; }
.footer { color: var(--muted); text-align: center; padding: 30px 0; font-size: 12px; }
.hero {
  background: linear-gradient(135deg, #ffffff, #eaf2ff);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 26px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.hero h1 { margin: 0 0 6px; font-size: 42px; }
.hero p { margin: 0 0 14px; color: var(--muted); }
.notice {
  border-left: 5px solid var(--primary);
  background: #fff;
  padding: 12px 14px;
  border-radius: 10px;
  line-height: 1.6;
}
.grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}
.card, .auth-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 20px;
}
.auth-card { max-width: 460px; margin: 60px auto; }
.card.wide { grid-row: span 2; }
h1, h2 { line-height: 1.2; }
h2 { margin-top: 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; color: var(--muted); }
.form { display: grid; gap: 10px; }
.form.compact { gap: 9px; }
label { font-weight: 700; }
input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  font: inherit;
  background: #fff;
}
textarea { resize: vertical; }
button, .button {
  appearance: none;
  border: 0;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
}
button:hover, .button:hover { background: var(--primary-dark); text-decoration: none; }
button.secondary { background: #e8eef8; color: #172033; }
button.secondary:hover { background: #dae4f3; }
button.danger { background: var(--danger); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.status { margin-top: 8px; color: var(--muted); font-size: 13px; min-height: 18px; }
.flash-wrap { margin-bottom: 16px; display: grid; gap: 8px; }
.flash { border-radius: 10px; padding: 10px 12px; background: #eef6ff; border: 1px solid #cfe4ff; }
.flash.error { background: #fff0f0; border-color: #ffd1d1; }
.flash.success { background: #effaf1; border-color: #ccefd2; }
.paste-zone {
  border: 2px dashed #b9c4d4;
  border-radius: 14px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  background: #fafcff;
  margin-top: 14px;
  outline: none;
}
.paste-zone:focus { border-color: var(--primary); color: var(--text); }
.paste-zone span { font-weight: 800; color: var(--primary); }
.list-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.items-list { display: grid; gap: 12px; }
.item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fcfdff;
}
.item-title { font-weight: 800; font-size: 17px; margin-bottom: 3px; }
.meta { color: var(--muted); font-size: 12px; }
.filename { margin-top: 10px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.item-image { display: block; margin-top: 10px; max-width: 100%; max-height: 320px; border-radius: 8px; border: 1px solid var(--line); object-fit: contain; cursor: pointer; }
pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: #f3f6fb;
  border-radius: 10px;
  padding: 10px;
  max-height: 240px;
  overflow: auto;
}
.item-actions { display: flex; gap: 8px; align-items: start; }
@media (max-width: 840px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .grid { grid-template-columns: 1fr; }
  .item { grid-template-columns: 1fr; }
  .item-actions { flex-wrap: wrap; }
}
.secondary-link { background: #e8eef8; color: #172033; }
.secondary-link:hover { background: #dae4f3; }
.admin-hero { background: linear-gradient(135deg, #ffffff, #eef7ef); }
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}
.stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 18px;
}
.stat-card span { display: block; color: var(--muted); font-size: 13px; }
.stat-card strong { display: block; font-size: 30px; margin-top: 4px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 900px; }
th, td { border-bottom: 1px solid var(--line); padding: 10px 8px; text-align: left; vertical-align: top; }
th { background: #f7f9fc; font-size: 13px; color: #334155; }
.inline-form { grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto auto; align-items: center; }
.check { display: inline-flex; gap: 6px; align-items: center; font-weight: 600; }
.check input { width: auto; }
.pill { display: inline-block; border-radius: 999px; padding: 3px 9px; background: #e8eef8; color: #172033; font-size: 12px; font-weight: 800; }
.pill.ok { background: #e8f7ed; color: #146c2e; }
.pill.stop { background: #fff0f0; color: #9f2222; }
.pill.admin { background: #fff6d8; color: #7a5200; }
.ops { display: flex; flex-wrap: wrap; gap: 6px; min-width: 260px; }
.ops form { display: inline-flex; gap: 6px; align-items: center; }
.small-btn { min-height: 32px; padding: 6px 9px; font-size: 12px; border-radius: 8px; }
.mini-input { width: 130px; min-height: 32px; padding: 6px 8px; border-radius: 8px; }
.mini-pre { max-height: 110px; font-size: 12px; margin: 6px 0 0; }
@media (max-width: 840px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .inline-form { grid-template-columns: 1fr; }
  .ops { min-width: auto; }
}
