/* ミセ会計 - 色: 淡い黄色ベース + 淡い青・淡い緑 (文字は濃い色で読みやすく) */
:root {
  --bg: #fffbea;          /* 淡い黄色 (背景) */
  --surface: #ffffff;     /* カード */
  --line: #ece4c4;        /* 枠線 */
  --text: #2a2a24;        /* 文字 */
  --sub: #5c5a4e;         /* 小さい文字 */
  --blue-soft: #dcebfa;   /* 淡い青 (背景用) */
  --blue: #1e5a96;        /* 青 (ボタン・強調) */
  --green-soft: #e2f3e6;  /* 淡い緑 (背景用) */
  --green: #2e7d4f;       /* 緑 (文字・強調) */
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans JP", "Meiryo", "Malgun Gothic", system-ui, sans-serif;
  font-size: 17px;
}

.layout { display: flex; flex-wrap: wrap; min-height: 100vh; }

/* 左メニュー */
.side {
  flex: 0 0 260px;
  max-width: 100%;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 24px 16px;
  display: flex; flex-direction: column; gap: 6px;
}
.brand { padding: 0 12px 20px; display: flex; flex-direction: column; gap: 4px; }
.brand-name { font-size: 23px; font-weight: 700; color: var(--blue); }
.brand-shop { font-size: 15px; color: var(--sub); }
.menu {
  display: flex; align-items: center;
  min-height: 52px; padding: 0 14px; border-radius: 12px;
  color: var(--text); text-decoration: none; font-size: 17px;
}
.menu:hover { background: var(--bg); }
.menu.active { background: var(--blue-soft); color: var(--blue); font-weight: 700; }

/* 右の本体 */
.main {
  flex: 999 1 560px; min-width: 0; max-width: 1200px;
  padding: 28px 36px 40px;
  display: flex; flex-direction: column; gap: 22px;
}
.top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.top-left, .top-right { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
h1 { margin: 0; font-size: 28px; }
h2 { margin: 0 0 8px; font-size: 19px; }

.pill {
  min-height: 44px; padding: 0 16px; border-radius: 22px;
  border: 1px solid var(--line); background: var(--surface);
  font: inherit; font-size: 16px; color: var(--text); cursor: pointer;
}

/* 信号の帯 */
.signal { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-radius: 14px; font-size: 18px; font-weight: 500; }
.signal .dot { width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0; }
.signal.ok { background: var(--green-soft); color: var(--green); }
.signal.ok .dot { background: var(--green); }

/* 今月のまとめ */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.card { background: var(--surface); border-radius: 16px; padding: 20px 22px; display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--line); }
.card .label { font-size: 16px; color: var(--sub); }
.card .num { font-size: 28px; font-weight: 700; }
.card.profit { background: var(--green-soft); border-color: transparent; }
.card.profit .num { color: var(--green); }

/* よく使う操作 */
.actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.act {
  min-height: 84px; border-radius: 16px;
  border: 1px solid var(--line); background: var(--surface);
  font: inherit; font-size: 19px; font-weight: 700; color: var(--text); cursor: pointer;
}
.act:hover { background: var(--blue-soft); }
.act.primary { background: var(--blue); border-color: var(--blue); color: #ffffff; }
.act.primary:hover { background: #174a7c; }

/* 最近の記録 */
.box { background: var(--surface); border-radius: 16px; padding: 20px 22px; border: 1px solid var(--line); }
.empty { color: var(--sub); margin: 8px 0 0; }

/* スマホ幅 */
@media (max-width: 700px) {
  .side { flex: 1 1 100%; border-right: none; border-bottom: 1px solid var(--line); flex-direction: row; flex-wrap: wrap; padding: 12px; }
  .brand { width: 100%; padding: 0 4px 8px; }
  .menu { min-height: 44px; }
  .main { padding: 20px 16px 32px; }
}

/* ===== v0.2 追加: 画面切り替え・経費フォーム ===== */
.view { display: flex; flex-direction: column; gap: 22px; }
.view[hidden] { display: none; }
a.act { display: flex; align-items: center; justify-content: center; text-decoration: none; text-align: center; padding: 0 12px; }

.two-col { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.form { flex: 3 1 480px; min-width: 0; display: flex; flex-direction: column; gap: 22px; padding: 24px 26px; }
.side-col { flex: 2 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }

.row { display: flex; flex-wrap: wrap; gap: 16px; }
.field { flex: 1 1 200px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.wide { flex: 2 1 260px; }
fieldset { border: none; margin: 0; padding: 0; min-width: 0; }
legend, .field > label { font-size: 16px; font-weight: 700; padding: 0 0 8px; }
.field > label { padding: 0; }
input[type="text"], input[type="date"] {
  height: 52px; border: 1px solid #d9d1b0; border-radius: 10px; padding: 0 14px;
  font: inherit; font-size: 18px; color: var(--text); background: #ffffff; width: 100%;
}
input:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid #8fb8e3; outline-offset: 2px; }

.chips-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.chip {
  min-height: 64px; border: 1px solid #d9d1b0; background: #ffffff; border-radius: 12px;
  font: inherit; font-size: 16px; color: var(--text); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 6px;
}
.chip .sub { font-size: 13px; color: var(--sub); }
.chip:hover { background: var(--bg); }
.chip[aria-pressed="true"] { border: 2px solid var(--blue); background: var(--blue-soft); color: var(--blue); font-weight: 700; }
.chip[aria-pressed="true"] .sub { color: var(--blue); }

.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pills.small { margin-top: 8px; }
.pills[hidden] { display: none; }
.opt {
  min-height: 48px; padding: 0 18px; border-radius: 24px; border: 1px solid #d9d1b0; background: #ffffff;
  font: inherit; font-size: 16px; color: var(--text); cursor: pointer;
}
.pills.small .opt { min-height: 44px; font-size: 15px; }
.opt[aria-pressed="true"] { border: 2px solid var(--blue); background: var(--blue-soft); color: var(--blue); font-weight: 700; }
.opt.green[aria-pressed="true"] { border-color: var(--green); background: var(--green-soft); color: var(--green); }

.btn {
  flex: 1 1 160px; min-height: 60px; border-radius: 14px; border: 1px solid #d9d1b0; background: #ffffff;
  font: inherit; font-size: 17px; color: var(--text); cursor: pointer;
}
.btn.primary { flex: 2 1 220px; border: none; background: var(--blue); color: #ffffff; font-size: 19px; font-weight: 700; }
.btn.primary:hover { background: #174a7c; }

.preview { background: var(--green-soft); border-color: transparent; display: flex; flex-direction: column; gap: 12px; }
.preview h2 { color: var(--green); }
.pv-row { display: flex; justify-content: space-between; gap: 12px; font-size: 16px; }
.pv-note { margin: 0; padding-top: 10px; border-top: 1px solid #b9dcc3; font-size: 14px; color: #2a4a35; }

.msg { margin: 0; padding: 12px 16px; border-radius: 10px; font-size: 16px; font-weight: 500; }
.msg.ok { background: var(--green-soft); color: var(--green); }
.msg.ng { background: #fde8e4; color: #a3341f; }

.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 16px; }
.tbl td { padding: 12px 8px; border-bottom: 1px solid #f0ead2; white-space: nowrap; }
.tbl tr:last-child td { border-bottom: none; }
.tbl td.num { text-align: right; font-weight: 700; }
.tbl td.warn { color: #a3501a; font-weight: 500; }
.card.profit.neg { background: #fde8e4; }
.card.profit.neg .num { color: #a3341f; }

/* ===== ログイン画面 ===== */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login-box {
  width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  padding: 40px 32px; display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center;
}
.login-box .brand-name { margin: 0; font-size: 32px; }
.login-lead { margin: 0; font-size: 18px; color: var(--sub); }
.login-btn { display: flex; align-items: center; justify-content: center; width: 100%; flex: none; text-decoration: none; }
