/* AlgoX BR: graphite builds the structure; copper only marks what asks for action. The clients' colors appear only inside their art. */
:root {
  --bg: #f7f6f4;
  --surface: #ffffff;
  --sunk: #efede9;
  --text: #0f0f10;
  --muted: #6b6b6b;
  --line: #e4e1db;
  --accent: #b85e30;
  --accent-soft: #f6e7dd;
  --accent-text: #ffffff;
  --copper: #d97745;
  --ink: #0f0f10;
  --ink-text: #ffffff;
  --ok: #2e7d4f;
  --ok-soft: #e3f1e8;
  --warn: #9a5b00;
  --warn-soft: #fbefdb;
  --bad: #b3261e;
  --bad-soft: #fde7e5;
  --radius: 10px;
  --display: "Schibsted Grotesk", "Segoe UI", system-ui, sans-serif;
  --body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f10;
    --surface: #18181a;
    --sunk: #222225;
    --text: #efedea;
    --muted: #a3a09b;
    --line: #2e2d2b;
    --accent: #e08a5c;
    --accent-soft: #3a261b;
    --accent-text: #0f0f10;
    --ink: #efedea;
    --ink-text: #0f0f10;
    --ok: #5fcf95;
    --ok-soft: #173326;
    --warn: #f0b45a;
    --warn-soft: #3a2c14;
    --bad: #ff8a80;
    --bad-soft: #3b1d1b;
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--body);
}

/* ---------- shell: side menu, page, and the phone's bottom bar ---------- */

.shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
}

.side {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 22px 14px 16px;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.logo,
.logo-phone {
  display: block;
  padding: 0 10px;
}

.logo img {
  display: block;
  height: 34px;
  width: auto;
}

.logo-dark {
  display: none !important;
}

@media (prefers-color-scheme: dark) {
  .logo-light {
    display: none !important;
  }
  .logo-dark {
    display: block !important;
  }
}

/* The brand's own lockup, as in its identity board: a short copper rule and three stacked words. */
.motto {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 10px 18px;
  font: 500 10.5px/1.3 var(--body);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--muted);
}

.motto i {
  width: 22px;
  height: 2px;
  margin-bottom: 7px;
  background: var(--copper);
}

#nav .group {
  margin-top: 16px;
}

#nav .group > p {
  margin: 0 10px 4px;
  font-size: 12px;
  color: var(--muted);
}

#nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  border-radius: 9px;
  color: var(--text);
  font-size: 14.5px;
  text-decoration: none;
}

#nav a:hover {
  background: var(--bg);
}

#nav a.active {
  background: var(--ink);
  color: var(--ink-text);
}

#nav a svg,
.tabbar a svg {
  flex: none;
  width: 18px;
  height: 18px;
}

.count {
  min-width: 22px;
  margin-left: auto;
  padding: 1px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

#nav a.active .count {
  border-color: transparent;
  background: transparent;
  color: inherit;
}

.side-foot {
  display: grid;
  gap: 8px;
  margin-top: auto;
  padding: 18px 10px 0;
}

.side-foot label {
  margin: 0;
  font-size: 13px;
}

.side-foot #mode {
  justify-self: start;
}

.stage {
  min-width: 0;
}

header.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px 14px;
  max-width: 1160px;
  margin: 0 auto;
  padding: 16px 28px 0;
}

.logo-phone {
  display: none;
  margin-right: auto;
  padding: 0;
}

.logo-phone img {
  height: 26px;
  width: auto;
}

.company {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 4px 6px 4px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.company select {
  width: auto;
  margin: 0;
  padding: 4px 6px;
  border: 0;
  background: transparent;
  font-family: var(--display);
  font-weight: 700;
  color: var(--text);
}

main {
  max-width: 1160px;
  margin: 0 auto;
  padding: 14px 28px 56px;
}

.tabbar {
  display: none;
}

/* Phones: the side menu becomes a sheet behind "Mais"; the bottom bar keeps the daily destinations. */
@media (max-width: 900px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
  }
  .side {
    position: fixed;
    inset: 0 0 64px 0;
    z-index: 20;
    height: auto;
    border-right: 0;
    transform: translateY(8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
  }
  body.menu-open .side {
    transform: none;
    opacity: 1;
    visibility: visible;
  }
  .logo-phone {
    display: block;
  }
  header.top {
    padding: 14px 16px 0;
  }
  .company span {
    display: none;
  }
  main {
    padding: 12px 16px 96px;
  }
  .tabbar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 30;
    display: flex;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: var(--surface);
  }
  .tabbar a {
    position: relative;
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 0;
    padding: 6px 4px;
    border-radius: 10px;
    color: var(--text);
    font-size: 11px;
    line-height: 1.2;
    text-decoration: none;
  }
  .tabbar a.active {
    background: var(--ink);
    color: var(--ink-text);
  }
  .tabbar .count {
    position: absolute;
    top: 0;
    right: 6px;
    min-width: 18px;
    margin: 0;
    padding: 0 5px;
    border: 0;
    background: var(--accent);
    color: var(--accent-text);
    font-size: 10px;
  }
}

/* ---------- type ---------- */

h1,
h2,
h3 {
  font-family: var(--display);
  text-wrap: balance;
}

h1 {
  margin: 0 0 16px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h1 .sub {
  font-weight: 600;
  color: var(--muted);
}

h2 {
  margin: 0 0 8px;
  font-size: 19px;
}

h3 {
  margin: 16px 0 6px;
  font-size: 15px;
}

a {
  color: var(--accent);
}

p {
  margin: 4px 0;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 13px;
}

.text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ---------- layout ---------- */

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.spread {
  justify-content: space-between;
}

.card {
  margin-bottom: 16px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat {
  display: block;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
}

.stat b {
  display: block;
  font: 600 26px/1.2 var(--display);
}

.cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0 16px;
}

.two {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

/* ---------- badges ---------- */

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--sunk);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.badge.ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.badge.warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.badge.bad {
  background: var(--bad-soft);
  color: var(--bad);
}

/* ---------- tables ---------- */

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}

/* ---------- controls ---------- */

button,
.button {
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  text-decoration: none;
}

button.primary,
.button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}

button.danger {
  border-color: var(--bad);
  color: var(--bad);
}

button.small {
  padding: 4px 10px;
  font-size: 13px;
}

button:disabled {
  opacity: 0.5;
  cursor: default;
}

button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

label {
  display: block;
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 600;
}

label small {
  display: block;
  font-weight: 400;
  color: var(--muted);
}

label.inline,
label.color {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-weight: 500;
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="password"],
select,
textarea {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 400;
}

input[type="color"] {
  width: 42px;
  height: 32px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

textarea {
  min-height: 84px;
  resize: vertical;
}

.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-top: 4px;
}

.checks label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-weight: 400;
  font-size: 15px;
}

.group {
  margin-bottom: 12px;
}

.group > label {
  margin-bottom: 4px;
}

.pillar {
  display: grid;
  grid-template-columns: 1fr 1fr 90px auto;
  gap: 8px;
  margin-bottom: 8px;
}

.pillar input {
  margin-top: 0;
}

.error {
  margin-bottom: 16px;
  padding: 10px 14px;
  border: 1px solid var(--bad);
  border-radius: 8px;
  background: var(--bad-soft);
  color: var(--bad);
}

.error ul {
  margin: 4px 0 0;
  padding-left: 20px;
}

/* ---------- content ---------- */

.version {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--sunk);
}

details.version summary {
  cursor: pointer;
}

details.version > div {
  margin-top: 8px;
}

ol.slides {
  margin: 4px 0;
  padding-left: 20px;
}

.actions {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.prompt {
  margin: 8px 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.prompt p {
  margin-top: 6px;
  max-height: 150px;
  overflow: auto;
  font: 13px/1.5 var(--mono);
}

img.media {
  display: block;
  max-width: min(100%, 320px);
  margin: 8px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.upload {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.dropzone {
  padding: 18px 14px;
  border: 2px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  cursor: pointer;
}

.dropzone:hover,
.dropzone:focus,
.dropzone.over {
  border-color: var(--accent);
  color: var(--text);
  outline: none;
}

.refs img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.ref {
  display: grid;
  gap: 4px;
  justify-items: center;
}

.ref img.media {
  width: 96px;
  height: 96px;
  max-width: none;
  margin: 0;
  object-fit: cover;
}

/* ---------- art block: the piece on the left, prompt and photo on the right ---------- */

.art-block {
  display: grid;
  grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
  gap: 20px;
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--sunk);
}

@media (max-width: 780px) {
  .art-block {
    grid-template-columns: minmax(0, 1fr);
  }
}

.art-col,
.art-info {
  display: grid;
  gap: 10px;
  align-content: start;
  min-width: 0;
}

.art-frame {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  border-radius: 8px;
  background: var(--surface);
}

.art-preview {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.2s;
}

.art-preview.loading {
  opacity: 0.55;
}

.art-checks {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
}

.art-checks li::before {
  content: "✓ ";
  font-weight: 600;
}

.art-checks li.ok {
  color: var(--ok);
}

.art-checks li.warning {
  color: var(--warn);
}

.art-checks li.warning::before {
  content: "! ";
}

.art-checks li.error {
  color: var(--bad);
}

.art-checks li.error::before {
  content: "✕ ";
}

.editor {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.editor h3 {
  margin: 0;
}

.editor label {
  margin-bottom: 8px;
}

@media (prefers-reduced-motion: reduce) {
  .art-preview {
    transition: none;
  }
}

/* ---------- the week ---------- */

.rail {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 20px;
}

.rail a {
  display: grid;
  gap: 2px;
  padding-top: 8px;
  border-top: 3px solid var(--line);
  color: var(--text);
  text-decoration: none;
}

.rail a span {
  font-size: 12px;
  color: var(--muted);
}

.rail a b {
  font-family: var(--display);
  font-size: 14px;
  font-weight: 600;
}

.rail a.done {
  border-top-color: var(--ink);
}

.rail a.active {
  border-top-color: var(--accent);
}

.rail a.active b {
  color: var(--accent);
}

@media (max-width: 620px) {
  .rail a span {
    display: none;
  }

  .rail a b {
    font-size: 12px;
  }
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin-top: 8px;
}

.stat-inline b {
  display: block;
  font: 600 22px/1.2 var(--display);
}

.stat-inline span {
  font-size: 12px;
  color: var(--muted);
}

table.plan td.day {
  font-family: var(--display);
  font-weight: 600;
  white-space: nowrap;
}

table.plan td.topic {
  min-width: 280px;
}

table.plan td.topic .hook {
  margin-top: 4px;
  font-size: 14px;
}

table.plan td.topic .why {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
}

table.plan td.topic .why b {
  color: var(--text);
  font-weight: 600;
}

table.plan select {
  margin: 0;
  min-width: 140px;
}

table.plan td.day small {
  color: var(--muted);
  font-weight: 500;
}

/* Stories sit under the day's feed post, a step lighter. */
table.plan tr.story td.topic b {
  font-weight: 600;
}

table.plan tr.story td:first-child {
  box-shadow: inset 3px 0 0 var(--line);
}

table.plan tr.auto td {
  color: var(--muted);
}

table.plan tr.removed td {
  opacity: 0.45;
}

table.plan tr.removed td:last-child {
  opacity: 1;
}

form.ask textarea {
  font: 500 17px/1.4 var(--display);
}

/* ---------- week steps 3–5 ---------- */

.panel {
  display: grid;
  gap: 16px;
}

.panel > .card {
  margin-bottom: 0;
}

.badge.accent {
  background: var(--accent-soft);
  color: var(--accent);
}

.prod-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.prod-card {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  min-width: 0;
}

.prod-card h3 {
  margin: 0;
  font-size: 14px;
}

.prod-card .art-block {
  grid-template-columns: minmax(0, 1fr);
  padding: 0;
  border: 0;
  background: none;
}

details.prompt-box summary {
  font-size: 13px;
  color: var(--accent);
  cursor: pointer;
}

.approve {
  display: grid;
  grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
  gap: 20px;
}

@media (max-width: 780px) {
  .approve {
    grid-template-columns: minmax(0, 1fr);
  }
}

.approve-art,
.approve-info {
  display: grid;
  gap: 12px;
  align-content: start;
  min-width: 0;
}

.approve-info h2 {
  margin: 0;
}

.caption {
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--sunk);
  font-size: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

textarea.caption {
  width: 100%;
  margin: 0;
  border: 1px solid transparent;
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
}

textarea.caption:focus {
  border-color: var(--line);
  background: var(--surface);
}

.mono {
  font-family: var(--mono);
}

.slot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
}

.pager {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.toast {
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--ok-soft);
  color: var(--ok);
  font-weight: 500;
}

.learn-list {
  display: grid;
  gap: 8px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.approve-info .row select {
  width: auto;
  margin: 0;
}

#week-picker {
  width: auto;
  margin: 0;
}

/* ---------- research summary on the week plan ---------- */

details.research summary {
  cursor: pointer;
}

ul.findings {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 14px;
}

ul.findings li p {
  margin: 4px 0 0;
}

/* ---------- trends ---------- */

.signals {
  display: grid;
  gap: 10px;
}

.signal {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 14px;
  align-items: start;
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.signal .score {
  font: 700 22px/1 var(--display);
  text-align: center;
  padding: 10px 0;
  border-radius: 8px;
  background: var(--sunk);
}

.signal b {
  display: block;
  margin-top: 6px;
  overflow-wrap: anywhere;
}

.signal p {
  margin: 4px 0 0;
}

/* ---------- concept board ---------- */

.concepts {
  display: grid;
  gap: 10px;
}

.concept {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 14px;
  align-items: start;
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  cursor: pointer;
}

.concept.picked {
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.concept .score {
  font: 700 22px/1 var(--display);
  text-align: center;
  padding: 10px 0;
  border-radius: 8px;
  background: var(--sunk);
}

.concept .row {
  align-items: center;
  gap: 10px;
}

.concept .row input {
  margin: 0;
}

.concept p {
  margin: 6px 0 0;
}

.concept .hook {
  font-size: 15px;
}

/* One summary row per post in the production grid. */
.prod-group {
  grid-column: 1 / -1;
  margin-top: 8px;
  padding: 12px 0 4px;
  border-top: 1px solid var(--line);
}

.prod-group h3 {
  margin: 0;
}

.prod-group details p {
  margin: 6px 0 0;
}

/* ---------- video posts ---------- */

.video-preview {
  display: block;
  width: 100%;
  max-width: 360px;
  aspect-ratio: 9 / 16;
  border-radius: 12px;
  background: #000;
}

.scene-list {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 4px;
}

.video-block .dropzone {
  margin-top: 4px;
}

.qa-box {
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

.qa-box ul {
  margin: 6px 0 0;
  padding-left: 4px;
  list-style: none;
  display: grid;
  gap: 4px;
}

.qa-ok {
  background: var(--ok-soft);
}

.qa-ok b {
  color: var(--ok);
}

.qa-warn {
  background: var(--warn-soft);
}

.qa-warn b {
  color: var(--warn);
}

.qa-error {
  background: var(--bad-soft);
}

.qa-error b {
  color: var(--bad);
}

/* ---------- home: the week, the posts waiting, how each network is doing ---------- */

.home-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px 16px;
  margin-bottom: 18px;
}

.home-head h1 {
  margin: 0;
  white-space: normal;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px 16px;
}

.section-head h2,
.next-step h2 {
  margin: 0;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: normal;
}

.waiting {
  margin-top: 28px;
}

.wait-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 18px;
  margin-top: 16px;
}

.wait-card {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  align-content: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  transition: border-color 0.2s;
}

.wait-card.done {
  border-color: var(--ok);
}

.thumb-art {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 5;
  border-radius: 8px;
  background: var(--sunk);
}

.thumb-media,
.thumb-media img,
.thumb-media video {
  display: block;
  width: 100%;
  height: 100%;
}

/* The whole piece shows: a 9:16 story sits inside the 4:5 frame instead of losing its text to a crop. */
.thumb-media img,
.thumb-media video {
  object-fit: contain;
}

.thumb-note {
  margin: 4px 2px 0;
  color: var(--muted);
  font-size: 12px;
}

.thumb-topic {
  display: grid;
  height: 100%;
  place-items: center;
  padding: 14px;
  color: var(--muted);
  text-align: center;
}

.thumb-chip {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(15, 15, 16, 0.72);
  color: #fff;
  font-size: 12px;
}

.wait-card.done .thumb-art::after {
  content: "Aprovado";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(46, 125, 79, 0.82);
  color: #fff;
  font: 700 20px var(--display);
}

.wait-info {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2px 8px;
  padding: 2px 4px 0;
  font-size: 14px;
}

.wait-topic {
  margin: 0;
  padding: 0 4px;
  font-size: 14px;
}

.wait-card > .badge {
  justify-self: start;
  margin: 0 4px;
  white-space: normal;
}

.wait-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 2px 4px 4px;
}

.wait-actions button {
  padding: 9px 6px;
  white-space: nowrap;
}

.approve-btn {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--ink-text);
  font-weight: 600;
}

.adjust-btn {
  font-weight: 600;
}

.wait-card.done .wait-actions {
  grid-template-columns: 1fr;
}

.wait-card.done .approve-btn {
  border-color: transparent;
  background: var(--ok-soft);
  color: var(--ok);
  opacity: 1;
}

.next-step {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 20px;
  margin-top: 28px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.next-step p {
  margin-top: 4px;
}

.perf {
  margin-top: 40px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.perf-tabs {
  display: flex;
  gap: 2px;
  padding: 8px 8px 0;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.perf-tab {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: 0;
  border-radius: 10px 10px 0 0;
  background: transparent;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}

.perf-tab[aria-selected="true"] {
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line), 0 1px 0 var(--surface);
  color: var(--text);
  font-weight: 600;
}

.perf-tab .n {
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}

.perf-tab.off {
  color: var(--muted);
  opacity: 0.75;
}

.perf-tab.off small {
  text-decoration: underline;
}

.net-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted);
}

.net-instagram { background: #d6249f; }
.net-facebook { background: #1877f2; }
.net-tiktok { background: #25f4ee; box-shadow: 2px 0 0 #fe2c55; }
.net-youtube { background: #ff0000; }
.net-linkedin { background: #0a66c2; }

.perf-body {
  padding: 22px 24px 24px;
}

.lead-metric {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 14px;
}

.lead-metric strong {
  font: 800 52px/1 var(--display);
  letter-spacing: -0.03em;
}

.lead-metric .what {
  font-size: 17px;
  font-weight: 500;
}

.lead-metric .delta {
  color: var(--ok);
  font-size: 14px;
  font-weight: 600;
}

.lead-metric .delta.down {
  color: var(--bad);
}

.other-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 26px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

.other-metrics b {
  color: var(--text);
  font-weight: 600;
}

.perf-empty {
  margin: 0;
}

.week-posts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 22px;
}

.week-post {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  color: var(--text);
  text-decoration: none;
}

.week-post:hover .thumb-art {
  outline: 2px solid var(--line);
}

.week-post-meta {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  color: var(--muted);
  font-size: 12.5px;
}

.state {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.state::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.state.ok {
  color: var(--ok);
}

.state.wait {
  color: var(--accent);
}

.perf .empty {
  padding: 26px 8px;
  color: var(--muted);
  text-align: center;
}

.perf .empty .button {
  display: inline-block;
  margin-top: 10px;
}

@media (max-width: 620px) {
  .wait-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .section-head .primary {
    width: 100%;
  }
  .lead-metric strong {
    font-size: 42px;
  }
  .week-posts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---------- signing in ---------- */

body.gated .shell,
body.gated .tabbar {
  display: none;
}

#gate {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px 16px;
}

.gate-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  width: min(880px, 100%);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}

.gate-brand {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  padding: 48px 40px;
  background: #0f0f10;
  color: #f7f6f4;
}

.gate-brand img {
  width: min(260px, 100%);
  height: auto;
}

.gate-line {
  margin: 0;
  font: 600 22px/1.25 var(--display);
  letter-spacing: -0.01em;
}

.gate-brand .motto {
  padding: 0;
  color: #a3a09b;
}

.gate-form {
  display: grid;
  gap: 12px;
  align-content: center;
  padding: 44px 40px;
}

.gate-form h1 {
  margin: 0 0 4px;
}

.gate-form label {
  margin: 0;
}

.gate-form .primary {
  margin-top: 4px;
  padding: 12px;
}

.gate-msg p {
  margin: 0;
  color: var(--bad);
  font-size: 14px;
}

#who {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.who-name {
  display: grid;
  min-width: 0;
}

.who-name span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .gate-card {
    grid-template-columns: minmax(0, 1fr);
  }
  .gate-brand {
    padding: 28px 24px;
  }
  .gate-line {
    font-size: 18px;
  }
  .gate-form {
    padding: 28px 24px;
  }
}

/* ---------- client access (owner) ---------- */

.access {
  margin-top: 24px;
}

.access-invite {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) auto auto;
  gap: 8px;
  margin-top: 14px;
}

.access-invite input,
.access-invite select {
  margin: 0;
}

.access-link {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
}

.access-link p {
  margin: 0;
}

.client-review {
  justify-self: start;
  margin: 0 4px;
  white-space: normal;
}

@media (max-width: 720px) {
  .access-invite {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- the client's page ---------- */

body.portal .shell,
body.portal .tabbar {
  display: none;
}

.portal-top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.portal-logo img {
  display: block;
  height: 26px;
  width: auto;
}

.portal-top select {
  width: auto;
  margin: 0;
}

.portal-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.portal-main {
  max-width: 980px;
  margin: 0 auto;
  padding: 20px 20px 60px;
}

.portal-loading {
  padding: 24px;
}

.portal-section {
  margin-top: 26px;
}

.portal-section h2 {
  margin: 0;
  font-size: 21px;
  font-weight: 700;
}

.portal-list {
  display: grid;
  gap: 18px;
  margin-top: 14px;
}

.portal-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.portal-gallery {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
}

.portal-piece {
  flex: 0 0 100%;
  overflow: hidden;
  border-radius: 8px;
  background: var(--sunk);
  scroll-snap-align: start;
}

.portal-piece img,
.portal-piece video {
  display: block;
  width: 100%;
  height: auto;
  max-height: 70vh;
  object-fit: contain;
}

.portal-info {
  display: grid;
  gap: 10px;
  align-content: start;
  min-width: 0;
}

.portal-when {
  display: grid;
}

.portal-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.portal-caption p {
  margin: 0 0 6px;
}

.portal-state .badge {
  margin: 0;
  white-space: normal;
}

.portal-decide {
  display: grid;
  gap: 8px;
}

.portal-decide textarea {
  margin: 0;
}

.portal-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

@media (max-width: 720px) {
  .portal-card {
    grid-template-columns: minmax(0, 1fr);
  }
  .portal-main {
    padding: 16px 16px 48px;
  }
  .portal-top {
    padding: 10px 16px;
  }
}
