/* Shared shell and page layout. Loaded last so every page follows one set of rules. */

/* ---------- One page frame for every section ---------- */
.page-container { max-width: 1360px; margin-inline: auto; padding: 22px 32px; }
.page-container > .page { min-width: 0; }
.page-container .page-heading { align-items: flex-end; flex-wrap: wrap; gap: 14px 24px; margin: 0 0 18px; }
.page-container .page-heading > div { min-width: 0; }
.page-container .page-heading .eyebrow { margin: 0 0 6px; }
.page-container .page-heading h2 { margin: 0; font-size: 26px; font-weight: 700; line-height: 1.2; letter-spacing: -.6px; }
.page-container .page-heading > div > p:not(.eyebrow) { margin: 6px 0 0; font-size: 13px; line-height: 1.6; }
.page-container .page-note { margin: 14px 0 0; font-size: 12px; line-height: 1.6; }

/* ---------- Top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 8; height: 64px; padding-inline: 32px; backdrop-filter: blur(12px); }
.mode-pill.quiet, .mode-pill.quiet + #refresh-button { display: none; }
.account-button { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 4px 14px 4px 10px; border: 1px solid #b5835a66; border-radius: 999px; background: #2a2024; color: #f6e4d2; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.account-button:hover { border-color: #f0ad6b; background: #3a2922; }
.account-button svg, .person-avatar svg, .auth-wide svg { width: 20px; height: 20px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.person-avatar { display: grid; place-items: center; flex: 0 0 36px; width: 36px; height: 36px; border: 1px solid #c9905b80; border-radius: 50%; background: #3a2922; color: #ffd3a0; }

/* ---------- Sidebar account ---------- */
.sidebar .sidebar-footer { width: 100%; min-height: 62px; padding: 12px 0; border: 0; border-top: 1px solid var(--line-soft); background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.sidebar .sidebar-footer:hover .person-avatar { border-color: #ffc47b; }
.sidebar-identity { min-width: 0; }
.sidebar-identity :is(b, small) { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-more { margin-left: auto; color: #b9a89a; }

.account-menu { position: fixed; inset: auto; top: 58px; right: 24px; width: min(280px, calc(100vw - 24px)); margin: 0; padding: 8px; border: 1px solid #b5835a66; border-radius: 14px; background: #221b21; color: #f1e4d8; box-shadow: 0 22px 60px #000b; }
.account-menu:popover-open { display: grid; gap: 2px; }
.account-menu[data-anchor="sidebar"] { top: auto; right: auto; bottom: 74px; left: 14px; }
.account-menu-identity { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 8px 8px 12px; margin-bottom: 4px; border-bottom: 1px solid #ffffff14; }
.account-menu-identity > span:last-child { min-width: 0; }
.account-menu-identity :is(b, small) { display: block; overflow-wrap: anywhere; font-size: 13px; }
.account-menu-identity small { color: #bba99a; font-size: 11px; }
.account-menu > :is(a, button) { display: flex; align-items: center; width: 100%; min-height: 40px; padding: 8px 10px; border: 0; border-radius: 8px; background: none; color: #f1e4d8; font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.account-menu > :is(a, button)[hidden] { display: none; }
.account-menu > :is(a, button):is(:hover, :focus-visible) { background: #48302555; }
.account-menu > .account-menu-exit { color: #ffc08a; font-weight: 600; }

/* ---------- Log in / sign up ---------- */
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: 22px; padding: 4px; border: 1px solid #c9905b4d; border-radius: 11px; background: #100d12b3; }
.login-card .auth-tabs button { min-height: 40px; border: 0; border-radius: 8px; background: none; color: #cdbcae; font: inherit; font-size: 14px; font-weight: 650; cursor: pointer; }
.login-card .auth-tabs button[aria-selected="true"] { background: #70462b; color: #fff0e0; }
.auth-panel[hidden] { display: none; }
.login-card .auth-panel h2 { margin: 20px 0 16px; font-size: 21px; }
.login-card .auth-wide { display: flex; box-sizing: border-box; align-items: center; justify-content: center; width: 100%; min-height: 46px; margin-top: 10px; text-align: center; text-decoration: none; white-space: normal; }
.login-card .auth-hint { margin: 8px 0 0; color: #bfb0a5; font-size: 12px; line-height: 1.6; text-align: center; }
.login-card .login-divider { margin: 18px 0 4px; }
.login-card #connection-error:empty { display: none; }
.auth-steps { display: grid; gap: 12px; margin: 0 0 16px; padding: 0; list-style: none; counter-reset: step; }
.auth-steps li { position: relative; padding-left: 40px; counter-increment: step; }
.auth-steps li::before { content: counter(step); position: absolute; top: 1px; left: 0; display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid #c9905b80; border-radius: 50%; color: #ffd3a0; font-size: 12px; font-weight: 700; }
.auth-steps b { display: block; font-size: 13px; }
.auth-steps span { display: block; margin-top: 2px; color: #bfb0a5; font-size: 12px; line-height: 1.5; }

/* ---------- Campaigns ---------- */
.campaign-guide { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0 0 14px; padding: 0; list-style: none; }
.campaign-guide li { padding: 14px 16px; border: 1px solid #a8815038; border-radius: 12px; background: #201b20e6; }
.campaign-guide b { display: block; color: #f4c38d; font-size: 13px; }
.campaign-guide span { display: block; margin-top: 4px; color: #cdbcae; font-size: 12px; line-height: 1.6; }
.campaign-guide em { color: #f3e2d2; font-style: normal; font-weight: 600; }
#campaigns #campaign-list[data-collection-style="tiles"] { grid-auto-rows: 1fr; align-items: stretch; }
#campaigns #campaign-list[data-collection-style="tiles"] .campaign-card { height: 100%; align-self: stretch; }
#campaigns #campaign-list[data-collection-style="tiles"] .campaign-card p { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
#campaigns #campaign-list .card-actions { flex-wrap: wrap; margin-top: auto; }

/* ---------- Queue: every tile the same height; details live behind Open ---------- */
#queue #queue-list .queue-reason { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
#queue #queue-list[data-collection-style="tiles"] .queue-table tbody { grid-auto-rows: 1fr; align-items: stretch; }
#queue #queue-list[data-collection-style="tiles"] .queue-table tbody tr { grid-template-rows: auto auto 1fr; height: 100%; align-self: stretch; }
#queue #queue-list[data-collection-style="tiles"] .queue-table .post-cell b { min-height: 3em; }
#queue #queue-list[data-collection-style="tiles"] .queue-table .post-cell small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#queue #queue-list[data-collection-style="tiles"] .queue-table td:nth-child(2) { overflow: hidden; }
#queue #queue-list[data-collection-style="tiles"] .queue-table td:last-child { align-self: end; }

/* ---------- Channels: even tiles ---------- */
#channels #channel-list[data-collection-style="tiles"] { grid-auto-rows: 1fr; align-items: stretch; }
#channels #channel-list[data-collection-style="tiles"] .account-card { height: 100%; align-self: stretch; }

/* ---------- Utility panels ---------- */
#queue .receipt-list > [data-action="draft-recovery"] { justify-self: start; align-self: flex-start; width: auto; min-height: 36px; font-size: 12px; }
#queue .receipt-list { display: flex; flex-direction: column; align-items: stretch; gap: 10px; margin-top: 14px; }
.billing-card { display: grid; justify-items: start; gap: 12px; max-width: 640px; padding: 22px; }
.billing-card :is(h3, p) { margin: 0; }
.billing-card p { color: #cdbcae; font-size: 13px; line-height: 1.6; }
#team-panel .team-note { margin: 0; padding: 0 20px 18px; }

/* ---------- Tablet and phone ---------- */
@media (max-width: 800px) {
  .topbar { height: 60px; padding-inline: 16px; }
  .page-container { padding: 16px; }
  .campaign-guide { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .account-menu { top: 56px; right: 12px; }
  .settings-layout { grid-template-columns: minmax(0, 1fr); }
  .settings-nav { display: flex; gap: 6px; max-width: 100%; overflow-x: auto; padding-bottom: 4px; }
  .settings-nav button { flex: 0 0 auto; width: auto; white-space: nowrap; }
  #analytics .analytics-form { display: grid; grid-template-columns: minmax(0, 1fr); align-items: stretch; gap: 12px; }
}
@media (max-width: 580px) {
  .topbar { padding-inline: 12px; }
  .page-container { padding: 14px 12px; }
  .account-button { width: 44px; min-height: 44px; justify-content: center; padding: 0; }
  .account-button span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  #sidebar-toggle { width: 44px; height: 44px; }
  .page-container .page-heading { align-items: stretch; flex-direction: column; gap: 12px; margin-bottom: 14px; }
  .page-container .page-heading h2 { font-size: 22px; }
  .page-container .page-heading > .primary-button { width: 100%; min-height: 44px; }
}
@media (max-width: 1100px) {
  /* The form comes first; the artwork shrinks to a short masthead. */
  .login-gate { grid-template-columns: minmax(0, 1fr); align-content: start; background-position: center top; }
  .login-gate::before { background: linear-gradient(180deg, #09080a8c, #09080ad9 220px, #09080a 520px); }
  .login-art .login-scene, .login-art .login-statement > p, .login-art .login-pillars { display: none; }
  .login-art { align-items: center; gap: 16px; }
  .login-art .login-statement h1 { font-size: clamp(24px, 6.5vw, 36px); }
  .login-card > .brand { display: none; }
  .login-card .auth-tabs { margin-top: 0; }
}
@media (pointer: coarse) {
  .page-container :is(.primary-button, .secondary-button) { min-height: 44px; }
}
