:root {
  --bg: #F4F3EF;
  --surface: #FFFFFF;
  --surface-2: #FAFAF8;
  --ink: #16161A;
  --ink-2: #3A3A42;
  --muted: #74747D;
  --faint: #A6A6AE;
  --line: #E7E5DF;
  --line-2: #EFEDE8;
  --accent: #3D63FF;
  --accent-soft: #EBEFFF;
  --li: #0A66C2;
  --th: #101010;
  --ig: linear-gradient(45deg, #F9CE34 0%, #EE2A7B 50%, #6228D7 100%);
  --st-draft: #9C9CA5;
  --st-scheduled: #3D63FF;
  --st-publishing: #8E4EC6;
  --st-published: #13A15B;
  --st-partial: #DB8A00;
  --st-failed: #E5484D;
  --r: 12px;
  --r-sm: 8px;
  --shadow: 0 1px 2px rgba(22,22,26,.04), 0 4px 16px rgba(22,22,26,.05);
  --shadow-lg: 0 12px 48px rgba(22,22,26,.16);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: 232px 1fr; height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 20px 14px; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; letter-spacing: -.02em; padding: 4px 8px 20px; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 13px; letter-spacing: -.04em; position: relative; }
.brand-mark::after { content: ''; position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); top: -2px; right: -2px; border: 2px solid var(--surface); }
.brand-lg { font-size: 24px; padding: 0 0 6px; justify-content: center; }
.brand-lg .brand-mark { width: 44px; height: 44px; font-size: 17px; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 9px; color: var(--ink-2); font-weight: 500; cursor: pointer; border: 0; background: none; text-align: left; width: 100%; }
.nav-item svg { width: 18px; height: 18px; flex: none; opacity: .8; }
.nav-item:hover { background: var(--surface-2); }
.nav-item.active { background: var(--ink); color: #fff; }
.nav-item.active svg { opacity: 1; }
.nav-item .dots { margin-left: auto; display: flex; gap: 4px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); display: inline-block; }
.dot.ok { background: var(--st-published); }
.dot.warn { background: var(--st-partial); }
.dot.err { background: var(--st-failed); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.legend { padding: 12px 10px; border-top: 1px solid var(--line-2); display: grid; gap: 6px; font-size: 12px; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 8px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.main { display: flex; flex-direction: column; min-width: 0; height: 100vh; overflow: hidden; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 18px 28px; background: var(--bg); }
.topbar h1 { font-size: 22px; font-weight: 700; letter-spacing: -.02em; margin: 0; text-transform: capitalize; min-width: 200px; }
.topbar .spacer { flex: 1; }
.content { flex: 1; overflow: auto; padding: 0 28px 28px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, transform .05s; }
.btn:hover { border-color: #D3D1CA; background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover { background: #2B2B31; border-color: #2B2B31; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: #2F55F0; border-color: #2F55F0; }
.btn-danger { color: var(--st-failed); }
.btn-danger:hover { background: #FFF1F1; border-color: #F6C9CA; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: rgba(0,0,0,.04); border-color: transparent; }
.btn-icon { width: 36px; padding: 0; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.seg { display: inline-flex; background: #E9E7E1; border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: none; padding: 6px 14px; border-radius: 8px; font-weight: 600; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* ---------- Banner ---------- */
.banner { margin: 0 28px 14px; padding: 12px 16px; border-radius: var(--r); display: flex; align-items: center; gap: 12px; font-weight: 500; }
.banner.warn { background: #FFF6E5; border: 1px solid #F5DDAE; color: #7A4D00; }
.banner.err { background: #FFF0F0; border: 1px solid #F6C9CA; color: #9B1C20; }
.banner .btn { margin-left: auto; }

/* ---------- Calendar month ---------- */
.cal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); }
.cal-head { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--line); background: var(--surface-2); }
.cal-head div { padding: 10px 12px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.day { min-height: 148px; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); padding: 8px; display: flex; flex-direction: column; gap: 6px; position: relative; min-width: 0; }
.day:nth-child(7n) { border-right: 0; }
.day.weekend { background: #FCFCFA; }
.day.other { background: #FAF9F6; }
.day.other .day-num { color: var(--faint); }
.day.past .post-card:not(.st-published):not(.st-failed):not(.st-partial) { opacity: .7; }
.day.drop { background: var(--accent-soft); outline: 2px dashed var(--accent); outline-offset: -4px; }
.day-top { display: flex; align-items: center; justify-content: space-between; }
.day-num { font-weight: 600; font-size: 13px; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; }
.day.today .day-num { background: var(--accent); color: #fff; }
.day-add { opacity: 0; border: 0; background: var(--surface-2); width: 24px; height: 24px; border-radius: 7px; cursor: pointer; color: var(--muted); font-size: 17px; line-height: 1; }
.day:hover .day-add { opacity: 1; }
.day-add:hover { background: var(--ink); color: #fff; }
.more { font-size: 12px; color: var(--muted); font-weight: 600; cursor: pointer; padding: 0 4px; }

.post-card { display: flex; gap: 8px; align-items: center; padding: 6px; border-radius: 9px; background: var(--surface); border: 1px solid var(--line); cursor: pointer; position: relative; overflow: hidden; min-width: 0; transition: box-shadow .12s, border-color .12s; }
.post-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--st, var(--faint)); }
.post-card:hover { border-color: #D3D1CA; box-shadow: var(--shadow); }
.post-card.st-draft { border-style: dashed; background: var(--surface-2); }
.post-card .thumb { width: 34px; height: 42px; border-radius: 6px; flex: none; background: #EEECE6 center/cover no-repeat; display: grid; place-items: center; color: var(--muted); font-size: 10px; font-weight: 700; }
.post-card .meta { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.post-card .time { font-size: 11px; font-weight: 700; color: var(--ink-2); display: flex; align-items: center; gap: 5px; }
.post-card .ttl { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.st-draft { --st: var(--st-draft); } .st-scheduled { --st: var(--st-scheduled); } .st-publishing { --st: var(--st-publishing); }
.st-published { --st: var(--st-published); } .st-partial { --st: var(--st-partial); } .st-failed { --st: var(--st-failed); }

.chs { display: inline-flex; gap: 3px; }
.ch { width: 15px; height: 15px; border-radius: 4px; display: inline-grid; place-items: center; color: #fff; font-size: 8px; font-weight: 800; flex: none; }
.ch svg { width: 10px; height: 10px; }
.ch-linkedin { background: var(--li); }
.ch-instagram { background: var(--ig); }
.ch-threads { background: var(--th); }
.ch-lg { width: 22px; height: 22px; border-radius: 6px; }
.ch-lg svg { width: 13px; height: 13px; }

/* ---------- Week ---------- */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 12px; }
.wcol { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); min-height: 70vh; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.wcol.today { border-color: var(--accent); }
.wcol.drop { background: var(--accent-soft); }
.wcol-head { padding: 12px; border-bottom: 1px solid var(--line-2); display: flex; align-items: baseline; justify-content: space-between; }
.wcol-head b { font-size: 20px; letter-spacing: -.02em; }
.wcol-head span { color: var(--muted); font-size: 12px; text-transform: capitalize; }
.wcol-body { padding: 10px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.wcard { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; cursor: pointer; background: var(--surface); position: relative; transition: box-shadow .12s; }
.wcard:hover { box-shadow: var(--shadow); }
.wcard.st-draft { border-style: dashed; }
.wcard .wimg { aspect-ratio: 4/5; background: #EEECE6 center/cover no-repeat; display: grid; place-items: center; color: var(--muted); font-weight: 700; position: relative; }
.wcard .wimg .count { position: absolute; top: 6px; right: 6px; background: rgba(0,0,0,.6); color: #fff; font-size: 11px; padding: 2px 7px; border-radius: 20px; }
.wcard .wbody { padding: 9px 10px; display: grid; gap: 5px; border-top: 3px solid var(--st); }
.wcard .wtime { display: flex; justify-content: space-between; align-items: center; font-size: 12px; font-weight: 700; }
.wcard .wttl { font-size: 12.5px; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.wadd { margin-top: auto; border: 1px dashed var(--line); background: none; border-radius: 9px; padding: 8px; color: var(--muted); cursor: pointer; font-weight: 600; }
.wadd:hover { border-color: var(--ink); color: var(--ink); }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 600; background: color-mix(in srgb, var(--st) 12%, white); color: color-mix(in srgb, var(--st) 80%, black); white-space: nowrap; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--st); }

/* ---------- List ---------- */
.toolbar { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.list-day { margin-bottom: 18px; }
.list-day h3 { font-size: 13px; text-transform: capitalize; color: var(--muted); margin: 0 0 8px; font-weight: 600; }
.list-day h3.today { color: var(--accent); }
.row { display: grid; grid-template-columns: 56px 44px 1fr auto auto; gap: 14px; align-items: center; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 6px; cursor: pointer; }
.row:hover { box-shadow: var(--shadow); }
.row .t { font-weight: 700; }
.row .thumb { width: 44px; height: 55px; border-radius: 7px; background: #EEECE6 center/cover; display: grid; place-items: center; font-size: 10px; color: var(--muted); font-weight: 700; }
.row .txt b { display: block; }
.row .txt span { color: var(--muted); font-size: 12.5px; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.empty { padding: 60px 20px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r); }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 6px; }

/* ---------- Media ---------- */
.dropzone { border: 2px dashed #D6D3CB; border-radius: var(--r); padding: 26px; text-align: center; color: var(--muted); background: var(--surface); cursor: pointer; transition: all .15s; }
.dropzone b { color: var(--ink); }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 16px; }
.mtile { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; position: relative; cursor: pointer; }
.mtile .mimg { aspect-ratio: 4/5; background: #EEECE6 center/cover no-repeat; display: grid; place-items: center; position: relative; }
.mtile video { width: 100%; height: 100%; object-fit: cover; }
.mtile .mname { padding: 7px 9px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; gap: 6px; align-items: center; }
.kind { font-size: 10px; font-weight: 800; padding: 2px 6px; border-radius: 5px; background: var(--ink); color: #fff; text-transform: uppercase; flex: none; }
.kind.pdf { background: #D93025; } .kind.video { background: #8E4EC6; } .kind.image { background: #5B6470; }
.mtile .del { position: absolute; top: 6px; right: 6px; opacity: 0; }
.mtile:hover .del { opacity: 1; }
.mtile.sel { outline: 3px solid var(--accent); outline-offset: -1px; }
.mtile .num { position: absolute; top: 6px; left: 6px; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; display: grid; place-items: center; font-size: 12px; }
.pdf-ph { display: grid; place-items: center; gap: 4px; color: #D93025; font-weight: 800; font-size: 13px; }
.pdf-ph svg { width: 34px; height: 34px; }
.progress { height: 4px; background: var(--line); border-radius: 4px; overflow: hidden; margin-top: 10px; }
.progress i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }

/* ---------- Connections ---------- */
.conn-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; box-shadow: var(--shadow); }
.card h2 { margin: 0; font-size: 16px; display: flex; align-items: center; gap: 10px; }
.card .sub { color: var(--muted); font-size: 13px; margin: 4px 0 16px; }
.acct { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--surface-2); border-radius: 10px; margin-bottom: 14px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: #DDD center/cover; flex: none; display: grid; place-items: center; font-weight: 700; color: #fff; }
.expbar { height: 6px; background: var(--line); border-radius: 6px; overflow: hidden; margin: 6px 0 4px; }
.expbar i { display: block; height: 100%; background: var(--st-published); }
.expbar i.warn { background: var(--st-partial); } .expbar i.err { background: var(--st-failed); }
details.creds { margin-top: 14px; border-top: 1px solid var(--line-2); padding-top: 12px; }
details.creds summary { cursor: pointer; font-weight: 600; color: var(--muted); font-size: 13px; }
.copy { display: flex; gap: 6px; margin-top: 6px; }
.copy input { flex: 1; font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); }

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
input[type=text], input[type=password], input[type=date], input[type=time], textarea, select {
  width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 9px; padding: 9px 11px; outline: none; transition: border-color .12s, box-shadow .12s; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 200px; line-height: 1.5; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.counter { font-size: 12px; color: var(--muted); text-align: right; margin-top: -6px; }
.counter.over { color: var(--st-failed); font-weight: 700; }

/* ---------- Drawer editor ---------- */
.overlay { position: fixed; inset: 0; background: rgba(22,22,26,.32); z-index: 40; animation: fade .15s; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(1180px, 96vw); background: var(--bg); z-index: 41; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: slide .2s ease-out; }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.drawer-head { display: flex; align-items: center; gap: 12px; padding: 16px 22px; background: var(--surface); border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0; font-size: 17px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-body { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 420px; overflow: hidden; }
.ed-form { overflow: auto; padding: 20px 22px; }
.ed-prev { overflow: auto; padding: 20px; background: #ECEAE4; border-left: 1px solid var(--line); }
.drawer-foot { display: flex; align-items: center; gap: 8px; padding: 14px 22px; background: var(--surface); border-top: 1px solid var(--line); }
.drawer-foot .spacer { flex: 1; }
.section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin-bottom: 14px; }
.section-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.status-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.status-pick label { border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; display: grid; gap: 2px; }
.status-pick label b { display: flex; align-items: center; gap: 8px; }
.status-pick label span { font-size: 12px; color: var(--muted); }
.status-pick input { display: none; }
.status-pick label.on { border-color: var(--st); background: color-mix(in srgb, var(--st) 7%, white); }
.ch-tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.ch-tab { display: flex; align-items: center; gap: 8px; padding: 8px 12px 8px 8px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 600; }
.ch-tab.active { border-color: var(--ink); }
.ch-tab.off { opacity: .5; }
.ch-tab.off .ch { filter: grayscale(1); }
.toggle { position: relative; width: 36px; height: 21px; flex: none; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle i { position: absolute; inset: 0; background: #D7D5CE; border-radius: 20px; cursor: pointer; transition: .15s; }
.toggle i::after { content: ''; position: absolute; width: 15px; height: 15px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .15s; }
.toggle input:checked + i { background: var(--st-published); }
.toggle input:checked + i::after { transform: translateX(15px); }
.ch-on { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-weight: 600; }
.ch-on .hint { margin-left: auto; font-weight: 400; color: var(--muted); font-size: 12px; }
.strip { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.strip .mi { width: 76px; height: 95px; border-radius: 8px; background: #EEECE6 center/cover; position: relative; border: 1px solid var(--line); cursor: grab; display: grid; place-items: center; overflow: hidden; }
.strip .mi video { width: 100%; height: 100%; object-fit: cover; }
.strip .mi .x { position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: rgba(0,0,0,.65); color: #fff; cursor: pointer; font-size: 12px; line-height: 1; }
.strip .mi .n { position: absolute; bottom: 3px; left: 3px; background: rgba(0,0,0,.65); color: #fff; font-size: 10px; padding: 1px 6px; border-radius: 10px; font-weight: 700; }
.strip .mi.dragging { opacity: .4; }
.strip .add { width: 76px; height: 95px; border-radius: 8px; border: 1.5px dashed #CFCCC4; background: none; color: var(--muted); cursor: pointer; font-weight: 600; font-size: 12px; display: grid; place-items: center; gap: 2px; }
.strip .add:hover { border-color: var(--ink); color: var(--ink); }
.helper { font-size: 12px; color: var(--muted); margin-top: 8px; }
.issues { background: #FFF6E5; border: 1px solid #F5DDAE; color: #7A4D00; border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 14px; }
.issues ul { margin: 4px 0 0; padding-left: 18px; }
.results { display: grid; gap: 8px; }
.result { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line-2); font-size: 13px; }
.result .err { color: var(--st-failed); }
.mini-actions { display: flex; gap: 6px; }
.metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 8px; margin-top: 8px; }
.metric { background: var(--surface-2); border-radius: 9px; padding: 8px 10px; }
.metric b { font-size: 17px; display: block; }
.metric span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

/* ---------- Previews ---------- */
.prev-tabs { display: flex; gap: 6px; margin-bottom: 14px; justify-content: center; }
.prev-label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; text-align: center; margin-bottom: 10px; }
.pv { background: #fff; border-radius: 12px; box-shadow: 0 2px 12px rgba(0,0,0,.08); overflow: hidden; max-width: 380px; margin: 0 auto 20px; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }
.pv-head { display: flex; gap: 9px; padding: 12px; align-items: center; }
.pv-head .avatar { width: 40px; height: 40px; font-size: 14px; background-color: #7A7A84; }
.pv-head b { font-size: 14px; display: block; }
.pv-head small { color: #666; font-size: 12px; }
.pv-text { padding: 0 12px 10px; font-size: 14px; white-space: pre-wrap; word-wrap: break-word; color: rgba(0,0,0,.9); }
.pv-text .more-btn { color: #666; cursor: pointer; font-weight: 600; }
.pv-text .tag { color: var(--li); font-weight: 600; }
.pv-media img, .pv-media video { width: 100%; display: block; }
.pv-media .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
.pv-media .grid2 img { aspect-ratio: 1; object-fit: cover; }
.pv-doc { position: relative; background: #F3F2EF; }
.pv-doc object, .pv-doc iframe { width: 100%; aspect-ratio: 4/5; border: 0; display: block; }
.pv-doc .doc-bar { display: flex; justify-content: space-between; padding: 8px 12px; font-size: 12px; background: rgba(0,0,0,.75); color: #fff; }
.pv-foot { display: flex; justify-content: space-around; padding: 6px 8px 10px; border-top: 1px solid #EEE; margin: 0 12px; color: #666; font-size: 12.5px; font-weight: 600; }
.ig { max-width: 360px; }
.ig .pv-head { padding: 10px 12px; }
.ig .pv-head .avatar { width: 32px; height: 32px; padding: 2px; background: var(--ig); }
.ig .pv-head .avatar span { width: 100%; height: 100%; border-radius: 50%; background: #8A8A92 center/cover; border: 2px solid #fff; display: grid; place-items: center; font-size: 11px; }
.carousel { position: relative; aspect-ratio: 4/5; background: #000; overflow: hidden; }
.carousel .track { display: flex; height: 100%; transition: transform .25s ease; }
.carousel .slide { flex: 0 0 100%; height: 100%; display: grid; place-items: center; background: #111; }
.carousel .slide img, .carousel .slide video { width: 100%; height: 100%; object-fit: cover; }
.carousel .nav { position: absolute; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(255,255,255,.9); cursor: pointer; font-weight: 700; box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.carousel .nav.l { left: 8px; } .carousel .nav.r { right: 8px; }
.carousel .cnt { position: absolute; top: 10px; right: 10px; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; padding: 2px 8px; border-radius: 12px; }
.ig-dots { display: flex; justify-content: center; gap: 4px; padding: 8px 0 0; }
.ig-dots i { width: 6px; height: 6px; border-radius: 50%; background: #CCC; }
.ig-dots i.on { background: #3897F0; }
.ig-icons { display: flex; gap: 14px; padding: 8px 12px 4px; font-size: 20px; }
.ig .pv-text { padding: 2px 12px 12px; font-size: 13.5px; }
.ig .pv-text b { margin-right: 5px; }
.ig .pv-text .tag { color: #00376B; font-weight: 400; }
.th .pv-text .tag { color: #0095F6; font-weight: 400; }
.th { max-width: 380px; }
.th .pv-media { padding: 0 12px 12px 61px; }
.th .pv-media .hscroll { display: flex; gap: 6px; overflow-x: auto; }
.th .pv-media .hscroll img, .th .pv-media .hscroll video { width: 190px; aspect-ratio: 4/5; object-fit: cover; border-radius: 8px; flex: none; }
.th .pv-media > img, .th .pv-media > video { border-radius: 8px; }
.th .pv-text { padding: 0 12px 10px 61px; margin-top: -18px; }
.pv-empty { padding: 50px 20px; text-align: center; color: #999; font-size: 13px; }
.reel-badge { position: absolute; top: 10px; left: 10px; background: rgba(0,0,0,.6); color: #fff; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 12px; }

/* ---------- Modal ---------- */
.modal { position: fixed; z-index: 60; inset: 5vh 50% auto auto; transform: translateX(50%); width: min(980px, 94vw); max-height: 90vh; background: var(--bg); border-radius: 16px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: fade .15s; }
.modal-head { padding: 16px 20px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); background: var(--surface); border-radius: 16px 16px 0 0; }
.modal-head h3 { margin: 0; flex: 1; font-size: 16px; }
.modal-body { overflow: auto; padding: 18px 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; align-items: center; background: var(--surface); border-radius: 0 0 16px 16px; }
.modal-ov { z-index: 59; }

/* ---------- Toast ---------- */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; }
.toast { background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); font-weight: 500; animation: fade .2s; max-width: 520px; }
.toast.err { background: #B4232A; }
.toast.ok { background: #0F7A45; }

/* ---------- Login ---------- */
.login-body { display: grid; place-items: center; min-height: 100vh; }
.login-card { background: var(--surface); padding: 36px 32px; border-radius: 18px; width: 360px; box-shadow: var(--shadow-lg); text-align: center; }
.login-card .field { text-align: left; margin-top: 22px; }
.login-card .err { color: var(--st-failed); min-height: 20px; margin: 10px 0 0; }

@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; overflow-x: auto; padding: 10px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar .brand, .sidebar .legend { display: none; }
  .sidebar-foot { margin: 0; }
  .main { height: auto; }
  .drawer-body { grid-template-columns: 1fr; overflow: auto; }
  .ed-form, .ed-prev { overflow: visible; }
  .week { grid-template-columns: 1fr; }
}
