:root {
  --bg: #f6f7f4;
  --panel: #ffffff;
  --ink: #1d2a22;
  --muted: #6b766f;
  --line: #e2e6df;
  --accent: #2f8f5b;
  --accent-ink: #ffffff;
  --warn: #b7791f;
  --error: #c0392b;
  --maestro: #eef6f1;
  --event: #f4f2ea;
  /* Soft button colours, one per kind of action: background, text, border */
  --btn-danger-bg: #fdecea; --btn-danger-ink: #a8322a; --btn-danger-line: #f3c4bf;
  --btn-info-bg: #e8f1fb; --btn-info-ink: #1f5f9e; --btn-info-line: #c3d9f1;
  --btn-warn-bg: #fdf4e3; --btn-warn-ink: #8a5a0b; --btn-warn-line: #f0dbb0;
  --btn-connect-bg: #f0ecfb; --btn-connect-ink: #5a45a8; --btn-connect-line: #d8cff3;
  --btn-upload-bg: #e5f5f3; --btn-upload-ink: #16716b; --btn-upload-line: #bfe4df;
  /* Social Insights chart: one fixed colour per platform (validated categorical slots 1-4) */
  --pf-facebook: #2a78d6; --pf-instagram: #eb6834; --pf-youtube: #1baf7a; --pf-x: #eda100;
}
/* Dark look: follows the computer unless Control Panel picks light or dark (data-theme on <html>) */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121614;
  --panel: #1a201c;
  --ink: #e7ece8;
  --muted: #93a098;
  --line: #2b332e;
  --accent: #4cbb7f;
  --accent-ink: #0d1510;
  --maestro: #1d2a22;
  --event: #24231d;
  --btn-danger-bg: #3a1f1d; --btn-danger-ink: #f2a29a; --btn-danger-line: #5a2c28;
  --btn-info-bg: #1b2a3a; --btn-info-ink: #9cc4ee; --btn-info-line: #2b4560;
  --btn-warn-bg: #352a17; --btn-warn-ink: #eac77f; --btn-warn-line: #57431f;
  --btn-connect-bg: #2a2440; --btn-connect-ink: #c4b6f2; --btn-connect-line: #43396a;
  --btn-upload-bg: #16302d; --btn-upload-ink: #8fd6cc; --btn-upload-line: #24504a;
  --pf-facebook: #3987e5; --pf-instagram: #d95926; --pf-youtube: #199e70; --pf-x: #c98500;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121614;
    --panel: #1a201c;
    --ink: #e7ece8;
    --muted: #93a098;
    --line: #2b332e;
    --accent: #4cbb7f;
    --accent-ink: #0d1510;
    --maestro: #1d2a22;
    --event: #24231d;
    --btn-danger-bg: #3a1f1d; --btn-danger-ink: #f2a29a; --btn-danger-line: #5a2c28;
    --btn-info-bg: #1b2a3a; --btn-info-ink: #9cc4ee; --btn-info-line: #2b4560;
    --btn-warn-bg: #352a17; --btn-warn-ink: #eac77f; --btn-warn-line: #57431f;
    --btn-connect-bg: #2a2440; --btn-connect-ink: #c4b6f2; --btn-connect-line: #43396a;
    --btn-upload-bg: #16302d; --btn-upload-ink: #8fd6cc; --btn-upload-line: #24504a;
    --pf-facebook: #3987e5; --pf-instagram: #d95926; --pf-youtube: #199e70; --pf-x: #c98500;
  }
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 "Segoe UI", system-ui, sans-serif; background: var(--bg); color: var(--ink); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--error); min-height: 1.2em; }
h1, h2, h3 { margin: 0 0 .4em; }
button { font: inherit; background: var(--accent); color: var(--accent-ink); border: 1px solid transparent; border-radius: 8px; padding: .5em 1em; cursor: pointer; transition: filter .15s, box-shadow .15s; }
button:hover:not(:disabled) { filter: brightness(.97); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
button:disabled { opacity: .5; cursor: default; }
button.secondary { background: transparent; color: var(--ink); border-color: var(--line); }
/* One soft colour per kind of action */
button.btn-approve { background: var(--accent); color: var(--accent-ink); }
button.danger { background: var(--btn-danger-bg); color: var(--btn-danger-ink); border-color: var(--btn-danger-line); }
button.danger.confirming { background: var(--error); color: #fff; border-color: var(--error); font-weight: 600; }
button.btn-info { background: var(--btn-info-bg); color: var(--btn-info-ink); border-color: var(--btn-info-line); }
button.btn-warn { background: var(--btn-warn-bg); color: var(--btn-warn-ink); border-color: var(--btn-warn-line); }
button.btn-connect { background: var(--btn-connect-bg); color: var(--btn-connect-ink); border-color: var(--btn-connect-line); }
button.link { background: none; color: var(--accent); padding: 0; border: 0; box-shadow: none; }
input, textarea, select { font: inherit; width: 100%; padding: .5em .6em; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); }
label { display: block; margin: .6em 0; font-size: .9em; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.card.inset { margin: 8px 0; padding: 12px; border-color: var(--accent, var(--line)); }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(360px, 100%); }
.login-card button { width: 100%; margin-top: .6em; }

.app { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; transition: grid-template-columns .25s ease; }
.sidebar { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 16px 12px;
  height: 100vh; position: sticky; top: 0; overflow-y: auto; transition: transform .25s ease, opacity .2s; }
.app.menu-collapsed { grid-template-columns: 0 1fr; }
.app.menu-collapsed .sidebar { transform: translateX(-100%); opacity: 0; pointer-events: none; padding: 0; border: 0; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.brand { font-weight: 700; font-size: 1.2em; color: var(--accent); display: flex; align-items: center; gap: 8px; }
.brand-logo { width: 28px; height: 28px; flex: none; }
.login-logo { display: block; width: 64px; height: 64px; margin: 0 0 4px; }
.icon-btn { background: transparent; color: var(--muted); border: 1px solid var(--line); padding: .1em .55em; font-size: 1.05em; line-height: 1.4; }
.menu-open { position: fixed; top: 12px; left: 12px; z-index: 20; display: none; background: var(--panel); color: var(--ink);
  border: 1px solid var(--line); box-shadow: 0 2px 8px rgba(0, 0, 0, .08); padding: .35em .7em; }
.app.menu-collapsed .menu-open { display: block; }
.app.menu-collapsed main { padding-left: 64px; }
.menu-search { margin-bottom: 10px; font-size: .9em; padding: .45em .7em; }
nav { display: flex; flex-direction: column; gap: 2px; }
.menu-group { margin-bottom: 6px; }
.menu-head { width: 100%; background: none; color: var(--ink); opacity: .82; text-align: left; font-size: .76em; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; padding: .55em .6em .35em; display: flex; align-items: center; gap: 8px; box-shadow: none; }
.menu-head:hover { opacity: 1; background: var(--bg); }
.menu-head .menu-icon { color: var(--accent); flex: none; }
.menu-head::after { content: "▾"; margin-left: auto; transition: transform .2s; }
.menu-head[aria-expanded="false"]::after { transform: rotate(-90deg); }
.menu-items { display: flex; flex-direction: column; gap: 2px; }
.nav { background: none; color: var(--ink); text-align: left; display: flex; justify-content: space-between; align-items: center; padding: .45em .8em; }
.nav:hover:not(.active) { background: var(--bg); box-shadow: none; }
.nav.active { background: var(--maestro); color: var(--accent); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.badge { background: var(--warn); color: #fff; border-radius: 999px; padding: 0 .5em; font-size: .8em; }
main { padding: 0 20px 20px; overflow: auto; height: 100vh; }

/* Top bar: bell with approvals, then the profile chip */
.topbar { position: sticky; top: 0; z-index: 15; display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  height: 56px; margin: 0 -20px 12px; padding: 0 20px; background: var(--bg); border-bottom: 1px solid var(--line); }
.topbar-extra { margin-right: auto; }

/* Page tabs under the top bar: one per open menu; they scroll sideways when there are many */
.page-tabs { position: sticky; top: 56px; z-index: 14; display: flex; align-items: flex-end; gap: 4px; overflow-x: auto; overflow-y: hidden; margin: -12px -20px 14px;
  padding: 6px 20px 0; background: var(--bg); border-bottom: 1px solid var(--line); scrollbar-width: thin; }
.page-tab { display: flex; align-items: center; flex: none; margin-bottom: -1px; color: var(--muted); background: transparent;
  border: 1px solid transparent; border-bottom: 0; border-radius: 8px 8px 0 0; }
.page-tab:hover:not(.active) { background: var(--panel); color: var(--ink); }
.page-tab.active { background: var(--panel); color: var(--accent); border-color: var(--line); box-shadow: inset 0 2px 0 var(--accent); font-weight: 600; }
.page-tab-open, .page-tab-close { background: none; color: inherit; border: 0; box-shadow: none; }
.page-tab-open { padding: .4em .35em .4em .85em; font: inherit; white-space: nowrap; }
.page-tab-close { width: 22px; height: 22px; margin-right: 5px; padding: 0; border-radius: 50%; font-size: 1.05em; line-height: 1; }
.page-tab-close:hover { background: var(--line); color: var(--ink); box-shadow: none; filter: none; }
.bell-wrap, .attach-wrap { position: relative; }
.bell { position: relative; background: var(--panel); color: var(--muted); border: 1px solid var(--line); border-radius: 999px;
  width: 40px; height: 40px; padding: 0; display: grid; place-items: center; }
.bell.ringing { color: var(--warn); border-color: var(--warn); }
.bell.ringing svg { transform-origin: 50% 8%; animation: bell-ring 4s ease-in-out infinite; }
.bell.shake-now svg { animation: bell-shake .9s ease-in-out 2, bell-ring 4s ease-in-out 1.8s infinite; }
.bell .badge { position: absolute; top: -4px; right: -6px; min-width: 20px; line-height: 20px; padding: 0 5px; font-size: .72em; font-weight: 700; }
@keyframes bell-ring {
  0%, 12%, 100% { transform: rotate(0); }
  2% { transform: rotate(14deg); } 4% { transform: rotate(-12deg); } 6% { transform: rotate(9deg); }
  8% { transform: rotate(-6deg); } 10% { transform: rotate(3deg); }
}
@keyframes bell-shake {
  0%, 100% { transform: rotate(0); }
  15% { transform: rotate(22deg); } 30% { transform: rotate(-20deg); } 45% { transform: rotate(16deg); }
  60% { transform: rotate(-12deg); } 75% { transform: rotate(6deg); }
}
@media (prefers-reduced-motion: reduce) { .bell svg { animation: none !important; } }
.bell-menu { position: absolute; right: 0; top: 48px; width: min(380px, calc(100vw - 32px)); padding: 8px; z-index: 30;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .14); display: flex; flex-direction: column; gap: 4px; }
.bell-menu-head { font-size: .78em; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 4px 8px; }
.bell-item { background: none; color: var(--ink); text-align: left; display: flex; flex-direction: column; gap: 2px; padding: 8px;
  border-left: 3px solid var(--warn); border-radius: 6px; font-size: .9em; }
.bell-item:hover { background: var(--bg); }
.bell-item.bell-message { border-left-color: var(--accent); }
.bell-item .muted { font-size: .85em; }
.bell-all { align-self: flex-end; padding: 4px 8px; font-size: .9em; }
.me-button { display: flex; align-items: center; gap: 8px; background: none; color: var(--ink); padding: 4px 10px 4px 4px;
  border: 1px solid var(--line); border-radius: 999px; }
.me-button[aria-expanded="true"] { border-color: var(--accent); }
.caret { font-size: .75em; color: var(--muted); }
.me-wrap { position: relative; }
.me-menu { position: absolute; right: 0; top: 48px; width: 280px; padding: 8px; z-index: 30; box-shadow: 0 8px 24px rgba(0, 0, 0, .14);
  display: flex; flex-direction: column; gap: 2px; }
.me-menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; width: 100%; }
.me-head { display: flex; gap: 10px; align-items: center; padding: 6px 8px; }
.me-who { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.me-who strong, .me-who .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-who .muted { font-size: .85em; }
.me-who .pill { align-self: flex-start; }
.avatar-md { width: 44px; height: 44px; font-size: 1em; }
.me-item { background: none; color: var(--ink); text-align: left; display: flex; align-items: center; gap: 10px; padding: .5em .7em;
  border-radius: 6px; font-size: .95em; }
.me-item:hover { background: var(--bg); box-shadow: none; }
.me-icon { width: 1.4em; text-align: center; }
.me-item.me-logout { color: var(--error); }
.sound-hint { position: fixed; right: 16px; bottom: 16px; z-index: 70; background: var(--panel); color: var(--ink);
  border: 1px solid var(--line); border-radius: 999px; padding: .45em .95em; font-size: .85em; box-shadow: 0 6px 18px rgba(0, 0, 0, .12); }
.sound-hint:hover { background: var(--bg); }
.context-menu { position: fixed; right: auto; top: 0; left: 0; width: 230px; max-height: calc(100vh - 16px); overflow-y: auto; z-index: 60; }
.context-head { font-size: .72em; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: .5em .7em .15em; }
.context-menu .me-item { padding: .4em .7em; }
.context-menu .me-item.current { font-weight: 700; }
.me-name { max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .92em; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--maestro); color: var(--accent); display: inline-grid;
  place-items: center; font-weight: 700; font-size: .8em; overflow: hidden; flex: none; border: 1px solid var(--line); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 96px; height: 96px; font-size: 1.8em; }
.profile-photo { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 8px 0 12px; }
.section-card { margin-top: 16px; }

.chat-layout { display: grid; grid-template-columns: 220px 1fr; gap: 16px; height: calc(100vh - 130px); }
.chat-list { display: flex; flex-direction: column; min-height: 0; }
.chat-list ul { list-style: none; padding: 0; margin: 8px 0 0; flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: none; }  /* pages, not scrolling */
.chat-list ul::-webkit-scrollbar { display: none; }
.chat-list > * { flex: none; }
.chat-list > ul { flex: 1; }
/* Chat list pages, under "+ New chat": small, quiet buttons; the current page in the accent colour */
.list-pager { display: flex; align-items: center; justify-content: center; gap: 2px; margin-top: 10px; padding: 3px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--panel); }
.lp-btn { min-width: 26px; height: 26px; padding: 0 6px; border-radius: 999px; background: none; color: var(--muted);
  font-size: .82em; font-weight: 500; line-height: 26px; box-shadow: none; }
.lp-btn:hover:not(:disabled) { background: var(--bg); color: var(--ink); box-shadow: none; }
.lp-btn.current, .lp-btn.current:disabled { background: var(--accent); color: var(--accent-ink); font-weight: 700; opacity: 1; cursor: default; }
.lp-btn:disabled:not(.current) { opacity: .35; cursor: default; }
.lp-arrow { font-size: 1em; font-weight: 700; }
.lp-gap { min-width: 14px; text-align: center; color: var(--muted); font-size: .82em; }
.chat-list li { padding: .4em .6em; border-radius: 8px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-list li.active { background: var(--maestro); color: var(--accent); }
.chat-list > button { width: 100%; }
.chat-list li { display: flex; align-items: center; gap: 4px; }
.chat-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.chat-del, .chat-restore { flex: none; font-size: .78em; padding: .1em .5em; }
.chat-del { opacity: 0; transition: opacity .15s; }
.chat-list li:hover .chat-del, .chat-list li.active .chat-del, .chat-del:focus-visible, .chat-del.confirming { opacity: 1; }
.chat-list li.is-deleted .chat-title { color: var(--muted); text-decoration: line-through; }
label.show-deleted { margin-top: 10px; font-size: .85em; color: var(--muted); }
.deleted-banner { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 8px 12px; margin-bottom: 8px; border-radius: 10px; font-size: .9em;
  background: var(--btn-danger-bg); color: var(--btn-danger-ink); border: 1px solid var(--btn-danger-line); }
.card.is-deleted { opacity: .75; border-style: dashed; }
.chat-main { display: flex; flex-direction: column; min-height: 0; }
.messages { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding-right: 4px; }
.msg { max-width: 760px; padding: 10px 14px; border-radius: 12px; white-space: pre-wrap; word-wrap: break-word; }
.msg.user { align-self: flex-end; background: var(--accent); color: var(--accent-ink); }
.msg.maestro { align-self: flex-start; background: var(--maestro); border: 1px solid var(--line); }
.msg.schedule { align-self: flex-end; background: var(--btn-warn-bg); color: var(--btn-warn-ink); border: 1px solid var(--btn-warn-line); }
.msg.event { align-self: center; background: var(--event); font-size: .88em; color: var(--muted); max-width: 680px; }
.msg .who { font-size: .75em; font-weight: 600; opacity: .7; display: block; }
.chat-form { display: flex; gap: 8px; margin-top: 12px; align-items: flex-end; }
.chat-form textarea { resize: vertical; }
/* Team Chat */
.team-threads li.team-thread { display: flex; align-items: center; gap: 8px; padding: .5em .5em; white-space: normal; }
.team-thread-text { flex: 1; min-width: 0; }
.team-thread-top { display: flex; justify-content: space-between; gap: 6px; }
.team-thread-top strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-avatar { font-size: 1em; }
.avatar-sm { width: 28px; height: 28px; font-size: .7em; }
.team-head { display: flex; align-items: center; gap: 10px; padding: 4px 0 10px; border-bottom: 1px solid var(--line); margin-bottom: 8px; min-height: 48px; }
.team-msg { display: flex; gap: 8px; align-items: flex-end; max-width: 760px; }
.team-msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.team-bubble { background: var(--panel); border: 1px solid var(--line); border-radius: 14px 14px 14px 4px; padding: 8px 12px; min-width: 120px; }
.team-msg.mine .team-bubble { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); border-radius: 14px 14px 4px 14px; }
.team-msg.mine .team-bubble .muted, .team-msg.mine .team-del { color: var(--accent-ink); opacity: .8; }
.team-meta { display: flex; gap: 8px; align-items: baseline; font-size: .85em; margin-bottom: 2px; }
.team-del { font-size: .85em; margin-left: auto; }
.team-del.confirming { opacity: 1; font-weight: 700; }.team-text { white-space: pre-wrap; word-wrap: break-word; }
.team-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.team-media img, video.team-media { max-width: 240px; max-height: 240px; border-radius: 10px; display: block; background: #fff; }
.team-chip { background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: .25em .8em; font-size: .85em; }
.team-chip:disabled { opacity: .8; cursor: default; }
.team-msg.mine .team-chip { background: rgba(255, 255, 255, .9); color: #1d2a22; }
.team-person { flex-direction: row; align-items: center; gap: 10px; padding: 8px 10px; }
.team-new-dialog { width: min(480px, calc(100vw - 32px)); }
/* Attach button, its menu, and the chips of what will be sent */
.attach-btn { background: var(--panel); color: var(--muted); border: 1px solid var(--line); width: 42px; height: 42px; padding: 0;
  display: grid; place-items: center; }
.attach-btn:hover, .attach-btn[aria-expanded="true"] { color: var(--accent); border-color: var(--accent); }
.attach-menu { position: absolute; bottom: 50px; left: 0; z-index: 30; padding: 6px; min-width: 220px; display: flex;
  flex-direction: column; gap: 2px; box-shadow: 0 8px 24px rgba(0, 0, 0, .14); }
.attach-menu button, .attach-menu .menu-item { background: none; color: var(--ink); text-align: left; padding: .5em .7em;
  border-radius: 6px; margin: 0; font-size: .95em; cursor: pointer; }
.attach-menu button:hover, .attach-menu .menu-item:hover { background: var(--bg); box-shadow: none; }
.attach-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.attach-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 280px; padding: 3px 4px 3px 8px; font-size: .85em;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px; }
.attach-chip img { width: 22px; height: 22px; object-fit: cover; border-radius: 4px; }
.attach-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip-x { background: none; color: var(--muted); padding: 0 .4em; border-radius: 999px; font-size: .9em; }
.chip-x:hover { color: var(--error); box-shadow: none; }
/* Picker dialog */
.picker { width: min(880px, calc(100vw - 32px)); max-height: 86vh; border: 1px solid var(--line); border-radius: 14px;
  background: var(--panel); color: var(--ink); padding: 16px; }
.picker[open] { display: flex; flex-direction: column; }
.picker::backdrop { background: rgba(0, 0, 0, .45); }
.picker-head { display: flex; justify-content: space-between; align-items: center; }
.picker-body { overflow-y: auto; min-height: 200px; flex: 1; }
.picker-foot { justify-content: space-between; border-top: 1px solid var(--line); padding-top: 10px; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.pick-list { display: flex; flex-direction: column; gap: 6px; }
.pick { background: var(--bg); color: var(--ink); border: 2px solid transparent; border-radius: 10px; padding: 6px; text-align: left;
  display: flex; flex-direction: column; gap: 6px; font-size: .85em; }
.pick-list .pick { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 10px; }
.pick.selected { border-color: var(--accent); background: var(--maestro); }
.pick img, .pick video, .pick-icon { width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 6px; background: var(--panel); }
.pick-icon { display: grid; place-items: center; font-size: 40px; color: var(--accent); }
.pick-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Recurring tasks: on/off switch and the schedule editor */
.recurring-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
label.switch { display: inline-flex; align-items: center; gap: 6px; margin: 0; cursor: pointer; flex: none; position: relative; }
label.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.slider { width: 40px; height: 22px; border-radius: 999px; background: var(--line); position: relative; transition: background .2s; }
.slider::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .2s; }
label.switch input:checked + .slider { background: var(--accent); }
label.switch input:checked + .slider::after { transform: translateX(18px); }
label.switch input:focus-visible + .slider { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch-text { font-size: .85em; font-weight: 600; color: var(--muted); min-width: 2em; }
.schedule-edit { margin: 6px 0; }
.schedule-edit select, .schedule-edit input[type="time"] { width: auto; }
.inbox-watch { margin-bottom: 14px; border-left: 4px solid var(--accent); display: flex; flex-direction: column; gap: 6px; }
.inbox-watch .row span { font-size: .9em; }
.inbox-watch select, .inbox-watch .row input[type="time"] { width: auto; flex: none; min-width: 0; }
.inbox-watch input.num { width: 80px; flex: none; min-width: 0; }
.backup-card { margin: 10px 0; border-left: 4px solid var(--accent); display: flex; flex-direction: column; gap: 6px; }
.backup-card .row span { font-size: .9em; }
.backup-card .row input[type="time"] { width: auto; flex: none; min-width: 0; }
.backup-card input.num { width: 70px; flex: none; min-width: 0; }
.backup-running { margin: 0; font-weight: 600; }
.backup-list { margin: 6px 0 0; padding-left: 18px; font-size: .9em; }
.backup-list li { display: flex; justify-content: space-between; gap: 12px; }
.day-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
label.day-chip { display: inline-flex; align-items: center; gap: 4px; margin: 0; padding: 2px 8px; border: 1px solid var(--line);
  border-radius: 999px; font-size: .85em; cursor: pointer; }
label.day-chip input { width: auto; }
/* Control Panel swatches */
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 34px; height: 34px; padding: 0; border-radius: 50%; background: var(--swatch); border: 3px solid var(--panel);
  box-shadow: 0 0 0 1px var(--line); }
.swatch.active { box-shadow: 0 0 0 2px var(--ink); }
.sound-switch-row { align-items: center; margin: 8px 0; }
.color-input { width: 56px; height: 36px; padding: 2px; flex: none; min-width: 0; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.board { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 12px; align-items: start; }
.column h3 { font-size: .95em; color: var(--muted); }
.task { margin-bottom: 8px; font-size: .9em; }
.task pre, .approval pre { white-space: pre-wrap; font-size: .85em; background: var(--bg); padding: 8px; border-radius: 8px; max-height: 220px; overflow: auto; }
.pill { display: inline-block; font-size: .75em; border-radius: 999px; padding: 0 .6em; border: 1px solid var(--line); margin-right: 4px; }
.pill.ok { color: var(--accent); border-color: var(--accent); }
.pill.off { color: var(--muted); }
.pill.warn { color: var(--warn); border-color: var(--warn); }
.pill.bad { color: var(--error); border-color: var(--error); }
.approval { margin-bottom: 12px; border-left: 4px solid var(--warn); }
.approval-head { font-size: .75em; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--warn); }
.approval h3 { font-size: 1em; }
/* Email reply approvals: looks like an opened email */
.approval-email { border-left-color: var(--accent); }
.approval-email .approval-head { color: var(--accent); }
.mail { margin: 8px 0; display: flex; flex-direction: column; gap: 10px; }
.mail-subject { font-size: 1.25em; font-weight: 600; line-height: 1.3; }
.mail-subject.small-subject { font-size: 1em; margin: 6px 0; }
.mail-person { display: flex; gap: 10px; align-items: center; }
.mail-avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 700;
  background: var(--btn-info-bg); color: var(--btn-info-ink); }
.mail-avatar.own { background: var(--accent); color: var(--accent-ink); }
.mail-who { min-width: 0; font-size: .92em; }
.mail-who > div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-frame { width: 100%; height: 420px; border: 1px solid var(--line); border-radius: 10px; background: #f6f7f4; display: block; }
.blog-frame { background: #fff; height: 560px; }
/* Dashboard: number tiles, then panels (attention, work chart, coming up, chats, activity) */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.dash-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 10px 0 16px; }
.dash-tile { display: flex; flex-direction: column; gap: 2px; text-align: left; color: var(--ink); font: inherit; cursor: pointer;
  border-left: 4px solid var(--accent); transition: box-shadow .15s; }
.dash-tile:hover { box-shadow: 0 4px 14px rgba(0, 0, 0, .08); }
.dash-tile.alert { border-left-color: var(--warn); }
.dash-num { font-size: 2em; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.dash-label { font-weight: 600; }
.dash-panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 12px; align-items: start; }
.dash-panel h3 { margin: 0 0 10px; font-size: 1em; }
.dash-list { display: flex; flex-direction: column; }
.dash-row { display: flex; gap: 10px; align-items: baseline; padding: 7px 4px; border-bottom: 1px solid var(--line); background: none;
  color: var(--ink); font: inherit; text-align: left; width: 100%; border-radius: 0; box-shadow: none; }
.dash-row:last-child { border-bottom: 0; }
button.dash-row { cursor: pointer; }
button.dash-row:hover { background: var(--bg); box-shadow: none; }
.dash-icon { flex: none; width: 1.3em; text-align: center; }
.dash-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-meta { flex: none; }
.work-chart { display: flex; gap: 10px; align-items: flex-end; height: 160px; padding: 8px 4px 0; border-bottom: 1px solid var(--line); }
.work-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; }
.work-track { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.work-bar { width: min(28px, 70%); background: var(--accent); border-radius: 4px 4px 0 0; position: relative; min-height: 2px; }
.work-bar.empty { background: var(--line); }
.work-tip { position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: .78em;
  background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .12); opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 2; }
.work-col:hover .work-tip { opacity: 1; }
.work-col:hover .work-bar:not(.empty) { filter: brightness(1.1); }
.work-day { padding-bottom: 6px; }
/* Content > Product Posts and Blog Posts */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.sync-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 6px; }
.list-search { max-width: 320px; margin-bottom: 12px; }
.product-card { display: flex; flex-direction: column; gap: 6px; text-align: left; color: var(--ink); padding: 10px; cursor: pointer;
  font: inherit; transition: border-color .15s, box-shadow .15s; }
.product-card:hover { border-color: var(--accent); box-shadow: 0 4px 14px rgba(0, 0, 0, .08); }
.product-card img, .product-noimg { width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 8px; background: var(--bg); }
.product-noimg { display: grid; place-items: center; color: var(--muted); font-size: .85em; }
.product-title { font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-price { display: flex; gap: 8px; align-items: baseline; }
.product-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.blog-dialog { width: min(820px, calc(100vw - 32px)); }
/* Product details, in the page: photos on the left, the edit form on the right (stacked on narrow screens) */
.product-detail-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.product-detail-top .row { gap: 16px; }
.product-detail-title { margin: 14px 0 4px; }
.product-badges { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 6px 0 16px; }
.product-detail-grid { display: grid; grid-template-columns: minmax(260px, 440px) minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 900px) { .product-detail-grid { grid-template-columns: minmax(0, 1fr); } }
.product-gallery { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.product-hero { width: 100%; aspect-ratio: 1; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); overflow: hidden; }
.product-hero img { width: 100%; height: 100%; object-fit: contain; display: block; }
.product-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
.product-thumb { padding: 0; aspect-ratio: 1; border: 2px solid var(--line); border-radius: 8px; background: var(--panel); overflow: hidden;
  cursor: pointer; box-shadow: none; }
.product-thumb.selected { border-color: var(--accent); }
.product-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.product-form { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
/* The description editor: a toolbar over an editable area that looks like the finished text */
.rte-label { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin: .6em 0 .3em; font-size: .9em; }
.rte { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); overflow: hidden; }
.rte:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--maestro); }
.rte-toolbar { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 6px; border-bottom: 1px solid var(--line); background: var(--bg); }
.rte-btn { background: transparent; color: var(--ink); border: 1px solid transparent; border-radius: 6px; padding: .25em .6em;
  font-size: .88em; box-shadow: none; }
.rte-btn:hover:not(:disabled) { background: var(--panel); border-color: var(--line); box-shadow: none; }
.rte-btn:disabled { opacity: .4; }
.rte-b { font-weight: 800; } .rte-i { font-style: italic; } .rte-u { text-decoration: underline; }
.rte-block { width: auto; padding: .25em .4em; font-size: .88em; }
.rte-spacer { flex: 1; }
.rte-html { font-family: ui-monospace, Consolas, monospace; font-size: .8em; }
.rte-link { display: flex; gap: 6px; padding: 6px; border-bottom: 1px solid var(--line); background: var(--bg); }
.rte-link input { flex: 1; }
.rte-area { min-height: 180px; max-height: 420px; overflow-y: auto; padding: 12px 14px; line-height: 1.6; outline: none; }
.rte-area:empty::before { content: "Describe the product…"; color: var(--muted); }
.rte-area h2 { font-size: 1.3em; margin: .6em 0 .3em; } .rte-area h3 { font-size: 1.12em; margin: .5em 0 .25em; }
.rte-area h4 { font-size: 1em; margin: .5em 0 .2em; }
.rte-area p { margin: 0 0 .6em; } .rte-area ul, .rte-area ol { margin: 0 0 .6em; padding-left: 1.4em; }
.rte-area a { color: var(--accent); } .rte-area img { max-width: 100%; height: auto; }
.rte-area table { border-collapse: collapse; } .rte-area td, .rte-area th { border: 1px solid var(--line); padding: 4px 8px; }
.rte-code { border: 0; border-radius: 0; min-height: 180px; font-family: ui-monospace, Consolas, monospace; font-size: .85em; resize: vertical; }
.rte.disabled .rte-toolbar { display: none; }
.product-form-foot { justify-content: flex-end; gap: 12px; align-items: center; margin-top: 8px; }
.product-variants { display: flex; flex-direction: column; gap: 6px; margin: .6em 0; font-size: .9em; }
.pv-head, .pv-row { display: grid; grid-template-columns: minmax(80px, 1.4fr) 1fr 1fr 70px; gap: 8px; align-items: center; }
.pv-head { color: var(--muted); font-size: .85em; }
.picker-foot .row { gap: 12px; align-items: center; flex-wrap: wrap; }
.blog-action { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.blog-changes { margin: 0; padding-left: 20px; font-size: .92em; }
.mail-original { border-top: 1px solid var(--line); padding-top: 8px; }
.mail-original summary { cursor: pointer; font-size: .9em; }
.mail-original .mail-person { margin-top: 10px; }
.mail-original-body { white-space: pre-wrap; font-size: .92em; background: var(--bg); border-radius: 8px; padding: 10px 12px;
  max-height: 260px; overflow: auto; }
.chat-approvals { max-height: 40vh; overflow-y: auto; margin-top: 8px; }
.chat-approvals .approval { margin: 8px 0 0; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.choices button { font-size: .9em; padding: .4em .9em; background: var(--panel); }
.choices button:not(:disabled):hover { border-color: var(--accent); color: var(--accent); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.row input { flex: 1; min-width: 160px; }
.security-card { max-width: 560px; }
.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.asset { margin: 0; padding: 10px; }
.asset img, .asset video { width: 100%; aspect-ratio: 1; object-fit: contain; background: var(--bg); border-radius: 8px; display: block; }
.audio-box { aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: var(--bg); border-radius: 8px; }
.audio-box span { font-size: 64px; color: var(--accent); }
.audio-box audio { width: 92%; }
.logo-preview { max-height: 80px; max-width: 200px; display: block; margin: 6px 0; background: #fff; border-radius: 8px; border: 1px solid var(--line); }
label.button-like { background: var(--accent); color: var(--accent-ink); border-radius: 8px; padding: .5em 1em; cursor: pointer; display: inline-block; margin: 0; }
label.button-like.btn-upload { background: var(--btn-upload-bg); color: var(--btn-upload-ink); border: 1px solid var(--btn-upload-line); font-weight: 600; }
.upload-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 10px 0 14px; border-style: dashed; }
/* Tabs (Task Board, Assets, Social Posts) */
.tab-stack { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.tab-stack .tabs + .tabs { border-bottom: 0; margin-bottom: 0; }
.tab-stack .tabs + .tabs .tab { font-size: .85em; border: 1px solid var(--line); border-radius: 999px; padding: .25em .9em; margin: 0; }
.tab-stack .tabs + .tabs .tab.active { background: var(--maestro); border-color: var(--accent); }
.tab { background: none; color: var(--muted); border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: .5em 1em; margin-bottom: -1px; box-shadow: none; }
.tab:hover:not(.active) { color: var(--ink); box-shadow: none; filter: none; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.pager { display: flex; align-items: center; gap: 12px; justify-content: center; margin: 16px 0; }
.section-title { margin-top: 18px; display: flex; align-items: baseline; gap: 6px; }
.sub-title { margin: 12px 0 8px; font-size: .85em; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.conn-category { margin-bottom: 18px; padding-bottom: 6px; }
.conn-tabs { position: sticky; top: 97px; z-index: 5; background: var(--bg); padding-top: 4px; }  /* under the top bar and page tabs */
.custom-ai-letter { display: inline-flex; align-items: center; justify-content: center; color: #2b2b2b; font-size: .85em; font-weight: 700; }
.custom-ai { min-height: 320px; }
.custom-ai p { overflow-wrap: anywhere; }
.add-ai-box { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; min-height: 320px; width: 100%; padding: 16px;
  background: transparent; color: var(--muted); border: 2px dashed var(--line); border-radius: 12px; box-shadow: none; font: inherit; font-weight: 600; }
.add-ai-box:hover { color: var(--accent); border-color: var(--accent); background: var(--panel); box-shadow: none; filter: none; }
.add-ai-plus { display: flex; align-items: center; justify-content: center; width: 56px; height: 56px; border: 2px solid currentColor; border-radius: 50%; font-size: 34px; font-weight: 400; line-height: 1; }
/* Email Marketing */
.mail-counts { display: flex; flex-wrap: wrap; gap: 24px; align-items: center; margin-bottom: 12px; }
.mail-limit-note { margin: 0; flex-basis: 100%; }
.mail-new { margin-bottom: 12px; }
.mail-campaign { margin-bottom: 12px; }
.mail-campaign h3 { margin: 0; }
.mail-progress { margin: 8px 0 12px; }
.mail-progress-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: baseline; }
.mail-progress .ad-progress { height: 10px; border-radius: 999px; margin: 6px 0 4px; }
.mail-progress p { margin: 0; }
.mail-table { overflow-x: auto; margin-bottom: 12px; }
.mail-table table { width: 100%; border-collapse: collapse; }
.mail-table th { text-align: left; }
.mail-table th, .mail-table td { padding: 8px 12px; border-bottom: 1px solid var(--line); }
.mail-table td { overflow-wrap: anywhere; }
.mail-reply-text { white-space: pre-line; overflow-wrap: anywhere; }
.mail-preview { width: 100%; height: 60vh; border: 1px solid var(--line); border-radius: 8px; background: #fff; }

/* Blend Hive's own message box (messageBox in app.js) */
.message-box { width: min(440px, calc(100vw - 32px)); padding: 22px 24px 18px; background: var(--panel); color: var(--ink);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 18px 50px rgba(0, 0, 0, .25); }
.message-box::backdrop { background: rgba(0, 0, 0, .45); }
.message-box h3 { margin: 0 0 8px; }
.message-box p { margin: 0 0 18px; color: var(--muted); overflow-wrap: anywhere; white-space: pre-line; }
.message-box.bad h3 { color: var(--error); }
.message-box.good h3 { color: var(--accent); }
.message-box-buttons { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.add-ai-form { display: flex; flex-direction: column; gap: 12px; padding-top: 8px; }
.add-ai-form p:empty { display: none; }
.add-ai-warning { background: var(--btn-warn-bg); color: var(--btn-warn-ink); border: 1px solid var(--btn-warn-line); border-radius: 8px; padding: .5em .7em; margin: 0; }
.provider-letter { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; background: #fff; color: #2b2b2b; border: 1px solid var(--line); border-radius: 6px; font-weight: 700; }
#add-ai-dialog { overflow-y: auto; }
.custom-ai .small { overflow-wrap: anywhere; }
.conn-tabs { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.conn-tabs::-webkit-scrollbar { display: none; }
.conn-tabs .tab { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; flex: none; margin-bottom: 0; }
.tab-count { font-size: .78em; color: var(--muted); background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 0 .5em; }
.tab.active .tab-count { color: var(--accent); border-color: var(--accent); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); flex: none; }
.status-dot.ok { background: var(--accent); }
.status-dot.warn { background: var(--warn); }
.conn-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.console-link { margin-left: auto; font-size: .72em; font-weight: 600; text-decoration: none; white-space: nowrap;
  padding: .35em .8em; border-radius: 999px; border: 1px solid var(--btn-info-line); background: var(--btn-info-bg); color: var(--btn-info-ink); }
.console-link:hover { filter: brightness(.97); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.conn-logo { width: 28px; height: 28px; padding: 4px; background: #fff; border-radius: 8px; border: 1px solid var(--line); flex: none; }
.asset figcaption { margin-top: 6px; font-size: .85em; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.thumbs img { width: 120px; height: 120px; object-fit: contain; background: #fff; border-radius: 8px; border: 1px solid var(--line); }
.thumbs video { width: 135px; height: 240px; background: #000; border-radius: 8px; }
label.check { display: flex; gap: .5em; align-items: flex-start; }
label.check input { width: auto; margin-top: .3em; }
.security-card img { background: #fff; border-radius: 8px; padding: 4px; }
code { background: var(--bg); padding: 0 .3em; border-radius: 4px; word-break: break-all; }
body.mfa-locked .nav:not([data-view="security"]) { display: none; }
body.pw-locked .nav:not([data-view="profile"]) { display: none; }
body.pw-locked .topbar .bell-wrap, body.pw-locked .me-menu .me-item:not(.me-logout) { display: none; }
.nav.no-access, .menu-group.no-access { display: none !important; }
/* Users page */
.users-bar { justify-content: space-between; margin-bottom: 12px; }
.users-bar .show-deleted { margin: 0; }
.row input[type="checkbox"], .row input[type="radio"] { flex: none; min-width: 0; }
.user-form { max-width: 720px; margin-bottom: 16px; }
.user-card { display: flex; flex-direction: column; gap: 8px; }
.user-head { display: flex; gap: 10px; align-items: center; }
.user-pills { display: flex; flex-wrap: wrap; gap: 4px; }
.user-lines { font-size: .9em; display: flex; flex-direction: column; gap: 2px; }
.perm-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; margin: 8px 0 0 24px; }
.perm-menu { padding: 4px 0 6px; border-bottom: 1px dashed var(--line); }
.perm-menu:last-child { border-bottom: 0; }
label.check.perm-open { display: block; margin: .3em 0 .1em; }
label.check.perm-open input { margin-right: .4em; vertical-align: -1px; }
label.check.perm-action { margin: .15em 0 .15em 22px; font-size: .88em; }
.perm-groups.disabled { opacity: .45; pointer-events: none; }
.preset-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 6px; }
.preset-chip { background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: .3em .9em; font-size: .9em; }
.preset-chip:hover { border-color: var(--accent); color: var(--accent); }
.preset-chip.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.preset-desc { margin: 0 0 4px; min-height: 1.3em; }
.perm-group { border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px 8px; margin: 0; }
.perm-group legend { font-size: .75em; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 0 4px; }
.perm-group label.check { margin: .3em 0; }
.small { font-size: .85em; }
.temp-pw { font-size: 1.15em; padding: .3em .6em; letter-spacing: .05em; }
.table { width: 100%; border-collapse: collapse; font-size: .88em; }
.table td, .table th { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .app.menu-collapsed { grid-template-columns: 1fr; }
  .sidebar { height: auto; position: static; }
  .app.menu-collapsed .sidebar { display: none; }
  main { height: auto; padding: 0 16px 16px; }
  .topbar { margin: 0 -16px 12px; padding: 0 16px 0 64px; }
  .me-name { display: none; }
  .chat-layout { grid-template-columns: 1fr; height: auto; }
  .messages { max-height: 60vh; }
  .board { grid-template-columns: 1fr; }
}

/* ---------- Content > Social Insights ---------- */
.pf-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; }
.pf-facebook { background: var(--pf-facebook); }
.pf-instagram { background: var(--pf-instagram); }
.pf-youtube { background: var(--pf-youtube); }
.pf-x { background: var(--pf-x); }
#insights { display: flex; flex-direction: column; gap: 14px; }
#insights-period .tabs { margin: 0; }
.insight-accounts { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.insight-account { display: flex; flex-direction: column; gap: 8px; }
.insight-account.off { opacity: .85; }
.insight-account-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.insight-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); gap: 6px; }
.insight-stat .dash-num { font-size: 1.35em; }
.insight-note { margin: 0; }
.insight-findings { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.insight-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .9em; margin-bottom: 4px; }
.insight-legend span { display: inline-flex; align-items: center; gap: 6px; }
.insight-stack { width: min(28px, 70%); display: flex; flex-direction: column-reverse; gap: 2px; position: relative; min-height: 2px; }
.insight-stack.empty { background: var(--line); border-radius: 4px 4px 0 0; }
.insight-seg { width: 100%; min-height: 2px; }
.insight-stack .insight-seg:last-of-type { border-radius: 4px 4px 0 0; }
.insight-weeks .work-col:hover .insight-seg { filter: brightness(1.1); }
.insight-breakdowns { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; align-items: start; }
.insight-bars { display: flex; flex-direction: column; gap: 6px; }
.insight-bar-row { display: grid; grid-template-columns: 88px 1fr 40px 56px; gap: 8px; align-items: center; font-size: .9em; }
.insight-bar-row.few { opacity: .55; }
.insight-bar-row.best .insight-bar-label, .insight-bar-row.best .insight-bar-value { font-weight: 700; }
.insight-bar-track { height: 12px; background: var(--line); border-radius: 0 4px 4px 0; overflow: hidden; }
.insight-bar { display: block; height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; }
.insight-bar-value { text-align: right; }
.insight-posts { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.insight-post { display: flex; flex-direction: column; padding: 0; overflow: hidden; color: inherit; text-decoration: none; }
.insight-post:hover { border-color: var(--accent); }
.insight-post img, .insight-post-noimg { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--line); display: block; }
.insight-post-noimg { display: grid; place-items: center; color: var(--muted); }
.insight-post-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; }
.insight-post-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.insight-post-text { margin: 0; font-size: .9em; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.insight-metrics { display: flex; gap: 10px; flex-wrap: wrap; font-size: .88em; }
.insight-all > summary { cursor: pointer; font-weight: 600; }
.insight-all .insight-posts { margin-top: 12px; }
.insight-comments { max-height: 420px; overflow: auto; }
.insight-comment { display: grid; grid-template-columns: 10px 1fr; gap: 10px; align-items: start; padding: 8px 0; border-bottom: 1px solid var(--line); }
.insight-comment .pf-dot { margin-top: 6px; }
.insight-ai-text h4 { margin: 10px 0 4px; }
.insight-ai-point { margin: 2px 0; }
@media (max-width: 600px) {
  .insight-bar-row { grid-template-columns: 72px 1fr 34px; }
  .insight-bar-row > .muted { display: none; }
}
.insight-weeks .tip-start .work-tip { left: 0; transform: none; }
.insight-weeks .tip-end .work-tip { left: auto; right: 0; transform: none; }
.insight-weeks .work-tip { white-space: normal; width: max-content; max-width: 260px; }
.insight-weeks .work-day { white-space: nowrap; font-size: .72em; }
.agent-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.provider-badge { display: inline-flex; align-items: center; gap: 6px; font-size: .85em; color: var(--muted); }
.provider-badge img { width: 22px; height: 22px; padding: 3px; background: #fff; border-radius: 6px; border: 1px solid var(--line); }
.model-pick { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; font-size: .9em; }
.model-pick select { width: 100%; }
.model-note { margin: 0; }
.model-prices { margin-top: 14px; overflow-x: auto; }
.model-prices > summary { cursor: pointer; font-weight: 700; font-size: 1.05em; }
.model-prices[open] > summary { margin-bottom: 10px; }
.model-prices table { width: 100%; border-collapse: collapse; font-size: .9em; }
.model-prices th, .model-prices td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.model-prices th { font-weight: 600; }
.chat-cost { padding: 4px 12px; border-bottom: 1px solid var(--line); }
.task-cost strong { color: var(--ink); font-weight: 600; }
.task-cost-summary { margin: 6px 0 14px; display: flex; flex-direction: column; gap: 8px; }
.cost-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.cost-tile { text-align: left; color: var(--ink); background: var(--panel); cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.cost-tile .dash-num { font-size: 1.5em; }
.cost-tile.active { box-shadow: inset 0 0 0 2px var(--accent); }
.cost-split > summary { cursor: pointer; font-weight: 600; }
.cost-split .insight-bars { margin-top: 10px; }
.cost-note { margin: 0; }

/* ---------- Marketing > Ads ---------- */
.ad-tile { cursor: default; }
.ad-progress { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin: 4px 0 2px; }
.ad-progress span { display: block; height: 100%; background: var(--accent); }
.ad-progress.high span { background: var(--warn); }
.ad-alert { border-left: 4px solid var(--warn); margin-bottom: 12px; }
.ad-platforms { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; margin-bottom: 12px; }
.ad-platform { display: flex; flex-direction: column; gap: 6px; }
.ad-platform-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ad-steps { margin: 6px 0 0; padding-left: 20px; font-size: .9em; display: flex; flex-direction: column; gap: 4px; }
.campaign { display: flex; flex-direction: column; gap: 6px; }
.campaign h3 { margin: 0; }
.campaign-head { display: flex; gap: 6px; flex-wrap: wrap; }
.campaign-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 8px; margin: 4px 0; }
.campaign-img { max-width: 160px; border-radius: 6px; margin-top: 6px; display: block; }
.ad-budget-edit { display: inline-flex; gap: 6px; align-items: center; }
.ad-budget-edit input.num, .limits-card input.num { width: 90px; flex: none; min-width: 0; }
.limits-card { max-width: 720px; display: flex; flex-direction: column; gap: 8px; }
.limit-row { display: grid; grid-template-columns: minmax(180px, 280px) 100px 1fr; gap: 10px; align-items: center; }
@media (max-width: 600px) { .limit-row { grid-template-columns: 1fr 90px; } .limit-row > .muted { grid-column: 1 / -1; } }

/* ---------- Paid Marketing: friendlier pages ---------- */
:root { --ad-spend: var(--pf-facebook); --ad-value: var(--pf-youtube); }
.pf-dot.ad-spend, .ad-bar.ad-spend { background: var(--ad-spend); }
.pf-dot.ad-value, .ad-bar.ad-value { background: var(--ad-value); }
#ads-overview { display: flex; flex-direction: column; gap: 14px; }
.ad-tiles { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin: 0; }
.ad-tile .pill { align-self: flex-start; margin-top: 4px; }
.ad-welcome h3 { margin-top: 0; }
.ad-steps-big { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-direction: column; gap: 12px; }
.ad-step { display: grid; grid-template-columns: 28px 1fr; gap: 12px; align-items: start; }
.ad-step p { margin: 2px 0 6px; }
.ad-step-mark { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-weight: 700; color: var(--accent-ink); }
.ad-step.done .ad-step-mark { background: var(--accent); border-color: var(--accent); }
.ad-chart { display: flex; gap: 3px; align-items: flex-end; height: 170px; padding-top: 8px; border-bottom: 1px solid var(--line); }
.ad-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; min-width: 0; }
.ad-bars { flex: 1; width: 100%; display: flex; gap: 1px; align-items: flex-end; justify-content: center; position: relative; }
.ad-bar { width: 45%; max-width: 9px; border-radius: 3px 3px 0 0; }
.ad-col:hover .ad-bar { filter: brightness(1.12); }
.ad-col .work-tip { position: absolute; bottom: calc(100% + 4px); white-space: nowrap; }
.ad-col:hover .work-tip { opacity: 1; }
.ad-col.tip-start .work-tip { left: 0; transform: none; }
.ad-col.tip-end .work-tip { left: auto; right: 0; transform: none; }
.ad-day { height: 1.4em; white-space: nowrap; font-size: .7em; }
.ad-kv { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; border-bottom: 1px solid var(--line); font-size: .92em; }
.ad-platform.best { box-shadow: inset 0 0 0 2px var(--accent); }
.table-scroll { overflow-x: auto; }
.ad-ranking table { width: 100%; border-collapse: collapse; font-size: .9em; }
.ad-ranking th, .ad-ranking td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.ad-glossary > summary, .campaign-guide > summary, .ad-setup > summary { cursor: pointer; font-weight: 600; }
.ad-glossary dl { margin: 10px 0 0; }
.ad-glossary dt { font-weight: 600; margin-top: 8px; }
.ad-glossary dd { margin: 2px 0 0; color: var(--muted); font-size: .92em; }
.campaign-guide { margin-bottom: 14px; }
.campaign-guide[open] > summary { margin-bottom: 10px; }
.guide-steps { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 14px; }
.guide-step { display: grid; grid-template-columns: 30px 1fr; gap: 12px; align-items: start; }
.guide-step p { margin: 3px 0 6px; }
.guide-num { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700; }
.guide-examples { margin: 4px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.guide-examples li { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--bg); border-radius: 8px; padding: 6px 10px; font-size: .92em; }
.small-btn { padding: .25em .7em; font-size: .85em; flex: none; }
.ad-hint { background: var(--btn-warn-bg); color: var(--btn-warn-ink); border-radius: 6px; padding: 6px 10px; margin: 0; }
.ad-empty { grid-column: 1 / -1; }
.ad-accounts { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; align-items: start; }
.ad-account { display: flex; flex-direction: column; gap: 10px; }
.ad-account h3 { margin: 0; }
.ad-account.ready { box-shadow: inset 4px 0 0 var(--accent); }
.ad-checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ad-checklist li { display: flex; gap: 8px; align-items: center; }
.ad-check { width: 20px; text-align: center; color: var(--muted); font-weight: 700; }
.ad-checklist li.done .ad-check { color: var(--accent); }
.ad-live { border-radius: 6px; padding: 6px 10px; font-size: .9em; }
.ad-live.ok { background: var(--maestro); }
.ad-live.bad { background: var(--btn-danger-bg); color: var(--btn-danger-ink); }
.limits-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; align-items: start; }
.limits-card { max-width: none; }
.limits-card h3 { margin: 0; }
.limit-sentence { margin: 0; line-height: 2.3; }
.limit-sentence input.num { width: 82px; display: inline-block; margin: 0 2px; padding: .25em .4em; }
.limit-summary { margin: 4px 0 0; padding: 8px 10px; background: var(--maestro); border-radius: 6px; font-size: .92em; }
.switch-row { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.limits-save { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 14px; padding-bottom: 8px; }
.ad-budget-edit { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.look-title { margin-top: 18px; }
.limit-tabs { margin-bottom: 12px; flex-wrap: wrap; }
.limit-standing { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; padding: 10px 12px; background: var(--bg); border-radius: 8px; }
.limit-standing > div { display: flex; flex-direction: column; gap: 2px; }
.limit-note { margin: 4px 0 0; }
#adlimits .limits-card { max-width: 820px; min-width: 0; overflow-wrap: anywhere; }
#adlimits { min-width: 0; }
.task-clickable { cursor: pointer; transition: box-shadow .15s; }
.task-clickable:hover { box-shadow: 0 0 0 2px var(--accent); }
.task-outputs { display: flex; flex-wrap: wrap; gap: 6px; }
.task-outputs:empty { display: none; }
.output-chip { background: var(--maestro); color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: .25em .8em; font-size: .85em; text-align: left; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.output-chip:hover { border-color: var(--accent); }

/* ---------- Content > Sent Emails ---------- */
.emails-search { max-width: 320px; }
.email-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.email-row { display: grid; grid-template-columns: 40px 1fr; gap: 12px; align-items: start; text-align: left; color: var(--ink); background: var(--panel); cursor: pointer; width: 100%; }
.email-row:hover { box-shadow: 0 0 0 2px var(--accent); }
.email-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.email-top { display: flex; justify-content: space-between; gap: 10px; }
.email-subject { font-weight: 600; }
.email-snippet { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.email-meta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 4px; }
.model-pick label { display: flex; flex-direction: column; gap: 3px; }
.agents-keys { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.agents-keys p { margin: 0; }

/* Business > Ads: the countries ads are shown in */
.country-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 16px; margin: 8px 0; }

/* Bell: finished tasks, and a small pulsing dot while tasks are in progress */
.bell-working { position: absolute; bottom: -2px; right: -2px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--panel); animation: bell-working 1.6s ease-in-out infinite; }
@keyframes bell-working { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .bell-working { animation: none; } }
.bell-head-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.bell-head-row .link { font-size: 1em; text-transform: none; letter-spacing: 0; font-weight: 600; padding: 0; }
.bell-item.bell-task { border-left-color: var(--accent); }
.bell-item.bell-task-bad { border-left-color: var(--error); }
.bell-item.bell-pending { border-left-color: var(--line); }
.menu-head .task-news { letter-spacing: 0; text-transform: none; }
.bell-item .pill { margin-right: 4px; }
.nav .task-news, .menu-head .task-news { margin-left: auto; }
.task-news-result { white-space: pre-wrap; max-height: 50vh; overflow: auto; }

/* Asset Library: an unused asset is flagged so it stands apart from the used ones */
.card.asset.is-unused { border-color: var(--warn); border-style: dashed; }
.asset-used summary { cursor: pointer; font-size: .85em; color: var(--muted); }
.asset-used ul { margin: 4px 0 0; padding-left: 18px; font-size: .85em; }
/* the group's count sits just before its arrow */
.menu-head:has(.task-news:not(.hidden))::after { margin-left: 6px; }
