:root {
  --brand: #ff6b4a;
  --brand-dark: #e2502f;
  --brand-soft: #fff0eb;
  --ink: #1f2430;
  --muted: #6b7280;
  --line: #e9e4df;
  --bg: #f6f3f0;
  --card: #fff;
  --side: #1f2430;
  --ok: #1f9d6b;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", sans-serif; background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.6; }
[hidden] { display: none !important; }
a { color: inherit; }

.logo-mark { width: 34px; height: 34px; border-radius: 10px; display: inline-grid; place-items: center; background: var(--brand); color: #fff; font-weight: 800; flex: none; }
.logo-mark.big { width: 48px; height: 48px; font-size: 22px; border-radius: 14px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand strong { display: block; font-size: 17px; }
.brand small { display: block; font-size: 11px; opacity: .7; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(circle at 20% 10%, #ffe3d9, transparent 40%), var(--bg); }
.login-card { width: min(380px, 100%); background: #fff; border-radius: 20px; padding: 28px; box-shadow: 0 10px 40px rgba(0,0,0,.08); display: grid; gap: 14px; }
.login-card label { display: grid; gap: 4px; font-weight: 700; font-size: 13px; }

input, select, textarea { font: inherit; padding: 9px 11px; border: 1px solid #d9d2cc; border-radius: 10px; background: #fff; color: var(--ink); width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid #ffc2b2; border-color: var(--brand); }
input[type="checkbox"] { width: auto; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 9px 16px; border-radius: 10px; border: 1px solid #d9d2cc; background: #fff; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn:hover { background: #faf7f4; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--muted); cursor: pointer; text-decoration: underline; }
.error { color: #b91c1c; background: #fef2f2; padding: 8px 12px; border-radius: 8px; margin: 0; }

.layout { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--side); color: #fff; padding: 20px 14px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; }
.side nav { display: grid; gap: 2px; }
.side nav a { padding: 9px 12px; border-radius: 10px; text-decoration: none; color: #cdd1da; font-weight: 600; display: flex; align-items: center; justify-content: space-between; }
.side nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.side nav a.on { background: var(--brand); color: #fff; }
.nav-badge { background: #fff; color: var(--brand-dark); border-radius: 99px; font-size: 11px; padding: 0 7px; }
.side-foot { margin-top: auto; display: grid; gap: 6px; font-size: 12px; color: #aab0bd; }
.side-foot a, .side-foot .link { color: #aab0bd; text-align: left; }

.content { padding: 24px 28px 60px; min-width: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.page-head h1 { font-size: 22px; margin: 0; }
.page-head select { width: auto; }
.lead { color: var(--muted); margin: 0 0 16px; }

.card { background: var(--card); border-radius: 16px; padding: 18px 20px; box-shadow: 0 2px 10px rgba(31,36,48,.05); margin-bottom: 16px; }
.card h2 { font-size: 15px; margin: 0 0 12px; }
.card.off { opacity: .6; }
tr.off { opacity: .55; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.cards .card { margin: 0; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 12px 0 16px; }
.kpi { background: var(--card); border-radius: 16px; padding: 14px 16px; box-shadow: 0 2px 10px rgba(31,36,48,.05); display: grid; }
.kpi span { color: var(--muted); font-size: 12px; font-weight: 700; }
.kpi strong { font-size: 28px; line-height: 1.3; font-variant-numeric: tabular-nums; }
.kpi small { color: var(--muted); font-size: 11px; }
.kpi.accent { background: linear-gradient(135deg, var(--brand), #ff8f6b); color: #fff; }
.kpi.accent span, .kpi.accent small { color: rgba(255,255,255,.85); }
.grid2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }

.bars { display: flex; align-items: flex-end; gap: 4px; height: 180px; padding-top: 6px; }
.bar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; min-width: 0; }
.bar i { display: block; width: 100%; max-width: 26px; background: linear-gradient(180deg, #ff9b80, var(--brand)); border-radius: 6px 6px 2px 2px; min-height: 2px; }
.bar span { font-size: 10px; color: var(--muted); }
.hbar { display: grid; grid-template-columns: 110px 1fr 56px; gap: 8px; align-items: center; margin: 7px 0; font-size: 13px; }
.hbar div { background: #f3eeea; border-radius: 99px; height: 10px; overflow: hidden; }
.hbar i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.hbar b { text-align: right; font-variant-numeric: tabular-nums; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 700; }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
td.msg { max-width: 360px; white-space: pre-wrap; }
td select { width: auto; padding: 4px 8px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.tag { font-size: 11px; padding: 1px 8px; border-radius: 99px; background: #eee; color: var(--muted); font-weight: 600; }
.tag.gold { background: #fff4d6; color: #a16207; }
.tag.warn { background: #ffedd5; color: #c2410c; }
.tag.bad { background: #fee2e2; color: #b91c1c; }
.tag.ok { background: #dcfce7; color: #15803d; }

/* 管理画面の管理 */
.nav-group { margin: 14px 12px 4px; font-size: 11px; color: #8a91a0; font-weight: 700; letter-spacing: .08em; }
.sec-title { font-size: 16px; margin: 22px 0 10px; }
.sec-head { margin-top: 10px; }
.sec-head .sec-title { margin: 0; }
.todo { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 6px; }
.todo-item { background: var(--card); border-radius: 16px; padding: 12px 16px; text-decoration: none; display: flex; align-items: baseline; gap: 10px; box-shadow: 0 2px 10px rgba(31,36,48,.05); }
.todo-item b { font-size: 26px; font-variant-numeric: tabular-nums; color: var(--muted); }
.todo-item span { font-weight: 700; color: var(--muted); }
.todo-item.hot { background: var(--brand-soft); }
.todo-item.hot b, .todo-item.hot span { color: var(--brand-dark); }
.console-card { border-top: 5px solid var(--brand); }
.console-card.c-shop { border-top-color: #2fb3a6; }
.console-card.c-advertiser { border-top-color: #2e4a8c; }
.console-top { display: flex; gap: 12px; align-items: center; }
.console-top h3 { margin: 0; font-size: 16px; }
.console-top p { margin: 0; font-size: 12px; }
.console-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; color: #fff; background: var(--brand); flex: none; }
.c-shop .console-icon { background: #2fb3a6; }
.c-advertiser .console-icon { background: #2e4a8c; }
.console-nums { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.console-nums div { background: #f6f3f0; border-radius: 10px; padding: 6px 10px; }
.console-nums span { display: block; font-size: 11px; color: var(--muted); font-weight: 700; }
.console-nums b { font-size: 14px; }
.seg { display: inline-flex; background: #ebe6e1; border-radius: 12px; padding: 3px; margin-bottom: 12px; }
.seg button { border: 0; background: none; font: inherit; font-weight: 700; padding: 6px 16px; border-radius: 9px; cursor: pointer; color: var(--muted); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.cred { display: flex; align-items: center; gap: 10px; background: #f6f3f0; border-radius: 10px; padding: 8px 12px; }
.cred span { width: 9em; font-size: 12px; color: var(--muted); font-weight: 700; flex: none; }
.cred b { font-size: 15px; word-break: break-all; }
.cred .pw { font-family: ui-monospace, Consolas, monospace; font-size: 18px; letter-spacing: .05em; }
.cred .btn { margin-left: auto; }

/* 広告の審査 */
.review-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.review-body { display: grid; grid-template-columns: 220px 1fr; gap: 16px; align-items: start; }
.diff th { width: 9em; }
.diff td.changed { background: #fff7d6; font-weight: 700; }
.review-foot { display: flex; gap: 8px; margin-top: 12px; }
.review-foot input { flex: 1; }

.shop-card { display: grid; grid-template-columns: 110px 1fr; gap: 14px; }
.shop-card .qr img { width: 110px; height: 110px; border-radius: 8px; border: 1px solid var(--line); }
.info h3 { margin: 0; font-size: 16px; }
.info p { margin: 2px 0; }
.coupon-line { color: var(--brand-dark); font-weight: 700; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.ad-card { display: grid; grid-template-columns: 140px 1fr; gap: 14px; }
.ad-img { aspect-ratio: 16/9; background: #f3eeea; border-radius: 10px; overflow: hidden; display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.ad-img img { width: 100%; height: 100%; object-fit: cover; }
.langs-have { display: flex; gap: 4px; }
.langs-have span { font-size: 10px; padding: 0 6px; border-radius: 4px; background: #f1f1f1; color: #aaa; }
.langs-have span.on { background: #e9f7f0; color: var(--ok); }
.filters { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.filters select, .filters input { width: auto; }

.dlg { border: 0; border-radius: 18px; padding: 0; width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 40px); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.dlg::backdrop { background: rgba(31,36,48,.45); }
.dlg form { display: flex; flex-direction: column; max-height: calc(100vh - 40px); }
.dlg header, .dlg footer { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--line); gap: 8px; }
.dlg footer { border-bottom: 0; border-top: 1px solid var(--line); justify-content: flex-end; }
.dlg h2 { margin: 0; font-size: 17px; }
.dlg .x { background: none; border: 0; font-size: 24px; cursor: pointer; color: var(--muted); }
.dlg-body { padding: 16px 20px; overflow: auto; display: grid; gap: 14px; }
.field { display: grid; gap: 4px; }
.field .label { font-weight: 700; font-size: 13px; }
.field em { font-style: normal; color: #fff; background: var(--brand); font-size: 10px; padding: 0 6px; border-radius: 4px; margin-left: 4px; }
.field.check { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.help { color: var(--muted); font-size: 12px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab { border: 1px solid var(--line); background: #faf7f4; border-radius: 8px 8px 0 0; padding: 4px 10px; font: inherit; font-size: 12px; cursor: pointer; color: var(--muted); }
.tab.on { background: #fff; color: var(--ink); font-weight: 700; border-bottom-color: #fff; }
.img-row { display: grid; grid-template-columns: 180px 1fr; gap: 12px; align-items: start; }
.img-prev { aspect-ratio: 16/9; background: #f3eeea; border-radius: 10px; overflow: hidden; display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.img-prev img { width: 100%; height: 100%; object-fit: cover; }

.report-head { display: flex; justify-content: space-between; align-items: flex-start; }
.report-head h2 { font-size: 22px; margin: 2px 0; }
.report h3 { font-size: 13px; color: var(--muted); }

.toast { position: fixed; right: 20px; bottom: 20px; background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 12px; font-weight: 700; opacity: 0; transform: translateY(10px); transition: all .2s; pointer-events: none; z-index: 100; }
.toast.show { opacity: 1; transform: none; }
.toast.bad { background: #b91c1c; }

.print-area { display: none; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  .side nav { grid-template-columns: repeat(2, 1fr); }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .grid2 { grid-template-columns: 1fr; }
  .content { padding: 16px; }
  .card { overflow-x: auto; }
  .nav-group { grid-column: 1 / -1; }
  .todo { grid-template-columns: 1fr; }
  .review-body { grid-template-columns: 1fr; }
  .review-foot { flex-wrap: wrap; }
}

/* POP (A4) and report printing */
.pop { width: 100%; text-align: center; padding: 18mm 14mm; font-family: system-ui, "Hiragino Sans", "Noto Sans JP", sans-serif; }
.pop-top { display: flex; align-items: center; justify-content: center; gap: 10px; }
.pop-top b { display: block; font-size: 22px; text-align: left; }
.pop-top small { display: block; font-size: 12px; color: #666; text-align: left; }
.pop h1 { font-size: 34px; line-height: 1.35; margin: 14mm 0 4mm; }
.pop-sub { font-size: 18px; margin: 0; color: #444; }
.pop-coupon { display: inline-block; margin: 8mm 0; padding: 4mm 10mm; border: 3px dashed var(--brand); border-radius: 6mm; font-size: 24px; font-weight: 800; color: var(--brand-dark); }
.pop-qr { width: 70mm; height: 70mm; display: block; margin: 0 auto; }
.pop-langs { font-size: 14px; color: #555; margin: 6mm 0 2mm; }
.pop-shop { font-size: 18px; font-weight: 700; margin: 6mm 0 0; }
.pop-note { font-size: 12px; color: #777; }

@media print {
  @page { size: A4; margin: 0; }
  body { background: #fff; }
  #app, #login, .toast, .dlg { display: none !important; }
  .print-area { display: block; }
  .print-area .card { box-shadow: none; margin: 14mm; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
img.logo-mark { background: none; display: block; }
