:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #1a1a2e;
  --muted: #6b7280;
  --accent: #2e86ab;
  --accent-dark: #246a89;
  --border: #e3e6ea;
  --ok: #1f9d55;
  --danger: #d64545;
  --shadow: 0 1px 3px rgba(0,0,0,.08);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}
button { font-family: inherit; cursor: pointer; }
input, textarea, select {
  font-family: inherit;
  font-size: 14px;
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}
textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
h1, h2, h3 { color: var(--ink); }

/* ── Login ─────────────────────────────── */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
}
.login-card {
  background: var(--card); padding: 32px; border-radius: 14px; box-shadow: var(--shadow);
  width: 100%; max-width: 360px;
}
.login-card h1 { margin: 0 0 4px; font-size: 22px; }
.login-card p.sub { margin: 0 0 22px; color: var(--muted); font-size: 14px; }
.btn {
  background: var(--accent); color: #fff; border: none; padding: 11px 16px;
  border-radius: 8px; font-size: 15px; font-weight: 600; width: 100%;
}
.btn:hover { background: var(--accent-dark); }
.btn.secondary { background: #eef1f4; color: var(--ink); width: auto; }
.btn.secondary:hover { background: #e1e6eb; }
.btn.small { width: auto; padding: 7px 13px; font-size: 13px; }
.btn.danger { background: var(--danger); }
.err { color: var(--danger); font-size: 13px; margin-top: 12px; min-height: 18px; }

/* ── Layout ─────────────────────────────── */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 230px; background: #1a1a2e; color: #cdd2dc; padding: 22px 0; flex-shrink: 0;
}
.sidebar .brand { font-size: 18px; font-weight: 700; color: #fff; padding: 0 22px 18px; }
.sidebar a {
  display: block; padding: 11px 22px; color: #cdd2dc; text-decoration: none; font-size: 14px;
  border-left: 3px solid transparent;
}
.sidebar a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar a.active { background: rgba(46,134,171,.18); border-left-color: var(--accent); color: #fff; }
.main { flex: 1; min-width: 0; }
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 28px; background: #fff; border-bottom: 1px solid var(--border);
}
.topbar .title { font-weight: 600; font-size: 16px; }
.content { padding: 26px 28px; max-width: 980px; }

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 22px; margin-bottom: 20px; box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 4px; font-size: 17px; }
.card .hint { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.actions { margin-top: 18px; display: flex; gap: 10px; align-items: center; }

.tab { display: none; }
.tab.active { display: block; }

/* ── Tables / lists ──────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
.stats { display: flex; gap: 16px; flex-wrap: wrap; }
.stat { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 16px 20px; min-width: 120px; }
.stat .n { font-size: 26px; font-weight: 700; color: var(--accent); }
.stat .l { font-size: 13px; color: var(--muted); }

.cat-block { border: 1px solid var(--border); border-radius: 10px; padding: 16px; margin-bottom: 14px; background: #fafbfc; }
.cat-head { display: flex; gap: 10px; align-items: center; }
.cat-head input { flex: 1; }
.prod-row { display: flex; gap: 8px; margin-top: 8px; }
.prod-row input { flex: 1; }

.toast {
  position: fixed; bottom: 24px; right: 24px; background: #1a1a2e; color: #fff;
  padding: 13px 18px; border-radius: 9px; box-shadow: 0 4px 14px rgba(0,0,0,.2);
  font-size: 14px; opacity: 0; transform: translateY(10px); transition: .25s; pointer-events: none; z-index: 50;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.ok { background: var(--ok); }
.toast.err { background: var(--danger); }
.muted { color: var(--muted); }
.tag { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 20px; background: #eef1f4; color: var(--muted); }
.tag.publish { background: #e3f5ea; color: var(--ok); }
.tag.draft { background: #fdf0d5; color: #9a6b00; }
