/* Página do cliente: barra da marca + réplica do perfil do Instagram */

/* ---------- Barra da marca ---------- */
.brandbar {
  position: sticky; top: 0; z-index: 50; height: 60px; background: var(--ink); color: var(--paper);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 max(16px, env(safe-area-inset-left));
}
.brandbar .brand img { height: 30px; width: auto; }
.bb-right { display: flex; align-items: center; gap: 10px; }
.review-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px 0 6px; border-radius: 999px; border: 0;
  background: var(--paper); color: var(--ink); font-weight: 600; font-size: 13px;
}
.review-btn .count { min-width: 26px; height: 26px; border-radius: 999px; background: var(--ink); color: var(--paper); display: grid; place-items: center; font-size: 12px; padding: 0 7px; }
.review-btn.done { background: transparent; color: var(--paper); border: 1.5px solid rgba(255,255,255,.35); padding: 0 14px; }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: rgba(255,255,255,.75); user-select: none; cursor: pointer; }
.toggle input { appearance: none; width: 34px; height: 20px; border-radius: 999px; background: #444; position: relative; margin: 0; cursor: pointer; transition: background .2s; }
.toggle input::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; }
.toggle input:checked { background: #fff; }
.toggle input:checked::after { transform: translateX(14px); background: #000; }

.hint { max-width: 935px; margin: 16px auto 0; padding: 0 16px; }
.hint-box { display: flex; align-items: center; gap: 12px; border: 1.5px solid var(--ink); border-radius: var(--radius); padding: 12px 14px 12px 16px; font-size: 13.5px; line-height: 1.45; }
.hint-box p { margin: 0; flex: 1; }
.hint-box b { font-weight: 700; }

/* ---------- Instagram ---------- */
.ig {
  --ig-text: #000; --ig-muted: #737373; --ig-line: #dbdbdb; --ig-blue: #0095f6; --ig-btn: #efefef; --ig-link: #00376b;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: var(--ig-text); font-size: 14px; line-height: 18px; max-width: 935px; margin: 0 auto; padding: 30px 20px 60px;
}
.ig-head { display: grid; grid-template-columns: 290px 1fr; align-items: center; margin-bottom: 44px; }
.ig-avatar-wrap { display: flex; justify-content: center; }
.ig-avatar { width: 150px; height: 150px; border-radius: 50%; border: 0; padding: 0; background: none; position: relative; cursor: default; }
.ig-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; background: #fafafa; }
.ig-avatar.ring { cursor: pointer; padding: 6px; }
.ig-avatar.ring::before { content: ''; position: absolute; inset: 0; border-radius: 50%; padding: 3px; background: linear-gradient(45deg, #feda75, #fa7e1e 25%, #d62976 50%, #962fbf 75%, #4f5bd5);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
.ig-avatar.ring.seen::before { background: #dbdbdb; padding: 2px; }
.ig-avatar.ring img { border: 0; }

.ig-row1 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.ig-username { font-size: 20px; line-height: 25px; font-weight: 400; margin: 0 12px 0 0; }
.ig-btn { height: 32px; padding: 0 16px; border-radius: 8px; background: var(--ig-btn); font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; }
.ig-btn.primary { background: var(--ig-blue); color: #fff; }
.ig-more { display: inline-grid; place-items: center; width: 32px; height: 32px; }
.ig-name { font-weight: 600; display: block; font-size: 15px; }
.ig-name-m, .ig-btns-m { display: none; }

.ig-hl { display: flex; gap: 46px; padding: 0 0 44px 44px; overflow-x: auto; scrollbar-width: none; }
.ig-hl::-webkit-scrollbar { display: none; }
.ig-hl button { border: 0; background: none; padding: 0; display: grid; justify-items: center; gap: 12px; flex: 0 0 auto; cursor: pointer; }
.ig-hl .c { width: 87px; height: 87px; border-radius: 50%; padding: 4px; border: 1px solid var(--ig-line); background: #fff; position: relative; }
.ig-hl .c img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.ig-hl .c .st { position: absolute; right: -2px; bottom: 2px; }
.ig-hl span.l { font-size: 12px; font-weight: 600; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ig-tabs { display: flex; justify-content: center; gap: 60px; border-top: 1px solid var(--ig-line); }
.ig-tabs button { border: 0; background: none; height: 52px; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; letter-spacing: 1px;
  text-transform: uppercase; color: var(--ig-muted); border-top: 1px solid transparent; margin-top: -1px; padding: 0; }
.ig-tabs button.active { color: var(--ig-text); border-top-color: var(--ig-text); }

.ig-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.tile { position: relative; aspect-ratio: 3 / 4; border: 0; padding: 0; background: #efefef; overflow: hidden; cursor: pointer; }
.ig-grid.reels .tile { aspect-ratio: 9 / 16; }
.tile img, .tile video { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.tile .tt { position: absolute; top: 8px; right: 8px; color: #fff; filter: drop-shadow(0 0 2px rgba(0,0,0,.4)); }
.tile .hov { position: absolute; inset: 0; background: rgba(0,0,0,.35); color: #fff; display: grid; place-items: center; opacity: 0; transition: opacity .15s; font-weight: 600; font-size: 15px; text-align: center; padding: 10px; }
.tile:hover .hov { opacity: 1; }
.tile .hov small { display: block; font-weight: 500; font-size: 13px; opacity: .9; margin-top: 4px; }
.ig-empty { padding: 60px 20px; text-align: center; color: var(--ig-muted); }
.ig-empty b { display: block; color: var(--ig-text); font-size: 24px; font-weight: 800; margin-bottom: 8px; line-height: 1.2; }

/* Marcas de estado (só com "Estados" ligado) */
.st { display: none; }
.show-status .st { display: inline-flex; }
.tile .st { position: absolute; left: 8px; bottom: 8px; }
.st-badge { align-items: center; gap: 5px; height: 24px; padding: 0 9px 0 6px; border-radius: 999px; font-family: var(--brand-font); font-size: 11.5px; font-weight: 600; box-shadow: 0 1px 6px rgba(0,0,0,.25); }
.st-badge.pending { background: #fff; color: #000; }
.st-badge.approved { background: var(--ok); color: #fff; }
.st-badge.changes { background: var(--warn); color: #fff; }
.st-dot { width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; border: 2px solid #fff; }
.st-dot.pending { background: #000; color: #fff; }
.st-dot.approved { background: var(--ok); color: #fff; }
.st-dot.changes { background: var(--warn); color: #fff; }

/* ---------- Calendário ---------- */
.cal { font-family: var(--brand-font); padding-top: 24px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.cal-head h3 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.cal-head .nav { display: flex; gap: 6px; }
.cal-head .nav button { width: 38px; height: 38px; border-radius: 50%; border: 1.5px solid var(--line); background: #fff; display: grid; place-items: center; }
.cal-head .nav button:hover { border-color: var(--ink); }
.cal-dow, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-dow div { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 0 8px 8px; }
.cal-grid { border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.cal-cell { min-height: 112px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 6px; display: flex; flex-direction: column; gap: 6px; }
.cal-cell.out { background: #fafafa; }
.cal-cell.out .cal-n { color: #c4c4c4; }
.cal-n { font-size: 12.5px; font-weight: 600; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.cal-cell.today .cal-n { background: var(--ink); color: #fff; }
.cal-thumbs { display: flex; flex-wrap: wrap; gap: 4px; }
.cal-thumb { position: relative; width: 38px; aspect-ratio: 3 / 4; border: 0; padding: 0; border-radius: 6px; overflow: hidden; background: #eee; }
.cal-thumb img, .cal-thumb video { width: 100%; height: 100%; object-fit: cover; }
.cal-thumb::after { content: ''; position: absolute; right: 3px; bottom: 3px; width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid #fff; }
.cal-thumb.pending::after { background: #000; }
.cal-thumb.approved::after { background: var(--ok); }
.cal-thumb.changes::after { background: var(--warn); }
.cal-list { margin-top: 28px; display: grid; gap: 2px; }
.cal-list h4 { margin: 0 0 8px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.cal-item { display: grid; grid-template-columns: 52px 1fr auto; gap: 14px; align-items: center; padding: 10px; border: 0; background: none; text-align: left; border-radius: 12px; }
.cal-item:hover { background: var(--soft); }
.cal-item .th { width: 52px; aspect-ratio: 3 / 4; border-radius: 8px; overflow: hidden; background: #eee; }
.cal-item .th img, .cal-item .th video { width: 100%; height: 100%; object-fit: cover; }
.cal-item .tx b { display: block; font-size: 14px; font-weight: 600; }
.cal-item .tx span { font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.cal-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 12px; }
.cal-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }

/* ---------- Modal de publicação ---------- */
body.lock { overflow: hidden; }
.pm-overlay { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.65); display: grid; place-items: center; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; } }
.pm-x { position: fixed; top: 10px; right: 10px; color: #fff; z-index: 2; }
.pm-x:hover { background: rgba(255,255,255,.12); }
.pm-nav { position: fixed; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(255,255,255,.9); display: grid; place-items: center; z-index: 2; color: #000; }
.pm-nav.prev { left: 22px; } .pm-nav.next { right: 22px; }

.pm {
  --ar: .8; --side: 405px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; font-size: 14px; line-height: 18px;
  background: #fff; display: grid; grid-template-columns: auto var(--side); grid-template-rows: auto 1fr auto;
  grid-template-areas: "media head" "media rest" "media ap"; border-radius: 4px; overflow: hidden; max-height: 92vh;
}
.pm > .ap { grid-area: ap; }
.pm-bar { display: none; grid-area: bar; }
.pm-head { grid-area: head; display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 12px 0 16px; border-bottom: 1px solid #efefef; }
.pm-head .av { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.pm-head b { font-weight: 600; flex: 1; }
.pm-media { grid-area: media; position: relative; background: #000; width: min(calc(min(92vh, 900px) * var(--ar)), calc(100vw - var(--side) - 128px)); aspect-ratio: var(--ar); max-height: 92vh; }
.pm-rest { grid-area: rest; display: flex; flex-direction: column; min-height: 0; }
.pm-cap { flex: 1; overflow-y: auto; padding: 16px; min-height: 80px; }
.pm-cap .row { display: flex; gap: 14px; }
.pm-cap .av { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; }
.pm-cap .txt { white-space: pre-wrap; word-break: break-word; }
.pm-cap .txt b { font-weight: 600; margin-right: 4px; }
.pm-cap .when { color: #737373; font-size: 12px; margin-top: 10px; }
.pm-cap .nocap { color: #737373; }
.pm-icons { display: flex; align-items: center; gap: 16px; padding: 10px 16px 4px; border-top: 1px solid #efefef; }
.pm-icons span:last-child { margin-left: auto; }
.pm-date { padding: 4px 16px 12px; font-size: 10px; letter-spacing: .3px; text-transform: uppercase; color: #737373; }

/* Carrossel */
.car { position: absolute; inset: 0; overflow: hidden; }
.car-track { display: flex; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; scrollbar-width: none; }
.car-track::-webkit-scrollbar { display: none; }
.car-slide { flex: 0 0 100%; height: 100%; scroll-snap-align: start; position: relative; }
.car-slide img, .car-slide video { width: 100%; height: 100%; object-fit: cover; }
.car-btn { position: absolute; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(255,255,255,.85); display: grid; place-items: center; color: #000; z-index: 1; box-shadow: 0 0 4px rgba(0,0,0,.2); }
.car-btn.p { left: 10px; } .car-btn.n { right: 10px; }
.car-dots { position: absolute; bottom: 14px; left: 0; right: 0; display: flex; justify-content: center; gap: 4px; z-index: 1; }
.car-dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,.5); }
.car-dots i.on { background: #fff; }
.car-count { position: absolute; top: 12px; right: 12px; background: rgba(26,26,26,.75); color: #fff; font-size: 12px; padding: 3px 9px; border-radius: 999px; z-index: 1; }
.mute-btn { position: absolute; right: 12px; bottom: 12px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(38,38,38,.8); color: #fff; display: grid; place-items: center; z-index: 1; }

/* ---------- Painel de aprovação ---------- */
.ap { font-family: var(--brand-font); border-top: 1px solid #efefef; padding: 14px 16px 16px; background: #fff; }
.ap-when { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); margin: 0 0 12px; }
.ap-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ap-actions .btn { height: 46px; }
.ap-form { display: grid; gap: 8px; margin-top: 10px; }
.ap-form .textarea { min-height: 84px; font-size: 14px; }
.ap-form .row { display: flex; gap: 8px; justify-content: flex-end; }
.ap-done { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 12px; font-size: 13.5px; line-height: 1.4; font-weight: 500; }
.ap-done svg { flex: 0 0 auto; margin-top: 1px; }
.ap-done.approved { background: var(--ok-soft); color: #0b6b35; }
.ap-done.changes { background: var(--warn-soft); color: #9c3b06; }
.ap-done q { display: block; color: var(--ink); font-style: normal; margin-top: 4px; font-weight: 400; }
.ap-links { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.ap-links .btn { flex: 1; }
.ap-next { margin-top: 10px; }

/* Variante escura (stories) */
.ap.dark { background: transparent; border: 0; color: #fff; padding: 12px 14px calc(14px + env(safe-area-inset-bottom)); }
.ap.dark .ap-when { color: rgba(255,255,255,.8); }
.ap.dark .btn { background: #fff; color: #000; border-color: #fff; }
.ap.dark .btn.ghost { background: rgba(0,0,0,.35); color: #fff; border-color: rgba(255,255,255,.7); }
.ap.dark .textarea { background: rgba(0,0,0,.55); color: #fff; border-color: rgba(255,255,255,.4); }
.ap.dark .ap-done.approved { background: rgba(18,161,80,.92); color: #fff; }
.ap.dark .ap-done.changes { background: rgba(232,89,12,.92); color: #fff; }
.ap.dark .ap-done q { color: #fff; }

/* ---------- Stories ---------- */
.sv { position: fixed; inset: 0; z-index: 120; background: #1a1a1a; display: grid; place-items: center; animation: fade .18s ease; }
.sv-frame { position: relative; height: min(100vh, 100dvh); max-height: 920px; aspect-ratio: 9 / 16; max-width: 100vw; background: #000; overflow: hidden; border-radius: 10px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; color: #fff; }
.sv-media { position: absolute; inset: 0; }
.sv-media img, .sv-media video { width: 100%; height: 100%; object-fit: cover; }
.sv-top { position: absolute; top: 0; left: 0; right: 0; padding: 12px 12px 30px; background: linear-gradient(rgba(0,0,0,.45), transparent); z-index: 2; }
.sv-bars { display: flex; gap: 3px; }
.sv-bars i { flex: 1; height: 2px; border-radius: 2px; background: rgba(255,255,255,.35); overflow: hidden; }
.sv-bars i b { display: block; height: 100%; width: 0; background: #fff; }
.sv-head { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 14px; }
.sv-head img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.sv-head b { font-weight: 600; }
.sv-head span { opacity: .75; }
.sv-head .icon-btn { margin-left: auto; color: #fff; }
.sv-tap { position: absolute; top: 80px; bottom: 170px; width: 35%; z-index: 1; border: 0; background: none; }
.sv-tap.l { left: 0; } .sv-tap.r { right: 0; width: 65%; }
.sv-foot { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; background: linear-gradient(transparent, rgba(0,0,0,.6) 40%); padding-top: 40px; }
.sv-side { position: fixed; top: 50%; transform: translateY(-50%); }
.sv-x { position: fixed; top: 12px; right: 12px; color: #fff; z-index: 3; }

/* ---------- Ecrã de erro / vazio ---------- */
.screen { min-height: calc(100vh - 60px); display: grid; place-items: center; text-align: center; padding: 40px 24px; }
.screen h1 { font-size: 28px; font-weight: 800; letter-spacing: -.02em; margin: 0 0 10px; }
.screen p { color: var(--muted); max-width: 380px; margin: 0 auto; line-height: 1.5; }
.center { min-height: 60vh; display: grid; place-items: center; }

.portal-foot { font-family: var(--brand-font); text-align: center; font-size: 12px; color: var(--muted); padding: 10px 16px 40px; }
.portal-foot img { height: 18px; margin: 0 auto 8px; filter: invert(1); opacity: .8; }

/* ---------- Telemóvel ---------- */
@media (max-width: 735px) {
  .brandbar { height: 56px; }
  .brandbar .brand img { height: 24px; }
  .toggle span { display: none; }
  .ig { padding: 16px 0 40px; }
  .ig-head { grid-template-columns: auto 1fr; gap: 0 22px; padding: 0 16px; margin-bottom: 14px; align-items: center; }
  .ig-avatar { width: 86px; height: 86px; }
  .ig-avatar.ring { padding: 4px; }
  .ig-row1 { display: none; }
  .ig-name-m { display: block; font-weight: 600; font-size: 16px; line-height: 1.3; }
  .ig-name-m small { display: block; font-weight: 400; font-size: 14px; color: var(--ig-muted); }
  .ig-info > .ig-name { display: none; }
  .ig-btns-m { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; grid-column: 1 / -1; margin-top: 14px; }
  .ig-btns-m .ig-btn { justify-content: center; }
  .ig-hl { gap: 14px; padding: 0 16px 16px; }
  .ig-hl .c { width: 64px; height: 64px; padding: 3px; }
  .ig-hl span.l { font-size: 12px; font-weight: 400; }
  .ig-tabs { gap: 0; }
  .ig-tabs button { flex: 1; justify-content: center; height: 46px; border-top: 0; border-bottom: 1px solid transparent; }
  .ig-tabs button.active { border-bottom-color: #000; }
  .ig-tabs button span { display: none; }
  .ig-tabs button svg { width: 24px; height: 24px; }
  .ig-grid { gap: 2px; }
  .tile .hov { display: none; }
  .st-badge { height: 20px; font-size: 10.5px; padding: 0 7px 0 4px; }
  .st-badge svg { width: 11px; height: 11px; }
  .tile .st { left: 5px; bottom: 5px; }
  .cal { padding: 16px 12px 0; }
  .cal-cell { min-height: 70px; padding: 4px; gap: 3px; }
  .cal-thumb { width: 100%; }
  .cal-thumbs .cal-thumb:nth-child(n+2) { display: none; }
  .cal-more { font-size: 10px; color: var(--muted); font-weight: 600; }
  .cal-dow div { padding: 0 4px 6px; font-size: 10px; }
  .hint { margin-top: 12px; }

  .pm-overlay { display: block; background: #fff; }
  .pm-x, .pm-nav { display: none; }
  .pm { display: flex; flex-direction: column; height: 100%; max-height: none; border-radius: 0; overflow-y: auto; }
  .pm-bar { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 8px; border-bottom: 1px solid #efefef; position: sticky; top: 0; background: #fff; z-index: 3; flex: 0 0 auto; }
  .pm-bar b { flex: 1; text-align: center; font-size: 16px; margin-right: 40px; }
  .pm-head { height: 56px; border-bottom: 0; flex: 0 0 auto; }
  .pm-media { width: 100%; max-height: none; flex: 0 0 auto; }
  .pm-rest { flex: 1 0 auto; }
  .pm-icons { order: -2; border-top: 0; padding-top: 8px; }
  .pm-cap { order: -1; flex: 0 0 auto; padding: 6px 16px 10px; overflow: visible; }
  .pm-cap .av { display: none; }
  .pm-date { order: -1; padding-top: 0; }
  .ap { position: sticky; bottom: 0; margin-top: auto; box-shadow: 0 -6px 20px rgba(0,0,0,.06); padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .sv-frame { border-radius: 0; height: 100dvh; max-height: none; width: 100vw; aspect-ratio: auto; }
}
