:root{--bg:#f5f6f8;--surface:#fff;--ink:#17191e;--muted:#777c85;--line:#e7e9ed;--purple:#6b59e4;--green:#16865e;--green-soft:#e9f7f1;--red:#c74f58;--red-soft:#fff0f1;--sidebar:240px;font-family:"DM Sans","Noto Sans JP",sans-serif}
*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--ink);font-size:14px}button,input{font:inherit}button{color:inherit}
.sidebar{position:fixed;inset:0 auto 0 0;width:var(--sidebar);padding:28px 18px;background:#121318;color:#fff;display:flex;flex-direction:column;z-index:20}.brand{display:flex;align-items:center;gap:11px;padding:0 9px;color:#fff;text-decoration:none;font-size:18px;font-weight:700}.brand-mark{width:32px;height:32px;display:grid;place-items:center;border-radius:10px;background:linear-gradient(145deg,#8d7cf7,#5745d4)}.nav-label{margin:48px 12px 12px;color:#656873;font-size:9px;font-weight:700;letter-spacing:.16em}
.platform-nav{display:grid;gap:8px}.platform-button{width:100%;display:grid;grid-template-columns:38px 1fr;align-items:center;gap:10px;padding:12px;border:1px solid transparent;border-radius:12px;background:transparent;color:#91949d;text-align:left;cursor:pointer}.platform-button:hover,.platform-button.active{background:#25272e;color:#fff;border-color:#30323a}.platform-logo{width:36px;height:36px;display:grid;place-items:center;border-radius:10px;font-weight:700}.instagram-logo{background:linear-gradient(145deg,#fead5b,#b24fd5)}.threads-logo{background:#fff;color:#14151a}.meo-logo{background:linear-gradient(145deg,#4a8cf5,#35ad70)}.scheduler-logo{background:linear-gradient(145deg,#f2994a,#eb5757)}.platform-button strong,.platform-button small{display:block}.platform-button strong{font-size:13px}.platform-button small{margin-top:2px;color:#737680;font-size:9px}.source-card{margin-top:auto;display:flex;align-items:center;gap:10px;padding:14px;border:1px solid #2c2e36;border-radius:12px;background:#191a20}.status-dot{width:8px;height:8px;border-radius:50%;background:#45c98b;box-shadow:0 0 0 4px #45c98b16}.source-card strong,.source-card small{display:block}.source-card strong{font-size:10px}.source-card small{margin-top:4px;color:#747780;font-size:8px}
.main{margin-left:var(--sidebar);padding:36px 42px 60px}.topbar{display:flex;justify-content:space-between;align-items:center;gap:20px}.eyebrow,.section-label{margin:0 0 6px;color:#999da5;font-size:9px;font-weight:700;letter-spacing:.17em}h1,h2,p{margin-top:0}h1{margin-bottom:7px;font-size:28px;letter-spacing:-.04em}h2{margin-bottom:0;font-size:20px;letter-spacing:-.025em}.subtitle{margin:0;color:var(--muted)}.sync-actions{display:flex;align-items:center;gap:12px}.last-sync{text-align:right}.last-sync span,.last-sync strong{display:block}.last-sync span{color:#999da5;font-size:9px}.last-sync strong{margin-top:3px;font-size:10px}.refresh-button{padding:11px 15px;border:0;border-radius:9px;background:#202228;color:#fff;font-size:11px;font-weight:600;cursor:pointer}.refresh-button.loading span{display:inline-block;animation:spin .7s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}
.detail-panel{margin-top:28px;padding:22px;border:1px solid var(--line);border-radius:15px;background:#fff}.detail-head{display:flex;align-items:center;justify-content:space-between;gap:15px}.selected-account{display:flex;align-items:center;gap:13px}.selected-avatar{width:54px;height:54px;display:grid;place-items:center;border-radius:15px;background:linear-gradient(145deg,#7868e9,#4e3fc0);color:#fff;font-size:20px;font-weight:700;overflow:hidden}.selected-avatar img{width:100%;height:100%;object-fit:cover}.selected-avatar svg{width:56%;height:56%}.selected-avatar svg path{fill:#fff!important}.selected-label{color:#999da5;font-size:8px;letter-spacing:.08em}.selected-account h2{margin:2px 0 2px;font-size:21px}.selected-account p{margin:0;color:#888d95;font-size:10px}.api-status{padding:6px 9px;border-radius:6px;background:#f1f2f4;color:#70757d;font-size:9px}.api-status.connected{background:var(--green-soft);color:var(--green)}
.detail-metrics{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin-top:20px}.detail-metrics:empty{display:none;margin:0}.metric-card{padding:15px;border:1px solid #eceef1;border-radius:11px;background:#fafafb}.metric-card span,.metric-card small{display:block}.metric-card span{color:#858a92;font-size:9px}.metric-card strong{display:block;margin:9px 0 4px;font-size:22px;letter-spacing:-.04em}.metric-card small{color:#a0a4aa;font-size:8px}.metric-card .positive{color:var(--green)}.metric-card .negative{color:var(--red)}
.feed-store-name{font-size:11px;font-weight:800;color:var(--purple);letter-spacing:.02em}
.recent-heading{display:flex;align-items:end;justify-content:space-between;margin:23px 0 11px}.recent-heading h3{margin:0;font-size:14px}.recent-heading span{color:#999da5;font-size:9px}.recent-posts{display:grid;grid-template-columns:repeat(3,1fr);gap:9px}.recent-post{position:relative;min-height:170px;overflow:hidden;border-radius:10px;background:linear-gradient(145deg,#eff0f3,#dfe2e7);text-decoration:none}.recent-post .placeholder{position:absolute;inset:0;display:grid;place-items:center;color:#858a92;text-align:center;font-size:9px}.recent-post .placeholder b{display:block;margin-bottom:5px;font-size:22px}.recent-post-meta{position:absolute;inset:auto 7px 7px;padding:7px 8px;border-radius:7px;background:#15171ddb;color:#fff}.recent-post-meta strong,.recent-post-meta span{display:block}.recent-post-meta strong{font-size:14px}.recent-post-meta span{margin-top:2px;color:#c8cbd0;font-size:8px}.post-missing{display:grid;place-items:center;min-height:170px;border:1px dashed #d7dae0;border-radius:10px;color:#969aa2;text-align:center;font-size:9px;background:#fafafb}
.meo-panels{display:grid;grid-template-columns:1.1fr .9fr;gap:10px;margin-top:20px}.mini-panel{padding:16px;border:1px solid #eceef1;border-radius:11px}.mini-panel h3{margin:0 0 12px;font-size:13px}.sparkline{display:flex;align-items:end;gap:7px;height:90px}.spark-bar{flex:1;border-radius:4px 4px 0 0;background:#6b59e4;opacity:.85}.empty-chart{height:90px;display:grid;place-items:center;border:1px dashed #d9dce1;border-radius:8px;color:#969aa2;font-size:9px}.keyword-table{width:100%;border-collapse:collapse}.keyword-table th,.keyword-table td{padding:9px 7px;border-bottom:1px solid #eef0f2;text-align:left;font-size:9px}.keyword-table th{color:#92969e;font-weight:500}.keyword-table td:last-child{text-align:right}.rank-pending{color:#9a9ea5}
.review-list{display:flex;flex-direction:column;gap:10px;max-height:280px;overflow-y:auto;}
.review-card{padding:11px 12px;border:1px solid #eef0f2;border-radius:10px;background:#fafbfc;}
.review-head{display:flex;justify-content:space-between;align-items:center;font-size:12px;margin-bottom:6px;}
.review-card p{margin:0 0 6px;font-size:12px;line-height:1.5;white-space:pre-wrap;}
.review-card small{color:#9a9ea5;font-size:10px;}
.google-connect-panel{margin-top:16px;padding:16px;border:1px solid #eceef1;border-radius:11px;display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;}
.google-connect-panel p{margin:0;color:#70757d;font-size:12px;}
.google-connect-panel button{border:0;border-radius:10px;background:#151821;color:#fff;font-weight:800;padding:10px 16px;cursor:pointer;white-space:nowrap;}
.section-toolbar{display:flex;justify-content:space-between;align-items:end;gap:18px;margin:30px 0 13px}.section-toolbar h2{font-size:18px}.list-tools{display:flex;align-items:center;gap:12px}.search-box{display:flex;align-items:center;gap:8px;width:270px;padding:0 12px;border:1px solid var(--line);border-radius:9px;background:#fff;color:#9ca0a7}.search-box input{width:100%;height:40px;border:0;outline:0;background:transparent;font-size:11px}.result-count{color:#92969e;font-size:10px}
.store-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}.store-card{width:100%;display:flex;align-items:center;gap:12px;padding:15px;border:1px solid var(--line);border-radius:12px;background:#fff;text-align:left;cursor:pointer;transition:.18s}.store-card:hover{transform:translateY(-1px);border-color:#c9c4ee;box-shadow:0 7px 20px #33364a0b}.store-card.active{border-color:#6b59e4;box-shadow:inset 0 0 0 1px #6b59e4}.store-avatar{width:42px;height:42px;flex:0 0 auto;display:grid;place-items:center;border-radius:12px;background:#ededf0;color:#686d75;font-weight:700}.store-copy{min-width:0;flex:1}.store-copy strong{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px}.store-copy span{display:block;margin-top:3px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#9599a1;font-size:9px}.store-arrow{color:#a3a6ad}.toast{position:fixed;right:25px;bottom:25px;z-index:40;padding:12px 16px;border-radius:9px;background:#202228;color:#fff;font-size:10px;opacity:0;transform:translateY(10px);transition:.2s}.toast.show{opacity:1;transform:none}
@media(max-width:1050px){:root{--sidebar:82px}.brand>span:last-child,.platform-button>span:last-child,.nav-label,.source-card{display:none}.platform-button{display:flex;justify-content:center}.store-grid{grid-template-columns:repeat(2,1fr)}.detail-metrics{grid-template-columns:repeat(2,1fr)}}@media(max-width:700px){:root{--sidebar:0px}.sidebar{position:sticky;top:0;width:100%;height:auto;padding:8px 10px}.sidebar .brand,.sidebar .nav-label,.sidebar .source-card{display:none}.platform-nav{grid-template-columns:repeat(3,1fr)}.platform-button{display:flex;justify-content:center;padding:6px}.platform-button>span:last-child{display:block}.platform-logo{width:29px;height:29px}.main{margin:0;padding:22px 15px 50px}.topbar,.section-toolbar{align-items:flex-start;flex-direction:column}.sync-actions{width:100%;justify-content:space-between}.detail-metrics,.store-grid,.recent-posts,.meo-panels{grid-template-columns:1fr}.list-tools,.search-box{width:100%}}

/* Readability and unified store dashboard */
:root{--sidebar:260px;--muted:#686e77;--line:#e3e5e9}
body{font-size:16px}
.brand{font-size:17px;line-height:1.25}.brand-mark{width:42px;height:42px;font-size:14px}.nav-label{font-size:11px}
.stores-logo{background:linear-gradient(145deg,#8070eb,#5544c6)}
.platform-logo{width:40px;height:40px}.platform-button strong{font-size:15px}.platform-button small{font-size:11px}.source-card strong{font-size:12px}.source-card small{font-size:10px}
.main{padding:38px 44px 65px}.eyebrow,.section-label{font-size:11px}h1{font-size:32px}h2{font-size:23px}.subtitle{font-size:15px}
.last-sync span{font-size:11px}.last-sync strong{font-size:12px}.refresh-button{font-size:13px}
.selected-avatar{width:62px;height:62px;font-size:23px}.selected-label{font-size:11px}.selected-account h2{font-size:25px}.selected-account p{font-size:13px}
.detail-actions{display:flex;align-items:center;gap:9px}.icon-change-button{padding:8px 11px;border:1px solid var(--line);border-radius:7px;background:#fff;font-size:12px;cursor:pointer}.api-status{font-size:11px}
.metric-card span{font-size:12px}.metric-card strong{font-size:26px}.metric-card small{font-size:11px}
.section-toolbar h2{font-size:22px}.search-box input{height:44px;font-size:14px}.result-count{font-size:12px}
.store-avatar{overflow:hidden}.store-avatar img{width:100%;height:100%;object-fit:cover}.store-copy strong{font-size:17px}.store-copy span{font-size:12px}
.combined-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:11px;margin-top:20px}.channel-card{padding:18px;border:1px solid #e7e9ed;border-radius:12px;background:#fafafb}.channel-title{display:flex;align-items:center;gap:9px;margin-bottom:15px}.channel-title i{width:29px;height:29px;display:grid;place-items:center;border-radius:8px;background:#eeeafc;font-style:normal;font-weight:700}.channel-title strong{font-size:16px}.channel-stats{display:grid;gap:10px}.channel-stat{display:flex;justify-content:space-between;gap:12px;padding-top:9px;border-top:1px solid #e7e9ed}.channel-stat span{color:#777d86;font-size:12px}.channel-stat strong{font-size:15px}.channel-note{margin:13px 0 0;color:#92979f;font-size:11px}
@media(max-width:1050px){.combined-grid{grid-template-columns:1fr}}
@media(max-width:700px){.platform-nav{grid-template-columns:repeat(4,1fr)}.platform-button>span:last-child{display:none}.detail-head{align-items:flex-start;flex-direction:column}.detail-actions{width:100%;justify-content:space-between}.combined-grid{grid-template-columns:1fr}}


/* Threads API live cards */
.threads-api-box{margin-top:22px;padding:18px;border:1px solid #dfe5f4;border-radius:14px;background:#f7f9ff;display:grid;gap:12px}
.threads-api-box strong{font-size:17px}.threads-api-box p{margin:6px 0 0;color:#6c7280;font-size:13px}.threads-api-box textarea{width:100%;min-height:74px;padding:12px;border:1px solid #ccd5e8;border-radius:10px;font-size:13px;resize:vertical}.threads-api-actions{display:flex;gap:10px;flex-wrap:wrap}.threads-api-actions button{padding:10px 14px;border:0;border-radius:999px;background:#202228;color:#fff;font-weight:700;cursor:pointer}.threads-api-actions button:first-child{background:#edf2ff;color:#2545a8}.threads-live-posts{display:grid;grid-template-columns:repeat(3,1fr);gap:12px}.threads-live-post{min-height:230px;padding:16px;border:1px solid #e3e6ee;border-radius:14px;background:#fff;display:flex;flex-direction:column;gap:13px}.threads-post-top,.threads-post-foot{display:flex;justify-content:space-between;gap:12px;align-items:center}.threads-post-top span{color:#858b96;font-size:12px}.threads-post-top strong{font-size:20px}.threads-post-text{flex:1;margin:0;white-space:pre-wrap;line-height:1.65;font-size:14px;color:#252a33}.threads-post-stats{display:flex;flex-wrap:wrap;gap:7px}.threads-post-stats span{padding:5px 8px;border-radius:999px;background:#f1f3f7;color:#5e6570;font-size:12px}.threads-post-foot small{color:#8a909a;font-size:11px}.threads-post-foot a{color:#5544c6;font-weight:700;text-decoration:none}
@media(max-width:900px){.threads-live-posts{grid-template-columns:1fr}}


/* Instagram API live cards */
.instagram-live-posts{display:grid;grid-template-columns:1fr;gap:13px}.instagram-live-post{display:grid;grid-template-columns:220px 1fr;gap:16px;padding:16px;border:1px solid #e3e6ee;border-radius:15px;background:#fff}.instagram-thumb{min-height:220px;border-radius:13px;overflow:hidden;background:linear-gradient(145deg,#f4d1ff,#ffe2bd);display:grid;place-items:center;color:#6f566f;text-decoration:none;font-weight:800}.instagram-thumb img{width:100%;height:100%;object-fit:cover}.instagram-live-body{display:flex;flex-direction:column;gap:12px;min-width:0}.instagram-api-box{background:#fff7fb;border-color:#f0d9e7}
@media(max-width:850px){.instagram-live-post{grid-template-columns:1fr}.instagram-thumb{min-height:260px}}

.instagram-thumb.thumb-error::after{content:"サムネ取得待ち";font-size:16px;color:#6f566f}.selected-avatar img,.store-avatar img{background:#edeff4}


/* Instagram media aspect ratio tuning */
.instagram-live-post{grid-template-columns:minmax(170px,240px) 1fr;align-items:start}
.instagram-thumb{width:100%;height:auto;min-height:0!important;aspect-ratio:9/16;border-radius:16px;background:#f5d4f4;align-self:start}
.instagram-thumb.is-image{aspect-ratio:4/5}
.instagram-thumb.is-reel{aspect-ratio:9/16}
.instagram-thumb img{width:100%;height:100%;object-fit:cover;display:block}
@media(max-width:850px){.instagram-live-post{grid-template-columns:1fr}.instagram-thumb{max-width:360px;margin:0 auto}.instagram-thumb.is-image{aspect-ratio:4/5}.instagram-thumb.is-reel{aspect-ratio:9/16}}


/* Connected API note / hidden token UI */
.api-connected-note{margin-top:22px;padding:14px 16px;border:1px solid #d6ecd9;background:#f0fbf2;border-radius:14px;display:flex;gap:10px;align-items:center;flex-wrap:wrap}.api-connected-note strong{color:#16865e}.api-connected-note span{color:#617067;font-size:13px}.instagram-api-box,.threads-api-box{display:none}


/* Compact readable post cards */
.api-connected-note{margin-top:16px!important;padding:10px 12px!important;border-radius:10px!important;background:#f7faf7!important;border-color:#e4efe6!important;font-size:12px!important;opacity:.82}
.api-connected-note strong{font-size:12px!important}.api-connected-note span{font-size:11px!important;color:#7b857d!important}
.instagram-live-posts{gap:12px!important}.instagram-live-post{grid-template-columns:180px minmax(0,1fr)!important;min-height:0!important;padding:14px!important;align-items:stretch!important}.instagram-thumb{max-height:320px!important}.instagram-thumb.is-image{aspect-ratio:4/5!important}.instagram-thumb.is-reel{aspect-ratio:9/16!important}.instagram-live-body{min-height:0!important;gap:9px!important}.threads-post-top strong{font-size:19px!important}.threads-post-top span{font-size:11px!important}.threads-post-text{max-height:150px!important;overflow:auto!important;padding:10px 12px!important;border-radius:10px!important;background:#fafafb!important;border:1px solid #eef0f4!important;font-size:13px!important;line-height:1.65!important;white-space:pre-wrap!important}.threads-post-text::-webkit-scrollbar{width:7px}.threads-post-text::-webkit-scrollbar-thumb{background:#d6dae2;border-radius:999px}.threads-post-stats{gap:6px!important}.threads-post-stats span{font-size:11px!important;padding:5px 8px!important}.threads-post-foot{margin-top:auto!important}.threads-post-foot small{font-size:10px!important}.threads-post-foot a{font-size:13px!important}.threads-live-post{min-height:250px!important}.threads-live-post .threads-post-text{max-height:120px!important}
@media(max-width:900px){.instagram-live-post{grid-template-columns:140px minmax(0,1fr)!important}.instagram-thumb{max-height:250px!important}.threads-post-text{max-height:130px!important}.instagram-live-posts{gap:10px!important}}
@media(max-width:640px){.main{padding:18px 12px 48px!important}.detail-panel{padding:16px!important}.instagram-live-post{grid-template-columns:1fr!important}.instagram-thumb{width:100%!important;max-width:260px!important;max-height:none!important;margin:0 auto!important}.instagram-thumb.is-image{aspect-ratio:4/5!important}.instagram-thumb.is-reel{aspect-ratio:9/16!important}.threads-post-text{max-height:150px!important}.threads-post-top{align-items:flex-start!important}.threads-post-top strong{font-size:18px!important}.api-connected-note{display:none!important}.metric-card strong{font-size:22px!important}.store-grid{grid-template-columns:1fr!important}}


/* Five metric cards support */
.detail-metrics{grid-template-columns:repeat(auto-fit,minmax(180px,1fr))!important}


/* Dropdown store selector and no bottom card list */
.compact-tools{align-items:end;gap:12px;flex-wrap:wrap}.select-box{display:grid;gap:6px;min-width:260px}.select-box span{color:#858b96;font-size:12px;font-weight:700}.select-box select{height:46px;border:1px solid var(--line);border-radius:12px;background:#fff;padding:0 14px;font-size:15px;font-weight:700;color:#20242b}.store-grid:empty{display:none}.section-toolbar{margin-bottom:20px}.recent-posts{grid-template-columns:repeat(3,1fr)}.instagram-live-posts{display:grid;grid-template-columns:1fr}.threads-live-posts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}@media(max-width:900px){.select-box{width:100%;min-width:0}.recent-posts,.threads-live-posts{grid-template-columns:1fr}.compact-tools{width:100%}}


/* Put controls first and make selection UI primary */
.section-toolbar{margin:24px 0 18px;background:#fff;border:1px solid #e4e7ee;border-radius:16px;padding:18px 20px;align-items:center}.section-toolbar h2{font-size:24px}.compact-tools{justify-content:flex-end}.select-box select{min-width:280px}.post-missing{min-height:210px;font-size:13px;background:#fff;border-style:solid;color:#8f96a3}
@media(max-width:700px){.section-toolbar{padding:14px}.select-box select{min-width:0;width:100%}.compact-tools{align-items:stretch}.post-missing{min-height:120px}}


/* UI polish: primary controls at top + compact post reading */
.app-header-sticky{
  position: sticky;
  top: 0;
  z-index: 15;
  background: var(--bg);
  margin: -36px -42px 0;
  padding: 36px 42px 0;
}
@media(max-width:700px){
  .app-header-sticky{position:static;margin:0;padding:0;}
  .topbar{position:sticky;top:0;z-index:15;background:var(--bg);padding-bottom:10px;}
  .section-toolbar{position:static;}
}
.section-toolbar{
  background: rgba(246,247,251,.94);
  backdrop-filter: blur(12px);
  border: 1px solid #e5e7eb;
  box-shadow: 0 12px 28px rgba(15,23,42,.06);
  margin-bottom: 18px;
}
.compact-tools{
  width: 100%;
  display: grid;
  grid-template-columns: minmax(280px, 1.4fr) minmax(180px, .7fr) auto;
  gap: 14px;
  align-items: end;
}
.select-box span{
  display:block;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .08em;
  color: #7b8190;
  margin: 0 0 7px;
}
.select-box select{
  width:100%;
  height:56px;
  border:1px solid #d8dce5;
  border-radius:18px;
  padding:0 48px 0 18px;
  background:#fff;
  color:#151821;
  font-size:20px;
  font-weight:900;
  box-shadow:0 8px 18px rgba(15,23,42,.04);
}
.result-count{
  height:56px;
  display:flex;
  align-items:center;
  color:#858b98;
  font-weight:800;
  white-space:nowrap;
}
.store-grid{display:none;}
.instagram-live-posts,.threads-live-posts{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:18px;
}
.instagram-live-post,.threads-live-post{min-height:0;align-items:stretch;}
.instagram-live-post{
  display:grid;
  grid-template-columns:180px minmax(0,1fr);
  gap:18px;
}
.instagram-thumb{
  width:180px;
  align-self:start;
  aspect-ratio:9/16;
  border-radius:22px;
  overflow:hidden;
  background:linear-gradient(135deg,#f4d5ff,#ffdcb8);
}
.instagram-thumb.is-image{aspect-ratio:4/5;}
.instagram-thumb img{width:100%;height:100%;object-fit:cover;display:block;}
.instagram-live-body{min-width:0;display:flex;flex-direction:column;gap:12px;}
.threads-post-text{
  max-height:148px;
  overflow:auto;
  padding-right:8px;
  line-height:1.72;
  white-space:pre-wrap;
}
.threads-post-text::-webkit-scrollbar{width:8px;}
.threads-post-text::-webkit-scrollbar-thumb{background:#d9dde7;border-radius:999px;}
.post-missing{
  min-height:180px;
  border:1px dashed #d8dce5;
  border-radius:24px;
  display:flex;
  align-items:center;
  justify-content:center;
  text-align:center;
  color:#9aa0ad;
  font-weight:900;
  background:#fafafa;
}
@media (max-width: 980px){
  .compact-tools{grid-template-columns:1fr;}
  .result-count{height:auto;}
  .instagram-live-posts,.threads-live-posts{grid-template-columns:1fr;}
  .instagram-live-post{grid-template-columns:132px minmax(0,1fr);}
  .instagram-thumb{width:132px;border-radius:18px;}
  .select-box select{font-size:18px;}
}
@media (max-width: 640px){
  .section-toolbar{position:static;}
  .instagram-live-post{grid-template-columns:1fr;}
  .instagram-thumb{width:100%;max-width:220px;}
  .threads-post-text{max-height:132px;}
}


/* Compact UI pass: reduce oversized controls and whitespace */
.main{padding-top:28px;}
.page-header{margin-bottom:18px;}
.page-header h1{font-size:34px;line-height:1.1;}
.page-header p{font-size:16px;}
.section-toolbar{padding:14px 16px;margin-bottom:14px;border-radius:22px;}
.compact-tools{grid-template-columns:minmax(240px,1.1fr) minmax(150px,.55fr) auto;gap:10px;}
.select-box span{font-size:11px;margin-bottom:5px;letter-spacing:.06em;}
.select-box select{height:44px;border-radius:14px;font-size:15px;font-weight:800;padding-left:14px;}
.result-count{height:44px;font-size:13px;}
.detail-panel{padding:22px;border-radius:26px;}
.selected-store{gap:12px;margin-bottom:18px;}
.selected-avatar{width:62px;height:62px;border-radius:18px;font-size:24px;}
.selected-copy h2{font-size:26px;}
.selected-copy p{font-size:14px;}
.metrics-grid{gap:12px;margin-bottom:18px;}
.metric-card{padding:16px;border-radius:18px;min-height:112px;}
.metric-card span{font-size:13px;}
.metric-card strong{font-size:28px;}
.metric-card small{font-size:12px;}
.recent-heading{margin:8px 0 12px;}
.recent-heading h3{font-size:18px;}
.instagram-live-posts,.threads-live-posts{gap:12px;}
.instagram-live-post{grid-template-columns:132px minmax(0,1fr);gap:12px;padding:14px;border-radius:20px;}
.instagram-thumb{width:132px;border-radius:16px;}
.threads-post-top span{font-size:12px;}
.threads-post-top strong{font-size:20px;}
.threads-post-text{max-height:116px;font-size:14px;line-height:1.6;}
.threads-post-stats{gap:6px;}
.threads-post-stats span{font-size:12px;padding:6px 9px;}
.threads-post-foot small,.threads-post-foot a{font-size:13px;}
.api-connected-note.compact-status{padding:10px 12px;border-radius:14px;margin-bottom:10px;}
.post-missing{min-height:132px;border-radius:18px;font-size:13px;}
@media(max-width:980px){.compact-tools{grid-template-columns:1fr 1fr}.result-count{grid-column:1/-1;height:auto}.instagram-live-posts,.threads-live-posts{grid-template-columns:1fr}.instagram-live-post{grid-template-columns:120px minmax(0,1fr)}.instagram-thumb{width:120px}}
@media(max-width:640px){.main{padding:18px 14px}.page-header h1{font-size:28px}.compact-tools{grid-template-columns:1fr}.detail-panel{padding:16px}.instagram-live-post{grid-template-columns:1fr}.instagram-thumb{width:100%;max-width:170px}.threads-post-text{max-height:120px}}


/* Brand logo + simplified headings */
.brand-mark,.logo-mark,.app-logo,.sidebar-logo-icon{overflow:hidden;background:#fff;color:transparent;}
.brand-mark::before,.logo-mark::before,.app-logo::before,.sidebar-logo-icon::before{content:"";display:block;width:100%;height:100%;background:url("assets/rogo.jpg") center/cover no-repeat;}
.brand-mark img,.logo-mark img,.app-logo img,.sidebar-logo-icon img{width:100%;height:100%;object-fit:cover;display:block;}
#platformEyebrow:empty,#pageSubtitle:empty,#listLabel:empty,#selectedHandle:empty{display:none;}
.page-header{margin-bottom:12px;}
.page-header h1{margin-top:0;}
.threads-as-instagram .threads-thumb.no-media{background:#111;color:#fff;display:flex;align-items:center;justify-content:center;font-size:42px;font-weight:900;}
.threads-as-instagram .threads-thumb.no-media span{display:block;}
.instagram-live-posts{align-items:start;}


/* Engagement panels and sorting */
.engagement-panel{margin-top:16px;border:1px solid #e7e9f0;border-radius:20px;background:#fff;padding:16px;}
.engagement-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px;}
.engagement-head h3{font-size:18px;margin:0;}
.engagement-head span{font-size:13px;color:#858b98;font-weight:800;}
.comment-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;}
.comment-row{border:1px solid #edf0f5;border-radius:14px;padding:12px;background:#fafbfc;}
.comment-row strong{display:block;font-size:13px;margin-bottom:5px;}
.comment-row p{font-size:14px;line-height:1.55;margin:0 0 8px;white-space:pre-wrap;}
.comment-row small,.empty-note{font-size:13px;color:#858b98;line-height:1.6;}
@media(max-width:980px){.comment-list{grid-template-columns:1fr}.compact-tools{grid-template-columns:1fr 1fr}.compact-tools .result-count{grid-column:1/-1}}
@media(max-width:640px){.compact-tools{grid-template-columns:1fr}}


/* Threads text-first layout */
.threads-text-posts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;align-items:start;}
.threads-text-card{border:1px solid #e7e9f0;border-radius:20px;background:#fff;padding:16px;box-shadow:0 10px 24px rgba(15,23,42,.04);}
.threads-text-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:10px;}
.threads-text-head span{font-size:12px;color:#858b98;font-weight:900;letter-spacing:.04em;}
.threads-text-head strong{font-size:20px;font-weight:900;color:#151821;white-space:nowrap;}
.threads-full-text{font-size:15px;line-height:1.75;white-space:pre-wrap;margin:0 0 14px;color:#222631;max-height:260px;overflow:auto;padding-right:8px;}
.threads-full-text::-webkit-scrollbar{width:8px;}
.threads-full-text::-webkit-scrollbar-thumb{background:#d9dde7;border-radius:999px;}
@media(max-width:980px){.threads-text-posts{grid-template-columns:1fr}.threads-full-text{max-height:240px}}


/* Compact post area: keep comments reachable */
.instagram-live-posts,
.threads-text-posts{
  max-height: 560px;
  overflow-y: auto;
  padding-right: 8px;
  scroll-behavior: smooth;
}
.instagram-live-posts::-webkit-scrollbar,
.threads-text-posts::-webkit-scrollbar{width:9px;}
.instagram-live-posts::-webkit-scrollbar-thumb,
.threads-text-posts::-webkit-scrollbar-thumb{background:#cfd4df;border-radius:999px;}
.recent-heading{position:sticky;top:0;background:#fff;z-index:2;padding:6px 0 10px;margin-top:0;}
.comments-panel{margin-top:18px;}
.compact-comment-list{max-height:340px;overflow-y:auto;padding-right:6px;}
.compact-comment-list::-webkit-scrollbar{width:8px;}
.compact-comment-list::-webkit-scrollbar-thumb{background:#d9dde7;border-radius:999px;}
@media(max-width:980px){.instagram-live-posts,.threads-text-posts{max-height:620px;}}


/* Updated brand crop, scheduler, and hidden sync text */
.brand-mark,.logo-mark,.app-logo,.sidebar-logo-icon{background:#fff!important;color:transparent!important;}
.brand-mark::before,.logo-mark::before,.app-logo::before,.sidebar-logo-icon::before{background-image:url("assets/brand-logo.png")!important;background-size:135%!important;background-position:center!important;background-repeat:no-repeat!important;}
.sync-info,.last-sync,#lastSync,#lastSyncLabel{display:none!important;}
.scheduler-panel{margin-top:16px;border:1px solid #e7e9f0;border-radius:20px;background:#fff;padding:16px;}
.scheduler-form{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;}
.scheduler-form label{display:flex;flex-direction:column;gap:6px;font-size:12px;font-weight:900;color:#858b98;}
.scheduler-form input,.scheduler-form select,.scheduler-form textarea{border:1px solid #d8dce5;border-radius:12px;padding:11px 12px;font:inherit;color:#151821;background:#fff;}
.scheduler-form textarea{min-height:88px;resize:vertical;}
.scheduler-form .wide{grid-column:span 2;}
.scheduler-form button{border:0;border-radius:14px;background:#151821;color:#fff;font-weight:900;padding:12px 16px;align-self:end;cursor:pointer;}
.schedule-submit-row{display:flex;gap:10px;flex-wrap:wrap;}
.schedule-submit-row button{align-self:auto;}
#runNowScheduleButton{background:#c74f58;}
.schedule-list-head{display:flex;justify-content:flex-end;margin-top:18px;}
.schedule-list-head .select-box{min-width:200px;}
.schedule-table-wrap{margin-top:10px;overflow-x:auto;border:1px solid #edf0f5;border-radius:14px;}
.schedule-table{width:100%;border-collapse:collapse;font-size:13px;}
.schedule-table th{text-align:left;padding:10px 12px;background:#f7f8fb;color:#737985;font-weight:800;font-size:12px;white-space:nowrap;position:sticky;top:0;}
.schedule-table td{padding:10px 12px;border-top:1px solid #edf0f5;vertical-align:top;}
.schedule-table tr:nth-child(even) td{background:#fafbfc;}
.schedule-datetime-cell{white-space:nowrap;font-weight:700;}
.schedule-caption-cell{max-width:340px;line-height:1.5;}
.schedule-caption-scroll{max-height:4.5em;overflow-y:auto;white-space:pre-wrap;-webkit-mask-image:linear-gradient(to bottom,#000 calc(100% - 14px),transparent 100%);mask-image:linear-gradient(to bottom,#000 calc(100% - 14px),transparent 100%);}
.schedule-error{color:var(--red);}
.schedule-note{color:#8a6d00;}
.schedule-actions-cell{white-space:nowrap;}
.schedule-actions-cell button{border:1px solid #e1e5ee;background:#fff;border-radius:10px;padding:6px 10px;font-weight:800;cursor:pointer;}
.schedule-actions-cell button+button{margin-left:6px;}
.status-pill{display:inline-flex;align-items:center;gap:4px;padding:4px 9px;border-radius:999px;font-size:12px;font-weight:800;white-space:nowrap;}
.status-pill.status-scheduled{background:#eef0f4;color:#575c66;}
.status-pill.status-posting{background:#fff3d6;color:#9a6b00;}
.status-pill.status-processing{background:#e4eefc;color:#1f5aa8;}
.status-pill.status-posted{background:var(--green-soft);color:var(--green);}
.status-pill.status-error{background:var(--red-soft);color:var(--red);}
@media(max-width:980px){.scheduler-form{grid-template-columns:1fr 1fr}.scheduler-form .wide{grid-column:1/-1}}
@media(max-width:640px){.schedule-caption-cell{max-width:180px;}}
@media(max-width:640px){.scheduler-form{grid-template-columns:1fr}}
.scheduler-form input[type="file"]{padding:8px;font-size:13px;}
.upload-note{margin-top:4px;color:#858b98;font-size:11px;}
.scheduler-target{display:flex;flex-wrap:wrap;align-items:end;gap:16px;margin-top:16px;padding:16px;border:1px solid #e7e9f0;border-radius:20px;background:#fff;}
.platform-toggle{display:flex;gap:8px;}
.platform-toggle button{border:1px solid #d8dce5;background:#fff;color:#151821;border-radius:12px;padding:11px 18px;font-weight:800;cursor:pointer;}
.platform-toggle button.active{background:#151821;color:#fff;border-color:#151821;}
.scheduler-target .select-box{min-width:220px;flex:1;}
@media(max-width:640px){
  .scheduler-target{flex-direction:column;align-items:stretch;padding:14px;}
  .platform-toggle button{flex:1;}
  .scheduler-target .select-box{min-width:0;width:100%;}
  .scheduler-panel{padding:14px;}
  .scheduled-list article{overflow-wrap:anywhere;}
  .scheduled-list article button{width:100%;margin:6px 0 0!important;}
}


/* Final logo crop fix and schedule button states */
.brand-mark::before,.logo-mark::before,.app-logo::before,.sidebar-logo-icon::before{background-image:url("assets/brand-logo.png")!important;background-size:160%!important;background-position:center 48%!important;}
.scheduled-list article button + button{margin-left:6px;}


/* Remove PC logo mark and show API update result */
.text-only-brand{display:block;color:#fff;font-weight:900;font-size:23px;line-height:1.15;text-decoration:none;padding:4px 0 22px 0;}
.brand-mark{display:none!important;}
.platform-button small:empty{display:none;}
.update-status{font-size:12px;font-weight:900;margin-top:8px;text-align:right;max-width:260px;color:#858b98;}
.update-status[data-type="success"]{color:#12a56b;}
.update-status[data-type="error"]{color:#d14b5b;}
.update-status[data-type="loading"]{color:#4b63d1;}


/* === 2026-07-09 mobile/social comparison fixes === */
.compare-panel{margin-top:16px;padding:16px;border:1px solid #e4e7ee;border-radius:20px;background:#fff;}
.compare-table-wrap{width:100%;overflow:auto;border:1px solid #edf0f5;border-radius:14px;}
.compare-table{width:100%;border-collapse:collapse;min-width:780px;background:#fff;}
.compare-table th,.compare-table td{padding:12px 14px;border-bottom:1px solid #edf0f5;text-align:left;font-size:13px;vertical-align:top;}
.compare-table th{position:sticky;top:0;background:#f7f8fb;color:#737985;font-size:12px;z-index:1;}
.account-compare-name{display:grid;gap:3px;border:0;background:transparent;text-align:left;cursor:pointer;color:#171a20;padding:0;font:inherit;}
.account-compare-name strong{font-size:14px;line-height:1.25;}
.account-compare-name span{font-size:11px;color:#8a9099;}
.compare-post-text{max-width:340px;line-height:1.55;}
.compare-post-text a{color:#4f46e5;text-decoration:none;}
.compare-rank-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;}
.compare-rank-card{padding:13px;border:1px solid #edf0f5;border-radius:14px;background:#fbfcff;display:grid;gap:7px;}
.compare-rank-card span{font-size:12px;color:#7b828d;font-weight:700;}
.compare-rank-card strong{font-size:18px;color:#171a20;}
.compare-rank-card p{margin:0;max-height:72px;overflow:auto;font-size:12px;line-height:1.6;color:#4b515b;white-space:pre-wrap;}
.compare-rank-card a{font-size:12px;color:#5b4ee6;font-weight:800;text-decoration:none;}

@media(max-width:700px){
  html,body{overflow-x:hidden;}
  .main{width:100%;max-width:100vw;box-sizing:border-box;}
  .section-toolbar{gap:12px!important;position:static!important;}
  .compact-tools{display:grid!important;grid-template-columns:1fr!important;width:100%!important;gap:10px!important;}
  .select-box{min-width:0!important;width:100%!important;}
  .select-box select{width:100%!important;min-width:0!important;height:44px!important;font-size:15px!important;}
  .detail-panel{width:100%;max-width:100%;box-sizing:border-box;overflow:hidden;}
  .detail-head{gap:12px!important;}
  .selected-account{width:100%;min-width:0;}
  .selected-account h2{font-size:22px!important;line-height:1.25;word-break:break-word;}
  .detail-metrics{grid-template-columns:1fr 1fr!important;gap:10px!important;}
  .metric-card{padding:12px!important;min-width:0;}
  .metric-card strong{font-size:20px!important;word-break:break-word;}
  .instagram-live-posts,.threads-text-posts{max-height:70vh!important;overflow:auto!important;padding-right:2px!important;}
  .instagram-live-post{display:grid!important;grid-template-columns:92px minmax(0,1fr)!important;gap:10px!important;padding:10px!important;border-radius:14px!important;align-items:start!important;}
  .instagram-thumb{width:92px!important;max-width:92px!important;min-height:0!important;margin:0!important;border-radius:12px!important;}
  .instagram-thumb.is-image{aspect-ratio:4/5!important;}
  .instagram-thumb.is-reel{aspect-ratio:9/16!important;}
  .instagram-live-body{min-width:0!important;gap:7px!important;}
  .threads-post-top{display:grid!important;grid-template-columns:1fr!important;gap:3px!important;}
  .threads-post-top strong{font-size:16px!important;line-height:1.1!important;}
  .threads-post-text,.threads-full-text{max-height:118px!important;font-size:12px!important;line-height:1.55!important;padding:8px!important;overflow:auto!important;word-break:break-word!important;}
  .threads-post-stats{display:flex!important;flex-wrap:wrap!important;gap:5px!important;}
  .threads-post-stats span{font-size:10px!important;padding:4px 7px!important;}
  .threads-post-foot{display:flex!important;align-items:center!important;justify-content:space-between!important;gap:8px!important;}
  .threads-post-foot small{font-size:10px!important;}
  .threads-post-foot a{font-size:12px!important;white-space:nowrap;}
  .threads-text-posts{grid-template-columns:1fr!important;}
  .threads-text-card{padding:12px!important;border-radius:14px!important;}
  .compare-panel{padding:12px;border-radius:16px;}
  .compare-table{min-width:680px;}
  .compare-table th,.compare-table td{padding:10px;font-size:12px;}
  .compare-rank-grid{grid-template-columns:1fr;}
}

@media(max-width:420px){
  .detail-metrics{grid-template-columns:1fr!important;}
  .instagram-live-post{grid-template-columns:78px minmax(0,1fr)!important;}
  .instagram-thumb{width:78px!important;max-width:78px!important;}
  .selected-avatar{width:46px!important;height:46px!important;}
}

@media(min-width:701px){
  .section-toolbar{flex-wrap:wrap!important;}
  .toolbar-heading{flex:1 1 200px;min-width:180px;}
}

.login-gate{position:fixed;inset:0;display:grid;place-items:center;background:#121318;z-index:100;}
.login-gate[hidden]{display:none;}
/* .platform-button sets its own `display`, which — same issue as .login-gate
   above — can beat the browser's default [hidden]{display:none} rule on
   specificity/source order. Without this, the "viewer" role's hidden nav
   tabs (Threads/MEO/scheduler/dashboard) could stay visible and clickable. */
.platform-button[hidden]{display:none;}
.login-card{width:100%;max-width:320px;padding:32px 28px;border-radius:16px;background:#1c1d24;display:flex;flex-direction:column;align-items:stretch;gap:14px;}
.login-card .brand{justify-content:center;margin-bottom:6px;}
.login-label{margin:0;color:#9a9ea6;font-size:12px;text-align:center;}
.login-input{width:100%;box-sizing:border-box;padding:12px 14px;border-radius:10px;border:1px solid #33353f;background:#121318;color:#fff;font-size:14px;}
.login-input:focus{outline:2px solid var(--purple);outline-offset:1px;}
.login-button{width:100%;padding:12px 14px;border-radius:10px;border:none;background:var(--purple);color:#fff;font-weight:700;font-size:14px;cursor:pointer;}
.login-button:hover{opacity:.92;}
.login-error{margin:0;color:#ff8a8f;font-size:12px;text-align:center;}
.logout-button{margin-top:auto;padding:10px 12px;border-radius:10px;border:1px solid #33353f;background:transparent;color:#9a9ea6;font-size:12px;cursor:pointer;}
.logout-button:hover{color:#fff;border-color:#4a4d59;}
#tiktokConnectButton{margin-top:10px;border:0;border-radius:10px;background:#151821;color:#fff;font-weight:800;padding:9px 14px;cursor:pointer;font-size:12px;}
.tiktok-audit-note{margin:6px 0 0;color:#b8860b;font-size:11px;}
.schedule-target-checkboxes{display:flex;gap:14px;flex-wrap:wrap;padding:10px 12px;border:1px solid #e1e5ee;border-radius:10px;background:#fafbfc;}
.schedule-target-option{display:flex;align-items:center;gap:6px;font-size:13px;font-weight:700;color:#33353f;cursor:pointer;}
.schedule-target-option input{width:15px;height:15px;cursor:pointer;}
.schedule-cover-section{grid-column:1/-1;display:flex;flex-direction:column;gap:10px;padding:12px;border:1px dashed #d6dae4;border-radius:10px;background:#fafbfc;}
.schedule-cover-section[hidden]{display:none;}
.schedule-cover-note{margin:0;color:#8a8f99;font-size:11px;}
.schedule-cover-heading{font-size:13px;font-weight:800;color:#33353f;}
.schedule-frame-picker{display:flex;gap:14px;flex-wrap:wrap;align-items:flex-start;}
.schedule-frame-picker video{width:220px;max-width:100%;border-radius:10px;background:#000;}
.schedule-frame-picker-side{flex:1;min-width:180px;display:flex;flex-direction:column;gap:8px;}
#scheduleCoverCanvas{width:110px;height:auto;border-radius:8px;border:1px solid #e1e5ee;}
#scheduleCaptureFrameButton{align-self:flex-start;border:0;border-radius:10px;background:#151821;color:#fff;font-weight:800;padding:8px 14px;cursor:pointer;font-size:12px;}
