*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --yellow:  #f0b429;
  --bg:      #0d1117;
  --bg2:     #161b27;
  --bg3:     #1e2535;
  --text:    #e6edf3;
  --muted:   rgba(230,237,243,.45);
  --line:    rgba(230,237,243,.08);
  --green:   #3fb950;
  --red:     #f85149;
  --radius:  8px;
  --sidebar: 220px;
}

html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--yellow); text-decoration: none; }

/* ── Layout ──────────────────────────────────────────────────────────── */
.a-layout { display: flex; min-height: 100vh; }

.a-sidebar {
  width: var(--sidebar); flex-shrink: 0;
  background: var(--bg2);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
}

.a-logo {
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--line);
}
.a-logo-text {
  font-size: 15px; font-weight: 700; letter-spacing: .1em;
  color: var(--yellow); text-transform: uppercase;
}
.a-logo-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }

.a-nav { padding: 12px 10px; flex: 1; }
.a-nav-label {
  font-size: 10px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted);
  padding: 12px 8px 6px;
}
.a-nav a {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 6px;
  color: var(--muted); font-size: 13px; font-weight: 500;
  transition: all .15s; margin-bottom: 2px;
}
.a-nav a:hover { background: rgba(255,255,255,.05); color: var(--text); }
.a-nav a.active { background: rgba(240,180,41,.12); color: var(--yellow); }
.a-nav-icon { font-size: 16px; width: 18px; flex-shrink: 0; }

.a-sidebar-foot {
  padding: 12px 10px;
  border-top: 1px solid var(--line);
}
.a-sidebar-foot a {
  display: flex; align-items: center; gap: 8px;
  color: var(--muted); font-size: 12px; padding: 6px 8px; border-radius: 6px;
}
.a-sidebar-foot a:hover { color: var(--red); }

.a-main { flex: 1; min-width: 0; overflow-x: hidden; }

/* ── Topbar ──────────────────────────────────────────────────────────── */
.a-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px; border-bottom: 1px solid var(--line);
  background: var(--bg2); position: sticky; top: 0; z-index: 50;
}
.a-topbar-title { font-size: 16px; font-weight: 600; }
.a-topbar-actions { display: flex; gap: 10px; align-items: center; }

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 6px; font-size: 13px; font-weight: 600;
  padding: 7px 14px; cursor: pointer; border: 1px solid transparent;
  transition: all .15s; font-family: inherit;
}
.btn-yellow { background: var(--yellow); color: #0d1117; border-color: var(--yellow); }
.btn-yellow:hover { background: #d4951a; }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--line); }
.btn-ghost:hover { background: var(--bg3); color: var(--text); }
.btn-green { background: rgba(63,185,80,.15); color: var(--green); border-color: rgba(63,185,80,.3); }
.btn-green:hover { background: rgba(63,185,80,.25); }
.btn-red { background: rgba(248,81,73,.1); color: var(--red); border-color: rgba(248,81,73,.25); }
.btn-red:hover { background: rgba(248,81,73,.2); }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ── Stats bar ───────────────────────────────────────────────────────── */
.a-stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 1px; background: var(--line); border-bottom: 1px solid var(--line); }
.a-stat { background: var(--bg); padding: 20px 24px; }
.a-stat-val { font-size: 26px; font-weight: 700; color: var(--yellow); line-height: 1; }
.a-stat-lbl { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ── Content area ────────────────────────────────────────────────────── */
.a-content { padding: 28px; }

/* ── Filters / toolbar ───────────────────────────────────────────────── */
.a-toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 20px; flex-wrap: wrap; }
.a-toolbar input[type=text], .a-toolbar select {
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: 6px; color: var(--text);
  font-size: 13px; padding: 7px 12px; outline: none;
  font-family: inherit;
}
.a-toolbar input[type=text]:focus, .a-toolbar select:focus { border-color: var(--yellow); }
.a-toolbar input[type=text] { min-width: 220px; }

.a-filter-tabs { display: flex; gap: 4px; }
.a-filter-tab {
  padding: 6px 14px; border-radius: 6px; font-size: 13px; font-weight: 500;
  color: var(--muted); cursor: pointer; background: none; border: 1px solid var(--line);
  transition: all .15s;
}
.a-filter-tab.active { background: var(--bg3); color: var(--text); border-color: rgba(255,255,255,.15); }
.a-filter-count { font-size: 11px; background: var(--bg3); border-radius: 10px; padding: 1px 7px; margin-left: 4px; color: var(--muted); }
.a-filter-tab.active .a-filter-count { background: rgba(240,180,41,.2); color: var(--yellow); }

/* ── Table ───────────────────────────────────────────────────────────── */
.a-table-wrap { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.a-table { width: 100%; border-collapse: collapse; }
.a-table thead th {
  padding: 10px 14px; text-align: left;
  font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted); border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.a-table tbody tr { border-top: 1px solid var(--line); transition: background .1s; }
.a-table tbody tr:first-child { border-top: none; }
.a-table tbody tr:hover { background: rgba(255,255,255,.03); }
.a-table td { padding: 12px 14px; vertical-align: middle; }
.a-table .td-img { width: 40px; padding: 8px 0 8px 14px; }
.a-table .td-thumb {
  width: 36px; height: 36px; border-radius: 5px;
  object-fit: cover; background: var(--bg3);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 16px; overflow: hidden;
}
.a-table .td-thumb img { width: 100%; height: 100%; object-fit: cover; }
.a-table .td-name { font-weight: 600; font-size: 14px; }
.a-table .td-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.a-table .td-val { font-weight: 600; color: var(--yellow); }
.a-table .td-actions { white-space: nowrap; }

/* ── Badge ───────────────────────────────────────────────────────────── */
.badge {
  display: inline-block; border-radius: 4px;
  font-size: 11px; font-weight: 700; letter-spacing: .04em;
  padding: 2px 8px;
}
.badge-publish { background: rgba(63,185,80,.15); color: var(--green); }
.badge-pending { background: rgba(240,180,41,.12); color: var(--yellow); }

/* ── Entry editor ────────────────────────────────────────────────────── */
.a-entry-grid { display: grid; grid-template-columns: 1fr 320px; gap: 24px; align-items: start; }
.a-card {
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
}
.a-card-head {
  padding: 14px 18px; border-bottom: 1px solid var(--line);
  font-size: 13px; font-weight: 600; color: var(--muted);
  display: flex; align-items: center; gap: 8px;
}
.a-card-body { padding: 18px; }

.a-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.a-form-grid .full { grid-column: 1/-1; }
.a-field { display: flex; flex-direction: column; gap: 5px; }
.a-field label {
  font-size: 11px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted);
}
.a-field input, .a-field select, .a-field textarea {
  background: var(--bg3); border: 1px solid var(--line);
  border-radius: 6px; color: var(--text);
  font-size: 14px; padding: 9px 12px; outline: none;
  font-family: inherit; transition: border-color .15s;
  -webkit-appearance: none;
}
.a-field input:focus, .a-field select:focus, .a-field textarea:focus { border-color: var(--yellow); }
.a-field textarea { resize: vertical; min-height: 80px; }

.a-form-actions {
  display: flex; gap: 10px; padding: 14px 18px;
  border-top: 1px solid var(--line); background: var(--bg);
}

/* ── Image picker ────────────────────────────────────────────────────── */
.img-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; }
.img-item {
  position: relative; border-radius: 8px; overflow: hidden;
  border: 2px solid transparent; cursor: pointer;
  transition: border-color .15s; aspect-ratio: 1;
  background: var(--bg3);
}
.img-item img { width: 100%; height: 100%; object-fit: cover; }
.img-item.selected { border-color: var(--yellow); }
.img-item-label {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,.7));
  padding: 20px 8px 6px;
  font-size: 11px; font-weight: 600; color: #fff;
  text-align: center; opacity: 0; transition: opacity .15s;
}
.img-item.selected .img-item-label,
.img-item:hover .img-item-label { opacity: 1; }
.img-item-check {
  position: absolute; top: 6px; right: 6px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--yellow); color: #0d1117;
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transform: scale(.7); transition: all .15s;
}
.img-item.selected .img-item-check { opacity: 1; transform: scale(1); }

.no-img { text-align: center; padding: 24px 12px; color: var(--muted); font-size: 13px; }

/* ── Login page ──────────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh; display: flex;
  align-items: center; justify-content: center; padding: 20px;
}
.login-box {
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: 16px; padding: 40px; width: 100%; max-width: 360px;
}
.login-logo {
  font-size: 20px; font-weight: 800; letter-spacing: .1em;
  color: var(--yellow); text-transform: uppercase;
  margin-bottom: 4px;
}
.login-sub { font-size: 13px; color: var(--muted); margin-bottom: 32px; }
.login-box .a-field { margin-bottom: 16px; }
.login-btn {
  width: 100%; background: var(--yellow); color: #0d1117;
  border: none; border-radius: 8px; font-size: 15px; font-weight: 700;
  padding: 12px; cursor: pointer; font-family: inherit;
  margin-top: 8px; transition: background .15s;
}
.login-btn:hover { background: #d4951a; }
.login-error { color: var(--red); font-size: 13px; margin-bottom: 14px; }

/* ── Alert ───────────────────────────────────────────────────────────── */
.a-alert {
  border-radius: 6px; padding: 10px 14px; font-size: 13px; margin-bottom: 18px;
}
.a-alert-success { background: rgba(63,185,80,.1); border: 1px solid rgba(63,185,80,.2); color: var(--green); }
.a-alert-error   { background: rgba(248,81,73,.1);  border: 1px solid rgba(248,81,73,.2);  color: var(--red); }

/* ── Pagination ──────────────────────────────────────────────────────── */
.a-pages { display: flex; gap: 6px; margin-top: 18px; }
.a-page {
  padding: 5px 11px; border-radius: 5px; font-size: 13px;
  border: 1px solid var(--line); color: var(--muted);
  background: none; transition: all .15s;
}
.a-page:hover { border-color: rgba(255,255,255,.2); color: var(--text); }
.a-page.active { background: var(--yellow); border-color: var(--yellow); color: #0d1117; font-weight: 700; }
