:root {
  --bg: #0d0f14; --card: #161a22; --line: #262c38; --text: #eef1f6; --muted: #8b93a5;
  --cyan: #25f4ee; --pink: #fe2c55; --green: #2ecc71; --amber: #f5a623; --red: #ff5c6c; --blue: #4ea1ff;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Khmer", sans-serif; }
a { color: var(--cyan); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.red { color: var(--red); }

.topbar { position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 10px 16px; background: rgba(13,15,20,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.top-actions form { margin: 0; }
main { max-width: 860px; margin: 0 auto; padding: 16px; display: grid; gap: 16px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 8px; }
h2 { margin: 0; font-size: 18px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: #1f2430; color: var(--text);
  padding: 9px 14px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: #3a4252; }
.btn.primary { background: linear-gradient(90deg, var(--pink), #ff4f7a); border-color: transparent; color: #fff; }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn.big { width: 100%; padding: 14px; font-size: 16px; margin-top: 6px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.banner { background: #2a2210; border: 1px solid #5c4714; color: #f7e3b0; border-radius: var(--radius); padding: 12px 14px; font-size: 14px; }
.banner code { background: #3b3017; padding: 1px 5px; border-radius: 5px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 18px; z-index: 50; background: #12301f; border: 1px solid #1f6b40; color: #c9f5da;
  padding: 10px 16px; border-radius: 10px; max-width: 92vw; box-shadow: 0 8px 30px rgba(0,0,0,.4); }
.toast.bad { background: #3a1419; border-color: #7a2430; color: #ffd0d6; }
.empty { color: var(--muted); padding: 18px; text-align: center; border: 1px dashed var(--line); border-radius: 12px; }

.avatar { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; background: #222836; flex: none; border: 2px solid #2b3140; }
.avatar.sm { width: 38px; height: 38px; }
.accounts { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); margin-bottom: 8px; }
.acc { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: #12151c; }
.acc.warn { border-color: #6b2a33; }
.acc-info { flex: 1; min-width: 0; }
.acc-name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-actions { display: flex; gap: 6px; }

.creator { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: #12151c; border: 1px solid var(--line); margin-bottom: 12px; }
.creator-name { font-weight: 700; }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; background: #12151c; padding: 4px; border-radius: 12px; border: 1px solid var(--line); }
.tab { flex: 1; border: 0; background: transparent; color: var(--muted); padding: 9px; border-radius: 9px; font: inherit; font-weight: 650; cursor: pointer; }
.tab.active { background: #252b38; color: var(--text); }

.drop { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 90px; border: 2px dashed #34405a; border-radius: 12px;
  cursor: pointer; color: var(--muted); padding: 14px; margin-bottom: 12px; background: #11141b; }
.drop:hover { border-color: var(--cyan); color: var(--text); }
.drop input { display: none; }
.video-preview { margin-bottom: 12px; }
.video-preview video { width: 100%; max-height: 420px; background: #000; border-radius: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 6px; }

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-bottom: 6px; }
.ph { position: relative; aspect-ratio: 3/4; border-radius: 10px; overflow: hidden; border: 2px solid transparent; background: #11141b; cursor: pointer; }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph.cover { border-color: var(--cyan); }
.ph.add { display: flex; align-items: center; justify-content: center; font-size: 30px; color: var(--muted); border: 2px dashed #34405a; }
.badge-cover { position: absolute; left: 5px; bottom: 5px; background: var(--cyan); color: #032; font-size: 11px; font-weight: 800; padding: 1px 6px; border-radius: 6px; }
.ph-num { position: absolute; left: 5px; top: 5px; background: rgba(0,0,0,.6); font-size: 11px; padding: 0 6px; border-radius: 6px; }
.ph-x { position: absolute; right: 4px; top: 4px; border: 0; background: rgba(0,0,0,.65); color: #fff; width: 24px; height: 24px; border-radius: 50%; cursor: pointer; }

.field { margin: 0 0 14px; border: 0; padding: 0; }
fieldset.field { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
legend { padding: 0 6px; font-weight: 650; }
label { display: block; font-weight: 600; margin-bottom: 6px; }
input[type=text], input:not([type]), textarea, select, input[type=datetime-local] {
  width: 100%; background: #0f1218; color: var(--text); border: 1px solid #2c3342; border-radius: 10px; padding: 10px 12px; font: inherit; }
input[type=datetime-local] { width: auto; margin-left: 6px; padding: 6px 8px; color-scheme: dark; }
textarea { resize: vertical; }
select:invalid { color: var(--muted); }
.radio, .check { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; margin: 6px 0; flex-wrap: wrap; }
.radio input, .check input { margin-top: 3px; accent-color: var(--pink); }
.switch-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; font-weight: 500; margin: 0; }
.switch { appearance: none; width: 44px; height: 26px; border-radius: 13px; background: #353c4b; position: relative; cursor: pointer; flex: none; transition: .2s; }
.switch::after { content: ""; position: absolute; width: 20px; height: 20px; top: 3px; left: 3px; border-radius: 50%; background: #fff; transition: .2s; }
.switch:checked { background: var(--pink); }
.switch:checked::after { left: 21px; }
#commercialBox { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
.label-hint { color: var(--cyan); font-size: 13px; margin-top: 4px; }
.consent { font-size: 13px; color: var(--muted); margin: 4px 0 8px; }

.progress { position: relative; height: 26px; border-radius: 8px; background: #0f1218; border: 1px solid var(--line); overflow: hidden; margin-bottom: 8px; }
.progress div { height: 100%; width: 0; background: linear-gradient(90deg, var(--cyan), var(--pink)); transition: width .2s; }
.progress span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; text-shadow: 0 1px 2px #000; }
.form-error { background: #3a1419; border: 1px solid #7a2430; color: #ffd0d6; padding: 10px 12px; border-radius: 10px; margin-bottom: 8px; }

.small-select { width: auto; padding: 6px 10px; font-size: 13px; }
.posts { display: grid; gap: 8px; }
.post { display: flex; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: #12151c; align-items: flex-start; }
.post-main { flex: 1; min-width: 0; }
.post-text { margin: 2px 0; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
.post-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.post-actions { display: flex; gap: 4px; }
.pill { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 20px; white-space: nowrap; }
.pill.blue { background: #13294a; color: var(--blue); } .pill.amber { background: #3a2a0c; color: var(--amber); }
.pill.green { background: #10331f; color: var(--green); } .pill.red { background: #3a1419; color: var(--red); } .pill.grey { background: #262b35; color: var(--muted); }
.foot { text-align: center; padding: 6px 0 24px; }

/* Login page */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login { width: 100%; max-width: 360px; }
.login h1 { font-size: 20px; margin: 10px 0 4px; }

@media (max-width: 560px) {
  .topbar { padding: 10px 12px; }
  .top-actions .btn { padding: 8px 10px; font-size: 13px; }
  main { padding: 10px; }
  .post { flex-wrap: wrap; }
  .post-side { flex-direction: row; width: 100%; justify-content: space-between; align-items: center; }
  input[type=datetime-local] { margin: 6px 0 0 24px; }
}
article h1 { margin-top: 0; }
article h2 { margin: 20px 0 6px; font-size: 16px; }

.dialog { width: min(520px, 94vw); color: var(--text); padding: 18px; }
.dialog::backdrop { background: rgba(0,0,0,.6); }
.dialog h2 { margin-bottom: 4px; }
.dialog code { background: #0f1218; padding: 1px 5px; border-radius: 5px; }
.acc { flex-wrap: wrap; }
.acc-proxy { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding-top: 8px; margin-top: 2px; border-top: 1px solid var(--line); font-size: 12.5px; }
.acc-proxy .px { min-width: 0; word-break: break-all; line-height: 1.35; }
.acc-proxy .ip { color: var(--muted); }
.acc-proxy .on { color: var(--cyan); }

@media (max-width: 400px) { .accounts { grid-template-columns: 1fr; } }
