/* Gaya mengikuti Seller Centre Shopee: latar abu muda, kartu putih, satu aksen oranye, tabel lapang. */
:root {
  --bg: #f6f6f6; --card: #ffffff; --ink: #333333; --ink-2: #555555; --muted: #999999; --line: #ebebeb; --head: #fafafa;
  --orange: #ee4d2d; --orange-soft: #fff1ed;
  --good: #26aa64; --good-soft: #e9f8ef; --warn: #f69113; --warn-soft: #fff6e8; --bad: #ee4d2d; --bad-soft: #fff1ed;
  --info: #2673dd; --info-soft: #eaf2fd;
  color-scheme: light;
}
* { box-sizing: border-box; }
/* atribut hidden harus menang dari display milik kelas */
[hidden] { display: none !important; }
html, body { background: var(--bg); }
body { margin: 0; color: var(--ink); font: 14px/1.5 Roboto, "Helvetica Neue", "Segoe UI", Arial, sans-serif; -webkit-font-smoothing: antialiased; }
h2 { font-size: 16px; font-weight: 500; margin: 0; color: #222; }
b { font-weight: 500; }
.sub, .footnote { color: var(--muted); font-size: 12px; }
.footnote { margin: 10px 0 0; }
.error { color: var(--bad); min-height: 1.2em; margin: 0; font-size: 13px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.btn { font: inherit; padding: 8px 16px; border-radius: 4px; border: 1px solid #e5e5e5; background: #fff; color: var(--ink); cursor: pointer; white-space: nowrap; }
.btn.primary { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn.wide { width: 100%; padding-block: 10px; }
.btn:disabled { opacity: .6; cursor: wait; }
.link { font: inherit; background: none; border: 0; color: var(--ink-2); cursor: pointer; padding: 6px 8px; }
input, select { font: inherit; padding: 7px 10px; border-radius: 4px; border: 1px solid #e5e5e5; background: #fff; color: var(--ink); min-width: 0; }
input:focus, select:focus { outline: none; border-color: var(--orange); }

/* ---- login ---- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 380px; padding: 28px; display: grid; gap: 14px; background: #fff; border-radius: 4px; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.login-card label { display: grid; gap: 6px; font-size: 13px; color: var(--ink-2); }
.brand-row { display: flex; gap: 10px; align-items: center; }
.brand-row b { display: block; font-size: 16px; color: #222; }
.brand-row small { display: block; font-size: 12px; color: var(--muted); }
.logo { width: 34px; height: 34px; border-radius: 6px; background: var(--orange); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; letter-spacing: -.02em; flex: none; }

/* ---- navigasi atas ---- */
.nav { background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.06); position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; }
.nav-in { max-width: 1240px; margin: 0 auto; padding: 10px 16px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.nav-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.pill { font-size: 12px; padding: 3px 10px; border-radius: 999px; background: var(--head); color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.pill.ok { background: var(--good-soft); color: var(--good); } .pill.ok::before { background: var(--good); }
.pill.bad { background: var(--bad-soft); color: var(--bad); } .pill.bad::before { background: var(--bad); }
.switch { display: inline-flex; border: 1px solid #e5e5e5; border-radius: 4px; overflow: hidden; }
.switch button { font: inherit; border: 0; background: #fff; color: var(--ink-2); padding: 6px 14px; cursor: pointer; }
.switch button + button { border-left: 1px solid #e5e5e5; }
#m-otomatis[aria-pressed="true"] { background: var(--orange); color: #fff; }
#m-manual[aria-pressed="true"] { background: var(--info); color: #fff; }

/* ---- halaman ---- */
.page { max-width: 1240px; margin: 0 auto; padding: 16px; padding-block: 16px 40px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.page > *, .tabpane { min-width: 0; } /* tabel lebar menggulir di dalam kartu, bukan mendorong halaman */
.card { background: var(--card); border-radius: 4px; box-shadow: 0 1px 4px rgba(0,0,0,.05); padding: 20px 24px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head > div { display: grid; gap: 2px; }
.tag { font-size: 12px; padding: 3px 10px; border-radius: 2px; background: var(--head); color: var(--ink-2); white-space: nowrap; }
.tag.emas { background: var(--good-soft); color: var(--good); }
.tag.boros, .tag.malam { background: var(--warn-soft); color: var(--warn); }
.tag.kampanye { background: var(--info-soft); color: var(--info); }
.notice { padding: 10px 16px; border-radius: 4px; background: var(--warn-soft); color: #7a4a00; font-size: 13px; }
.notice.manual { background: var(--info-soft); color: #1d4f9c; }
.notice.bad { background: var(--bad-soft); color: #a3301a; }
.confirm { padding: 14px 18px; border-radius: 4px; background: #fff; border: 1px solid var(--orange); box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.confirm p { margin: 0 0 12px; }

/* ---- metrik (seperti "Performa Iklan" di Seller Centre) ---- */
.metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 4px; }
.metric { padding: 14px 16px; display: grid; gap: 4px; align-content: start; }
.metric + .metric { border-left: 1px solid var(--line); }
.m-label { font-size: 12px; color: var(--muted); }
.metric b { font-size: 20px; color: #222; font-variant-numeric: tabular-nums; }
.m-sub { font-size: 12px; color: var(--muted); }
.rule-now { margin: 12px 0 0; font-size: 13px; color: var(--ink-2); }
.target { margin-top: 14px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 4px; background: var(--head); }
.target-row { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 14px; }
.target-row b { font-weight: 500; color: #222; }
.target p { margin: 6px 0 0; font-size: 12.5px; color: var(--ink-2); }
.up { color: var(--good); } .down { color: var(--warn); } .bad { color: var(--bad); }

/* ---- tab ---- */
.tabs { display: flex; gap: 28px; border-bottom: 1px solid var(--line); margin: -4px 0 16px; overflow-x: auto; }
.tabs button { font: inherit; padding: 10px 0; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--ink-2); cursor: pointer; white-space: nowrap; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--orange); border-bottom-color: var(--orange); }
.n { color: var(--muted); }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--orange); color: #fff; font-size: 11px; text-align: center; line-height: 18px; }
.badge:empty { display: none; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar input[type="search"] { width: 280px; max-width: 100%; }

/* ---- tabel iklan ---- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 4px; }
table { border-collapse: collapse; width: 100%; }
th { background: var(--head); color: var(--ink-2); font-weight: 500; font-size: 13px; text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable::after { content: " ⇅"; color: #ccc; font-size: 11px; }
th.sorted::after { content: " ↓"; color: var(--orange); }
td { padding: 14px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 13px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fcfcfc; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.col-info { min-width: 300px; }
.col-diag { min-width: 190px; }
.info { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 12px; }
.thumb { width: 56px; height: 56px; border-radius: 2px; object-fit: cover; background: var(--head); border: 1px solid var(--line); display: block; }
.thumb.ph { display: grid; place-items: center; color: #ccc; font-size: 11px; }
.iname { color: #222; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.4; }
.itype { color: var(--muted); font-size: 12px; margin-top: 2px; }
.state { font-size: 12px; color: var(--good); margin-top: 2px; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.chip { font-size: 11px; padding: 0 6px; border-radius: 2px; border: 1px solid; line-height: 18px; }
.chip.g { color: #00a89c; border-color: #00a89c; } .chip.b { color: var(--info); border-color: var(--info); } .chip.o { color: var(--orange); border-color: var(--orange); }
.big { font-size: 14px; color: #222; }
.small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; }
.dlabel { font-weight: 500; font-size: 14px; }
.dlabel.good { color: var(--good); } .dlabel.warn { color: var(--warn); } .dlabel.bad { color: var(--bad); } .dlabel.info { color: var(--info); } .dlabel.muted { color: var(--muted); }
.dbasis { margin-top: 4px; font-size: 11.5px; color: var(--muted); }
.pantau-head { margin: 0 0 4px; font-weight: 500; color: var(--ink); }
.dwatch { margin-top: 4px; font-size: 12px; color: var(--warn); font-weight: 500; }
.dhint { margin-top: 4px; font-size: 12px; color: var(--ink-2); background: var(--head); border-radius: 2px; padding: 6px 8px; line-height: 1.4; }
meter { display: block; width: 100%; height: 6px; margin-top: 6px; }
td meter { width: 96px; margin: 6px 0 0 auto; }
.ctl-btn { font: inherit; font-size: 12px; padding: 5px 10px; border-radius: 4px; border: 1px solid #e5e5e5; background: #fff; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.ctl-btn.manual { color: var(--info); border-color: var(--info); background: var(--info-soft); }
.ctl-who { display: block; font-size: 12px; margin-bottom: 6px; color: var(--ink-2); white-space: nowrap; }
.empty { padding: 32px; text-align: center; color: var(--muted); }

/* ---- Iklan Produk Otomatis ---- */
.gms { border: 1px solid var(--line); border-radius: 4px; padding: 16px 20px; background: var(--head); }
.gms-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.gms-head b { font-size: 15px; color: #222; }
.gms-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: #fff; border-radius: 4px; }
.gms-grid > div { padding: 14px 16px; display: grid; gap: 4px; }
.gms-grid > div + div { border-left: 1px solid var(--line); }
.gms-grid b { font-size: 18px; color: #222; font-variant-numeric: tabular-nums; }

/* ---- riwayat ---- */
.log td { white-space: normal; }
.log td:first-child { white-space: nowrap; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.log .chg { white-space: nowrap; font-variant-numeric: tabular-nums; }
.log .who { white-space: nowrap; }
.log .day td { background: var(--head); color: var(--muted); font-size: 12px; padding: 8px 14px; }
.log .lname { min-width: 180px; max-width: 320px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: #222; }

/* ---- usulan ---- */
.props { display: grid; gap: 12px; }
.prop { border: 1px solid var(--line); border-radius: 4px; padding: 16px; display: grid; gap: 8px; }
.prop .roasline { font-size: 16px; color: #222; }

/* ---- portal: pilih toko ---- */
.stores { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.store { display: grid; gap: 12px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 4px; color: inherit; text-decoration: none; background: #fff; transition: border-color .15s, box-shadow .15s; }
.store:hover { border-color: var(--orange); box-shadow: 0 2px 10px rgba(238,77,45,.12); }
.store-top { display: flex; gap: 12px; align-items: center; }
.store-name { flex: 1; min-width: 0; }
.store-name b { display: block; font-size: 15px; color: #222; }
.store-name small { display: block; font-size: 12px; color: var(--muted); }
.store-state { font-size: 13px; }
.store-state.on { color: var(--good); } .store-state.off { color: var(--bad); }
.store-kpi { display: grid; gap: 2px; padding: 10px 12px; background: var(--head); border-radius: 4px; }
.store-kpi b { font-size: 20px; font-weight: 500; }
.store-go { color: var(--orange); font-size: 13px; }
.rules { padding: 14px 24px; font-size: 13px; color: var(--ink-2); }
.rules summary { cursor: pointer; color: #222; }
.rules ul { margin: 10px 0 0; padding-left: 18px; display: grid; gap: 6px; }

@media (max-width: 900px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric + .metric { border-left: 0; }
  .metric { border-bottom: 1px solid var(--line); }
  .gms-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gms-grid > div + div { border-left: 0; }
  .card { padding: 16px; }
  .tabs { gap: 20px; }
}
@media (max-width: 560px) {
  .nav-in { gap: 8px; }
  .nav-right { width: 100%; justify-content: space-between; margin-left: 0; }
  .metric b { font-size: 17px; }
  .col-info { min-width: 240px; }
}
