/* ──────────────────────────────────────────────────────────────────────
   Olaif Social — DEMO stylesheet
   Hand-authored, self-contained reproduction of the production app's look.
   No build step, no CDN. Tokens mirror src/app/globals.css exactly.

   Brand palette
     Primary   Olaif Green  #009c88
     Secondary Dark Gray    #52555a
     Comp      Yellow #ffc72b · Blue #00a1e1 · Pink #ef6fbd · Purple #8a74d1
   TT Norms (proprietary) → substituted with a clean geometric system stack
   (Inter if installed) to stay fully offline.
   ────────────────────────────────────────────────────────────────────── */

:root {
  --olaif-green:     #009c88;
  --olaif-gray:      #52555a;
  --olaif-yellow:    #ffc72b;
  --olaif-blue:      #00a1e1;
  --olaif-pink:      #ef6fbd;
  --olaif-purple:    #8a74d1;
  --olaif-green-alt: #00af77;

  /* Semantic tokens — HSL triples, used via hsl(var(--x)) just like the app */
  --background:           0 0% 100%;
  --foreground:           218 5% 22%;
  --primary:              172 100% 31%;
  --primary-foreground:   0 0% 100%;
  --secondary:            218 5% 34%;
  --muted:                173 25% 96%;
  --muted-foreground:     218 5% 46%;
  --accent:               173 50% 92%;
  --accent-foreground:    172 100% 25%;
  --border:               218 12% 90%;

  --radius: 6px;
  --maxw: 72rem;          /* max-w-6xl */
  --maxw-narrow: 56rem;   /* max-w-3xl-ish */

  --font-sans: "Inter", "Inter var", ui-sans-serif, system-ui, -apple-system,
    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
img, video, svg { display: block; max-width: 100%; }
input, select, textarea { font: inherit; color: inherit; }
code, pre, .mono { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace; }
table { border-collapse: collapse; }

/* ── Color helpers ─────────────────────────────────────────────────────── */
.text-primary    { color: hsl(var(--primary)); }
.text-muted      { color: hsl(var(--muted-foreground)); }
.text-red        { color: #dc2626; }
.text-amber      { color: #b45309; }
.bg-primary      { background: hsl(var(--primary)); }
.bg-muted        { background: hsl(var(--muted)); }

/* ── Typography utilities ──────────────────────────────────────────────── */
.h1 { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.02em; }
.h2 { font-size: 1.125rem; font-weight: 600; }
.lead { font-size: .875rem; color: hsl(var(--muted-foreground)); }
.section-title {
  font-size: .8125rem; font-weight: 500; text-transform: uppercase;
  letter-spacing: .05em; color: hsl(var(--muted-foreground)); margin-bottom: .75rem;
}
.xs   { font-size: .75rem; }
.sm   { font-size: .875rem; }
.tiny { font-size: .6875rem; }
.semibold { font-weight: 600; }
.medium   { font-weight: 500; }
.nums { font-variant-numeric: tabular-nums; }
.upper { text-transform: uppercase; letter-spacing: .05em; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp-1, .clamp-2 { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-1 { -webkit-line-clamp: 1; }
.clamp-2 { -webkit-line-clamp: 2; }
.prewrap { white-space: pre-wrap; }

/* ── Layout primitives ─────────────────────────────────────────────────── */
.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 1.5rem; }
.page { padding-block: 2rem; }
.narrow { max-width: var(--maxw-narrow); }
.row { display: flex; align-items: center; gap: .75rem; }
.row.wrap { flex-wrap: wrap; }
.row.start { align-items: flex-start; }
.row.end { align-items: flex-end; }
.between { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; }
.between.start { align-items: flex-start; }
.col { display: flex; flex-direction: column; gap: .75rem; }
.ml-auto { margin-left: auto; }
.gap-1 { gap: .25rem; } .gap-2 { gap: .5rem; } .gap-3 { gap: .75rem; }
.gap-4 { gap: 1rem; } .gap-6 { gap: 1.5rem; }
.wrap { flex-wrap: wrap; }

.stack > * + * { margin-top: 1.5rem; }
.stack-sm > * + * { margin-top: .75rem; }
.stack-xs > * + * { margin-top: .375rem; }
.stack-lg > * + * { margin-top: 2rem; }

.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.grid-7 { grid-template-columns: repeat(7, minmax(0,1fr)); }
@media (max-width: 1100px) { .grid-7 { grid-template-columns: repeat(4, minmax(0,1fr)); } }
@media (max-width: 800px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 640px) { .grid-7 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 520px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0,1fr); }
}

/* ── App bar / navigation ──────────────────────────────────────────────── */
.appbar { border-bottom: 1px solid hsl(var(--border)); background: hsl(var(--background)); position: sticky; top: 0; z-index: 30; }
.appbar-inner {
  max-width: var(--maxw); margin-inline: auto; padding: .75rem 1.5rem;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem;
}
.appbar-left { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.5rem; }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem 1rem; font-size: .875rem; color: hsl(var(--muted-foreground)); }
.nav a { transition: color .12s; }
.nav a:hover { color: hsl(var(--primary)); }
.nav a.active { color: hsl(var(--foreground)); font-weight: 500; }
.appbar-right { display: flex; align-items: center; gap: .75rem; font-size: .875rem; }
.user-email { color: hsl(var(--muted-foreground)); }
@media (max-width: 640px) { .user-email .email { display: none; } }

/* Brand mark (logo + wordmark) */
.brandmark { display: inline-flex; align-items: center; gap: .5rem; }
.brandmark img { width: 28px; height: 28px; }
.brandmark .word { font-weight: 600; letter-spacing: -.01em; font-size: .95rem; }

/* Role badges */
.role { margin-left: .25rem; border-radius: 4px; padding: .1rem .375rem; font-size: .6875rem; font-weight: 500; }
.role.admin   { background: hsl(var(--primary) / .1); color: hsl(var(--primary)); }
.role.finance { background: #fef3c7; color: #92400e; }
.role.internal{ background: #dbeafe; color: #1e40af; }

/* Admin dropdown (details/summary) */
.dropdown { position: relative; }
.dropdown > summary { list-style: none; cursor: pointer; color: hsl(var(--muted-foreground)); }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown > summary:hover { color: hsl(var(--primary)); }
.dropdown[open] > summary { color: hsl(var(--foreground)); }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + .4rem); min-width: 200px; z-index: 40;
  background: hsl(var(--background)); border: 1px solid hsl(var(--border));
  border-radius: var(--radius); box-shadow: 0 8px 24px rgb(0 0 0 / .1); padding: .35rem;
}
.dropdown-menu a { display: block; padding: .4rem .55rem; border-radius: 4px; font-size: .8125rem; color: hsl(var(--foreground)); }
.dropdown-menu a:hover { background: hsl(var(--muted)); color: hsl(var(--primary)); }
.dropdown-menu .menu-label { padding: .35rem .55rem .15rem; font-size: .625rem; text-transform: uppercase; letter-spacing: .06em; color: hsl(var(--muted-foreground)); }
.dropdown-menu hr { border: 0; border-top: 1px solid hsl(var(--border)); margin: .35rem 0; }

/* ── Cards & surfaces ──────────────────────────────────────────────────── */
.card { border: 1px solid hsl(var(--border)); border-radius: var(--radius); padding: 1rem; background: hsl(var(--background)); }
.card-pad-sm { padding: .75rem; }
.surface-muted { background: hsl(var(--muted) / .35); }

.stat { border: 1px solid hsl(var(--border)); border-radius: var(--radius); padding: 1rem; }
.stat .label { font-size: .875rem; color: hsl(var(--muted-foreground)); }
.stat .value { margin-top: .25rem; font-size: 1.5rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat .delta { margin-top: .25rem; font-size: .75rem; }
.stat .delta.up { color: hsl(var(--primary)); }
.stat .delta.down { color: #dc2626; }
.stat.compact .value { font-size: 1.125rem; }
.stat .value.accent { color: hsl(var(--primary)); }

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  border: 1px solid hsl(var(--border)); background: hsl(var(--background));
  border-radius: var(--radius); padding: .5rem .75rem; font-size: .875rem; line-height: 1;
  transition: background .12s, opacity .12s; white-space: nowrap;
}
.btn:hover { background: hsl(var(--muted)); }
.btn-primary { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); border-color: transparent; font-weight: 500; }
.btn-primary:hover { background: hsl(var(--primary) / .9); }
.btn-dark { background: hsl(var(--foreground)); color: hsl(var(--background)); border-color: transparent; font-weight: 500; }
.btn-dark:hover { background: hsl(var(--foreground) / .9); }
.btn-danger { background: #dc2626; color: #fff; border-color: transparent; font-weight: 500; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: .3rem .55rem; font-size: .75rem; }
.btn-xs { padding: .15rem .45rem; font-size: .6875rem; }
.btn[disabled], .btn.is-disabled { opacity: .5; cursor: not-allowed; }
/* Selected platform toggle in the composer */
.plat-btn.on { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); border-color: transparent; }
.plat-btn.on:hover { background: hsl(var(--primary) / .9); }

/* ── Status pills (mirror src/lib/status-colors.ts, light mode) ────────── */
.pill { display: inline-flex; align-items: center; border-radius: 4px; padding: .1rem .375rem; font-size: .75rem; font-weight: 500; }
.pill.DRAFT      { background: hsl(var(--muted)); color: hsl(var(--muted-foreground)); }
.pill.SCHEDULED  { background: #e2f3fb; color: #0a6b94; }
.pill.PUBLISHING { background: #fff4d3; color: #8a6b00; }
.pill.PUBLISHED  { background: #d6f1ec; color: #005c52; }
.pill.FAILED     { background: #fde2e2; color: #9b1c1c; }
.pill.DELETED    { background: hsl(var(--muted)); color: hsl(var(--muted-foreground)); text-decoration: line-through; }

/* ── Brand badge ───────────────────────────────────────────────────────── */
.brand { display: inline-flex; align-items: center; gap: .375rem; vertical-align: middle; }
.brand .thumb {
  width: 18px; height: 18px; border-radius: 4px; background: #fff;
  box-shadow: 0 0 0 1px hsl(var(--border)); overflow: hidden; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.brand .thumb img { width: 100%; height: 100%; object-fit: contain; padding: 1px; }
.brand .name { font-size: .75rem; }
.brand.lg .thumb { width: 32px; height: 32px; border-radius: 6px; }
.brand.logo { height: 32px; background: #fff; box-shadow: 0 0 0 1px hsl(var(--border)); border-radius: 6px; padding-inline: .25rem; }
.brand.logo img { height: 100%; width: auto; }

/* Initials avatar (dummy creator brands — no real photos) */
.avatar-initials {
  width: 18px; height: 18px; border-radius: 4px; flex-shrink: 0; color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .5625rem; font-weight: 700; letter-spacing: .02em;
}
.brand.lg .avatar-initials { width: 32px; height: 32px; border-radius: 6px; font-size: .8125rem; }

/* ── Tables ────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border: 1px solid hsl(var(--border)); border-radius: var(--radius); }
table.tbl { width: 100%; font-size: .875rem; }
table.tbl thead { background: hsl(var(--muted) / .5); }
table.tbl th {
  padding: .5rem .75rem; text-align: left; font-size: .6875rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: .05em; color: hsl(var(--muted-foreground)); white-space: nowrap;
}
table.tbl td { padding: .5rem .75rem; vertical-align: top; border-top: 1px solid hsl(var(--border)); }
table.tbl tbody tr:hover { background: hsl(var(--muted) / .3); }
.t-right { text-align: right; } .t-left { text-align: left; }
th.t-right { text-align: right; }

/* chips / tags */
.tag { border-radius: 4px; background: hsl(var(--muted)); padding: .1rem .375rem; font-size: .75rem; font-weight: 500; }
.chip {
  border: 1px solid hsl(var(--border)); background: hsl(var(--background));
  border-radius: 999px; padding: .2rem .6rem; font-size: .75rem; cursor: pointer; transition: background .12s;
}
.chip:hover { background: hsl(var(--muted)); }
.chip.on { background: hsl(var(--primary)); color: #fff; border-color: transparent; }

/* ── Forms ─────────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: .375rem; }
label.lbl, .lbl { font-size: .875rem; font-weight: 500; }
.lbl-xs { font-size: .75rem; color: hsl(var(--muted-foreground)); }
.input, select.input, textarea.input {
  width: 100%; border: 1px solid hsl(var(--border)); background: hsl(var(--background));
  border-radius: var(--radius); padding: .5rem .75rem; font-size: .875rem; outline: none;
}
select.input { width: auto; }
.input:focus { box-shadow: 0 0 0 2px hsl(var(--foreground) / .1); }
textarea.input { resize: vertical; }

/* Alerts */
.alert { border-radius: var(--radius); padding: .5rem .75rem; font-size: .875rem; border: 1px solid; }
.alert-red    { border-color: #fca5a5; background: #fef2f2; color: #b91c1c; }
.alert-amber  { border-color: #fcd34d; background: #fffbeb; color: #92400e; }
.alert-green  { border: 2px solid #6ee7b7; background: #ecfdf5; color: #065f46; padding: 1rem; }
.alert-blue   { border: 2px solid #93c5fd; background: #eff6ff; color: #1e40af; padding: 1rem; }
.alert-primary{ border-color: hsl(var(--primary) / .3); background: hsl(var(--primary) / .1); color: hsl(var(--primary)); }

/* details/summary as collapsible */
details.box { border: 1px solid hsl(var(--border)); border-radius: var(--radius); padding: .75rem; font-size: .875rem; }
details.box > summary { cursor: pointer; font-weight: 500; list-style: none; }
details.box > summary::-webkit-details-marker { display: none; }
details.box > summary::before { content: "▸ "; color: hsl(var(--muted-foreground)); }
details.box[open] > summary::before { content: "▾ "; }
details.box.amber { border-color: #fcd34d; background: #fffbeb66; }

/* ── Network preview (composer) ────────────────────────────────────────── */
.preview {
  border: 1px solid hsl(var(--border)); border-radius: var(--radius);
  background: hsl(var(--muted) / .2); padding: .75rem;
}
.preview-tabs { display: flex; flex-wrap: wrap; gap: .25rem; border-bottom: 1px solid hsl(var(--border)); padding-bottom: .5rem; margin: .5rem 0 .75rem; }
.preview-tab { border-radius: var(--radius); padding: .25rem .55rem; font-size: .75rem; color: hsl(var(--muted-foreground)); background: transparent; border: 0; }
.preview-tab:hover { background: hsl(var(--muted)); }
.preview-tab.on { background: hsl(var(--primary)); color: #fff; }
.pcard { overflow: hidden; border: 1px solid hsl(var(--border)); border-radius: 8px; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / .05); }
.pcard-head { display: flex; align-items: center; gap: .5rem; border-bottom: 1px solid hsl(var(--border)); padding: .5rem .75rem; }
.pavatar { width: 28px; height: 28px; border-radius: 999px; background: #fff; box-shadow: 0 0 0 1px hsl(var(--border)); overflow: hidden; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; }
.pavatar img { width: 100%; height: 100%; object-fit: contain; padding: 2px; }
.pcard-handle { font-size: .75rem; font-weight: 600; line-height: 1.15; }
.pcard-sub { font-size: .625rem; color: hsl(var(--muted-foreground)); }
.pmedia { position: relative; width: 100%; overflow: hidden; background: hsl(var(--muted)); display: flex; align-items: center; justify-content: center; }
.pmedia .ph { font-size: .6875rem; color: hsl(var(--muted-foreground)); }
.pmedia .overlay-top { position: absolute; inset-inline: 0; top: 0; display: flex; align-items: center; gap: .5rem; padding: .6rem; color: #fff; background: linear-gradient(to bottom, rgb(0 0 0 / .5), transparent); }
.pmedia .overlay-bottom { position: absolute; inset-inline: 0; bottom: 0; max-height: 42%; overflow: hidden; padding: .6rem; color: #fff; background: linear-gradient(to top, rgb(0 0 0 / .7), transparent); font-size: .75rem; }
.pcard-foot { padding: .6rem .75rem; display: flex; flex-direction: column; gap: .35rem; }
.pactions { display: flex; align-items: center; gap: .75rem; font-size: 1rem; color: hsl(var(--muted-foreground)); }
.pactions.fb { justify-content: space-around; border-block: 1px solid hsl(var(--border)); padding-block: .25rem; font-size: .6875rem; }
.pcaption { font-size: .75rem; white-space: pre-wrap; word-break: break-word; }

/* ── Calendar ──────────────────────────────────────────────────────────── */
.cal { border: 1px solid hsl(var(--border)); border-radius: var(--radius); background: #fff; padding: .75rem; }
.cal-toolbar { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .75rem; flex-wrap: wrap; }
.cal-title { font-size: 1.05rem; font-weight: 600; }
.cal-btns { display: inline-flex; border: 1px solid hsl(var(--border)); border-radius: var(--radius); overflow: hidden; }
.cal-btns button { padding: .35rem .6rem; font-size: .8125rem; background: #fff; border: 0; border-left: 1px solid hsl(var(--border)); }
.cal-btns button:first-child { border-left: 0; }
.cal-btns button:hover { background: hsl(var(--muted)); }
.cal-btns button.on { background: hsl(var(--primary)); color: #fff; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); border: 1px solid hsl(var(--border)); border-radius: 4px; overflow: hidden; }
.cal-dow { background: hsl(var(--muted) / .5); font-size: .6875rem; text-transform: uppercase; letter-spacing: .04em; color: hsl(var(--muted-foreground)); padding: .35rem .5rem; text-align: right; border-bottom: 1px solid hsl(var(--border)); border-left: 1px solid hsl(var(--border)); }
.cal-dow:first-child { border-left: 0; }
.cal-cell { min-height: 96px; border-left: 1px solid hsl(var(--border)); border-bottom: 1px solid hsl(var(--border)); padding: .3rem; display: flex; flex-direction: column; gap: .2rem; }
.cal-cell:nth-child(7n+1) { border-left: 0; }
.cal-daynum { font-size: .75rem; color: hsl(var(--muted-foreground)); text-align: right; }
.cal-cell.dim { background: hsl(var(--muted) / .25); }
.cal-cell.today .cal-daynum { color: hsl(var(--primary)); font-weight: 700; }
.cal-event { font-size: .6875rem; line-height: 1.25; padding: .1rem .3rem; border-radius: 3px; color: #fff; cursor: pointer; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cal-legend { display: flex; flex-wrap: wrap; gap: .75rem; font-size: .75rem; color: hsl(var(--muted-foreground)); align-items: center; }
.cal-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .25rem; vertical-align: -1px; }

/* ── Misc ──────────────────────────────────────────────────────────────── */
.divider { border: 0; border-top: 1px solid hsl(var(--border)); }
.border-top { border-top: 1px solid hsl(var(--border)); padding-top: 1rem; }
.demo-note {
  display: flex; gap: .5rem; align-items: flex-start;
  border: 1px dashed hsl(var(--primary) / .4); background: hsl(var(--primary) / .05);
  color: hsl(var(--accent-foreground)); border-radius: var(--radius); padding: .5rem .75rem; font-size: .75rem;
}
.demo-note b { font-weight: 600; }
.kbd { border: 1px solid hsl(var(--border)); border-bottom-width: 2px; border-radius: 4px; padding: .05rem .35rem; font-size: .75rem; background: hsl(var(--muted) / .5); }
pre.code { overflow-x: auto; border: 1px solid hsl(var(--border)); border-radius: var(--radius); background: hsl(var(--background)); padding: .75rem; font-size: .75rem; }

/* Media canvas placeholders for post-detail / authors thumbs */
.media-tile { overflow: hidden; border: 1px solid hsl(var(--border)); border-radius: var(--radius); background: hsl(var(--muted)); }
.media-tile .canvas { aspect-ratio: 1/1; width: 100%; display: flex; align-items: center; justify-content: center; color: hsl(var(--muted-foreground)); font-size: .75rem; }
.thumb-sq { width: 40px; height: 40px; border-radius: 4px; object-fit: cover; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-size: .6rem; font-weight: 600; }

/* footer */
.demo-footer { border-top: 1px solid hsl(var(--border)); color: hsl(var(--muted-foreground)); font-size: .75rem; }
.demo-footer .container { padding-block: 1.25rem; display: flex; flex-wrap: wrap; gap: .5rem 1rem; justify-content: space-between; }
