:root {
  --bg: #0b0b0f; --bg2: #111117; --card: #17171f; --card2: #1e1e28; --line: #2a2a36; --line2: #353545;
  --text: #ececf1; --muted: #9a9aab; --faint: #6b6b7c;
  --accent: #7c6cff; --accent2: #6857f5; --accent-soft: rgba(124,108,255,.14);
  --ok: #22c55e; --ok-soft: rgba(34,197,94,.14); --warn: #f59e0b; --warn-soft: rgba(245,158,11,.14);
  --err: #ef4444; --err-soft: rgba(239,68,68,.14); --pink: #e1306c;
  --ig: linear-gradient(45deg,#f09433,#e6683c,#dc2743,#cc2366,#bc1888);
  --r: 14px; --shadow: 0 10px 30px -12px rgba(0,0,0,.6);
  --font: ui-sans-serif, -apple-system, "Segoe UI", Roboto, Inter, "Helvetica Neue", Arial, sans-serif;
  --bar: rgba(11,11,15,.78); --seg-on: #3a3a4a;
  --nav-h: 44px; --tab-h: 50px;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px);
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f5f5f8; --bg2: #ffffff; --card: #ffffff; --card2: #f3f3f7; --line: #e4e4ea; --line2: #d6d6df;
    --text: #17171f; --muted: #5d5d6e; --faint: #8a8a99; --accent-soft: rgba(124,108,255,.12);
    --shadow: 0 10px 30px -14px rgba(20,20,40,.25); color-scheme: light;
    --bar: rgba(245,245,248,.82); --seg-on: #ffffff;
  }
}
:root[data-theme="light"] {
  --bg: #f5f5f8; --bg2: #ffffff; --card: #ffffff; --card2: #f3f3f7; --line: #e4e4ea; --line2: #d6d6df;
  --text: #17171f; --muted: #5d5d6e; --faint: #8a8a99; --accent-soft: rgba(124,108,255,.12);
  --shadow: 0 10px 30px -14px rgba(20,20,40,.25); color-scheme: light;
  --bar: rgba(245,245,248,.82); --seg-on: #ffffff;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
img, video { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
h1 { font-size: 22px; line-height: 1.25; letter-spacing: -.01em; }
h2 { font-size: 17px; letter-spacing: -.01em; }
h3 { font-size: 15px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
.hidden { display: none !important; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.grid { display: grid; gap: 14px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- botões e campos ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--line2); background: var(--card2); font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .1s; color: var(--text); }
.btn:hover { border-color: var(--faint); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent2); }
.btn.danger { color: var(--err); }
.btn.danger:hover { border-color: var(--err); background: var(--err-soft); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--card2); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn.icon { width: 38px; padding: 0; }
.btn.sm.icon { width: 30px; }
.btn.ig { background: var(--ig); border: 0; color: #fff; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label { font-size: 12px; font-weight: 600; color: var(--muted); }
.field .hint { font-size: 11.5px; color: var(--faint); }
.input, textarea.input, select.input { width: 100%; background: var(--bg2); border: 1px solid var(--line2); border-radius: 10px; padding: 9px 12px; outline: none; transition: border-color .15s, box-shadow .15s; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.input { resize: vertical; min-height: 70px; }
.seg { display: inline-flex; background: var(--bg2); border: 1px solid var(--line2); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 7px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 12.5px; }
.seg button.on { background: var(--card2); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch { position: relative; width: 38px; height: 22px; flex-shrink: 0; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line2); border-radius: 22px; transition: .2s; }
.switch span::after { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(16px); }

/* ---------- cartões ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; }
.card.pad0 { padding: 0; overflow: hidden; }
.card-h { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-h h2, .card-h h3 { flex: 1; }
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 11px; font-weight: 700; letter-spacing: .02em; background: var(--card2); 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.err { background: var(--err-soft); color: var(--err); }
.badge.acc { background: var(--accent-soft); color: var(--accent); }
.badge.pink { background: rgba(225,48,108,.14); color: var(--pink); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--faint); }
.dot.ok { background: var(--ok); } .dot.err { background: var(--err); } .dot.warn { background: var(--warn); }

.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.kpi .l { font-size: 12px; color: var(--muted); font-weight: 600; }
.kpi .v { font-size: 24px; font-weight: 750; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi .s { font-size: 11.5px; color: var(--faint); }

.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--ig); flex-shrink: 0; object-fit: cover; display: grid; place-items: center; color: #fff; font-weight: 700; overflow: hidden; }
.avatar.lg { width: 64px; height: 64px; font-size: 24px; }
.avatar.sm { width: 28px; height: 28px; font-size: 12px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty svg { width: 34px; height: 34px; opacity: .5; margin-bottom: 8px; }

/* ---------- layout do painel ---------- */
.layout { display: grid; grid-template-columns: 260px 1fr; height: 100vh; }
.side { background: var(--bg2); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; font-weight: 800; font-size: 15px; letter-spacing: -.01em; }
.brand .logo { width: 30px; height: 30px; border-radius: 9px; background: var(--ig); display: grid; place-items: center; color: #fff; }
.brand .logo svg { width: 18px; height: 18px; }
.nav { padding: 6px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 11px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; padding: 14px 18px 6px; display: flex; align-items: center; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; cursor: pointer; color: var(--muted); font-weight: 600; border: 0; background: none; width: 100%; text-align: left; }
.nav-item:hover { background: var(--card2); color: var(--text); }
.nav-item.on { background: var(--accent-soft); color: var(--text); }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item .meta { margin-left: auto; font-size: 11px; color: var(--faint); font-weight: 600; }
.profiles { flex: 1; overflow-y: auto; padding: 0 10px; }
.side-foot { padding: 12px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.main { overflow-y: auto; min-width: 0; }
.main-inner { max-width: 1240px; margin: 0 auto; padding: 26px 28px 60px; }
.page-h { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.page-h .t { flex: 1; min-width: 200px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 22px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 10px 14px; font-weight: 650; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.topbar { display: none; }

.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.cols-3-1 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 14px; }

/* cards de perfis (visão geral) */
.acc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.acc-card { cursor: pointer; transition: border-color .15s, transform .15s; }
.acc-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.acc-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.acc-stats div { background: var(--card2); border-radius: 10px; padding: 8px 10px; }
.acc-stats b { display: block; font-size: 16px; font-variant-numeric: tabular-nums; }
.acc-stats span { font-size: 11px; color: var(--muted); }

/* feed de atividade */
.feed { display: flex; flex-direction: column; }
.feed-item { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.feed-item:last-child { border-bottom: 0; }
.feed-item .ic { width: 28px; height: 28px; border-radius: 8px; background: var(--card2); display: grid; place-items: center; flex-shrink: 0; }
.feed-item .ic svg { width: 15px; height: 15px; }
.feed-item .bd { flex: 1; min-width: 0; }
.feed-item .tx { font-size: 13px; }
.feed-item .dt { font-size: 11.5px; color: var(--faint); }

/* posts */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.media { position: relative; border-radius: 12px; overflow: hidden; background: var(--card2); aspect-ratio: 4/5; border: 1px solid var(--line); }
.media img, .media video { width: 100%; height: 100%; object-fit: cover; }
.media .ov { position: absolute; inset: auto 0 0 0; padding: 26px 10px 8px; background: linear-gradient(transparent, rgba(0,0,0,.8)); color: #fff; font-size: 12px; display: flex; gap: 10px; align-items: center; }
.media .ov svg { width: 13px; height: 13px; }
.media .tp { position: absolute; top: 8px; left: 8px; }
.media .act { position: absolute; top: 8px; right: 8px; }
.media.pick { cursor: pointer; }
.media.pick:hover { outline: 2px solid var(--accent); outline-offset: -2px; }
.media .has { position: absolute; top: 8px; right: 8px; }

/* automações */
.auto-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.auto { display: flex; gap: 14px; }
.auto .thumb { width: 72px; height: 90px; border-radius: 10px; background: var(--card2); overflow: hidden; flex-shrink: 0; display: grid; place-items: center; color: var(--faint); }
.auto .thumb img { width: 100%; height: 100%; object-fit: cover; }
.auto .thumb.dm { background: var(--ig); color: #fff; }
.auto .thumb svg { width: 26px; height: 26px; }
.auto .bd { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.terms { display: flex; flex-wrap: wrap; gap: 4px; }
.term { background: var(--card2); border: 1px solid var(--line); padding: 1px 8px; border-radius: 999px; font-size: 11.5px; }
.mini-stats { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.mini-stats b { color: var(--text); font-variant-numeric: tabular-nums; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(5,5,10,.72); backdrop-filter: blur(4px); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: var(--card); border: 1px solid var(--line); border-radius: 18px; width: 100%; max-width: 1080px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; box-shadow: var(--shadow); overflow: hidden; }
.modal.sm { max-width: 460px; }
.modal-h { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-h h2 { flex: 1; }
.modal-b { overflow-y: auto; padding: 20px; flex: 1; }
.modal-f { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; }
.editor { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 22px; }
.sec-title { font-size: 11px; font-weight: 800; color: var(--accent); letter-spacing: .08em; text-transform: uppercase; margin: 6px 0 12px; display: flex; align-items: center; gap: 8px; }
.sec-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* pré-visualização estilo Instagram */
.phone { background: #000; color: #f5f5f5; border-radius: 22px; border: 1px solid var(--line2); overflow: hidden; position: sticky; top: 0; }
.phone-h { padding: 12px 14px; border-bottom: 1px solid #262626; font-weight: 700; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.phone-b { padding: 14px; display: flex; flex-direction: column; gap: 10px; min-height: 200px; background: #000; }
.cmt { display: flex; gap: 8px; font-size: 12.5px; }
.cmt .av { width: 26px; height: 26px; border-radius: 50%; background: #444; flex-shrink: 0; }
.cmt .av.brand { background: var(--ig); }
.cmt b { margin-right: 4px; }
.cmt .tm { color: #8e8e8e; font-size: 11px; }
.bubble { max-width: 82%; padding: 9px 13px; border-radius: 18px; font-size: 13px; line-height: 1.35; white-space: pre-wrap; word-break: break-word; }
.bubble.me { align-self: flex-end; background: #3797f0; color: #fff; border-bottom-right-radius: 5px; }
.bubble.them { align-self: flex-start; background: #262626; border-bottom-left-radius: 5px; }
.tpl { align-self: flex-end; width: 82%; background: #262626; border-radius: 16px; overflow: hidden; font-size: 13px; }
.tpl .tx { padding: 11px 13px; white-space: pre-wrap; word-break: break-word; }
.tpl .bt { border-top: 1px solid #3a3a3a; padding: 10px; text-align: center; font-weight: 600; color: #e0f1ff; }
.sys { text-align: center; color: #8e8e8e; font-size: 11px; padding: 0 10px; }

/* publicar */
.drop { border: 2px dashed var(--line2); border-radius: 14px; padding: 26px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop svg { width: 30px; height: 30px; color: var(--accent); margin: 0 auto 8px; }
.thumbs { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.thumb-item { position: relative; width: 88px; height: 110px; border-radius: 10px; overflow: hidden; background: var(--card2); border: 1px solid var(--line); }
.thumb-item img, .thumb-item video { width: 100%; height: 100%; object-fit: cover; }
.thumb-item .x { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; background: rgba(0,0,0,.7); color: #fff; border: 0; cursor: pointer; display: grid; place-items: center; }
.thumb-item .n { position: absolute; bottom: 4px; left: 4px; background: rgba(0,0,0,.7); color: #fff; font-size: 10px; padding: 0 6px; border-radius: 6px; font-weight: 700; }
.thumb-item .prog { position: absolute; inset: auto 0 0 0; height: 4px; background: var(--accent); transition: width .2s; }
.ig-post { background: #000; color: #f5f5f5; border-radius: 18px; overflow: hidden; border: 1px solid var(--line2); }
.ig-post .h { display: flex; align-items: center; gap: 8px; padding: 10px 12px; font-size: 13px; font-weight: 700; }
.ig-post .m { aspect-ratio: 4/5; background: #111; display: grid; place-items: center; color: #555; overflow: hidden; }
.ig-post .m.story { aspect-ratio: 9/16; }
.ig-post .m img, .ig-post .m video { width: 100%; height: 100%; object-fit: cover; }
.ig-post .c { padding: 10px 12px 14px; font-size: 12.5px; white-space: pre-wrap; word-break: break-word; max-height: 160px; overflow: auto; }

/* tabelas */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; color: var(--faint); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }

/* gráficos */
.chart { position: relative; width: 100%; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .tip { position: absolute; pointer-events: none; background: var(--card2); border: 1px solid var(--line2); border-radius: 8px; padding: 6px 9px; font-size: 12px; white-space: nowrap; box-shadow: var(--shadow); transform: translate(-50%, -110%); display: none; z-index: 2; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 8px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* toast */
.toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--card2); border: 1px solid var(--line2); border-left: 3px solid var(--accent); padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow); font-size: 13px; max-width: 360px; animation: tin .2s ease-out; }
.toast.err { border-left-color: var(--err); }
.toast.ok { border-left-color: var(--ok); }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }

.skel { background: linear-gradient(90deg, var(--card2), var(--line), var(--card2)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 10px; }
@keyframes sk { to { background-position: -200% 0; } }
.spin { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: rot .7s linear infinite; display: inline-block; }
@keyframes rot { to { transform: rotate(360deg); } }

.alert { padding: 12px 14px; border-radius: 12px; background: var(--warn-soft); color: var(--warn); font-size: 13px; margin-bottom: 16px; border: 1px solid rgba(245,158,11,.25); }
.alert.info { background: var(--accent-soft); color: var(--text); border-color: rgba(124,108,255,.25); }
.copy-box { display: flex; gap: 8px; }
.copy-box .input { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }

/* página central (login / mensagens) */
.center-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 600px at 50% -10%, var(--accent-soft), transparent), var(--bg); }
.narrow { width: 100%; max-width: 400px; text-align: center; padding: 32px 28px; box-shadow: var(--shadow); }
.narrow h1 { margin: 10px 0 6px; }
.narrow .btn { width: 100%; height: 44px; margin-top: 18px; }
.narrow .field { text-align: left; }
.narrow .logo-xl { width: 54px; height: 54px; border-radius: 16px; background: var(--ig); margin: 0 auto; display: grid; place-items: center; color: #fff; }
.narrow .logo-xl svg { width: 30px; height: 30px; }

/* ---------- responsivo ---------- */
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; height: auto; min-height: 100vh; }
  /* no celular a navegação é a barra de abas inferior (ver "app iOS" abaixo) */
  .side, .topbar { display: none !important; }
  .main { overflow: visible; }
  .main-inner { padding: 18px 16px 50px; }
  .cols-2, .cols-3-1, .editor { grid-template-columns: 1fr; }
  .phone { position: static; }
  .auto-list { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .kpi .v { font-size: 20px; }
  .media-grid { grid-template-columns: repeat(2, 1fr); }
  .page-h .btn span.lbl { display: none; }
}
.alert svg { vertical-align: -3px; margin-right: 2px; }
.ig-post .m > svg, .empty > svg { width: 40px; height: 40px; opacity: .5; }
.phone-h svg { width: 15px; height: 15px; }
.ig-post { max-width: 360px; margin: 0 auto; }
.drop svg { display: block; }

/* ======================================================================
   PWA / app iOS — barra de título, abas inferiores, sheets e listas
   ====================================================================== */
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
button, a, label, .media, .list-row { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.navbar, .tabbar, .ptr { display: none; }
.seg-ios { display: contents; }
body.modal-open { overflow: hidden; }

.offline { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; align-items: center; gap: 6px;
  background: var(--card2); border: 1px solid rgba(245,158,11,.35); color: var(--warn); font-size: 12.5px; font-weight: 600;
  padding: 6px 12px; border-radius: 999px; box-shadow: var(--shadow); white-space: nowrap; }
.offline svg { width: 14px; height: 14px; }

/* listas agrupadas (Perfis, Ajustes) */
.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.list-h { font-size: 12.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 0 16px 7px; margin-top: 24px; }
.list-f { font-size: 12.5px; color: var(--faint); padding: 7px 16px 0; }
.list-row { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 50px; padding: 10px 14px;
  background: none; border: 0; color: var(--text); text-align: left; cursor: pointer; font-size: 15px; transition: background .15s; }
.list-row + .list-row::before { content: ""; position: absolute; top: 0; right: 0; left: 56px; border-top: 1px solid var(--line); }
.list.avatars .list-row + .list-row::before { left: 62px; }
.list-row:has(> .lr-b:first-child)::before { left: 16px; }
.list-row:not(div):hover { background: var(--card2); }
div.list-row { cursor: default; }
.list-row .lr-b { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.list-row .lr-b b { font-weight: 600; }
.list-row .lr-v { color: var(--muted); }
.list-row .chev { width: 18px; height: 18px; color: var(--faint); flex-shrink: 0; }
.list-row .ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: #fff; flex-shrink: 0; }
.list-row .ico svg { width: 17px; height: 17px; }
.list-row.acc { color: var(--accent); }
.list-row.danger { color: var(--err); justify-content: center; font-weight: 600; }
.install { margin-bottom: 6px; display: flex; flex-direction: column; gap: 6px; }
.install .btn { align-self: flex-start; margin-top: 6px; }
.ios-share svg { width: 15px; height: 15px; vertical-align: -2px; color: var(--accent); }

/* confirmação (alerta / action sheet) */
.sheet-bg { position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; padding: 20px; animation: fadein .2s; }
.action-sheet { width: 100%; max-width: 320px; display: flex; flex-direction: column; gap: 8px; }
.as-group { background: var(--card2); border-radius: 14px; overflow: hidden; text-align: center; }
.as-title { font-weight: 700; font-size: 14px; padding: 16px 16px 0; }
.as-msg { color: var(--muted); font-size: 13px; padding: 6px 18px 16px; }
.as-btn { display: block; width: 100%; background: var(--card2); border: 0; border-top: 1px solid var(--line2); padding: 14px; font-size: 16px; color: var(--accent); cursor: pointer; }
.as-btn:hover, .as-btn:active { background: var(--line); }
.as-btn.danger { color: var(--err); font-weight: 600; }
.as-cancel { border: 0; border-radius: 14px; font-weight: 700; }
.sheet-bg.closing { opacity: 0; transition: opacity .2s; }
@keyframes fadein { from { opacity: 0; } }
@keyframes sheetUp { from { transform: translateY(100%); } }
@keyframes tdown { from { transform: translateY(-16px); opacity: 0; } }

@media (max-width: 960px) {
  body { font-size: 15px; }
  .layout { display: block; min-height: 100dvh; }

  /* barra do topo translúcida com título pequeno que aparece ao rolar */
  .navbar { display: flex; align-items: center; position: fixed; top: 0; left: 0; right: 0; z-index: 35;
    height: calc(var(--nav-h) + var(--sat)); padding: var(--sat) calc(4px + var(--sar)) 0 calc(4px + var(--sal));
    background: var(--bg); background: var(--bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid transparent; transition: border-color .2s; }
  .navbar.collapsed { border-bottom-color: var(--line); }
  .nb-l, .nb-r { flex: 0 0 96px; display: flex; align-items: center; }
  .nb-r { justify-content: flex-end; }
  .nb-t { flex: 1; min-width: 0; text-align: center; font-weight: 650; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    opacity: 0; transition: opacity .18s; }
  .navbar.collapsed .nb-t { opacity: 1; }
  .nb-btn { display: inline-flex; align-items: center; gap: 1px; height: 44px; padding: 0 8px; border: 0; background: none; color: var(--accent);
    font-size: 17px; cursor: pointer; white-space: nowrap; }
  .nb-btn svg { width: 24px; height: 24px; stroke-width: 2.2; }
  .nb-btn span { overflow: hidden; text-overflow: ellipsis; }
  .nb-btn:active { opacity: .45; }

  /* abas inferiores */
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; height: calc(var(--tab-h) + var(--sab));
    padding: 0 var(--sar) var(--sab) var(--sal);
    background: var(--bg); background: var(--bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
    border-top: 1px solid var(--line); }
  .tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding-top: 2px;
    border: 0; background: none; color: var(--faint); font-size: 10.5px; font-weight: 600; cursor: pointer; }
  .tabbar button svg { width: 25px; height: 25px; stroke-width: 1.9; }
  .tabbar button.on { color: var(--accent); }
  .tabbar button:active { opacity: .6; }

  .main-inner { padding: calc(var(--nav-h) + var(--sat) + 2px) calc(16px + var(--sar)) calc(var(--tab-h) + var(--sab) + 28px) calc(16px + var(--sal)); }

  /* título grande */
  .page-h { gap: 12px; margin-bottom: 18px; }
  .page-h h1 { font-size: 32px; font-weight: 800; letter-spacing: -.025em; line-height: 1.15; }
  .page-h .t { min-width: 0; flex-basis: 0; }
  .page-h .t p { font-size: 13.5px; margin-top: 2px; }
  .page-h .avatar.lg { width: 58px; height: 58px; }
  /* cabeçalho do perfil: nome ao lado da foto, ações numa linha própria embaixo */
  .profile-h .t { flex: 1 1 calc(100% - 80px); }
  .profile-h h1 { font-size: 26px; }
  .profile-h > .btn { flex: 1; }
  .profile-h > .btn.icon { flex: 0 0 42px; }
  .profile-h .btn span.lbl { display: inline !important; }
  #pf-connect { display: none; } /* no celular o "+" fica na barra do topo */
  .auto-h h2 { flex-basis: 100%; }
  .auto-h .btn { flex: 1; }

  /* abas do perfil → controle segmentado fixo sob a barra */
  .tabs { position: sticky; top: calc(var(--nav-h) + var(--sat)); z-index: 20; margin: 0 calc(-16px - var(--sar)) 16px calc(-16px - var(--sal));
    padding: 6px calc(16px + var(--sar)) 10px calc(16px + var(--sal)); border: 0; overflow: visible;
    background: var(--bg); background: var(--bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); }
  .seg-ios { display: flex; width: 100%; padding: 2px; gap: 2px; border-radius: 9px; background: var(--card2); }
  .tabs button { flex: 1; margin: 0; padding: 7px 2px; border: 0; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--text); transition: background .2s; }
  .tabs button.on { background: var(--seg-on); border: 0; box-shadow: 0 1px 4px rgba(0,0,0,.22); }

  /* toque */
  .input, textarea.input, select.input { font-size: 16px; padding: 11px 12px; border-radius: 11px; }
  .btn { height: 42px; font-size: 15px; border-radius: 11px; }
  .btn.sm { height: 34px; font-size: 13px; }
  .btn.icon { width: 42px; }
  .btn.sm.icon { width: 34px; }
  .btn:active, .acc-card:active, .media:active, .list-row:not(div):active { transform: scale(.97); opacity: .8; }
  .acc-card:hover { transform: none; border-color: var(--line); }
  .list-row:not(div):hover { background: none; }
  .card { padding: 16px; }
  .kpi { padding: 12px 14px; }
  .media-grid { gap: 8px; }
  .drop { padding: 22px 14px; }
  .ig-post { max-width: 100%; }
  .seg { display: flex; width: 100%; }
  .seg button { flex: 1 1 auto; padding: 8px 10px; font-size: 13.5px; }
  .center-page { min-height: 100dvh; padding: calc(20px + var(--sat)) 20px calc(20px + var(--sab)); }

  /* modais → sheets que sobem de baixo e fecham arrastando */
  .modal-bg { align-items: flex-end; padding: 0; animation: fadein .25s; transition: background .25s; }
  .modal { height: calc(100dvh - var(--sat) - 10px); max-height: none; border-radius: 14px 14px 0 0; border-bottom: 0;
    animation: sheetUp .35s cubic-bezier(.2,.9,.25,1); transition: transform .25s cubic-bezier(.2,.9,.25,1); }
  .modal.sm { height: auto; max-height: calc(100dvh - var(--sat) - 10px); padding-bottom: var(--sab); }
  .modal-bg.closing { background: transparent; }
  .modal-bg.closing .modal { transform: translateY(105%) !important; }
  .modal-h { position: relative; padding: 24px 52px 12px; text-align: center; touch-action: none; }
  .modal-h::before { content: ""; position: absolute; top: 7px; left: 50%; width: 36px; height: 5px; margin-left: -18px; border-radius: 3px; background: var(--line2); }
  .modal-h h2 { font-size: 17px; }
  .modal-h [data-close] { position: absolute; right: 12px; top: 17px; width: 30px; height: 30px; border-radius: 50%; background: var(--card2); color: var(--muted); }
  .modal-h [data-close] svg { width: 15px; height: 15px; stroke-width: 2.6; }
  .modal-b { padding: 16px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  .modal-f { padding: 12px 16px calc(12px + var(--sab)); }
  .modal-f .btn { flex: 1; height: 48px; }

  /* confirmação vira action sheet */
  .sheet-bg { align-items: flex-end; padding: 0 8px calc(8px + var(--sab)); }
  .action-sheet { max-width: 520px; animation: sheetUp .3s cubic-bezier(.2,.9,.25,1); transition: transform .2s; }
  .as-btn { padding: 17px; font-size: 18px; }
  .sheet-bg.closing .action-sheet { transform: translateY(110%); }

  /* avisos no topo, como banners do iOS */
  .toasts { top: calc(var(--sat) + 8px); bottom: auto; left: 12px; right: 12px; align-items: center; }
  .toast { display: flex; align-items: center; gap: 9px; width: 100%; max-width: 420px; padding: 13px 16px; border: 0; border-radius: 16px;
    background: var(--card2); font-size: 14px; font-weight: 600; animation: tdown .3s ease-out; }
  .toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
  .toast.err::before { background: var(--err); }
  .toast.ok::before { background: var(--ok); }

  .offline { top: calc(var(--nav-h) + var(--sat) + 8px); }

  /* tabelas → linhas de lista */
  .table thead { display: none; }
  .table, .table tbody { display: block; }
  .table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
  .table tr:last-child { border-bottom: 0; }
  .table td { display: block; padding: 0; border: 0; max-width: none !important; }
  .table td.c-type, .table td.c-label { grid-row: 1; grid-column: 1; }
  .table td.c-status { grid-row: 1; grid-column: 2; justify-self: end; }
  .table td.c-cap, .table td.c-prof { grid-column: 1 / -1; }
  .table td.c-date { grid-column: 1; }
  .table td.c-act { grid-column: 2; }

  /* puxar para atualizar (app instalado) */
  html.standalone .ptr { display: grid; place-items: center; position: fixed; z-index: 34; top: calc(var(--nav-h) + var(--sat) - 40px); left: 50%;
    width: 36px; height: 36px; margin-left: -18px; border-radius: 50%; background: var(--card2); color: var(--muted); box-shadow: var(--shadow);
    opacity: 0; transition: transform .25s, opacity .25s; }
  .ptr .spin { animation-play-state: paused; }
  .ptr.ready { color: var(--accent); }
  .ptr.busy .spin { animation-play-state: running; }
}
