:root {
  --accent: #157a52;
  --accent-dark: #0f5c3d;
  --bg: #f4f6f5;
  --card: #ffffff;
  --border: #e3e8e6;
  --text: #1a211e;
  --muted: #6b7772;
  --danger: #c0392b;
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
}
a { color: var(--accent); }
button { font-family: inherit; }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 10px 40px rgba(0,0,0,.06);
}
.login-card h1 { font-size: 22px; margin: 0 0 4px; }
.login-card .sub { color: var(--muted); margin: 0 0 24px; font-size: 14px; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 230px;
  background: #11201a;
  color: #cfe0d8;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; color: #fff; padding: 6px 10px 20px; }
.brand .logo { width: 28px; height: 28px; background: var(--accent); border-radius: 7px; display: grid; place-items: center; color: #fff; font-weight: 700; }
.nav-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-radius: 8px; cursor: pointer; color: #cfe0d8;
  font-size: 14px; margin-bottom: 2px;
}
.nav-item:hover { background: rgba(255,255,255,.06); }
.nav-item.active { background: var(--accent); color: #fff; }
.nav-item .badge { background: var(--danger); color: #fff; border-radius: 10px; font-size: 11px; padding: 1px 7px; }
.sidebar .spacer { flex: 1; }
.sidebar .user { font-size: 13px; color: #8ba89c; padding: 10px; border-top: 1px solid rgba(255,255,255,.1); margin-top: 10px; }

.main { flex: 1; padding: 28px 34px; overflow: auto; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.page-head h2 { margin: 0; font-size: 24px; }

/* ---------- Cards / stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; }
.stat {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px;
}
.stat .n { font-size: 32px; font-weight: 700; }
.stat .l { color: var(--muted); font-size: 13px; margin-top: 4px; }
.stat.alert .n { color: var(--danger); }

/* ---------- Table ---------- */
.table-wrap { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: top; }
th { background: #fafbfa; color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
tr:last-child td { border-bottom: none; }
td .row-actions { display: flex; gap: 8px; }
.empty { padding: 40px; text-align: center; color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
  background: var(--accent); color: #fff; border: none; padding: 9px 16px;
  border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 500;
}
.btn:hover { background: var(--accent-dark); }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--border); }
.btn.ghost:hover { background: #f0f4f2; }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid #f0d4d0; }
.btn.danger:hover { background: #fdf0ee; }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
.field input[type=text], .field input[type=password], .field input[type=number],
.field input[type=email], .field textarea, .field select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; font-family: inherit; background: #fff;
}
.field textarea { min-height: 90px; resize: vertical; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.editorjs-holder {
  border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 14px; min-height: 160px; background: #fff;
}
.editorjs-holder .ce-block__content, .editorjs-holder .ce-toolbar__content { max-width: none; }
.editorjs-holder .codex-editor__redactor { padding-bottom: 60px !important; }
.field.check { display: flex; align-items: center; gap: 8px; }
.field.check label { margin: 0; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(10,20,15,.45);
  display: flex; align-items: flex-start; justify-content: center; padding: 40px 20px; overflow: auto; z-index: 50;
}
.modal {
  background: var(--card); border-radius: var(--radius); width: 100%; max-width: 620px;
  padding: 26px 28px; box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.modal h3 { margin: 0 0 20px; font-size: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

/* ---------- Misc ---------- */
.pill { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.pill.new { background: #fde9e7; color: var(--danger); }
.pill.in_progress { background: #fff3d9; color: #b7791f; }
.pill.done { background: #e2f3ea; color: var(--accent); }
.pill.spam { background: #eceff0; color: var(--muted); }
.pill.on { background: #e2f3ea; color: var(--accent); }
.pill.off { background: #eceff0; color: var(--muted); }
.error-msg { background: #fdecea; color: var(--danger); padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }
.muted { color: var(--muted); }
.tag { display: inline-block; background: #eef2f0; border-radius: 6px; padding: 1px 8px; font-size: 12px; margin: 0 4px 4px 0; }
