* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #0f1117; color: #e8eaed; min-height: 100vh; }
.hidden { display: none !important; }

.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #1a1d29 0%, #0f1117 100%); }
.login-box { background: #1a1d29; padding: 40px; border-radius: 12px; width: 360px; box-shadow: 0 8px 32px rgba(0,0,0,.4); }
.login-box h1 { font-size: 24px; margin-bottom: 4px; }
.subtitle { color: #9aa0a6; margin-bottom: 24px; font-size: 14px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; color: #9aa0a6; margin-bottom: 6px; }
.form-group input, .form-group select, .form-row input, textarea, .toolbar input, .toolbar select {
  width: 100%; padding: 10px 12px; border: 1px solid #3c4043; border-radius: 8px; background: #0f1117; color: #e8eaed; font-size: 14px;
}
textarea { resize: vertical; font-family: monospace; }
.form-row { margin-bottom: 12px; }
.form-row label { display: block; font-size: 13px; color: #9aa0a6; margin-bottom: 6px; }
.form-row input { max-width: 200px; }
.form-row input.wide, .replace-grid input { max-width: 100%; width: 100%; }
.replace-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin-bottom: 12px; }
@media (max-width: 768px) { .replace-grid { grid-template-columns: 1fr; } }
.btn-danger { background: #dc3545; color: #fff; border: none; padding: 8px 16px; border-radius: 8px; cursor: pointer; }
.btn-danger:hover { background: #c82333; }
.btn-danger:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary, .btn-secondary, .nav-item, .logout-btn {
  border: none; cursor: pointer; border-radius: 8px; font-size: 14px; transition: .2s;
}
.btn-primary { background: #7c5cff; color: #fff; padding: 10px 20px; width: 100%; }
.btn-primary:hover { background: #6a4de6; }
.btn-secondary { background: #2d3139; color: #e8eaed; padding: 8px 16px; }
.btn-secondary:hover { background: #3c4043; }
.error-text { color: #f28b82; font-size: 13px; margin-top: 12px; text-align: center; }

.app { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: #1a1d29; padding: 20px 12px; display: flex; flex-direction: column; border-right: 1px solid #2d3139; }
.brand { font-weight: 700; font-size: 16px; padding: 8px 12px 24px; color: #7c5cff; }
.nav-item { display: block; width: 100%; text-align: left; padding: 10px 12px; margin-bottom: 4px; background: transparent; color: #9aa0a6; }
.nav-item:hover, .nav-item.active { background: #2d3139; color: #fff; }
.logout-btn { margin-top: auto; padding: 10px 12px; background: transparent; color: #9aa0a6; text-align: left; }
.logout-btn:hover { color: #f28b82; }

.main { flex: 1; padding: 24px; overflow: auto; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.topbar h2 { font-size: 22px; }
.api-badge { font-size: 12px; color: #9aa0a6; background: #1a1d29; padding: 4px 10px; border-radius: 20px; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: #1a1d29; padding: 20px; border-radius: 12px; border: 1px solid #2d3139; }
.stat-card .label { font-size: 13px; color: #9aa0a6; }
.stat-card .value { font-size: 28px; font-weight: 700; margin-top: 8px; color: #7c5cff; }

.card { background: #1a1d29; border-radius: 12px; border: 1px solid #2d3139; padding: 20px; margin-bottom: 20px; }
.card h3 { margin-bottom: 16px; font-size: 16px; }
.hint { font-size: 13px; color: #9aa0a6; margin-bottom: 12px; }
.hint code { background: #0f1117; padding: 2px 6px; border-radius: 4px; }

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar input, .toolbar select { width: auto; min-width: 160px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #2d3139; }
th { color: #9aa0a6; font-weight: 500; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; }
.tag-published { background: #1e3a2f; color: #81c995; }
.tag-draft { background: #3d3420; color: #fdd663; }
.tag-deleted { background: #3d2020; color: #f28b82; }
.link-btn { background: none; border: none; color: #7c5cff; cursor: pointer; font-size: 13px; margin-right: 8px; }
.link-btn.danger { color: #f28b82; }

.pagination { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.pagination button { padding: 6px 12px; background: #2d3139; border: none; color: #e8eaed; border-radius: 6px; cursor: pointer; }
.pagination button:disabled { opacity: .4; cursor: not-allowed; }

.activity-list { list-style: none; }
.activity-list li { padding: 10px 0; border-bottom: 1px solid #2d3139; font-size: 14px; }
.activity-list .time { color: #9aa0a6; font-size: 12px; margin-top: 4px; }

.result-box { background: #0f1117; padding: 12px; border-radius: 8px; font-size: 12px; max-height: 300px; overflow: auto; margin-top: 12px; white-space: pre-wrap; }
.status-text { font-size: 13px; color: #9aa0a6; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal-content { background: #1a1d29; padding: 24px; border-radius: 12px; width: 400px; max-width: 90vw; }
.modal-content h3 { margin-bottom: 16px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.modal-actions .btn-primary { width: auto; }

@media (max-width: 768px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; flex-wrap: wrap; }
  .nav-item { width: auto; }
  .logout-btn { margin-top: 0; }
}
