/* Oval Brand Hive — one stylesheet, no build step. */
:root {
  --ink: #1d1b2e;
  --ink-2: #2b2842;
  --canvas: #f3f2f7;
  --surface: #ffffff;
  --line: #dedce8;
  --text: #24222f;
  --muted: #6b6880;
  --primary: #3d35a8;
  --primary-ink: #ffffff;
  --primary-soft: #e9e7fb;
  --honey: #f2b632;
  --good: #1e7f55;
  --good-soft: #e3f3ea;
  --bad: #b83a2e;
  --bad-soft: #fbe8e5;
  --warn-soft: #fdf3dc;
  --radius-s: 6px;
  --radius-m: 10px;
  --radius-l: 14px;
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: "Instrument Sans", "Segoe UI", system-ui, sans-serif;

  --net-instagram: #c13584;
  --net-facebook: #1877f2;
  --net-linkedin: #0a66c2;
  --net-tiktok: #111111;
  --net-x: #3a3a3a;
  --net-youtube: #e62117;
  --net-threads: #5a5a5a;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 15px/1.55 var(--body);
  color: var(--text);
  background: var(--canvas);
}
a { color: var(--primary); text-underline-offset: 2px; }
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--display); color: var(--ink); line-height: 1.2; margin: 0 0 .5rem; letter-spacing: -0.01em; }
h1 { font-size: 1.75rem; font-weight: 700; }
h2 { font-size: 1.25rem; font-weight: 650; }
h3 { font-size: 1.05rem; font-weight: 650; }
p { margin: 0 0 .75rem; max-width: 72ch; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.small { font-size: .85rem; }
:focus-visible { outline: 3px solid var(--honey); outline-offset: 2px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- App shell ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--ink);
  color: #d9d7e6;
  padding: 20px 14px;
  display: flex; flex-direction: column; gap: 18px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-family: var(--display); font-weight: 700; font-size: 1.25rem; padding: 0 6px; }
.hive-mark { width: 26px; height: 30px; background: var(--honey); clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
.ws-switch select {
  width: 100%; background: var(--ink-2); color: #fff; border: 1px solid #3b3758;
  border-radius: var(--radius-s); padding: 8px 10px; font: inherit;
}
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  color: #d9d7e6; text-decoration: none; padding: 8px 10px; border-radius: var(--radius-s);
  display: flex; justify-content: space-between; align-items: center;
}
.nav a:hover { background: var(--ink-2); color: #fff; }
.nav a.active { background: var(--ink-2); color: #fff; box-shadow: inset 3px 0 0 var(--honey); }
.nav-group { font-size: .8rem; color: #8c88a6; padding: 10px 10px 4px; }
.count { background: var(--honey); color: var(--ink); font-size: .75rem; font-weight: 700; border-radius: 999px; padding: 0 7px; }
.sidebar .me { margin-top: auto; border-top: 1px solid #34304e; padding-top: 12px; font-size: .9rem; }
.sidebar .me a { color: #d9d7e6; }
.main { padding: 28px clamp(16px, 4vw, 40px) 60px; min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { margin: 0; }
.btn.menu-toggle { display: none; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; display: none; }
  .sidebar.open { display: flex; }
  .btn.menu-toggle { display: inline-flex; margin: 12px 16px 0; justify-self: start; }
}

/* ---------- Surfaces ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 20px; margin-bottom: 20px; }
.panel > h2:first-child, .panel > h3:first-child { margin-top: 0; }
.panel-tight { padding: 0; overflow: hidden; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
@media (max-width: 960px) { .grid-2 { grid-template-columns: 1fr; } }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

.stats { display: flex; gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); margin-bottom: 20px; overflow: hidden; flex-wrap: wrap; }
.stat { flex: 1 1 150px; padding: 16px 20px; border-right: 1px solid var(--line); }
.stat:last-child { border-right: 0; }
.stat b { display: block; font-family: var(--display); font-size: 1.75rem; color: var(--ink); line-height: 1.1; }
.stat span { color: var(--muted); font-size: .9rem; }

/* ---------- Buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  font: 600 .95rem var(--body); padding: 9px 16px; border-radius: var(--radius-s);
  border: 1px solid var(--primary); background: var(--primary); color: var(--primary-ink);
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; color: var(--primary); border-color: var(--line); }
.btn-ghost:hover { background: var(--primary-soft); filter: none; }
.btn-danger { background: transparent; color: var(--bad); border-color: #e7c3be; }
.btn-danger:hover { background: var(--bad-soft); filter: none; }
.btn-sm { padding: 5px 10px; font-size: .85rem; }
.link-btn { background: none; border: 0; color: var(--primary); font: inherit; cursor: pointer; padding: 0; text-decoration: underline; }
form.inline { display: inline; }

label { display: block; font-weight: 600; margin-bottom: 4px; color: var(--ink); }
.field { margin-bottom: 16px; }
.field .help { color: var(--muted); font-size: .85rem; margin-top: 4px; }
.field .error, .errorlist { color: var(--bad); font-size: .9rem; margin: 4px 0 0; padding: 0; list-style: none; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number],
input[type=datetime-local], input[type=search], input[type=file], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: #fff;
  border: 1px solid var(--line); border-radius: var(--radius-s); padding: 9px 11px;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: var(--primary); }
.checks { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.checks label { font-weight: 500; display: inline-flex; gap: 6px; align-items: center; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; background: #fff; cursor: pointer; }
.checks input { accent-color: var(--primary); }
.check-inline { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; }
.form-errors { background: var(--bad-soft); color: var(--bad); border-radius: var(--radius-m); padding: 12px 16px; margin-bottom: 16px; }
.form-errors ul { margin: 0; padding-left: 18px; }

/* ---------- Messages ---------- */
.flash { border-radius: var(--radius-m); padding: 11px 16px; margin-bottom: 16px; border: 1px solid var(--line); background: #fff; }
.flash.success { background: var(--good-soft); border-color: #bfe3cf; }
.flash.error { background: var(--bad-soft); border-color: #efc6c0; }
.flash.warning, .flash.info { background: var(--warn-soft); border-color: #f1dca8; }

/* ---------- Network badges: the hive motif ---------- */
.hex {
  --c: var(--muted);
  width: 26px; height: 30px; flex: none;
  background: var(--c); color: #fff;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  display: inline-grid; place-items: center; font: 700 .7rem var(--body);
}
.hex.sm { width: 18px; height: 21px; font-size: .55rem; }
.hex.lg { width: 40px; height: 46px; font-size: .95rem; }
.net-instagram { --c: var(--net-instagram); }
.net-facebook { --c: var(--net-facebook); }
.net-linkedin { --c: var(--net-linkedin); }
.net-tiktok { --c: var(--net-tiktok); }
.net-x { --c: var(--net-x); }
.net-youtube { --c: var(--net-youtube); }
.net-threads { --c: var(--net-threads); }
.hex-stack { display: inline-flex; }
.hex-stack .hex + .hex { margin-left: -5px; }

.pill { display: inline-block; font-size: .78rem; font-weight: 600; border-radius: 999px; padding: 2px 9px; background: var(--canvas); color: var(--muted); }
.pill.scheduled, .pill.queued, .pill.active { background: var(--primary-soft); color: var(--primary); }
.pill.published, .pill.done { background: var(--good-soft); color: var(--good); }
.pill.failed, .pill.error, .pill.expired, .pill.rejected { background: var(--bad-soft); color: var(--bad); }
.pill.in_review, .pill.pending, .pill.publishing, .pill.running, .pill.partial { background: var(--warn-soft); color: #8a5a00; }

/* ---------- Tables / lists ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: .85rem; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 8px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.active { color: var(--ink); border-color: var(--honey); font-weight: 600; }
.caption-preview { white-space: pre-wrap; overflow-wrap: anywhere; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty h3 { color: var(--ink); }

/* ---------- Calendar ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius-l); overflow: hidden; background: var(--line); gap: 1px; }
.cal-head { background: var(--surface); padding: 8px 10px; font-size: .85rem; color: var(--muted); font-weight: 600; }
.cal-day { background: var(--surface); min-height: 118px; padding: 6px 8px 8px; display: flex; flex-direction: column; gap: 4px; }
.cal-day.out { background: #faf9fc; }
.cal-day.out .cal-date { color: #b2afc3; }
.cal-day.drop { background: var(--primary-soft); }
.cal-date { font-size: .85rem; font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.cal-date a { opacity: 0; text-decoration: none; font-weight: 700; }
.cal-day:hover .cal-date a, .cal-date a:focus { opacity: 1; }
.cal-day.today .cal-date span { background: var(--honey); color: var(--ink); border-radius: 999px; padding: 0 7px; }
.chip {
  display: flex; gap: 6px; align-items: center; text-decoration: none; color: var(--text);
  font-size: .8rem; background: var(--canvas); border-radius: var(--radius-s); padding: 3px 6px; border-left: 3px solid var(--primary);
}
.chip[draggable=true] { cursor: grab; }
.chip.published { border-color: var(--good); }
.chip.failed, .chip.partial { border-color: var(--bad); }
.chip.draft, .chip.in_review { border-color: var(--honey); }
.chip .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-date .wd { display: none; font-style: normal; font-weight: 500; color: var(--muted); }
@media (max-width: 700px) {
  .cal-date .wd { display: inline; }
  .cal { grid-template-columns: 1fr; }
  .cal-head { display: none; }
  .cal-day { min-height: 0; }
  .cal-day.out { display: none; }
}

/* ---------- Composer ---------- */
.composer { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 1000px) { .composer { grid-template-columns: 1fr; } }
.counter { font-size: .8rem; color: var(--muted); text-align: right; }
.counter.over { color: var(--bad); font-weight: 600; }
details.custom { border: 1px solid var(--line); border-radius: var(--radius-m); padding: 10px 14px; margin-bottom: 10px; background: #fff; }
details.custom summary { cursor: pointer; display: flex; gap: 8px; align-items: center; font-weight: 600; }
.preview { border: 1px solid var(--line); border-radius: var(--radius-m); padding: 14px; background: #fff; margin-bottom: 12px; }
.preview .who { display: flex; gap: 8px; align-items: center; font-weight: 600; margin-bottom: 8px; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.thumb { position: relative; border-radius: var(--radius-s); overflow: hidden; background: var(--canvas); aspect-ratio: 1; border: 1px solid var(--line); }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; }
.thumb label { position: absolute; inset: 0; margin: 0; cursor: pointer; }
.thumb input { position: absolute; top: 6px; left: 6px; accent-color: var(--primary); }
.thumb .kind { position: absolute; right: 4px; bottom: 4px; background: rgba(29,27,46,.75); color: #fff; font-size: .7rem; padding: 0 5px; border-radius: 4px; }

/* ---------- Avatars / people ---------- */
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: inline-grid; place-items: center; font-weight: 700; overflow: hidden; flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 84px; height: 84px; font-size: 1.6rem; }
.verified { color: var(--good); font-size: .8rem; font-weight: 600; }
.person { display: flex; gap: 12px; align-items: flex-start; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: .8rem; background: var(--canvas); border-radius: 999px; padding: 2px 10px; }

/* ---------- Chat ---------- */
.chat { display: flex; flex-direction: column; height: calc(100vh - 170px); min-height: 420px; }
.chat-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l) var(--radius-l) 0 0; }
.msg { max-width: min(70%, 560px); align-self: flex-start; }
.msg .bubble { background: var(--canvas); border-radius: 14px 14px 14px 4px; padding: 8px 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.mine { align-self: flex-end; }
.msg.mine .bubble { background: var(--primary); color: #fff; border-radius: 14px 14px 4px 14px; }
.msg.mine .bubble a { color: #fff; }
.msg .meta { font-size: .75rem; color: var(--muted); margin: 2px 4px; }
.msg.mine .meta { text-align: right; }
.chat-form { display: flex; gap: 8px; padding: 10px; background: var(--surface); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--radius-l) var(--radius-l); align-items: flex-end; }
.chat-form textarea { min-height: 44px; max-height: 160px; }
.convo-list a { display: flex; gap: 12px; padding: 12px 16px; text-decoration: none; color: var(--text); border-bottom: 1px solid var(--line); }
.convo-list a:hover { background: #faf9fc; }
.convo-list .unread { font-weight: 700; }

/* ---------- Marketplace ---------- */
.listing { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden; display: flex; flex-direction: column; text-decoration: none; color: var(--text); }
.listing:hover { border-color: #bdb8d6; }
.listing .cover { aspect-ratio: 16/9; background: var(--canvas); }
.listing .cover img { width: 100%; height: 100%; object-fit: cover; }
.listing .cover.placeholder { display: grid; place-items: center; background: var(--ink); }
.listing .body { padding: 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.listing .price { font-weight: 700; color: var(--ink); margin-top: auto; }
.filters { display: grid; grid-template-columns: 2fr repeat(4, 1fr); gap: 10px; margin-bottom: 18px; }
@media (max-width: 900px) { .filters { grid-template-columns: 1fr 1fr; } }

/* ---------- Public pages ---------- */
.public { min-height: 100vh; display: flex; flex-direction: column; }
.public header { display: flex; justify-content: space-between; align-items: center; padding: 18px clamp(16px, 4vw, 48px); }
.public header .brand { color: var(--ink); }
.public main { flex: 1; padding: 0 clamp(16px, 4vw, 48px) 60px; }
.public footer { padding: 20px clamp(16px, 4vw, 48px); color: var(--muted); font-size: .9rem; display: flex; gap: 16px; flex-wrap: wrap; }
.auth { max-width: 420px; margin: 40px auto; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px; align-items: center; max-width: 1180px; margin: 40px auto 0; }
.hero h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); line-height: 1.05; letter-spacing: -0.02em; }
.hero p { font-size: 1.1rem; color: var(--muted); }
@media (max-width: 900px) { .hero { grid-template-columns: 1fr; } }
.honeycomb { display: grid; grid-template-columns: repeat(4, 74px); gap: 6px 4px; justify-content: center; }
.honeycomb .hex { width: 74px; height: 84px; font-size: .8rem; }
.honeycomb .hex:nth-child(8n+5), .honeycomb .hex:nth-child(8n+6), .honeycomb .hex:nth-child(8n+7), .honeycomb .hex:nth-child(8n+8) { transform: translateX(39px); margin-top: -20px; }
.honeycomb .hex.empty-cell { --c: #e4e2ee; }
.honeycomb .hex.now { --c: var(--honey); color: var(--ink); }
.features { max-width: 1180px; margin: 64px auto 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }
.features h3 { margin-bottom: 6px; }
@media (max-width: 900px) { .features { grid-template-columns: 1fr; } }
.prose { max-width: 720px; margin: 20px auto; background: var(--surface); padding: 32px; border-radius: var(--radius-l); border: 1px solid var(--line); }
.prose h2 { margin-top: 1.5rem; }

.bar { height: 8px; background: var(--canvas); border-radius: 999px; overflow: hidden; min-width: 80px; }
.bar > i { display: block; height: 100%; background: var(--primary); }
.htmx-indicator { opacity: 0; transition: opacity .2s; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
.logo-img { height: 32px; width: auto; }
