:root {
  --bg: #0f1115;
  --bg2: #161a21;
  --card: #1c212b;
  --card-hover: #222835;
  --border: #2a3140;
  --text: #e8eaf0;
  --muted: #8b93a5;
  --accent: #f5c518;
  --accent-dark: #c79e00;
  --accent-text: #1a1505;
  --green: #34c77b;
  --red: #e85d5d;
  --blue: #4d9fff;
  --radius: 14px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, 'Segoe UI', sans-serif;
  font-size: 15px;
  min-height: 100vh;
}

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
a { color: var(--accent); text-decoration: none; }

.boot-loader { display: flex; align-items: center; justify-content: center; height: 100vh; }
.spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Login ---------- */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 20% 0%, #1d2230 0%, var(--bg) 55%);
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 400px; background: var(--card);
  border: 1px solid var(--border); border-radius: 20px; padding: 36px;
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .mark { font-size: 42px; display: block; margin-bottom: 10px; }
.login-logo h1 { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; }
.login-logo p { color: var(--muted); font-size: 13px; margin-top: 6px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 14px; border-radius: 10px;
  background: var(--bg2); border: 1px solid var(--border); color: var(--text);
  font-size: 14px; outline: none; transition: border-color 0.15s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: 10px; border: none;
  font-size: 14px; font-weight: 600; transition: opacity 0.15s, background 0.15s;
}
.btn:hover { opacity: 0.88; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-secondary { background: var(--bg2); color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: transparent; color: var(--red); border: 1px solid var(--red); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }

.login-switch { text-align: center; margin-top: 18px; font-size: 13px; color: var(--muted); }
.login-switch a { cursor: pointer; font-weight: 600; }
.login-error { background: rgba(232,93,93,0.12); border: 1px solid rgba(232,93,93,0.4); color: #ff9d9d; padding: 10px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 14px; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 230px; flex-shrink: 0; background: var(--bg2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar-logo { padding: 22px 20px; font-weight: 800; font-size: 17px; display: flex; align-items: center; gap: 9px; border-bottom: 1px solid var(--border); }
.sidebar-nav { padding: 14px 10px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 11px 14px; border-radius: 10px;
  color: var(--muted); font-weight: 500; font-size: 14px; margin-bottom: 3px; cursor: pointer;
}
.nav-item:hover { background: var(--card); color: var(--text); }
.nav-item.active { background: var(--card); color: var(--accent); font-weight: 600; }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.sidebar-footer .email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 10px; }
.main { flex: 1; padding: 32px 36px; max-width: 1200px; }

.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 26px; flex-wrap: wrap; gap: 12px; }
.page-head h2 { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* ---------- Cards / grids ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 28px; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.stat-card .num { font-size: 30px; font-weight: 800; }
.stat-card .lbl { color: var(--muted); font-size: 13px; margin-top: 4px; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.card h3 { font-size: 15px; font-weight: 700; margin-bottom: 14px; }

.clients-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.client-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; cursor: pointer; transition: background 0.15s, border-color 0.15s;
}
.client-card:hover { background: var(--card-hover); border-color: #3a4356; }
.client-card .top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.avatar {
  width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 17px; color: #fff; flex-shrink: 0;
}
.client-card .name { font-weight: 700; font-size: 15px; }
.client-card .pkg { color: var(--muted); font-size: 12px; margin-top: 2px; }
.badge { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 99px; margin-left: auto; }
.badge.on { background: rgba(52,199,123,0.15); color: var(--green); }
.badge.off { background: rgba(139,147,165,0.15); color: var(--muted); }
.progress { height: 6px; border-radius: 99px; background: var(--bg2); overflow: hidden; margin-top: 6px; }
.progress > div { height: 100%; border-radius: 99px; background: var(--accent); }
.client-card .meta { font-size: 12px; color: var(--muted); margin-top: 12px; display: flex; justify-content: space-between; }

/* ---------- Posts ---------- */
.post-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 8px;
}
.post-row .icon { font-size: 19px; width: 28px; text-align: center; flex-shrink: 0; }
.post-row .title { font-weight: 600; font-size: 14px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-row .tags { display: flex; gap: 6px; align-items: center; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.tag { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 99px; background: var(--bg2); color: var(--muted); white-space: nowrap; }
.tag.st-draft { color: var(--muted); }
.tag.st-scheduled { background: rgba(77,159,255,0.15); color: var(--blue); }
.tag.st-published { background: rgba(52,199,123,0.15); color: var(--green); }
.post-row .actions { display: flex; gap: 4px; flex-shrink: 0; }
.icon-btn { background: none; border: none; color: var(--muted); padding: 5px; border-radius: 7px; font-size: 14px; }
.icon-btn:hover { background: var(--bg2); color: var(--text); }
.date-group { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; margin: 20px 0 10px; }
.date-group:first-child { margin-top: 0; }

.filters { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.filters select { padding: 9px 12px; border-radius: 10px; background: var(--card); border: 1px solid var(--border); color: var(--text); font-size: 13px; outline: none; }

/* ---------- Chips ---------- */
.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  padding: 7px 13px; border-radius: 99px; font-size: 12px; font-weight: 600;
  background: var(--bg2); color: var(--muted); border: 1px solid var(--border);
}
.chip.sel { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 6px; margin-bottom: 22px; border-bottom: 1px solid var(--border); }
.tab { padding: 10px 18px; background: none; border: none; color: var(--muted); font-size: 14px; font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- Moodboard ---------- */
.month-nav { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.month-nav .label { font-weight: 700; font-size: 16px; min-width: 150px; text-align: center; }
.mood-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-top: 16px; }
.mood-item { position: relative; border-radius: 12px; overflow: hidden; background: var(--bg2); border: 1px solid var(--border); aspect-ratio: 1; }
.mood-item img, .mood-item video { width: 100%; height: 100%; object-fit: cover; display: block; }
.mood-item .del {
  position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,0.65); color: #fff;
  border: none; border-radius: 8px; width: 28px; height: 28px; font-size: 13px; opacity: 0; transition: opacity 0.15s;
}
.mood-item:hover .del { opacity: 1; }
.mood-item .link-box { display: flex; align-items: center; justify-content: center; height: 100%; padding: 14px; text-align: center; font-size: 13px; word-break: break-all; }
.share-box { display: flex; gap: 8px; align-items: center; background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; margin-top: 14px; font-size: 13px; }
.share-box input { flex: 1; background: none; border: none; color: var(--accent); font-size: 13px; outline: none; }

/* ---------- Billing ---------- */
.bill-row { display: flex; align-items: center; gap: 14px; padding: 13px 16px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 8px; }
.bill-row .month { font-weight: 700; width: 130px; text-transform: capitalize; }
.bill-row input.amount { width: 110px; padding: 8px 10px; border-radius: 8px; background: var(--bg2); border: 1px solid var(--border); color: var(--text); font-size: 14px; outline: none; }
.paid-toggle { margin-left: auto; padding: 7px 16px; border-radius: 99px; border: none; font-size: 12px; font-weight: 700; }
.paid-toggle.yes { background: rgba(52,199,123,0.18); color: var(--green); }
.paid-toggle.no { background: rgba(232,93,93,0.15); color: var(--red); }

/* ---------- Modal / toast ---------- */
#modal-wrap:not(:empty) {
  position: fixed; inset: 0; background: rgba(8,10,14,0.75); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal { width: 100%; max-width: 440px; background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 26px; max-height: 90vh; overflow-y: auto; }
.modal h3 { font-size: 17px; font-weight: 800; margin-bottom: 20px; }
.modal .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-actions { display: flex; gap: 10px; margin-top: 22px; }
.modal-actions .btn { flex: 1; }

#toast-wrap { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 20px; font-size: 14px; font-weight: 600; box-shadow: 0 8px 30px rgba(0,0,0,0.5);
  animation: toast-in 0.25s ease;
}
.toast.err { border-color: var(--red); color: #ff9d9d; }
.toast.ok { border-color: var(--green); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } }

.empty { text-align: center; color: var(--muted); padding: 44px 20px; font-size: 14px; }
.notice { background: rgba(245,197,24,0.08); border: 1px solid rgba(245,197,24,0.35); border-radius: 12px; padding: 14px 18px; font-size: 13px; margin-bottom: 20px; line-height: 1.55; }

/* ---------- Public moodboard ---------- */
.public-page { max-width: 1000px; margin: 0 auto; padding: 40px 24px; }
.public-head { text-align: center; margin-bottom: 30px; }
.public-head .mark { font-size: 36px; }
.public-head h1 { font-size: 22px; font-weight: 800; margin-top: 8px; }
.public-head p { color: var(--muted); font-size: 14px; margin-top: 6px; text-transform: capitalize; }

@media (max-width: 760px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; }
  .sidebar-logo { border-bottom: none; padding: 14px 16px; }
  .sidebar-nav { display: flex; padding: 8px; flex: 1; }
  .nav-item { margin-bottom: 0; padding: 9px 12px; }
  .sidebar-footer { border-top: none; padding: 10px 14px; }
  .sidebar-footer .email { display: none; }
  .main { padding: 20px 16px; }
}
