/* 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 26px; }
.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: 200px; max-width: 280px; }
.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: .1em; color: var(--ink-2); padding: 6px 16px; 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.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; }
.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; } }

/* ───── レスポンシブ */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .auth-wrap { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .top-in { padding: 0 16px; gap: 16px; height: 60px; }
  .brand img { height: 24px; }
  .brand .one { font-size: 22px; padding-left: 10px; }
  .menu-toggle { display: block; margin-left: auto; background: none; border: 0; font-size: 22px; color: var(--ink); cursor: pointer; }
  .nav, .me { display: none; }
  .top.open .nav, .top.open .me { display: flex; }
  .top.open .top-in { flex-wrap: wrap; height: auto; 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; }
  .wrap, .dash { padding: 32px 16px 80px; }
  .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 { top: 60px; }
  .filters-in { padding: 12px 16px; gap: 10px 16px; }
  .filters select.scope { min-width: 0; width: 100%; }
  .filters .fl { width: 100%; justify-content: space-between; }
  .kpis { grid-template-columns: 1fr; }
  .kpi .val { font-size: 34px; }
  .chart-card { padding: 20px 12px 12px; }
  .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; }
}
