:root{
  --bg:#0b0c10;
  --bg-alt:#121319;
  --card:#181a22;
  --border:#2a2c3833;
  --text:#f4f4f6;
  --text-dim:#a8a9b3;
  --accent:#7c5cff;
  --accent-2:#ff6b9d;
  --accent-grad: linear-gradient(135deg,#7c5cff 0%, #ff6b9d 100%);
  --green:#4ade80;
  --red:#ff6b6b;
}
*{box-sizing:border-box;}
body{
  margin:0;
  font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background:var(--bg);
  color:var(--text);
  line-height:1.6;
}
a{color:inherit; text-decoration:none;}

.topbar{
  display:flex; align-items:center; justify-content:space-between;
  padding:18px 32px; border-bottom:1px solid var(--border);
  background:rgba(11,12,16,0.9);
}
.brand{display:flex; align-items:center; gap:10px; font-weight:700; font-size:18px;}
.brand-mark{
  width:28px; height:28px; border-radius:8px; background:var(--accent-grad);
  display:flex; align-items:center; justify-content:center; font-size:14px; font-weight:800;
}
.brand-mark-img{width:28px; height:28px; border-radius:8px; display:block;}
.topbar nav{display:flex; gap:24px; align-items:center; font-size:14px; color:var(--text-dim);}
.topbar nav a:hover{color:var(--text);}
.logout-btn{background:none; border:1px solid var(--border); color:var(--text-dim); padding:7px 14px; border-radius:8px; font-size:13px; cursor:pointer;}

.page{max-width:900px; margin:0 auto; padding:48px 24px;}
.page-narrow{max-width:440px; margin:80px auto; padding:0 24px;}

h1{font-size:30px; font-weight:800; letter-spacing:-0.02em; margin:0 0 8px;}
h2{font-size:20px; font-weight:700; margin:0 0 6px;}
.subtitle{color:var(--text-dim); font-size:15px; margin-bottom:32px;}

.card{
  background:var(--card); border:1px solid var(--border); border-radius:14px;
  padding:28px; margin-bottom:20px;
}

label{display:block; font-size:13px; font-weight:600; margin-bottom:6px; color:var(--text-dim);}
input[type=text], input[type=email], input[type=password], textarea, select{
  width:100%; padding:12px 14px; border-radius:9px; border:1px solid var(--border);
  background:var(--bg-alt); color:var(--text); font-size:14px; margin-bottom:18px;
  font-family:inherit;
}
textarea{resize:vertical; min-height:80px;}
.btn{
  display:inline-block; background:var(--accent-grad); color:#fff; border:none;
  padding:13px 24px; border-radius:9px; font-weight:700; font-size:14px; cursor:pointer;
}
.btn-outline{
  display:inline-block; background:transparent; color:var(--text); border:1px solid var(--border);
  padding:13px 24px; border-radius:9px; font-weight:600; font-size:14px; cursor:pointer;
}
.btn-sm{padding:8px 16px; font-size:13px; border-radius:7px;}
.btn-full{width:100%;}
.error{color:var(--red); font-size:14px; margin-bottom:16px;}
.form-footer{margin-top:18px; font-size:13.5px; color:var(--text-dim); text-align:center;}

.connect-option{
  display:flex; align-items:center; justify-content:space-between;
  border:1px solid var(--border); border-radius:12px; padding:20px; margin-bottom:14px;
}
.connect-option .platform{display:flex; align-items:center; gap:14px;}
.platform-icon{width:40px; height:40px; border-radius:10px; display:flex; align-items:center; justify-content:center; font-size:18px;}
.platform-icon.ig{background:linear-gradient(135deg,#f58529,#dd2a7b,#8134af);}
.platform-icon.fb{background:#1877f2;}
.connected-badge{font-size:12px; color:var(--green); font-weight:700;}

.account-block{margin-bottom:36px;}
.account-header{display:flex; align-items:center; justify-content:between; gap:12px; margin-bottom:16px;}
.account-header .status-pill{
  font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.04em;
  padding:3px 10px; border-radius:999px; background:rgba(124,92,255,.15); color:#a993ff; margin-left:10px;
}

.post-card{
  background:var(--card); border:1px solid var(--border); border-radius:12px;
  padding:20px; margin-bottom:14px;
}
.post-card .status-tag{
  display:inline-block; font-size:11px; font-weight:700; text-transform:uppercase;
  padding:3px 9px; border-radius:6px; margin-bottom:10px;
}
.status-tag.draft{background:rgba(255,255,255,.08); color:var(--text-dim);}
.status-tag.approved{background:rgba(74,222,128,.15); color:var(--green);}
.status-tag.rejected{background:rgba(255,107,107,.15); color:var(--red);}
.post-caption{white-space:pre-wrap; font-size:14.5px; margin-bottom:14px;}
.post-notes{font-size:12.5px; color:#6b6c78; margin-bottom:14px;}
.post-actions{display:flex; gap:8px; flex-wrap:wrap;}
.post-actions form{display:inline;}

.toggle-row{
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 0; border-bottom:1px solid var(--border);
}
.toggle-row:last-child{border-bottom:none;}
.toggle-row .label-group .title{font-weight:600; font-size:14.5px;}
.toggle-row .label-group .desc{font-size:13px; color:var(--text-dim);}
.switch{
  width:44px; height:24px; border-radius:999px; border:none; cursor:pointer;
  background:#2a2c38; position:relative;
}
.switch.on{background:var(--accent-grad);}
.switch::after{
  content:""; position:absolute; top:3px; left:3px; width:18px; height:18px; border-radius:50%;
  background:#fff; transition:transform .15s ease;
}
.switch.on::after{transform:translateX(20px);}

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

.tone-grid{display:grid; grid-template-columns:repeat(3,1fr); gap:10px; margin-bottom:18px;}
.tone-option{
  border:1px solid var(--border); border-radius:10px; padding:14px; text-align:center;
  cursor:pointer; font-size:13.5px;
}
.tone-option input{display:none;}
.tone-option.selected, .tone-option:has(input:checked){border-color:var(--accent); background:rgba(124,92,255,.1);}

@keyframes btn-spin{to{transform:rotate(360deg);}}
.is-loading{pointer-events:none; opacity:.75; cursor:default;}
.is-loading:not(.switch){color:transparent !important; position:relative;}
.is-loading:not(.switch)::after{
  content:""; position:absolute; top:50%; left:50%; width:16px; height:16px;
  margin:-8px 0 0 -8px; border:2px solid rgba(255,255,255,.35); border-top-color:#fff;
  border-radius:50%; animation:btn-spin .6s linear infinite;
}
.btn-outline.is-loading::after, .logout-btn.is-loading::after{border-color:rgba(168,169,179,.35); border-top-color:var(--text);}
