:root {
  --bg: #0a0a0f;
  --bg-card: #12121a;
  --bg-hover: #1a1a26;
  --bg-input: #0e0e16;
  --border: #2a2a3a;
  --border-focus: #6366f1;
  --text: #e4e4e7;
  --text-dim: #71717a;
  --text-bright: #fafafa;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-dim: rgba(99, 102, 241, 0.1);
  --green: #22c55e;
  --green-dim: rgba(34, 197, 94, 0.1);
  --red: #ef4444;
  --red-dim: rgba(239, 68, 68, 0.1);
  --amber: #f59e0b;
  --amber-dim: rgba(245, 158, 11, 0.1);
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

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

/* Layout */
.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  padding: 24px 0;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  padding: 0 20px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.sidebar-brand h1 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-bright);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.sidebar-brand span {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.3px;
}

.sidebar nav { flex: 1; }

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
}

.sidebar nav a:hover,
.sidebar nav a.active {
  color: var(--text-bright);
  background: var(--accent-dim);
  border-right: 2px solid var(--accent);
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.sidebar-footer a {
  font-size: 13px;
  color: var(--text-dim);
}

.main-content {
  padding: 32px 40px;
  overflow-y: auto;
}

.page-header {
  margin-bottom: 32px;
}

.page-header h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 4px;
}

.page-header p {
  color: var(--text-dim);
  font-size: 14px;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-bright);
}

.card-body { padding: 20px; }

/* Queue table */
.queue-table {
  width: 100%;
  border-collapse: collapse;
}

.queue-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
}

.queue-table td {
  padding: 14px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.queue-table tr:last-child td {
  border-bottom: none;
}

.queue-table tr:hover td {
  background: var(--bg-hover);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.badge-pending {
  background: var(--amber-dim);
  color: var(--amber);
}

.badge-published {
  background: var(--green-dim);
  color: var(--green);
}

.badge-site {
  background: var(--accent-dim);
  color: var(--accent);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  font-family: var(--font);
}

.btn-primary {
  background: var(--accent);
  color: white;
}
.btn-primary:hover { background: var(--accent-hover); color: white; }

.btn-success {
  background: var(--green);
  color: white;
}
.btn-success:hover { opacity: 0.9; color: white; }

.btn-danger {
  background: transparent;
  color: var(--red);
  border: 1px solid var(--red);
}
.btn-danger:hover { background: var(--red-dim); }

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--text-dim); }

.btn-sm { padding: 5px 12px; font-size: 12px; }

.btn-group {
  display: flex;
  gap: 8px;
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-bright);
  font-size: 14px;
  font-family: var(--font);
  transition: border-color 0.15s;
}

.form-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

/* Login */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-box {
  width: 100%;
  max-width: 400px;
}

.login-box h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 4px;
}

.login-box p {
  color: var(--text-dim);
  font-size: 14px;
  margin-bottom: 32px;
}

.login-box .card {
  padding: 28px;
}

.login-error {
  background: var(--red-dim);
  color: var(--red);
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 16px;
}

/* Editor */
.editor-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 24px;
  align-items: start;
}

.editor-main .ql-container {
  min-height: 500px;
  font-size: 15px;
  background: var(--bg-input);
  border-color: var(--border);
  color: var(--text);
  border-radius: 0 0 var(--radius) var(--radius);
}

.editor-main .ql-toolbar {
  background: var(--bg-card);
  border-color: var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
}

.editor-main .ql-toolbar .ql-stroke { stroke: var(--text-dim); }
.editor-main .ql-toolbar .ql-fill { fill: var(--text-dim); }
.editor-main .ql-toolbar .ql-picker-label { color: var(--text-dim); }
.editor-main .ql-toolbar button:hover .ql-stroke { stroke: var(--text-bright); }
.editor-main .ql-toolbar button:hover .ql-fill { fill: var(--text-bright); }

.editor-sidebar .card {
  position: sticky;
  top: 32px;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.meta-row:last-child { border-bottom: none; }

.meta-label {
  color: var(--text-dim);
  font-weight: 500;
}

.meta-value {
  color: var(--text);
  text-align: right;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-bright);
}

.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
}

.empty-state h3 {
  font-size: 16px;
  color: var(--text);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 14px;
  max-width: 400px;
  margin: 0 auto;
}

/* Coming soon */
.coming-soon {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  background: linear-gradient(135deg, #0a0a0f 0%, #12121a 50%, #0a0a1a 100%);
}

.coming-soon h1 {
  font-size: 48px;
  font-weight: 800;
  color: var(--text-bright);
  letter-spacing: -1px;
  margin-bottom: 12px;
}

.coming-soon .accent {
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.coming-soon p {
  color: var(--text-dim);
  font-size: 18px;
  max-width: 500px;
  margin-bottom: 40px;
}

.coming-soon .divider {
  width: 60px;
  height: 2px;
  background: var(--border);
  margin: 0 auto 40px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s;
  z-index: 1000;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast-success {
  background: var(--green);
  color: white;
}

.toast-error {
  background: var(--red);
  color: white;
}

/* Responsive */
@media (max-width: 1024px) {
  .editor-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    left: -240px;
    z-index: 100;
    transition: left 0.3s;
  }
  .sidebar.open { left: 0; }
  .main-content { padding: 20px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
}

.modal h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 12px;
}

.modal p {
  color: var(--text-dim);
  font-size: 14px;
  margin-bottom: 20px;
}

.modal .btn-group {
  justify-content: flex-end;
}

/* Preview pane */
.preview-frame {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  min-height: 400px;
}

.preview-frame iframe {
  width: 100%;
  height: 600px;
  border: none;
  border-radius: var(--radius);
}

/* Source editor toggle */
.source-toggle {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
}

.source-toggle button {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-dim);
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.15s;
}

.source-toggle button:first-child {
  border-radius: var(--radius) 0 0 var(--radius);
}

.source-toggle button:last-child {
  border-radius: 0 var(--radius) var(--radius) 0;
  border-left: none;
}

.source-toggle button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.source-editor {
  width: 100%;
  min-height: 500px;
  padding: 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
}
