/* bellezza 売上ダッシュボード 共通スタイル（経営ダッシュボードのスタイルを流用） */
:root {
  color-scheme: light;
  --surface-0: #f4f4f2;
  --surface-1: #fcfcfb;
  --border: #e2e1dc;
  --grid: #ecebe7;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #7a7974;
  --accent: #2a78d6;
  --series-1: #2a78d6;
  --series-2: #d98a3a;
  --series-3: #4f9e6b;
  --series-4: #c0504d;
  --series-5: #8b6bb8;
  --series-6: #c9a227;
  --series-7: #3fa3b5;
  --series-8: #8a8a86;
  --good: #3f9a62;
  --bad: #c9504c;
  --error: #c03535;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --surface-0: #121211;
    --surface-1: #1a1a19;
    --border: #2f2f2d;
    --grid: #2a2a28;
    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted: #8f8e86;
    --accent: #3987e5;
    --series-1: #3987e5;
    --series-2: #e69a4c;
    --series-3: #5fb37f;
    --series-4: #e06b67;
    --series-5: #a588d1;
    --series-6: #d9b53d;
    --series-7: #52b8ca;
    --series-8: #a3a39c;
    --good: #5fb37f;
    --bad: #e06b67;
    --error: #e66767;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-0: #121211;
  --surface-1: #1a1a19;
  --border: #2f2f2d;
  --grid: #2a2a28;
  --text-primary: #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted: #8f8e86;
  --accent: #3987e5;
  --series-1: #3987e5;
  --series-2: #e69a4c;
  --series-3: #5fb37f;
  --series-4: #e06b67;
  --series-5: #a588d1;
  --series-6: #d9b53d;
  --series-7: #52b8ca;
  --series-8: #a3a39c;
  --good: #5fb37f;
  --bad: #e06b67;
  --error: #e66767;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--surface-0);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", Meiryo, sans-serif;
  font-size: 15px;
  line-height: 1.6;
}
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- ログイン ---------- */
.login-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card {
  width: 100%; max-width: 380px;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 28px 22px;
}
.login-title { font-size: 20px; margin: 0 0 20px; text-align: center; }
.login-form { display: flex; flex-direction: column; gap: 8px; }
.login-form label { font-size: 13px; color: var(--text-secondary); }
.login-form input {
  font-size: 17px; padding: 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface-0);
}
#code { letter-spacing: 0.3em; text-align: center; font-size: 22px; }
.login-form button[type="submit"] {
  margin-top: 8px; padding: 12px; border: 0; border-radius: 8px;
  background: var(--accent); color: #fff; font-weight: 600; cursor: pointer;
}
.login-form button:disabled { opacity: 0.6; cursor: default; }
.login-hint, .login-sent { font-size: 13px; color: var(--text-muted); margin: 4px 0 0; }
.login-sent { color: var(--text-secondary); margin: 0 0 4px; word-break: break-all; }
.login-links { display: flex; justify-content: space-between; margin-top: 8px; }
.link-button { background: none; border: 0; padding: 4px 0; color: var(--accent); cursor: pointer; font-size: 13px; }
.login-message { min-height: 1.6em; font-size: 13px; color: var(--text-secondary); margin: 16px 0 0; }
.login-message.is-error, .status.is-error { color: var(--error); }

/* ---------- ダッシュボード ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: var(--surface-1); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.topbar-title { font-weight: 700; }
.topbar-user { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-secondary); }
.ghost-button {
  background: none; border: 1px solid var(--border); border-radius: 6px;
  padding: 4px 10px; font-size: 13px; cursor: pointer;
}
.page { max-width: 1120px; margin: 0 auto; padding: 16px; }

.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 12px; }
.filter { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-secondary); }
.filter select {
  min-width: 180px; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface-1); font-size: 15px;
}
.filter-note { flex-basis: 100%; margin: 0; font-size: 12px; color: var(--text-muted); }
.status { color: var(--text-secondary); }

.scope-title { font-size: 18px; margin: 4px 0 12px; }

/* ---------- タブ ---------- */
.tabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.tab {
  background: none; border: 0; border-bottom: 2px solid transparent;
  padding: 8px 14px; margin-bottom: -1px; font-size: 14px; color: var(--text-secondary); cursor: pointer;
}
.tab.is-active { color: var(--text-primary); font-weight: 600; border-bottom-color: var(--accent); }

/* ---------- 2分割 ---------- */
.compare-grid { display: grid; grid-template-columns: 1fr; gap: 0 16px; }
@media (min-width: 1000px) { .compare-grid { grid-template-columns: 1fr 1fr; } }
.compare-col { min-width: 0; }
.compare-col .charts { grid-template-columns: 1fr; }
.compare-col .tiles { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.compare-col .scope-title { padding-top: 6px; border-top: 3px solid var(--accent); }
.diff-table td.diff-cell { font-weight: 600; }
@media (max-width: 600px) {
  .data-table.diff-table { white-space: normal; font-size: 12px; }
  .data-table.diff-table th, .data-table.diff-table td { padding: 6px 4px; }
  .diff-table th:first-child, .diff-table td:first-child { min-width: 6.5em; }
  .diff-table td.num, .diff-table th.num { white-space: nowrap; }
}
.page:has(#compare-view:not([hidden])) { max-width: 1400px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin-bottom: 14px; }
.tile { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.tile-label { font-size: 12px; color: var(--text-secondary); }
.tile-value { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; margin: 2px 0 4px; }
.tile-sub { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.panel { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; }
.panel h2 { font-size: 14px; margin: 0 0 10px; }
.panel-note { font-size: 11px; color: var(--text-muted); margin: 8px 0 0; }
.comment p { margin: 0 0 6px; }
.muted { color: var(--text-muted); }

.charts { display: grid; grid-template-columns: 1fr; gap: 0 14px; }
@media (min-width: 840px) { .charts { grid-template-columns: 1fr 1fr; } }
.chart-box { position: relative; height: 240px; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; white-space: nowrap; }
.data-table th, .data-table td { padding: 7px 8px; border-bottom: 1px solid var(--grid); text-align: left; }
.data-table th { font-weight: 600; color: var(--text-secondary); font-size: 12px; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table th:first-child, .data-table td:first-child { position: sticky; left: 0; background: var(--surface-1); }
.group-row td { font-size: 12px; color: var(--text-muted); background: var(--surface-0) !important; padding-top: 10px; }

.footer { font-size: 11px; color: var(--text-muted); padding: 8px 0 24px; }
.footer p { margin: 2px 0; }

@media (max-width: 480px) {
  .tiles { grid-template-columns: 1fr 1fr; }
  .tile-value { font-size: 19px; }
  .filter { flex: 1 1 140px; }
  .filter select { min-width: 0; width: 100%; }
}

/* ---------- bellezza 追加 ---------- */
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface-1); }
.seg { background: none; border: 0; padding: 8px 12px; font-size: 14px; cursor: pointer; color: var(--text-secondary); }
.seg + .seg { border-left: 1px solid var(--border); }
.seg.is-active { background: var(--accent); color: #fff; font-weight: 600; }
.period-inputs { display: flex; align-items: center; gap: 6px; }
.period-inputs select { min-width: 110px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-1); font-size: 15px; }
.chart-box-tall { height: 300px; }
.total-row td { font-weight: 700; border-top: 1px solid var(--border); }
@media (max-width: 480px) {
  .period-inputs select { min-width: 0; flex: 1; }
  .filter.period { flex-basis: 100%; }
}
