/* Social Studio admin panel. Brand colours come from /theme.css (editable in Owner → Settings). */
/* Look matches bucksconsultancyservices.com: ink on paper, DM Sans + Playfair italics + DM Mono labels, square corners, hairline borders */
:root {
  --primary: #111113; --accent: #111113; --bg: #f7f7f5; --surface: #fff; --text: #111113; --muted: #686970;
  --font: 'DM Sans', Arial, sans-serif; --radius: 0px;
  --serif: 'Playfair Display', Georgia, serif; --mono: 'DM Mono', ui-monospace, monospace;
  --line: #d9d9d7; --soft: #efefec; --ok: #1f7a4d; --warn: #9a6200; --bad: #b42318; --info: #3b4a6b;
  --shadow: none;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; }
h1 { font-size: 30px; font-weight: 400; letter-spacing: -.01em; } h2 { font-size: 18px; font-weight: 500; } h3 { font-size: 15px; font-weight: 600; }
h1 em, .hero em { font-family: var(--serif); font-style: italic; font-weight: 500; color: #5b5b61; }
.eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }
.muted { color: var(--muted); } .small { font-size: 12px; } .right { text-align: right; } .nowrap { white-space: nowrap; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } .row.between { justify-content: space-between; } .grow { flex: 1; }
.stack > * + * { margin-top: 12px; }
.grid { display: grid; gap: 16px; } .g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 720px) { .g2, .g3 { grid-template-columns: 1fr; } .g4 { grid-template-columns: 1fr 1fr; } }

/* Layout */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--surface); color: var(--text); border-right: 1px solid var(--line); padding: 20px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 18px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.brand img { width: 52px; height: 40px; object-fit: contain; }
.brand.haslogo { flex-direction: column; align-items: flex-start; gap: 6px; }
.brand.haslogo { justify-content: center; } .brand.haslogo img { width: 150px; height: auto; }
.brand .mark { width: 38px; height: 38px; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 800; }
.brand b { display: block; font-size: 14px; font-weight: 600; } .brand span { font-family: var(--mono); font-size: 9.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.nav a { display: flex; gap: 10px; align-items: center; padding: 9px 12px; text-decoration: none; color: #3a3a40; font-weight: 500; margin-bottom: 2px; border: 1px solid transparent; }
.nav a:hover { background: var(--soft); }
.nav a.on { background: var(--primary); color: #fff; }
.nav .sep { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin: 18px 12px 6px; }
.side .foot { margin-top: auto; font-size: 12px; color: var(--muted); padding: 8px; border-top: 1px solid var(--line); }
.main { min-width: 0; }
.top { display: flex; align-items: center; gap: 12px; padding: 14px 28px; background: rgba(255,255,255,.97); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.page { padding: 24px 28px 60px; max-width: 1400px; }
.burger { display: none; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 30; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; }
  .burger { display: inline-flex; }
  .page { padding: 16px; } .top { padding: 12px 16px; }
}

/* Components */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card.pad0 { padding: 0; overflow: hidden; }
.kpi .v { font-size: 34px; font-weight: 400; letter-spacing: -.02em; } .kpi .l { color: var(--muted); font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; }
.kpi { border-top: 2px solid var(--primary); }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--text); padding: 9px 16px; border-radius: var(--radius); font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--primary); }
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn.accent { background: var(--surface); color: var(--primary); border-color: var(--primary); font-weight: 600; }
.btn.accent:hover { background: var(--soft); }
.btn.primary:hover { background: #2a2a2e; }
.btn.danger { color: var(--bad); border-color: #fecaca; } .btn.danger:hover { background: #fef2f2; }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 12px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 1px solid var(--primary); border-color: var(--primary); }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--primary); }
input[type=color] { padding: 2px; height: 38px; }
textarea { min-height: 90px; resize: vertical; }
label.f { display: block; } label.f > span { display: block; font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 5px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: .03em; background: var(--soft); color: #3a3a40; border: 1px solid var(--line); white-space: nowrap; text-decoration: none; }
.b-scheduled { background: #fff; color: var(--text); border-color: var(--text); } .b-published { background: #eef6f1; color: var(--ok); border-color: #cfe3d7; } .b-failed { background: #fbeeec; color: var(--bad); border-color: #f0cfca; }
.b-needs_review { background: #fbf4e6; color: var(--warn); border-color: #ecdcb8; } .b-draft { color: var(--muted); } .b-paused { color: var(--muted); border-style: dashed; }
.b-processing, .b-publishing { background: var(--primary); color: #fff; border-color: var(--primary); }
.b-ig, .b-yt { border: 0; }
.b-ig { background: linear-gradient(45deg, #f58529, #dd2a7b, #8134af); color: #fff; } .b-yt { background: #ff0000; color: #fff; }
.switch { position: relative; width: 42px; height: 24px; flex: none; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i { position: absolute; inset: 0; background: #cbd5e1; border-radius: 999px; cursor: pointer; transition: .2s; }
.switch i::after { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + i { background: var(--primary); } .switch input:checked + i::after { transform: translateX(18px); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-family: var(--mono); font-size: 10.5px; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: .1em; background: var(--bg); }
tr:hover td { background: var(--bg); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 10px 14px; font: inherit; font-weight: 500; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--primary); border-color: var(--primary); font-weight: 600; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--soft); border: 1px solid var(--line); padding: 4px 10px; font-size: 12px; font-weight: 500; }
.chip button { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 0; font-size: 14px; }
.alert { padding: 10px 14px; border-radius: var(--radius); background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; }
.alert.ok { background: #f0fdf4; border-color: #bbf7d0; color: #166534; } .alert.bad { background: #fef2f2; border-color: #fecaca; color: #991b1b; }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 50; display: grid; place-items: center; padding: 20px; }
.modal { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--line); width: min(760px, 100%); max-height: 92vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.wide { width: min(1000px, 100%); }
.modal header { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal .body { padding: 20px 22px; } .modal footer { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; position: sticky; bottom: 0; background: var(--surface); }
#toasts { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--primary); color: #fff; padding: 11px 16px; box-shadow: var(--shadow); max-width: 380px; animation: pop .2s; }
.toast.bad { background: var(--bad); } .toast.ok { background: var(--ok); }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }

/* Login */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login .art { background: var(--bg); color: var(--text); border-right: 1px solid var(--line); padding: 60px; display: flex; flex-direction: column; justify-content: center; }
.login .art h1 { font-size: 56px; font-weight: 400; line-height: 1.05; letter-spacing: -.02em; max-width: 520px; } .login .art p { font-size: 16px; color: #3a3a40; max-width: 440px; }
.login .card { border-color: var(--line); }
.login form { align-self: center; justify-self: center; width: min(380px, 90vw); }
@media (max-width: 800px) { .login { grid-template-columns: 1fr; } .login .art { padding: 40px 24px; } }

/* Accounts */
.acc { display: flex; flex-direction: column; gap: 10px; }
.acc .head { display: flex; gap: 12px; align-items: center; }
.avatar { width: 44px; height: 44px; display: grid; place-items: center; color: #fff; font-weight: 700; flex: none; }
.avatar.instagram { background: linear-gradient(45deg, #f58529, #dd2a7b, #8134af); } .avatar.youtube { background: #ff0000; }
.acc.off { opacity: .6; }

/* Upload */
.drop { border: 1px dashed #b9b9b6; border-radius: var(--radius); padding: 34px; text-align: center; background: var(--surface); cursor: pointer; transition: .15s; }
.drop.over { border-color: var(--primary); background: var(--soft); }
.item { display: grid; grid-template-columns: 110px 1fr; gap: 14px; padding: 14px; border-bottom: 1px solid var(--line); }
.thumb { width: 110px; height: 140px; object-fit: cover; background: #0f172a; }
.thumb.sq { height: 110px; }
.progress { height: 4px; background: var(--soft); overflow: hidden; } .progress i { display: block; height: 100%; background: var(--primary); width: 0; transition: width .2s; }
.lib { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.lib .m { position: relative; overflow: hidden; border: 1px solid var(--line); background: var(--surface); }
.lib .m.sel { outline: 2px solid var(--primary); }
.lib .m img, .lib .m video { width: 100%; height: 150px; object-fit: cover; display: block; background: #0f172a; }
.lib .m .cap { padding: 6px 8px; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.cal .day { border-right: 1px solid var(--line); min-height: 420px; display: flex; flex-direction: column; }
.cal .day:last-child { border-right: 0; }
.cal .dh { padding: 10px; border-bottom: 1px solid var(--line); background: var(--bg); font-family: var(--mono); text-transform: uppercase; letter-spacing: .08em; font-size: 11px; display: flex; justify-content: space-between; }
.cal .dh.today { background: var(--primary); color: #fff; }
.cal .dz { flex: 1; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.cal .dz.over { background: var(--soft); }
.pc { border: 1px solid var(--line); border-left: 3px solid var(--primary); padding: 6px 8px; font-size: 12px; cursor: grab; background: var(--surface); }
.pc:hover { box-shadow: var(--shadow); }
.pc.s-published { border-left-color: var(--ok); cursor: pointer; opacity: .75; } .pc.s-failed { border-left-color: var(--bad); } .pc.s-needs_review { border-left-color: var(--warn); } .pc.s-paused, .pc.s-draft { border-left-color: #94a3b8; }
.pc .t { font-weight: 600; } .pc .c { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 900px) { .cal { grid-template-columns: 1fr; } .cal .day { min-height: auto; border-right: 0; border-bottom: 1px solid var(--line); } }
.bulkbar { position: sticky; top: 64px; z-index: 4; background: var(--primary); color: #fff; padding: 10px 14px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.bulkbar .btn { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.2); }
.bulkbar .btn:hover { background: rgba(255,255,255,.2); }
.scene { border: 1px solid var(--line); padding: 12px; }
.keyok { color: var(--ok); font-weight: 600; } .keybad { color: var(--bad); font-weight: 600; }
code, pre { font-family: var(--mono); } code { background: var(--soft); padding: 2px 6px; font-size: 12px; word-break: break-all; }

/* ---------- Phones & tablets (Android + iPhone) ---------- */
.show-m { display: none; }
.backdrop { display: none; }
.top .bb:empty { display: none; }
body { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
@supports (padding: max(0px)) {
  .side { padding-top: max(20px, env(safe-area-inset-top)); padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  .top { padding-top: max(14px, env(safe-area-inset-top)); }
  #toasts { bottom: max(18px, calc(env(safe-area-inset-bottom) + 12px)); }
  .modal footer { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
}
@media (max-width: 900px) {
  .side.open + .backdrop, .side.open ~ .backdrop { display: block; position: fixed; inset: 0; background: rgba(17,17,19,.35); z-index: 25; }
  .show-m { display: flex; }
  .hide-m { display: none !important; }
  .top { gap: 8px; flex-wrap: wrap; }
  .top #clientSel { min-width: 0 !important; flex: 1; }
  .top .bb { order: 10; flex-basis: 100%; }
  .top .bb .badge { white-space: normal; }
  .card.pad0 { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .card.pad0 > table { min-width: 680px; }
  .bulkbar { top: 0; flex-wrap: nowrap; overflow-x: auto; }
  .bulkbar .btn { flex: none; }
}
@media (max-width: 720px) {
  body { font-size: 15px; }
  /* 16px stops iPhone Safari from zooming into fields */
  input, select, textarea { font-size: 16px; }
  .btn { min-height: 40px; } .btn.sm { min-height: 34px; padding: 6px 10px; }
  .switch { width: 48px; height: 28px; } .switch i::after { width: 22px; height: 22px; } .switch input:checked + i::after { transform: translateX(20px); }
  h1 { font-size: 26px; }
  .page { padding: 16px 14px 90px; }
  .row.between > h1 { flex-basis: 100%; }
  .card { padding: 14px; }
  .kpi .v { font-size: 28px; }
  td, th { padding: 9px 10px; }
  .item { grid-template-columns: 84px 1fr; gap: 10px; padding: 12px; }
  .thumb { width: 84px; height: 108px; }
  .lib { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
  .lib .m img, .lib .m video { height: 130px; }
  .modal-bg { padding: 0; align-items: end; }
  .modal, .modal.wide { width: 100%; max-height: 94vh; max-height: 94dvh; border-left: 0; border-right: 0; border-bottom: 0; }
  .modal header { padding: 14px 16px; } .modal .body { padding: 16px; }
  .modal footer { flex-wrap: wrap; padding: 12px 16px; } .modal footer .btn { flex: 1 1 auto; justify-content: center; }
  .tabs button { padding: 10px 10px; }
  .login { display: flex; flex-direction: column-reverse; justify-content: flex-end; }
  .login form { margin: 20px auto; }
  .login .art { padding: 28px 20px; border-right: 0; border-top: 1px solid var(--line); }
  .login .art h1 { font-size: 36px; }
  .login .art img { width: 110px !important; margin-bottom: 18px !important; }
  #toasts { left: 12px; right: 12px; } .toast { max-width: none; }
  .drop { padding: 26px 14px; }
}
