:root {
  --bg: #f2f2f7;
  --card: #ffffff;
  --ink: #000000;
  --mute: #8a8a8e;
  --line: #e5e5ea;
  --fill: rgba(118, 118, 128, 0.12);
  --ok: #248a3d;
  --ok-soft: #e8f5ec;
  --ng: #d70015;
  --ng-soft: #fdecee;
  --warn: #b25000;
  --bar: #c7c7cc;
  --accent: #007aff;
  --fx-bg: #fff6d6;
  --fx-ink: #6b5200;
  --grid: #e5e5ea;
  --sec-bg: #f2f2f7;
  --sales: #2f7fd8;
  --purchase: #d9730d;
  --remain: #8a4fd0;
  --series: var(--sales);
  --goal: #8e8e93;
  --seg-on: #ffffff;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --card: #1c1c1e;
    --ink: #ffffff;
    --mute: #98989f;
    --line: #38383a;
    --fill: rgba(118, 118, 128, 0.24);
    --ok: #30d158;
    --ok-soft: #12301b;
    --ng: #ff453a;
    --ng-soft: #3a1513;
    --warn: #ff9f0a;
    --bar: #48484a;
    --accent: #0a84ff;
    --fx-bg: #2f2a14;
    --fx-ink: #f0d67a;
    --grid: #38383a;
    --sec-bg: #2c2c2e;
    --sales: #3a8ae8;
    --purchase: #cc7a12;
    --remain: #9d6ae0;
    --series: var(--sales);
    --goal: #8e8e93;
    --seg-on: #636366;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --bg: #000000;
    --card: #1c1c1e;
    --ink: #ffffff;
    --mute: #98989f;
    --line: #38383a;
    --fill: rgba(118, 118, 128, 0.24);
    --ok: #30d158;
    --ok-soft: #12301b;
    --ng: #ff453a;
    --ng-soft: #3a1513;
    --warn: #ff9f0a;
    --bar: #48484a;
    --accent: #0a84ff;
    --fx-bg: #2f2a14;
    --fx-ink: #f0d67a;
    --grid: #38383a;
    --sec-bg: #2c2c2e;
    --sales: #3a8ae8;
    --purchase: #cc7a12;
    --remain: #9d6ae0;
    --series: var(--sales);
    --goal: #8e8e93;
    --seg-on: #636366;
    color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}
#app { max-width: 520px; margin: 0 auto; min-height: 100dvh; padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
main { padding: 16px; }
h1 { font-size: 20px; margin: 4px 0 12px; }
h2 { font-size: 16px; margin: 20px 0 8px; }
p { margin: 6px 0; }
.mute { color: var(--mute); font-size: 14px; }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  margin: 12px 0;
}

/* ヘッダー */
.dayhead { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.dayhead .date { font-size: 18px; font-weight: 700; }
.dayhead button { all: unset; cursor: pointer; color: var(--mute); font-size: 14px; text-decoration: underline; }

/* 主役の数字 */
.hero { text-align: center; padding: 22px 16px 18px; border-width: 2px; }
.hero.ok { border-color: var(--ok); background: var(--ok-soft); }
.hero.ng { border-color: var(--ng); background: var(--ng-soft); }
.hero .lead { font-size: 15px; }
.hero .big { font-size: 44px; font-weight: 800; line-height: 1.2; margin: 4px 0; letter-spacing: -0.01em; }
.hero.ok .big { color: var(--ok); }
.hero.ng .big { color: var(--ng); }
.hero .tail { font-size: 15px; font-weight: 600; }
.hero .sub { font-size: 14px; margin-top: 2px; }

.meter { height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 14px 0 6px; position: relative; }
.meter > i { display: block; height: 100%; background: var(--ok); border-radius: 99px; }
.meter.ng > i { background: var(--ng); }
.meterlabel { display: flex; justify-content: space-between; font-size: 13px; color: var(--mute); }


.note { font-size: 14px; color: var(--mute); text-align: center; margin: 4px 0; }

/* 帯 */
.band { border-radius: 12px; padding: 12px 14px; margin: 12px 0; background: var(--ng-soft); color: var(--ng); font-size: 14px; font-weight: 600; border: 1px solid var(--ng); }
.band a { color: inherit; }

/* ボタン */
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0; }
.btn {
  appearance: none; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 12px; padding: 14px 12px; font: inherit; font-weight: 700; cursor: pointer; text-align: center;
  min-height: 48px;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.block { display: block; width: 100%; }
.btn.danger { color: var(--ng); }
.linkbtn { all: unset; cursor: pointer; color: var(--mute); text-decoration: underline; font-size: 14px; }

/* 記録の一覧 */
.list { list-style: none; padding: 0; margin: 0; }
.list li { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .kind { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--line); white-space: nowrap; }
.list .kind.sales { background: var(--ok-soft); color: var(--ok); }
.list .amt { margin-left: auto; font-weight: 700; }
.list .memo { color: var(--mute); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.list .del { all: unset; cursor: pointer; color: var(--mute); padding: 4px 6px; font-size: 13px; }

/* 今週の柱 */
.week { display: grid; gap: 6px; align-items: end; height: 180px; margin: 12px 0 4px; position: relative; }
.week .col { all: unset; cursor: pointer; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; position: relative; }
.week .bar { width: 70%; max-width: 24px; background: var(--series); border-radius: 6px 6px 2px 2px; min-height: 2px; }
.week .col.over .bar { background: var(--ng); }
.week .col.closed .bar { background: transparent; border: 1px dashed var(--line); height: 100% !important; }
.week .capline { position: absolute; left: 0; right: 0; border-top: 2px solid var(--goal); pointer-events: none; }
.weeklabels { display: grid; gap: 6px; text-align: center; font-size: 12px; color: var(--mute); }
.weeklabels .today { color: var(--ink); font-weight: 700; }
.weekvals { display: grid; gap: 6px; text-align: center; font-size: 11px; color: var(--mute); }

/* 今月の棒 */
.mbar { margin: 10px 0; }
.mbar .label { display: flex; justify-content: space-between; font-size: 14px; }
.mbar .track { height: 18px; background: var(--line); border-radius: 6px; position: relative; overflow: visible; margin-top: 4px; }
.mbar .fill { height: 100%; border-radius: 6px; background: var(--bar); }
.mbar.sales .fill { background: var(--ok); }
.mbar .mark { position: absolute; top: -4px; bottom: -4px; border-left: 2px solid var(--ink); }
.rates { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; margin-top: 8px; }
.rates div { background: var(--bg); border-radius: 10px; padding: 8px 4px; }
.rates b { display: block; font-size: 20px; }
.rates span { font-size: 12px; color: var(--mute); }

/* フォーム */
label.field { display: block; margin: 12px 0; }
label.field > span { display: block; font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.inputrow { display: flex; align-items: center; gap: 8px; }
input[type="number"], input[type="text"], input[type="date"], select {
  font: inherit; font-size: 18px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); width: 100%; min-height: 48px;
}
.inputrow input { flex: 1; }
.inputrow .unit { white-space: nowrap; }
.chips { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.chip { all: unset; cursor: pointer; border: 1px solid var(--line); border-radius: 10px; padding: 10px 0; text-align: center; background: var(--card); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.seg { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.seg button { all: unset; cursor: pointer; text-align: center; padding: 10px; font-weight: 700; }
.seg button[aria-pressed="true"] { background: var(--accent); color: #fff; }

/* 下のタブ */
#tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
#tabs[hidden] { display: none; }
#tabs a { text-align: center; padding: 14px 0; color: var(--mute); text-decoration: none; font-weight: 700; font-size: 15px; }
#tabs a.on { color: var(--accent); box-shadow: inset 0 3px 0 var(--accent); }
@media (min-width: 560px) { #tabs { max-width: 520px; margin: 0 auto; border: 1px solid var(--line); border-bottom: 0; border-radius: 14px 14px 0 0; } }

/* ボトムシート */
#sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 20; }
#sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 21;
  max-width: 520px; margin: 0 auto; max-height: 92dvh; overflow: auto;
  background: var(--card); border-radius: 18px 18px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
}
#sheet[hidden], #sheet-backdrop[hidden] { display: none; }
.sheethead { display: flex; justify-content: space-between; align-items: center; }
.sheethead h2 { margin: 0; }
.amountview { font-size: 36px; font-weight: 800; text-align: right; padding: 8px 4px; border-bottom: 2px solid var(--line); margin: 12px 0; min-height: 60px; }
.amountview small { font-size: 16px; font-weight: 600; margin-left: 4px; }
.pad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pad button { all: unset; box-sizing: border-box; cursor: pointer; text-align: center; padding: 14px 0; border-radius: 12px; background: var(--bg); font-size: 22px; font-weight: 700; border: 1px solid var(--line); }
.pad button.unit { font-size: 18px; color: var(--accent); }
.pad button:active { filter: brightness(.92); }

.foot { text-align: center; font-size: 13px; color: var(--mute); margin: 28px 0 8px; }
.foot a { color: var(--mute); }

/* 経費と月払いの仕入れの項目 */
.itemgroup { margin: 14px 0 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.itemgroup:first-child { border-top: 0; padding-top: 0; }
.itemhead { display: flex; justify-content: space-between; font-weight: 700; }
.itemgroup > .mute { margin: 0 0 6px; }
.itemrow { display: grid; grid-template-columns: minmax(0, 1fr) 92px auto 36px; gap: 6px; align-items: center; margin: 6px 0; }
.itemrow .itemname { font-size: 15px; min-width: 0; }
.itemrow input.itemname { font-size: 15px; padding: 8px 10px; min-height: 44px; }
.itemrow .itemamt { font-size: 17px; padding: 8px 10px; min-height: 44px; text-align: right; }
.itemrow .unit { font-size: 13px; color: var(--mute); }
.itemrow .del { all: unset; cursor: pointer; color: var(--mute); font-size: 13px; text-align: center; }
.addrow { display: inline-block; margin: 6px 0 2px; color: var(--accent); }

/* 上のバー（計算式の切り替え） */
#topbar {
  position: sticky; top: 0; z-index: 9;
  display: flex; justify-content: space-between; align-items: center;
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
#topbar .appname { font-size: 13px; font-weight: 700; color: var(--mute); }

/* 計算式 */
.fx {
  font-family: ui-monospace, Menlo, monospace; font-size: 12px; line-height: 1.5;
  background: var(--fx-bg); color: var(--fx-ink); border-radius: 6px; padding: 4px 8px; margin: 6px 0;
  text-align: left;
}

/* エクセル型の表 */
.sheetwrap { margin: 12px 0; border: 1px solid var(--grid); border-radius: 12px; overflow: hidden; background: var(--card); }
.sheet { width: 100%; border-collapse: collapse; font-size: 15px; }
.sheet caption { caption-side: bottom; text-align: right; font-size: 11px; color: var(--mute); padding: 6px 8px; background: var(--card); }
.sheet th, .sheet td { border-top: 1px solid var(--grid); padding: 8px 6px; }
.sheet td { text-align: right; white-space: nowrap; }
.sheet td + td, .sheet th + td { border-left: 1px solid var(--grid); }
.sheet tbody th[scope="row"] { text-align: left; font-weight: 600; font-size: 14px; line-height: 1.3; width: 34%; }
.sheet th small { font-weight: 400; color: var(--mute); font-size: 11px; }
.sheet tr.sec th { background: var(--sec-bg); font-size: 12px; color: var(--mute); text-align: right; font-weight: 600; padding: 6px; }
.sheet tr.sec th:first-child { text-align: left; color: var(--ink); font-size: 14px; }
.sheet tr.sec a { color: inherit; text-decoration: none; }
.sheet tbody:first-of-type tr.sec th { border-top: 0; }
.sheet td.good { color: var(--ok); font-weight: 700; }
.sheet td.bad { color: var(--ng); font-weight: 700; }
.sheet tr.verdict td { text-align: left; font-weight: 700; white-space: normal; }
.sheet tr.verdict.ok td { color: var(--ok); }
.sheet tr.verdict.ng td { color: var(--ng); }
.sheet tr.verdict .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; background: currentColor; }
.sheet tr.verdict .basis { display: block; font-weight: 400; font-size: 12px; color: var(--mute); }
.sheet tr.fxrow td { text-align: left; white-space: normal; border-top: 0; padding: 0 6px 8px; font-family: ui-monospace, Menlo, monospace; font-size: 11.5px; line-height: 1.5; color: var(--fx-ink); }
.sheet tr.fxrow td { background: var(--fx-bg); padding-top: 4px; }

/* 数字の出し方（一覧） */
.flist { list-style: none; padding: 0; margin: 8px 0; }
.flist li { display: flex; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
.flist li:first-child { border-top: 0; }
.fno { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; border-radius: 50%; background: var(--fx-bg); color: var(--fx-ink); font-size: 13px; font-weight: 700; font-style: normal; flex: none; }

/* 計算式モードの図 */
.fviz { border-color: var(--fx-ink); }
.frow { padding: 10px 0; border-top: 1px dashed var(--line); }
.frow:first-of-type { border-top: 0; }
.fhead { display: flex; align-items: center; gap: 8px; }
.fhead .fres { margin-left: auto; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.fres.good { color: var(--ok); }
.fres.bad { color: var(--ng); }
.fterms { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 6px; color: var(--mute); }
.ftok { display: inline-flex; flex-direction: column; align-items: center; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 3px 8px; min-width: 40px; color: var(--ink); }
.ftok small { font-size: 10.5px; color: var(--mute); white-space: nowrap; display: inline-flex; align-items: center; gap: 2px; }
.ftok small .fno { min-width: 14px; height: 14px; font-size: 9px; }
.ftok b { font-size: 15px; font-variant-numeric: tabular-nums; }
.ftok.linked { background: var(--fx-bg); border-color: var(--fx-ink); }
.fop { font-size: 16px; font-weight: 700; padding: 0 1px; }

/* 通常モード: メーター（目安に対する実績） */
.meters { padding-top: 8px; }
.mblock { padding: 8px 0 4px; border-top: 1px solid var(--line); }
.mblock:first-child { border-top: 0; }
.mblock h3 { font-size: 15px; margin: 4px 0 2px; }
.meter2 { margin: 10px 0; }
.m-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 14px; }
.m-label { font-weight: 600; }
.m-val { font-variant-numeric: tabular-nums; white-space: nowrap; }
.m-val b { font-size: 17px; }

/* 通常モード: 目標ライン付きの累計グラフ */
.chart { margin: 4px 0 18px; position: relative; }
.chart figcaption { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 8px; font-size: 15px; }
.c-status { font-size: 12.5px; color: var(--mute); }
.c-status.good { color: var(--ok); }
.c-status.bad { color: var(--ng); font-weight: 600; }
.chart svg { display: block; width: 100%; height: auto; margin-top: 6px; touch-action: pan-y; }
.c-grid { stroke: var(--line); stroke-width: 1; }
.c-tick { font-size: 10px; fill: var(--mute); }
.c-label { font-size: 11px; fill: var(--mute); }
.c-label.strong { fill: var(--ink); font-weight: 700; font-size: 12px; }
.c-goal { fill: none; stroke: var(--goal); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.c-line { fill: none; stroke: var(--series); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.c-area { fill: var(--series); opacity: .1; }
.c-dot { fill: var(--series); stroke: var(--card); stroke-width: 2; }
.c-cross { stroke: var(--mute); stroke-width: 1; }
.c-hit { fill: transparent; cursor: crosshair; }
.c-tip { position: absolute; right: 0; top: 0; width: max-content; max-width: 100%; background: var(--ink); color: var(--card); font-size: 12px; border-radius: 6px; padding: 4px 8px; pointer-events: none; font-variant-numeric: tabular-nums; }
.c-legend { display: flex; gap: 14px; font-size: 12px; color: var(--mute); margin-top: 2px; }
.c-legend i { display: inline-block; width: 16px; height: 0; border-top: 2px solid; vertical-align: middle; margin-right: 4px; }
.k-goal { border-color: var(--goal) !important; }
.k-line { border-color: var(--series) !important; }

/* 中央＝目安のメーター（多ければ右・少なければ左） */
.m-axis { display: grid; grid-template-columns: 1fr auto 1fr; font-size: 11px; color: var(--mute); padding: 4px 0 6px; border-bottom: 1px solid var(--line); }
.m-axis span:first-child { text-align: left; }
.m-axis span:nth-child(2) { font-weight: 700; color: var(--ink); }
.m-axis span:last-child { text-align: right; }
.m-track { position: relative; height: 22px; background: linear-gradient(var(--line), var(--line)) center / 100% 8px no-repeat; border-radius: 4px; margin-top: 6px; }
.m-bar { position: absolute; top: 3px; bottom: 3px; background: var(--series); }
.m-bar.r { border-radius: 0 4px 4px 0; }
.m-bar.l { border-radius: 4px 0 0 4px; }
.m-bar.bad { background: var(--ng); }
.m-bar.short { background: var(--goal); }
.m-center { position: absolute; left: 50%; top: -2px; bottom: -2px; width: 2px; margin-left: -1px; background: var(--ink); border-radius: 1px; }
.m-over { position: absolute; top: 2px; font-size: 11px; font-style: normal; color: var(--mute); line-height: 18px; }
.m-over.r { right: -2px; }
.m-over.l { left: -2px; }
.m-diff { position: absolute; top: 0; line-height: 22px; font-size: 12px; font-weight: 700; color: var(--ink); white-space: nowrap; font-variant-numeric: tabular-nums; }
.m-diff.in { color: #fff; }
.m-status { font-size: 12.5px; margin-top: 4px; color: var(--mute); }
.m-status.good::first-letter { color: var(--ok); }
.m-status.bad { color: var(--ng); font-weight: 600; }

/* 目安との差グラフ */
.c-center { stroke: var(--ink); stroke-width: 2; }
.c-tick.strong { fill: var(--ink); font-weight: 700; }
.c-bar { fill: var(--series); }
.c-bar.bad { fill: var(--ng); }
.c-bar.short { fill: var(--goal); }
.c-bar.closed { opacity: .55; }
.c-legend .sw { display: inline-block; width: 10px; height: 10px; border: 0; border-radius: 2px; vertical-align: -1px; margin-right: 4px; background: var(--series); }
.c-legend .sw.bad { background: var(--ng); }
.c-legend .sw.short { background: var(--goal); }
.c-legend { flex-wrap: wrap; }

/* TOP: 今月の目標額と累計の% */
.hero.top { text-align: left; padding: 14px 16px 6px; }
.goals { padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.g-title { font-size: 12px; font-weight: 700; }
.g-row { display: flex; flex-wrap: wrap; gap: 2px 16px; font-size: 14px; margin-top: 2px; }
.g-row b { font-size: 16px; }
.g-row small { font-size: 12px; color: var(--mute); margin-left: 2px; }
.prog { padding: 12px 0 10px; }
.prog + .prog { border-top: 1px solid var(--line); }
.p-head { display: flex; justify-content: space-between; align-items: baseline; }
.p-title { font-weight: 700; font-size: 15px; }
.p-title small { font-weight: 400; font-size: 12px; color: var(--mute); margin-left: 4px; }
.p-rate { font-size: 34px; font-weight: 800; line-height: 1.1; }
.p-rate small { font-size: 18px; margin-left: 1px; }
.p-rate.bad { color: var(--ng); }
.p-track { position: relative; height: 14px; background: var(--line); border-radius: 99px; margin-top: 6px; }
.p-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px; background: var(--series); }
.p-fill.bad { background: var(--ng); }
.p-fill.short { background: var(--goal); }
.p-over { position: absolute; right: 4px; top: 0; font-size: 10px; line-height: 14px; color: #fff; font-style: normal; }
.p-mark { position: absolute; top: -5px; bottom: -5px; width: 2px; margin-left: -1px; background: var(--ink); border-radius: 1px; }
.p-marklabel { position: relative; transform: translateX(-50%); width: max-content; font-size: 11px; color: var(--ink); margin-top: 3px; }
.p-sub { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--mute); margin-top: 2px; }
.p-status { font-size: 13.5px; margin-top: 6px; color: var(--mute); }
.p-status.good { color: var(--ok); }
.p-status.bad { color: var(--ng); font-weight: 600; }

/* 今日入れたもの: 1日の目安と今日の仕入れ */
.vs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0 2px; }
.vs-col { background: var(--bg); border-radius: 10px; padding: 8px 10px; }
.vs-col span { display: block; font-size: 12px; color: var(--mute); }
.vs-col b { font-size: 22px; }
.vs-col b.over { color: var(--ink); }
.todaycard .meter2 { margin: 8px 0 4px; }

/* ===== 配信ネタ帳に合わせた見た目（iOSの設定画面の形） ===== */
body { font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Hiragino Sans", "Noto Sans JP", sans-serif; }
h1 { font-size: 28px; font-weight: 700; letter-spacing: .01em; }
.card { border: 0; border-radius: 18px; padding: 16px; }
.card h2 { font-size: 17px; font-weight: 600; }
.hero, .hero.ok, .hero.ng { background: var(--card); border: 0; }
.hero.ok .big { color: var(--ink); }
.band { border: 0; border-radius: 14px; }

/* ボタン: 特別な色にしない（灰色の丸ボタン＋青い文字） */
.btn, .btn.primary {
  background: var(--fill); color: var(--accent); border: 0; border-radius: 999px;
  font-weight: 600; min-height: 50px;
}
.btn.danger { color: var(--ng); }
.linkbtn, .dayhead button { color: var(--accent); text-decoration: none; }
.addrow { color: var(--accent); text-decoration: none; }
.pad button { background: var(--fill); border: 0; }
.pad button.unit { color: var(--accent); }
.pad button[data-save] { background: var(--fill) !important; color: var(--accent) !important; }

/* 入力欄・切り替え（iOSのセグメント） */
input[type="number"], input[type="text"], input[type="date"], select { background: var(--fill); border: 0; border-radius: 10px; }
.chips { background: var(--fill); border-radius: 10px; padding: 3px; gap: 2px; }
.chip { border: 0; border-radius: 8px; padding: 8px 0; background: transparent; font-size: 15px; }
.chip[aria-pressed="true"] { background: var(--seg-on); color: var(--ink); font-weight: 700; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.seg { background: var(--fill); border: 0; border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border-radius: 8px; padding: 8px; font-weight: 600; }
.seg button[aria-pressed="true"] { background: var(--seg-on); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.15); }

/* 下のタブ・上のバー */
#tabs { background: color-mix(in srgb, var(--card) 88%, transparent); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-top: 1px solid var(--line); }
#tabs a { font-weight: 600; font-size: 13px; }
#tabs a.on { color: var(--accent); box-shadow: none; }
#topbar { background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-bottom: 0; }

/* 記録の種類 */
.list .kind { background: var(--fill); color: var(--mute); }
.list .kind.purchase { background: color-mix(in srgb, var(--purchase) 16%, transparent); color: var(--purchase); }
.list .kind.sales { background: color-mix(in srgb, var(--sales) 16%, transparent); color: var(--sales); }

/* グラフ: 仕入れ＝オレンジ・売上＝青・残り＝むらさき（色は種類、良し悪しは ✓ / ! と文字で） */
.s-purchase { --series: var(--purchase); }
.s-sales { --series: var(--sales); }
.s-remain { --series: var(--remain); }
.c-bar, .c-bar.bad, .c-bar.short { fill: var(--series); }
.m-bar, .m-bar.bad, .m-bar.short { background: var(--series); }
.p-fill, .p-fill.bad, .p-fill.short, .p-fill.good { background: var(--series); }
.week .bar { background: var(--purchase); }
.mbar .fill { background: var(--goal); }
.mbar.sales .fill { background: var(--sales); }
.mbar.purchase .fill { background: var(--purchase); }
.m-diff.in { color: #fff; }
.k-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: 0; background: var(--series); }
.sheet, .sheetwrap { border-color: var(--line); }
.sheetwrap { border: 0; border-radius: 18px; }
.vs-col { background: var(--fill); }
.fviz { border: 0; }

/* グラフモード｜計算式モード（iOSのセグメント） */
#modeswitch { display: inline-grid; grid-template-columns: 1fr 1fr; background: var(--fill); border-radius: 9px; padding: 2px; gap: 2px; }
#modeswitch button { appearance: none; border: 0; background: transparent; color: var(--ink); font: inherit; font-size: 13px; font-weight: 500; padding: 6px 10px; border-radius: 7px; cursor: pointer; min-height: 32px; white-space: nowrap; }
#modeswitch button[aria-pressed="true"] { background: var(--seg-on); font-weight: 700; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
@media (max-width: 360px) { #topbar .appname { display: none; } }
