/* Poppins One — 余白とタイポグラフィで見せる、静かなインターフェース */
:root {
  --bg: #fbf8f6;
  --surface: #ffffff;
  --ink: #2e2226;
  --ink-2: #6e5f63;
  --ink-3: #a3959a;
  --line: #ece2df;
  --line-2: #f4ece9;
  --wine: #912344;
  --wine-deep: #611d2f;
  --pink: #f6beca;
  --blush: #faeef1;
  --gold: #976532;
  /* グラフの系列（検証済み） */
  --s-actual: #912344;
  --s-budget: #a8701e;
  --s-prior: #1f7fb0;
  /* 状態 */
  --good: #2f7a5f;
  --bad: #b4432e;
  --font: 'Noto Sans JP', 'Hiragino Sans', 'Yu Gothic', sans-serif;
  --num: 'Jost', 'Noto Sans JP', sans-serif;
  --serif: 'Cormorant Garamond', 'Times New Roman', serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-weight: 400; font-size: 14px; line-height: 1.8; letter-spacing: .04em; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--wine); }
h1, h2, h3 { font-weight: 400; margin: 0; letter-spacing: .08em; }
p { margin: 0 0 1em; }
.muted { color: var(--ink-2); }
.small { font-size: 12px; }
.eyebrow { font-family: var(--num); font-size: 11px; letter-spacing: .32em; text-transform: uppercase; color: var(--ink-3); }
.num { font-family: var(--num); font-variant-numeric: tabular-nums lining-nums; letter-spacing: .02em; }
[hidden] { display: none !important; }

/* ───── ヘッダー */
.top { position: sticky; top: 0; z-index: 20; background: rgba(251, 248, 246, .88); backdrop-filter: saturate(1.2) blur(14px); -webkit-backdrop-filter: saturate(1.2) blur(14px); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1440px; margin: 0 auto; padding: 0 40px; height: 72px; display: flex; align-items: center; gap: 40px; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand img { height: 30px; width: auto; display: block; }
.brand .one { font-family: var(--serif); font-style: italic; font-size: 26px; color: var(--wine-deep); letter-spacing: .02em; line-height: 1; padding-left: 14px; border-left: 1px solid var(--line); }
.nav { display: flex; gap: 32px; flex: 1; }
.nav a { font-size: 13px; color: var(--ink-2); padding: 24px 0; border-bottom: 1px solid transparent; letter-spacing: .12em; }
.nav a.on { color: var(--ink); border-bottom-color: var(--wine); }
.me { display: flex; align-items: center; gap: 20px; font-size: 12px; color: var(--ink-2); }
.me form { margin: 0; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--ink-2); cursor: pointer; letter-spacing: .1em; }
.linkbtn:hover { color: var(--wine); }
.menu-toggle { display: none; }

.notice { background: var(--blush); color: var(--wine-deep); font-size: 12px; text-align: center; padding: 10px 16px; letter-spacing: .08em; }
.notice a { text-decoration: underline; text-underline-offset: 3px; }

.wrap { max-width: 1440px; margin: 0 auto; padding: 48px 40px 96px; }
.wrap.narrow { max-width: 880px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 40px; }
.page-head h1 { font-size: 26px; font-weight: 300; letter-spacing: .14em; margin-top: 8px; }

/* ───── フラッシュ */
.flash { padding: 14px 18px; margin: 0 0 24px; font-size: 13px; border-left: 2px solid; background: var(--surface); white-space: pre-line; }
.flash-success { border-color: var(--good); }
.flash-error { border-color: var(--bad); color: #7a2a1d; }
.flash-info { border-color: var(--gold); }

/* ───── ボタン・フォーム */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; height: 46px; padding: 0 30px; border-radius: 999px; border: 1px solid var(--ink); background: transparent; color: var(--ink); font: inherit; font-size: 13px; letter-spacing: .16em; cursor: pointer; transition: all .3s var(--ease); white-space: nowrap; }
.btn:hover { background: var(--ink); color: #fff; }
.btn-primary { background: var(--wine); border-color: var(--wine); color: #fff; }
.btn-primary:hover { background: var(--wine-deep); border-color: var(--wine-deep); color: #fff; }
.btn-sm { height: 36px; padding: 0 20px; font-size: 12px; }
.btn-block { width: 100%; }
.btn-danger { border-color: var(--bad); color: var(--bad); }
.btn-danger:hover { background: var(--bad); color: #fff; }
.btn .arrow { transition: transform .3s var(--ease); }
.btn:hover .arrow { transform: translateX(4px); }

label.f { display: block; margin-bottom: 26px; }
label.f > span { display: block; font-size: 11px; letter-spacing: .2em; color: var(--ink-2); margin-bottom: 8px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=month], select, textarea {
  width: 100%; height: 48px; padding: 0 2px; border: 0; border-bottom: 1px solid var(--line); background: transparent; font: inherit; font-size: 15px; color: var(--ink); border-radius: 0; transition: border-color .3s;
}
select { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%); background-position: calc(100% - 12px) 52%, calc(100% - 7px) 52%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 28px; cursor: pointer; }
input:focus, select:focus, textarea:focus { outline: none; border-bottom-color: var(--wine); }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13px; }
.check input { accent-color: var(--wine); width: 16px; height: 16px; }
.errors { margin: 0 0 24px; padding: 14px 18px 14px 34px; border-left: 2px solid var(--bad); background: var(--surface); color: #7a2a1d; font-size: 13px; }

/* ───── 認証（全面写真） */
body.auth { background: #fff; }
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.25fr 1fr; }
.auth-art { position: relative; overflow: hidden; background: var(--blush); }
.auth-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 40% 30%; animation: slowzoom 24s var(--ease) both; }
@keyframes slowzoom { from { transform: scale(1.06); } to { transform: scale(1); } }
.auth-art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(46, 34, 38, 0) 45%, rgba(46, 34, 38, .55)); }
.auth-copy { position: absolute; left: 56px; bottom: 56px; z-index: 1; color: #fff; }
.auth-copy .eyebrow { color: rgba(255, 255, 255, .8); }
.auth-copy h1 { font-family: var(--serif); font-weight: 300; font-size: 72px; line-height: 1; letter-spacing: .02em; margin: 14px 0 18px; }
.auth-copy h1 i { font-style: italic; }
.auth-copy p { font-size: 13px; letter-spacing: .2em; margin: 0; opacity: .9; }
.auth-side { display: flex; flex-direction: column; justify-content: center; padding: 64px clamp(32px, 6vw, 112px); }
.auth-card { width: 100%; max-width: 380px; }
.auth-logo { height: 40px; width: auto; margin-bottom: 56px; }
.auth-card h2 { font-size: 20px; font-weight: 300; letter-spacing: .2em; margin-bottom: 10px; }
.auth-card .lead { color: var(--ink-2); font-size: 13px; margin-bottom: 36px; }
.auth-card .btn-block + .btn-block { margin-top: 12px; }
.or { display: flex; align-items: center; gap: 16px; color: var(--ink-3); font-size: 11px; letter-spacing: .3em; margin: 28px 0; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.otp-input { font-family: var(--num) !important; font-size: 30px !important; letter-spacing: .5em !important; text-align: center; height: 64px !important; }
.auth-foot { margin-top: 48px; font-size: 11px; color: var(--ink-3); letter-spacing: .2em; }

/* ───── ダッシュボード：ヒーロー */
.hero { position: relative; height: 300px; overflow: hidden; background: var(--blush); }
.hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 35%; transition: opacity 1.2s var(--ease); }
.hero::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(251, 248, 246, .96) 0%, rgba(251, 248, 246, .82) 34%, rgba(251, 248, 246, 0) 70%); }
.hero-in { position: relative; z-index: 1; max-width: 1440px; margin: 0 auto; padding: 64px 40px 0; height: 100%; display: flex; flex-direction: column; }
.hero h1 { font-weight: 300; font-size: 34px; letter-spacing: .16em; margin: 14px 0 10px; }
.hero .crumb { font-size: 12px; color: var(--ink-2); letter-spacing: .14em; min-height: 1.8em; }
.hero .crumb a { border-bottom: 1px solid var(--line); }
.hero .meta > * { white-space: nowrap; }
.hero .meta { margin-top: auto; padding-bottom: 28px; display: flex; flex-wrap: wrap; gap: 10px 28px; align-items: center; font-size: 11px; color: var(--ink-2); letter-spacing: .14em; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px; border-radius: 999px; font-size: 10px; letter-spacing: .24em; border: 1px solid var(--wine); color: var(--wine); background: rgba(255, 255, 255, .7); }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 0 rgba(47, 122, 95, .5); animation: pulse 2.4s infinite; display: inline-block; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(47, 122, 95, 0); } 100% { box-shadow: 0 0 0 0 rgba(47, 122, 95, 0); } }

/* フィルター（1 行） */
.filters { position: sticky; top: 72px; z-index: 10; background: rgba(251, 248, 246, .94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.filters-in { max-width: 1440px; margin: 0 auto; padding: 14px 40px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 22px; }
.filters input[type=date] { width: 150px; height: 38px; font-size: 13px; }
.filters .fl > span { white-space: nowrap; }
.filters .fl { display: flex; align-items: center; gap: 12px; }
.filters .fl > span { font-size: 10px; letter-spacing: .26em; color: var(--ink-3); }
.filters select, .filters input[type=month] { height: 38px; font-size: 13px; width: auto; min-width: 120px; }
.filters select.scope { min-width: 180px; max-width: 240px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: var(--surface); }
.seg button { border: 0; background: transparent; font: inherit; font-size: 12px; letter-spacing: .08em; color: var(--ink-2); padding: 6px 13px; border-radius: 999px; cursor: pointer; transition: all .25s var(--ease); }
.seg button.on { background: var(--ink); color: #fff; }
.seg button:not(.on):hover { color: var(--wine); }
.seg button:disabled { opacity: .35; cursor: default; }

/* KPI タイル */
.dash { max-width: 1440px; margin: 0 auto; padding: 48px 40px 120px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; margin: 0 0 22px; }
.section-head h2 { font-size: 15px; letter-spacing: .24em; font-weight: 400; }
.section-head .sub { font-size: 11px; color: var(--ink-3); letter-spacing: .14em; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); border-left: 1px solid var(--line); margin-bottom: 80px; }
.kpis .kpi.reveal:nth-child(2) { animation-delay: .05s; } .kpis .kpi.reveal:nth-child(3) { animation-delay: .1s; } .kpis .kpi.reveal:nth-child(4) { animation-delay: .15s; }
.kpi { position: relative; background: var(--surface); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 28px 28px 26px; cursor: pointer; transition: background .3s var(--ease); text-align: left; font: inherit; color: inherit; }
.kpi:hover { background: #fffdfc; }
.kpi.on { background: var(--blush); }
.kpi.on::before { content: ''; position: absolute; left: 0; top: 0; right: 0; height: 2px; background: var(--wine); }
.kpi .lb { font-size: 12px; letter-spacing: .2em; color: var(--ink-2); display: flex; justify-content: space-between; gap: 8px; }
.kpi .lb .u { font-family: var(--num); font-size: 10px; letter-spacing: .14em; color: var(--ink-3); }
.kpi .val { font-family: var(--num); font-weight: 300; font-size: 40px; line-height: 1.15; margin: 14px 0 16px; letter-spacing: 0; font-variant-numeric: tabular-nums lining-nums; white-space: nowrap; }
.kpi .val small { font-size: 14px; color: var(--ink-3); margin-left: 6px; letter-spacing: .1em; }
.kpi .val.na { color: var(--ink-3); }
.kpi .cmp { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 12px; color: var(--ink-2); padding-top: 12px; border-top: 1px solid var(--line-2); }
.kpi .cmp .r { font-family: var(--num); font-size: 15px; font-weight: 400; letter-spacing: .02em; white-space: nowrap; }
.kpi .diff { font-family: var(--num); font-size: 12px; color: var(--ink-3); margin-top: 4px; display: flex; justify-content: space-between; }
.up-good { color: var(--good); }
.up-bad { color: var(--bad); }
.kpi .prog { margin-top: 16px; }
.kpi .prog .bar { height: 3px; background: var(--line-2); position: relative; overflow: visible; }
.kpi .prog .bar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--wine); border-radius: 0 2px 2px 0; transition: width .9s var(--ease); }
.kpi .prog .bar b { position: absolute; top: -4px; width: 1px; height: 11px; background: var(--ink-3); }
.kpi .prog .pl { display: flex; justify-content: space-between; font-size: 10px; letter-spacing: .1em; color: var(--ink-3); margin-top: 8px; }
.kpi .prog .pl .num { font-size: 12px; color: var(--ink-2); }

/* 推移グラフ */
.chart-card { background: var(--surface); border: 1px solid var(--line); padding: 32px 32px 20px; margin-bottom: 80px; position: relative; }
.legend { display: flex; gap: 24px; font-size: 11px; color: var(--ink-2); letter-spacing: .12em; }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend i { display: inline-block; width: 14px; height: 10px; border-radius: 2px; }
.legend i.ln { height: 2px; border-radius: 1px; }
.legend i.ln-dash { height: 0; border-top: 2px dashed; background: none !important; }
.chart { width: 100%; height: 340px; display: block; overflow: visible; }
.chart text { font-family: var(--num); font-size: 11px; fill: var(--ink-3); letter-spacing: .04em; }
.chart .grid { stroke: var(--line-2); stroke-width: 1; }
.chart .base { stroke: var(--line); stroke-width: 1; }
.tip { position: absolute; pointer-events: none; background: rgba(46, 34, 38, .94); color: #fff; padding: 12px 16px; font-size: 12px; min-width: 180px; letter-spacing: .06em; opacity: 0; transition: opacity .15s; z-index: 5; }
.tip.on { opacity: 1; }
.tip .t { font-size: 11px; letter-spacing: .2em; opacity: .75; margin-bottom: 6px; }
.tip .row { display: flex; justify-content: space-between; gap: 20px; font-family: var(--num); }
.tip .row i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 8px; }

/* 内訳の表 */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); background: var(--surface); }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { font-weight: 400; font-size: 11px; letter-spacing: .16em; color: var(--ink-3); text-align: right; padding: 16px 18px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #fffdfc; }
table.t th:first-child, table.t td:first-child { text-align: left; }
table.t td { padding: 18px; border-bottom: 1px solid var(--line-2); text-align: right; white-space: nowrap; font-family: var(--num); font-variant-numeric: tabular-nums; }
table.t td:first-child { font-family: var(--font); }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr { transition: background .2s; }
table.t tbody tr.drill { cursor: pointer; }
table.t tbody tr.drill:hover { background: var(--blush); }
table.t td .sub { display: block; font-size: 11px; color: var(--ink-3); }
table.t tfoot td { border-top: 1px solid var(--line); font-weight: 500; background: #fffdfc; }
.tw, .tw-sp { display: inline-flex; width: 20px; height: 20px; margin-right: 8px; vertical-align: -4px; }
.tw { align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--ink-2); font-size: 11px; line-height: 1; padding: 0; cursor: pointer; }
.tw:hover { border-color: var(--wine); color: var(--wine); }
table.t tbody tr.grp td:first-child { font-weight: 500; }
table.t tbody tr.lv0 td { border-top: 1px solid var(--line); }
table.t tbody tr.lv0:first-child td { border-top: 0; }
table.t tbody tr.lv1 td:first-child, table.t tbody tr.lv2 td:first-child, table.t tbody tr.lv3 td:first-child { color: var(--ink-2); }
table.t tbody tr.lv2 td, table.t tbody tr.lv3 td { padding-top: 12px; padding-bottom: 12px; }
td.biz-name { white-space: nowrap; }
td.biz-name > input { width: calc(100% - 2.6em); }
.bnum { display: inline-block; min-width: 2.2em; color: var(--ink-3); font-family: var(--num); font-weight: 400; }
table.t.sticky1 td:first-child { white-space: normal; min-width: 240px; max-width: 340px; line-height: 1.6; }
.scroll-hint { display: none; font-size: 11px; color: var(--ink-3); letter-spacing: .1em; margin: -12px 0 10px; }
.bn { display: flex; align-items: flex-start; }
.bn .tw, .bn .tw-sp { flex: none; margin-top: 1px; }
.bn .bnum { flex: none; }
.bname { flex: 1; min-width: 0; }
.drill-arrow { color: var(--ink-3); margin-left: 8px; font-size: 11px; }

/* 一般の表（管理画面） */
.list { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); }
.list th { font-weight: 400; font-size: 11px; letter-spacing: .16em; color: var(--ink-3); text-align: left; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.list td { padding: 16px 18px; border-bottom: 1px solid var(--line-2); vertical-align: middle; font-size: 13px; }
.list tr:last-child td { border-bottom: 0; }
.list tr.link { cursor: pointer; }
.list tr.link:hover td { background: var(--blush); }
.tag { display: inline-block; font-size: 10px; letter-spacing: .14em; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; }
.tag.wine { border-color: var(--wine); color: var(--wine); }
.tag.good { border-color: var(--good); color: var(--good); }
.tag.bad { border-color: var(--bad); color: var(--bad); }
.tag.warn { border-color: var(--gold); color: var(--gold); }

.card { background: var(--surface); border: 1px solid var(--line); padding: 36px; margin-bottom: 32px; }
.card h2 { font-size: 15px; letter-spacing: .22em; margin-bottom: 8px; }
.card .lead { color: var(--ink-2); font-size: 13px; margin-bottom: 28px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 40px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

/* 事業ツリーのチェック */
.tree { list-style: none; margin: 0; padding: 0; }
.tree ul { list-style: none; margin: 0; padding-left: 26px; border-left: 1px solid var(--line-2); margin-left: 7px; }
.tree li { padding: 4px 0; }
.tree .check { font-size: 13px; }
.tree .check.inherited { color: var(--ink-3); }

/* ホーム（ダッシュボード権限なし） */
.home-hero { position: relative; height: calc(100vh - 72px); min-height: 480px; overflow: hidden; }
.home-hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.home-hero::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(251, 248, 246, .95), rgba(251, 248, 246, 0) 60%); }
.home-hero .in { position: relative; z-index: 1; max-width: 1440px; margin: 0 auto; padding: 18vh 40px; }
.home-hero h1 { font-family: var(--serif); font-weight: 300; font-size: 64px; letter-spacing: .02em; color: var(--wine-deep); }

.foot { border-top: 1px solid var(--line); padding: 32px 40px; text-align: center; font-size: 10px; letter-spacing: .3em; color: var(--ink-3); }

/* フェードイン */
.reveal { opacity: 0; transform: translateY(10px); animation: reveal .9s var(--ease) forwards; }
@keyframes reveal { to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } .reveal { opacity: 1; transform: none; } }

/* ───── レスポンシブ */
/* 端末の目安：iPhone 390 / iPhone Duo 外側 466×678・内側 669×951・内側を横向き 951×669 */
@media (max-width: 1100px) {
  .auth-wrap { grid-template-columns: 1fr 1fr; }
  .top-in { padding: 0 max(24px, env(safe-area-inset-right)) 0 max(24px, env(safe-area-inset-left)); gap: 16px; height: 64px; }
  .menu-toggle { display: block; margin-left: auto; background: none; border: 0; font-size: 22px; color: var(--ink); cursor: pointer; padding: 8px; }
  .nav, .me { display: none; }
  .top.open .nav, .top.open .me { display: flex; }
  .top.open .top-in { flex-wrap: wrap; height: auto; padding-top: 14px; padding-bottom: 16px; }
  .top.open .nav { flex-direction: column; gap: 0; width: 100%; order: 3; }
  .top.open .nav a { padding: 12px 0; border-bottom: 1px solid var(--line-2); }
  .top.open .me { order: 4; width: 100%; padding-top: 12px; flex-wrap: wrap; }
  .filters { top: 64px; }
  .hero-in, .filters-in, .dash, .wrap { padding-left: max(24px, env(safe-area-inset-left)); padding-right: max(24px, env(safe-area-inset-right)); }
  /* KPI：コンパクトな 4 列 */
  .kpi { padding: 18px 16px 16px; }
  .kpi .val { font-size: 30px; margin: 10px 0 12px; }
  .kpi .prog .pl { flex-wrap: wrap; letter-spacing: .02em; }
}
/* 高さが低い画面（Duo 外側・横向き）：ヘッダーの写真を低くし、フィルターは追従させない */
@media (max-height: 760px) {
  .hero { height: 200px; }
  .hero-in { padding-top: 32px; }
  .hero h1 { font-size: 26px; margin: 8px 0 6px; }
  .hero .meta { padding-bottom: 16px; }
  .filters { position: static; }
}
@media (max-width: 760px) {
  .top-in { padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); height: 60px; }
  .brand img { height: 24px; }
  .brand .one { font-size: 22px; padding-left: 10px; }
  .wrap, .dash { padding: 32px max(16px, env(safe-area-inset-right)) 80px max(16px, env(safe-area-inset-left)); }
  .hero { height: 240px; }
  .hero-in { padding: 36px 16px 0; }
  .hero h1 { font-size: 22px; letter-spacing: .1em; }
  .hero .meta { padding-bottom: 18px; gap: 8px 16px; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 4px; }
  .hero::after { background: linear-gradient(90deg, rgba(251, 248, 246, .95), rgba(251, 248, 246, .7)); }
  /* フィルター：スマホでは追従させない（画面を覆わないように）。ラベルは上、操作は全幅 */
  .filters { position: static; }
  .filters-in { padding: 12px max(16px, env(safe-area-inset-right)) 14px max(16px, env(safe-area-inset-left)); gap: 8px; }
  .filters .fl { width: 100%; flex-direction: row; align-items: center; gap: 10px; }
  .filters .fl > span { flex: none; width: 58px; font-size: 9px; letter-spacing: .18em; }
  .filters .fl > select, .filters .fl > input, .filters .fl > .seg { flex: 1; min-width: 0; }
  .filters select.scope, .filters select, .filters input[type=month], .filters input[type=date] { min-width: 0; max-width: none; width: 100%; }
  .seg { display: flex; width: auto; }
  .seg button { flex: 1; padding: 7px 4px; font-size: 12px; letter-spacing: .02em; }
  /* KPI：2 列のコンパクト表示 */
  .kpis { grid-template-columns: repeat(2, 1fr); margin-bottom: 56px; }
  .kpi { padding: 16px 14px 14px; }
  .kpi .lb { font-size: 11px; letter-spacing: .1em; }
  .kpi .lb .u { font-size: 9px; letter-spacing: .04em; }
  .kpi .val { font-size: 26px; margin: 8px 0 10px; }
  .kpi .cmp { font-size: 11px; padding-top: 8px; }
  .kpi .cmp .r { font-size: 13px; }
  .kpi .diff { font-size: 10px; flex-wrap: wrap; gap: 0 6px; }
  .kpi .prog { margin-top: 10px; }
  .kpi .prog .pl { flex-wrap: wrap; font-size: 9px; letter-spacing: .02em; }
  .hero h1 { font-size: 22px; }
  .chart-card { padding: 20px 10px 12px; margin-bottom: 56px; }
  .chart { height: 260px; }
  .legend { gap: 14px; flex-wrap: wrap; }
  /* 内訳：事業名の列を固定し、数値を横にスクロール */
  table.t th, table.t td { padding: 12px 12px; }
  table.t.sticky1 th:first-child, table.t.sticky1 td:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); min-width: 150px; max-width: 168px; white-space: normal; box-shadow: 1px 0 0 var(--line); }
  table.t.sticky1 tfoot td:first-child, table.t.sticky1 thead th:first-child { background: #fffdfc; }
  table.t.sticky1 tbody tr.drill:hover td:first-child { background: var(--blush); }
  .bnum { min-width: 1.8em; }
  .drill-arrow { display: none; }
  .scroll-hint { display: block; }
  /* 一覧・設定の表：1 行を 1 枚のカードに */
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack thead { display: none; }
  table.stack tr { padding: 14px 16px; border-bottom: 1px solid var(--line); }
  table.stack tbody tr:last-child { border-bottom: 0; }
  table.stack td { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 5px 0 !important; border: 0 !important; text-align: right !important; white-space: normal !important; font-family: var(--font) !important; min-height: 30px; }
  table.stack td::before { content: attr(data-label); flex: none; max-width: 45%; text-align: left; color: var(--ink-3); font-size: 11px; letter-spacing: .1em; }
  table.stack td[data-label=""]::before { display: none; }
  table.stack td:empty { display: none; }
  table.stack td > input[type=text], table.stack td > input[type=number] { width: 60% !important; max-width: 60% !important; text-align: left; }
  table.stack td > details { text-align: left; }
  .list-tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .list-tabs > a { flex: none; }
  table.stack td.biz-name { flex-wrap: wrap; justify-content: flex-start; gap: 4px 0; }
  table.stack td.biz-name::before { max-width: none; width: 100%; color: var(--wine); }
  table.stack td.biz-name > input { width: calc(100% - 2.4em) !important; max-width: none !important; font-weight: 500; }
  .list-tabs button { white-space: nowrap; flex: none; padding: 7px 14px; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-art { height: 34vh; min-height: 220px; }
  .auth-copy { left: 24px; bottom: 24px; }
  .auth-copy h1 { font-size: 48px; }
  .auth-side { padding: 40px 16px 56px; }
  .auth-logo { margin-bottom: 32px; }
  .grid2 { grid-template-columns: 1fr; }
  .card { padding: 24px 18px; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .home-hero h1 { font-size: 44px; }
}

/* iPhone Duo 内側（縦向き 669px など、600〜760px）：KPI は 4 列、フィルターは 2 列 */
@media (min-width: 600px) and (max-width: 760px) {
  .kpis { grid-template-columns: repeat(4, 1fr); }
  .kpi { padding: 14px 12px 12px; }
  .kpi .val { font-size: 22px; }
  .kpi .cmp, .kpi .diff { font-size: 10px; }
  .kpi .cmp .r { font-size: 12px; }
  .filters-in { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 20px; }
  .filters .fl:has([data-seg="p"]) { grid-column: 1 / -1; }
  .filters .fl[hidden] { display: none; }
  .grid2 { grid-template-columns: 1fr 1fr; }
}
/* 高さが特に低い画面（Duo 外側 678px）：写真の帯をさらに低く */
@media (max-width: 760px) and (max-height: 700px) {
  .hero { height: 150px; }
  .hero-in { padding-top: 20px; }
  .hero .eyebrow { display: none; }
  .hero h1 { margin-top: 0; }
  .hero .meta { padding-bottom: 12px; }
}
/* ログイン：写真の側は画面の高さに固定（横向きで文字が画面外に出ないように） */
@media (min-width: 761px) {
  .auth-art { position: sticky; top: 0; height: 100vh; height: 100dvh; }
}
/* ログイン：高さが低いスマホ（Duo 外側）は写真の帯を低くし、ボタンまで 1 画面に */
@media (max-width: 760px) and (max-height: 760px) {
  .auth-art { height: 150px; min-height: 0; }
  .auth-art::after { background: linear-gradient(180deg, rgba(46, 34, 38, .15), rgba(46, 34, 38, .6)); }
  .auth-copy { bottom: 16px; }
  .auth-copy .eyebrow { display: none; }
  .auth-copy h1 { font-size: 36px; margin: 0 0 4px; }
  .auth-copy p { font-size: 11px; }
  .auth-side { padding: 22px 16px 40px; }
  .auth-logo { height: 30px; margin-bottom: 18px; }
  .auth-card .lead { margin-bottom: 18px; }
  label.f { margin-bottom: 16px; }
}
/* 幅の狭いスマホ（390px など）：期間のボタンが 1 行に収まるように */
@media (max-width: 440px) {
  .filters .fl > span { width: 46px; letter-spacing: .12em; }
  .seg button { font-size: 11px; padding: 7px 2px; letter-spacing: 0; white-space: nowrap; }
}

/* ───── 項目の詳細（シート） */
.kpi { cursor: pointer; }
.kpi:focus-visible { outline: 2px solid var(--wine); outline-offset: -2px; }
html.sheet-open { overflow: hidden; }
.sheet { width: min(1120px, calc(100vw - 48px)); max-height: calc(100vh - 64px); max-height: calc(100dvh - 64px); padding: 0; border: 0; background: var(--bg); color: var(--ink); box-shadow: 0 30px 80px rgba(46, 34, 38, .28); overflow: auto; overscroll-behavior: contain; }
.sheet::backdrop { background: rgba(46, 34, 38, .42); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.sheet[open] { animation: sheetIn .45s var(--ease); }
@keyframes sheetIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.sheet-in { padding: 36px 40px 44px; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 28px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { font-size: 28px; font-weight: 300; letter-spacing: .16em; margin-top: 6px; }
.sheet-sub { font-size: 12px; color: var(--ink-2); letter-spacing: .1em; margin: 6px 0 0; }
.sheet-close { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); font-size: 22px; line-height: 1; color: var(--ink-2); cursor: pointer; transition: all .2s var(--ease); }
.sheet-close:hover { border-color: var(--wine); color: var(--wine); }
.sheet .section-head h3 { font-size: 13px; letter-spacing: .24em; font-weight: 400; }
.pcards { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); border-left: 1px solid var(--line); margin-bottom: 12px; }
.pcard { background: var(--surface); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 24px 24px 22px; }
.pcard .ph { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.pcard .pl1 { font-size: 13px; letter-spacing: .2em; color: var(--ink); }
.pcard .pl2 { font-size: 11px; color: var(--ink-3); letter-spacing: .06em; }
.pcard .pv { font-family: var(--num); font-weight: 300; font-size: 36px; line-height: 1.2; margin: 12px 0 16px; white-space: nowrap; }
.pcard .pv small { font-size: 12px; color: var(--ink-3); margin-left: 6px; letter-spacing: .08em; }
.pcard .pv.na { color: var(--ink-3); }
.pcard .pt { border-top: 1px solid var(--line-2); padding-top: 8px; }
.pcard .pr { display: grid; grid-template-columns: 1fr auto 72px; gap: 10px; align-items: baseline; padding: 5px 0; font-size: 12px; }
.pcard .pr .k { color: var(--ink-2); }
.pcard .pr .v { text-align: right; color: var(--ink-2); }
.pcard .pr .r { text-align: right; font-size: 14px; }
.pcard .ph2 { font-size: 10px; color: var(--ink-3); letter-spacing: .14em; padding: 0 0 2px; }
.pcard .ph2 .r { font-size: 10px; }
.pcard .prog { margin-top: 14px; }
.pcard .prog .bar { height: 3px; background: var(--line-2); position: relative; }
.pcard .prog .bar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--wine); border-radius: 0 2px 2px 0; }
.pcard .prog .bar b { position: absolute; top: -4px; width: 1px; height: 11px; background: var(--ink-3); }
.pcard .prog .pl { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 10px; letter-spacing: .08em; color: var(--ink-3); margin-top: 8px; }
.pcard .prog .pl .num { font-size: 13px; color: var(--ink-2); }
.sheet-note { margin: 0 0 28px; }
.pcards + .section-head, .sheet-note + .section-head { margin-top: 36px; }
table.mtable th.grp { text-align: center; color: var(--ink-2); border-left: 1px solid var(--line-2); }
table.mtable thead tr:first-child th:first-child { vertical-align: bottom; }
table.mtable td:nth-child(2), table.mtable td:nth-child(4), table.mtable td:nth-child(6) { border-left: 1px solid var(--line-2); }
table.mtable tbody tr.grp td:first-child { font-weight: 500; }
@media (max-width: 1100px) {
  .sheet-in { padding: 28px 24px 36px; }
  .pcard { padding: 18px 16px; }
  .pcard .pv { font-size: 28px; }
}
/* スマホ・Duo 外側：画面いっぱいのシートにし、期間のカードは縦に */
@media (max-width: 760px) {
  .sheet { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; }
  .sheet-in { padding: 0 max(16px, env(safe-area-inset-right)) max(32px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
  .sheet-head { position: sticky; top: 0; z-index: 3; background: var(--bg); padding-top: max(16px, env(safe-area-inset-top)); padding-bottom: 14px; margin-bottom: 20px; align-items: center; }
  .sheet-head .eyebrow { display: none; }
  .sheet-head h2 { margin-top: 0; }
  .sheet-head h2 { font-size: 22px; }
  .pcards { grid-template-columns: 1fr; }
  .pcard .pv { font-size: 30px; margin: 8px 0 10px; }
}
/* Duo 内側（600〜760px）：期間のカードは 3 列のまま */
@media (min-width: 600px) and (max-width: 760px) {
  .pcards { grid-template-columns: repeat(3, 1fr); }
  .pcard { padding: 14px 12px; }
  .pcard .pv { font-size: 22px; }
  .pcard .pr { grid-template-columns: 1fr auto; }
  .pcard .pr .v { display: none; }
  .pcard .ph2 { display: none; }
}
