:root {
  --bg: #f6f7f9; --panel: #fff; --ink: #14171c; --muted: #6b7280; --line: #e5e7eb;
  --brand: #4f46e5; --brand-ink: #fff; --ok: #059669; --warn: #d97706; --bad: #dc2626; --radius: 12px;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0e1116; --panel: #161b22; --ink: #e6edf3; --muted: #8b949e; --line: #2a313b; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 12px; } .error { color: var(--bad); white-space: pre-line; }
h1, h2, h3 { margin: 0 0 4px; } h2 { font-size: 22px; } h3 { margin-top: 28px; font-size: 15px; }
header { margin-bottom: 18px; } header p { margin: 4px 0 0; }
code { background: var(--line); padding: 1px 5px; border-radius: 4px; }

.login { min-height: 100vh; display: grid; place-items: center; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.narrow { width: min(380px, 92vw); display: grid; gap: 12px; }

.shell { display: grid; grid-template-columns: 210px 1fr; min-height: 100vh; }
.sidebar { border-right: 1px solid var(--line); background: var(--panel); padding: 20px 14px; display: flex; flex-direction: column; gap: 18px; }
.brand { font-weight: 700; font-size: 18px; padding: 0 8px; }
nav { display: grid; gap: 2px; flex: 1; align-content: start; }
nav a { padding: 8px 10px; border-radius: 8px; color: inherit; text-decoration: none; }
nav a.active, nav a:hover { background: var(--bg); }
nav a.active { font-weight: 600; color: var(--brand); }
main { padding: 28px clamp(16px, 3vw, 40px); max-width: 1200px; width: 100%; position: relative; }
/* Phones: bottom tab bar, full-width inputs, safe areas for notches */
@media (max-width: 720px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 5; flex-direction: row; align-items: center; gap: 4px; border-right: 0; border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); }
  .sidebar .brand, #logout, #install { display: none; }
  nav { display: flex; flex: 1; justify-content: space-around; }
  nav a { font-size: 13px; padding: 8px 6px; }
  main { padding: calc(16px + env(safe-area-inset-top)) 14px 90px; }
  .target-head { flex-wrap: wrap; } .target-head input[type=datetime-local] { width: 100%; }
  .job { grid-template-columns: 64px 1fr; } .job .actions { grid-column: 1 / -1; justify-content: start; }
  .toast { left: 14px; right: 14px; bottom: 80px; }
  input, select, textarea { font-size: 16px; } /* stops iOS zooming into fields */
}
.qr svg { width: 220px; height: 220px; background: #fff; padding: 8px; border-radius: 10px; display: block; margin: 8px 0; }
.mono { font-family: ui-monospace, Consolas, monospace; word-break: break-all; }
/* Installed Chrome app with window-controls-overlay: keep content clear of the title bar */
@media (display-mode: window-controls-overlay) { .sidebar { padding-top: calc(env(titlebar-area-height, 0px) + 12px); } }

label { display: block; font-weight: 600; font-size: 13px; margin: 14px 0 6px; }
.card > label:first-child { margin-top: 0; }
input, textarea, select { width: 100%; font: inherit; color: inherit; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; }
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus, button:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
button { font: inherit; cursor: pointer; border-radius: 8px; padding: 9px 14px; border: 1px solid var(--line); background: var(--panel); color: inherit; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); font-weight: 600; }
button.ghost { background: transparent; } button.small { padding: 6px 10px; font-size: 13px; }
button.danger { color: var(--bad); } button.wide { width: 100%; margin-top: 16px; }
button.link { border: 0; padding: 0; background: none; color: var(--brand); text-decoration: underline; }
.row { display: flex; align-items: center; } .between { justify-content: space-between; gap: 12px; flex-wrap: wrap; } .gap { gap: 8px; }
.row.gap input, .row.gap select { width: auto; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 980px) { .grid2 { grid-template-columns: 1fr; } }

.dropzone { border: 2px dashed var(--line); border-radius: var(--radius); padding: 22px; text-align: center; margin-bottom: 8px; }
.dropzone.over { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 8%, transparent); }
.dropzone video, .dropzone img { max-width: 100%; max-height: 240px; border-radius: 8px; }
.progress { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-bottom: 8px; }
.progress div { height: 100%; width: 0; background: var(--brand); transition: width .2s; }

.targets { display: grid; gap: 8px; margin-top: 10px; }
.target { border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.target.off { opacity: .55; }
.target-head { display: flex; gap: 10px; align-items: center; }
.target-head input[type=checkbox] { width: 18px; height: 18px; }
.target-head .name { flex: 1; min-width: 0; }
.target-head input[type=datetime-local] { width: 200px; }
.target details { margin-top: 8px; } .target summary { font-size: 12px; color: var(--muted); cursor: pointer; }
.target details textarea, .target details input, .target details select { margin-top: 6px; }

.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--line); text-transform: uppercase; letter-spacing: .03em; }
.p-youtube { background: #ff000022; color: #c00; } .p-tiktok { background: #00000018; } .p-instagram { background: #c1358422; color: #c13584; }
.p-facebook { background: #1877f222; color: #1877f2; } .p-x { background: #00000018; } .p-linkedin { background: #0a66c222; color: #0a66c2; } .p-mock { background: #4f46e522; color: var(--brand); }
.s-scheduled { color: var(--brand); } .s-publishing { color: var(--warn); } .s-published { color: var(--ok); } .s-failed { color: var(--bad); } .s-cancelled { color: var(--muted); }

.connectors { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.connector { display: grid; gap: 8px; align-content: space-between; }
.connector p { margin: 0; font-size: 12px; }
.account-list { display: grid; gap: 8px; }
.account { display: flex; gap: 12px; align-items: center; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--line); object-fit: cover; flex: none; }
.account .grow { flex: 1; min-width: 0; }

.day { margin-bottom: 22px; } .day h4 { margin: 0 0 8px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.job { display: grid; grid-template-columns: 84px 1fr auto; gap: 12px; align-items: center; padding: 10px 14px; margin-bottom: 6px; }
.job .time { font-variant-numeric: tabular-nums; font-weight: 600; }
.job .what { min-width: 0; } .job .what div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: end; }
.job .err { color: var(--bad); font-size: 12px; white-space: normal !important; }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.media-grid .card { padding: 10px; display: grid; gap: 6px; }
.media-grid video, .media-grid img { width: 100%; aspect-ratio: 16/10; object-fit: cover; border-radius: 8px; background: #000; }

/* Loading skeletons (shimmer placeholders while lists fetch) */
.skeleton { display: grid; gap: 8px; margin-bottom: 6px; pointer-events: none; }
.sk-line { height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--line) 25%, var(--bg) 50%, var(--line) 75%); background-size: 200% 100%; animation: sk-shimmer 1.2s infinite linear; }
.sk-line.w60 { width: 60%; } .sk-line.w40 { width: 40%; }
@keyframes sk-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .sk-line { animation: none; } }

.toast { position: fixed; right: 20px; bottom: 20px; background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 10px; max-width: 420px; z-index: 10; box-shadow: 0 8px 24px #0003; }
.toast.bad { background: var(--bad); color: #fff; }
dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: inherit; width: min(720px, 94vw); }
dialog pre { max-height: 60vh; overflow: auto; background: var(--bg); padding: 12px; border-radius: 8px; font-size: 12px; white-space: pre-wrap; }
.grid2 > *, .shell > main { min-width: 0; }
.row.gap { flex-wrap: wrap; }
@media (max-width: 720px) {
  .row.between > .row.gap { width: 100%; }
  .row.between > .row.gap > input { flex: 1 1 100%; }
  .row.between > .row.gap > select { flex: 1; }
  .job .what div:first-child { white-space: normal; }
  .grid2 .card { padding: 14px; }
}
@media (max-width: 720px) { .target-head .name { flex: 1 1 calc(100% - 40px); } }

/* SCN logo on sign-in + sidebar (added 2026-11-20 for Google app verification: logo must appear on the app home page) */
.login-logo { width: 84px; height: 84px; border-radius: 18px; display: block; margin: 0 auto 10px; }
.brand-logo { width: 26px; height: 26px; border-radius: 6px; vertical-align: -6px; margin-right: 8px; }
.legal { text-align: center; margin-top: 14px; line-height: 1.6; }
.legal a { color: inherit; text-decoration: underline; }

/* Sidebar logo sizing fix (2026-11-20): constrain the brand emblem inside the sidebar */
.brand { display: flex; align-items: center; gap: 8px; }
.brand img.brand-logo { width: 26px !important; height: 26px !important; max-width: 26px; object-fit: contain; flex: none; margin: 0; }
img.login-logo { width: 84px !important; height: 84px !important; object-fit: contain; }
