:root {
  --bg: #0a0e1a;
  --bg-2: #111729;
  --bg-3: #1a2238;
  --border: #243049;
  --text: #e6ecf5;
  --text-dim: #8b95ab;
  --accent: #ff5722;
  --accent-2: #ffa726;
  --ok: #22c55e;
  --warn: #eab308;
  --err: #ef4444;
  --shadow: 0 8px 32px rgba(0,0,0,.4);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px; line-height: 1.5; min-height: 100vh; }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
button {
  background: var(--bg-3); color: var(--text); border: 1px solid var(--border);
  padding: 8px 14px; border-radius: 8px; cursor: pointer; font-size: 13px;
  transition: all .15s; font-family: inherit;
}
button:hover { background: var(--border); border-color: #2f3d5e; }
button.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none; color: #fff; font-weight: 600; }
button.primary:hover { filter: brightness(1.1); }
button.ghost { background: transparent; }
button.danger { background: #3a1a1a; border-color: #5a2a2a; color: #ff8a8a; }
button.danger:hover { background: #4a2222; }
button:disabled { opacity: .5; cursor: not-allowed; }
input, textarea, select {
  background: var(--bg); color: var(--text); border: 1px solid var(--border);
  padding: 8px 10px; border-radius: 6px; font-size: 13px; font-family: inherit; width: 100%;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; min-height: 80px; font-family: inherit; }
label { font-size: 12px; color: var(--text-dim); display: block; margin-bottom: 4px; font-weight: 500; }
.field { margin-bottom: 12px; }
.row { display: flex; gap: 12px; }
.row > .field { flex: 1; }

/* Layout */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: var(--bg-2); border-right: 1px solid var(--border);
  padding: 20px 0; flex-shrink: 0; }
.sidebar .brand { padding: 0 20px 20px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.sidebar .brand h1 { margin: 0; font-size: 18px; background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 800; }
.sidebar .brand .sub { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.nav { display: flex; flex-direction: column; }
.nav a { padding: 10px 20px; color: var(--text-dim); border-left: 3px solid transparent;
  cursor: pointer; font-size: 13px; }
.nav a:hover { background: var(--bg-3); color: var(--text); text-decoration: none; }
.nav a.active { color: var(--text); border-left-color: var(--accent); background: var(--bg-3); }
.main { flex: 1; padding: 30px 40px; overflow-x: auto; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.topbar h2 { margin: 0; font-size: 22px; }
.topbar .actions { display: flex; gap: 8px; }

/* Cards / lists */
.card { background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px;
  padding: 18px; margin-bottom: 16px; }
.card h3 { margin: 0 0 12px; font-size: 15px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.stat { background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.stat .label { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .5px; }
.stat .value { font-size: 24px; font-weight: 700; margin-top: 4px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.badge.posted { background: #14532d; color: #86efac; }
.badge.scheduled { background: #1e3a5f; color: #93c5fd; }
.badge.draft { background: #3b3225; color: #fcd34d; }
.badge.failed { background: #4a1a1a; color: #fca5a5; }
.badge.active { background: #14532d; color: #86efac; }
.badge.inactive { background: #3a3a3a; color: #a0a0a0; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--text-dim); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
tr:hover td { background: var(--bg-3); }
.muted { color: var(--text-dim); font-size: 12px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; }
.mt-12 { margin-top: 12px; } .mt-20 { margin-top: 20px; } .mb-12 { margin-bottom: 12px; }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex;
  align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal { background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px;
  padding: 24px; width: 100%; max-width: 600px; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow); }
.modal h2 { margin: 0 0 16px; font-size: 18px; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

/* Login */
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-card { width: 100%; max-width: 380px; background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 32px; box-shadow: var(--shadow); }
.login-card h1 { margin: 0 0 6px; background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-card .sub { color: var(--text-dim); font-size: 13px; margin-bottom: 24px; }

.preview-img { max-width: 100%; max-height: 260px; border-radius: 8px; border: 1px solid var(--border); }
.toast { position: fixed; bottom: 20px; right: 20px; background: var(--bg-3); border: 1px solid var(--border);
  padding: 12px 16px; border-radius: 8px; box-shadow: var(--shadow); z-index: 200; max-width: 360px; }
.toast.err { border-color: #5a2a2a; color: #ff8a8a; }
.toast.ok { border-color: #2a5a3a; color: #86efac; }

/* Calendar */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal .dh { font-size: 11px; color: var(--text-dim); text-align: center; padding: 6px 0; }
.cal .day { background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px;
  min-height: 90px; padding: 6px; font-size: 11px; }
.cal .day.today { border-color: var(--accent); }
.cal .day .date { font-weight: 700; color: var(--text-dim); margin-bottom: 4px; }
.cal .day .pill { background: var(--bg-3); border-radius: 4px; padding: 2px 4px; margin-bottom: 2px;
  font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal .day .pill.posted { background: #14532d; color: #86efac; }
.cal .day .pill.scheduled { background: #1e3a5f; color: #93c5fd; }
.cal .day .pill.failed { background: #4a1a1a; color: #fca5a5; }

@media (max-width: 800px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; padding: 12px; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav a { padding: 8px 12px; border-left: none; border-bottom: 3px solid transparent; }
  .nav a.active { border-left: none; border-bottom-color: var(--accent); }
  .main { padding: 16px; }
}
