:root {
  --primary: #c8102e;
  --ink: #171a21;
  --ink-2: #505665;
  --muted: #8a909c;
  --line: #e7e9ee;
  --bg: #f3f4f7;
  --side: #14161b;
  --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.5 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; }
.muted { color: var(--muted); }
code { background: var(--bg); padding: 2px 6px; border-radius: 4px; font-size: 12.5px; }

/* Layout */
.admin { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--side); color: #aeb3bd; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 800; font-size: 17px; padding: 20px; border-bottom: 1px solid #23262d; }
.brand:hover { text-decoration: none; }
.brand small { font-weight: 500; color: #7e838d; font-size: 11px; margin-left: auto; text-transform: uppercase; letter-spacing: 1px; }
.mark { width: 34px; height: 34px; border-radius: 8px; background: var(--primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; font: 900 19px Georgia, serif; flex-shrink: 0; }
.side nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; color: #b7bcc6; font-weight: 500; }
.side nav a:hover { background: #1f2229; color: #fff; text-decoration: none; }
.side nav a.active { background: var(--primary); color: #fff; }
.side nav svg { width: 18px; height: 18px; flex-shrink: 0; }
.badge { margin-left: auto; background: #f59e0b; color: #111; font-size: 11px; border-radius: 999px; padding: 1px 8px; }
.side-foot { padding: 16px 20px; border-top: 1px solid #23262d; }
.side-foot a { color: #b7bcc6; }

.main { min-width: 0; }
.top { display: flex; align-items: center; gap: 16px; background: #fff; padding: 0 28px; height: 64px; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.top h1 { font-size: 19px; font-weight: 800; }
.menu-btn { display: none; background: none; border: 0; font-size: 22px; cursor: pointer; }
.user { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.user .avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--ink); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.who { display: flex; flex-direction: column; line-height: 1.2; }
.who small { color: var(--muted); }
.user form { margin: 0 0 0 8px; }
.page { padding: 24px 28px 48px; max-width: 1400px; }
.greet { margin: 0 0 18px; font-size: 15px; }

/* Components */
.panel { background: #fff; border-radius: var(--radius); padding: 20px; margin-bottom: 20px; border: 1px solid var(--line); }
.panel.no-pad { padding: 0; overflow-x: auto; }
.panel h3 { font-size: 15px; margin-bottom: 14px; }
.panel.narrow { max-width: 620px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 10px; }
.panel-head h2 { font-size: 15px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; border-left: 4px solid var(--c); }
.stat span { color: var(--ink-2); font-size: 13px; font-weight: 500; }
.stat strong { display: block; font-size: 28px; font-weight: 800; margin-top: 4px; }
.stat-blue { --c: #2563eb; } .stat-amber { --c: #f59e0b; } .stat-gray { --c: #9ca3af; } .stat-green { --c: #16a34a; } .stat-red { --c: var(--primary); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-2 > .panel { margin-bottom: 0; }
.grid-2 + .grid-2 { margin-top: 20px; }
.grid-side { display: grid; grid-template-columns: 360px 1fr; gap: 20px; align-items: start; }

.bars { display: flex; align-items: flex-end; gap: 6px; height: 170px; padding-top: 10px; }
.bar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; }
.bar i { width: 100%; max-width: 28px; background: var(--primary); border-radius: 4px 4px 0 0; min-height: 3px; opacity: .85; }
.bar:hover i { opacity: 1; }
.bar small { color: var(--muted); font-size: 11px; }
.rank { margin: 0; padding-left: 20px; }
.rank li { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; gap: 10px; justify-content: space-between; }
.rank li:last-child { border: 0; }
.rank a { color: var(--ink); font-weight: 500; }
.rank span { color: var(--muted); white-space: nowrap; font-size: 12.5px; }

.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 600; padding: 12px 16px; border-bottom: 1px solid var(--line); background: #fafbfc; white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafbfc; }
.panel:not(.no-pad) .table td { padding: 10px 0; }
.table a { color: var(--ink); }
.table a:hover { color: var(--primary); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.title-cell { display: flex; gap: 12px; align-items: center; min-width: 300px; }
.title-cell img, .noimg { width: 72px; height: 44px; object-fit: cover; border-radius: 6px; flex-shrink: 0; background: var(--bg); display: block; }
.actions { white-space: nowrap; text-align: right; }
.actions a, .actions form { display: inline-block; margin-left: 10px; font-size: 13px; font-weight: 500; }
.actions a { color: var(--ink-2); }
.flags { margin-top: 4px; display: flex; gap: 4px; }
.flag { font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 4px; text-transform: uppercase; letter-spacing: .3px; }
.fl-hl { background: #e0e7ff; color: #3730a3; } .fl-br { background: #fee2e2; color: #b91c1c; } .fl-sc { background: #fef3c7; color: #92400e; }
.st { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.st-published { background: #dcfce7; color: #166534; } .st-draft { background: #f1f2f5; color: #4b5563; } .st-review { background: #fef3c7; color: #92400e; }
.role { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.role-admin { background: #fee2e2; color: #b91c1c; } .role-editor { background: #dbeafe; color: #1d4ed8; } .role-penulis { background: #f1f2f5; color: #4b5563; }
.empty { text-align: center; color: var(--muted); padding: 32px !important; }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; border-radius: 8px; color: var(--ink-2); font-weight: 500; }
.tabs a b { background: var(--line); border-radius: 999px; padding: 0 8px; font-size: 12px; margin-left: 4px; }
.tabs a.active { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.06); border: 1px solid var(--line); }
.tabs a:hover { text-decoration: none; }
.filters { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.filters input { flex: 1; min-width: 200px; }
.filters select, .filters input { width: auto; }
.bulk { display: flex; gap: 8px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.bulk .check { margin: 0 8px 0 0; }
.comment-body { margin: 6px 0; white-space: normal; }

/* Forms */
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=search], input[type=datetime-local], select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid #d5d8df; border-radius: 8px; font: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent); }
input[type=color] { width: 60px; height: 38px; padding: 2px; border: 1px solid #d5d8df; border-radius: 8px; background: #fff; display: block; }
input[type=file] { font-size: 13px; width: 100%; margin: 6px 0; }
.lbl { display: block; font-weight: 600; font-size: 13px; margin: 14px 0 6px; }
.lbl input, .lbl select, .lbl textarea { margin-top: 6px; font-weight: 400; }
.stack .lbl:first-of-type { margin-top: 0; }
.stack h3 { margin-top: 24px; }
.check { display: flex; align-items: center; gap: 8px; margin: 10px 0; font-weight: 400; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--primary); color: #fff; border: 1px solid var(--primary); padding: 9px 18px; border-radius: 8px; font: 600 14px inherit; font-family: inherit; cursor: pointer; text-decoration: none !important; }
.btn:hover { filter: brightness(.93); }
.btn-light { background: #fff; color: var(--ink); border-color: #d5d8df; }
.btn-danger { background: #fff; color: #b91c1c; border-color: #fca5a5; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; margin-top: 18px; padding: 11px; }
.btn-row { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.btn-link { background: none; border: 0; padding: 0; color: var(--ink-2); font: 500 13px inherit; font-family: inherit; cursor: pointer; }
.btn-link:hover { color: var(--primary); text-decoration: underline; }
.btn-link.danger { color: #b91c1c; } .btn-link.ok { color: #15803d; }
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-weight: 500; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.role-help { font-size: 12.5px; margin-top: 12px; line-height: 1.6; }

/* Editor */
.editor-form { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.editor-side { position: sticky; top: 84px; }
.editor-side .panel { margin-bottom: 16px; }
.editor-side .panel .lbl:first-of-type { margin-top: 0; }
.input-title { font-size: 24px !important; font-weight: 800; border: 0 !important; padding: 4px 0 !important; box-shadow: none !important; }
.slug-row { display: flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--muted); margin: 6px 0 16px; border-bottom: 1px solid var(--line); padding-bottom: 14px; }
.slug-row span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
.slug-row input { border: 0; padding: 2px 4px; font-size: 12.5px; background: var(--bg); }
#editor { min-height: 420px; font-size: 16px; }
.ql-toolbar.ql-snow { border-radius: 8px 8px 0 0; border-color: #d5d8df; background: #fafbfc; position: sticky; top: 64px; z-index: 5; }
.ql-container.ql-snow { border-radius: 0 0 8px 8px; border-color: #d5d8df; font-family: inherit; }
.ql-editor { min-height: 420px; line-height: 1.75; }
.ql-editor img { border-radius: 6px; }
.editor-foot { text-align: right; font-size: 12px; margin-top: 8px; }
.img-preview { aspect-ratio: 16/9; background: var(--bg); border-radius: 8px; overflow: hidden; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.img-preview img { width: 100%; height: 100%; object-fit: cover; }
.preview-link { display: inline-block; margin-top: 12px; font-weight: 600; font-size: 13px; }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 20px; }
.settings-grid .span2 { grid-column: span 2; }
.settings .btn { margin-top: 20px; }
.logo-prev { background: var(--bg); padding: 12px; border-radius: 8px; display: inline-block; margin: 8px 0; }
.logo-prev img { max-height: 50px; }

.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.pagination a, .pagination span { padding: 7px 13px; background: #fff; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); font-weight: 500; }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Auth */
.auth-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: radial-gradient(circle at 20% 10%, #2a0b12, #101216 60%); }
.auth-card { background: #fff; width: 100%; max-width: 400px; padding: 32px; border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; margin-bottom: 22px; }
.auth-card h1 { font-size: 22px; margin-bottom: 4px; }
.auth-card .muted { margin: 0 0 16px; }
.auth-card label { display: block; font-weight: 600; font-size: 13px; margin-top: 14px; }
.auth-card label input { margin-top: 6px; }
.back { display: block; text-align: center; margin-top: 16px; font-size: 13px; color: var(--muted); }

.side-backdrop { display: none; }

@media (max-width: 1100px) {
  .editor-form { grid-template-columns: 1fr; }
  .editor-side { position: static; }
  .grid-side { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .admin { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; width: 260px; z-index: 100; transform: translateX(-100%); transition: transform .25s; }
  .side-open .side { transform: none; }
  .side-open .side-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 90; }
  .menu-btn { display: block; }
  .top { padding: 0 16px; }
  .top h1 { font-size: 16px; }
  .who { display: none; }
  .page { padding: 16px; }
  .grid-2 { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-grid .span2 { grid-column: auto; }
  .ql-toolbar.ql-snow { top: 64px; }
}
