/* 給与と手取りの推移ノート（やさしい北欧ナチュラル・スタイル） */
:root {
  --bg: #FBF9F5;
  --surface: #FFFFFF;
  --surface-hover: #F8F6F0;
  --surface-border: #E8E3DA;
  --border-light: #F0EDE6;
  
  --text-main: #2D3748;
  --text-sub: #718096;
  --text-muted: #A0AEC0;
  
  --primary: #10B981;        /* やさしいフォレストグリーン（手取り） */
  --primary-light: #ECFDF5;
  --primary-border: #A7F3D0;
  
  --accent-blue: #3B82F6;     /* やわらかなブルー（総支給） */
  --accent-purple: #8B5CF6;   /* 年金・社保 */
  --accent-coral: #F43F5E;    /* 税金 */
  --accent-amber: #F59E0B;    /* 雇用・介護 */
  --deduction-bg: #FFF1F2;    /* 控除 */
  --deduction-border: #FECDD3;
  --deduction-text: #BE123C;

  --bonus-bg: #FEF3C7;
  --bonus-text: #92400E;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --shadow-sm: 0 2px 8px rgba(45, 55, 72, 0.03);
  --shadow-md: 0 4px 16px rgba(45, 55, 72, 0.05);
  --shadow-lg: 0 10px 30px rgba(45, 55, 72, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Zen Maru Gothic', 'M PLUS Rounded 1c', sans-serif;
  background-color: var(--bg);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.6;
  letter-spacing: 0.02em;
}

/* アプリ全体レイアウト */
.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 20px 80px;
}

/* ヘッダー */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--surface-border);
  margin-bottom: 24px;
}

.brand-pill {
  display: inline-block;
  background: var(--primary-light);
  color: #065F46;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 12px;
  border-radius: 20px;
  margin-bottom: 8px;
  border: 1px solid var(--primary-border);
}

.app-header h1 {
  font-size: 26px;
  font-weight: 800;
  color: #1F2937;
  letter-spacing: -0.01em;
}

.header-desc {
  font-size: 13px;
  color: var(--text-sub);
  margin-top: 2px;
}

.family-tag {
  background: var(--primary-light);
  color: #065F46;
  border: 1px solid var(--primary-border);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--shadow-sm);
}

/* ナビゲーションタブ */
.nav-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--surface-border);
  padding-bottom: 10px;
  overflow-x: auto;
}

.tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-sub);
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  padding: 10px 20px;
  border-radius: 24px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.tab-btn:hover {
  background: var(--surface-hover);
  color: var(--text-main);
}

.tab-btn.active {
  background: #FFFFFF;
  color: #065F46;
  border-color: var(--primary-border);
  box-shadow: var(--shadow-sm);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 円グラフ・ヒーローカード */
.hero-pie-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-xl);
  padding: 32px 36px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-md);
}

.pie-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 20px;
}

.section-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: #065F46;
  background: var(--primary-light);
  padding: 2px 10px;
  border-radius: 12px;
  margin-bottom: 6px;
}

.pie-card-header h2 {
  font-size: 22px;
  font-weight: 800;
  color: #1F2937;
}

.pie-card-sub {
  font-size: 13px;
  color: var(--text-sub);
  margin-top: 4px;
}

.pie-filters {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-sub);
  width: 44px;
}

.pills-group {
  display: flex;
  background: #F1F5F9;
  padding: 4px;
  border-radius: 20px;
  gap: 4px;
}

.pill-btn {
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-sub);
  padding: 5px 12px;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.pill-btn.active {
  background: #FFFFFF;
  color: var(--text-main);
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.pie-content-grid {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 40px;
  align-items: center;
}

@media (max-width: 820px) {
  .pie-content-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

.pie-chart-box {
  position: relative;
  width: 100%;
  max-width: 320px;
  height: 300px;
  margin: 0 auto;
}

.pie-center-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}

.center-sub {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-sub);
}

.center-val {
  display: block;
  font-size: 32px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.1;
}

.pie-explanation-box {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pie-stat-row {
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  transition: transform 0.2s;
}

.pie-stat-row.net {
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
}

.pie-stat-row.deduction {
  background: var(--deduction-bg);
  border: 1px solid var(--deduction-border);
}

.stat-badge {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.stat-amount {
  font-size: 28px;
  font-weight: 800;
  color: #1F2937;
  letter-spacing: -0.02em;
}

.pie-stat-row.net .stat-amount { color: #047857; }
.pie-stat-row.deduction .stat-amount { color: var(--deduction-text); }

.stat-rate {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-sub);
  margin-bottom: 6px;
}

.stat-sub-breakdown {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-sub);
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.stat-sub-breakdown strong {
  color: var(--text-main);
}

.stat-note {
  font-size: 12px;
  color: var(--text-sub);
  line-height: 1.5;
}

/* ★新設: グラフカテゴリ切り替えバー★ */
.chart-category-bar {
  background: #FFFFFF;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  padding: 16px 24px;
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}

.category-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.cat-icon {
  font-size: 20px;
}

.category-title h3 {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
}

.cat-hint {
  font-size: 12px;
  color: var(--text-sub);
}

.category-switcher {
  display: flex;
  background: #F1F5F9;
  padding: 4px;
  border-radius: 20px;
  gap: 4px;
}

.cat-btn {
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-sub);
  padding: 8px 18px;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.cat-btn.active {
  background: var(--primary);
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

/* チャートカード */
.chart-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-xl);
  padding: 28px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-sm);
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.chart-header h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
}

.chart-desc {
  font-size: 12px;
  color: var(--text-sub);
  margin-top: 2px;
}

.chart-wrapper {
  position: relative;
  width: 100%;
  height: 380px;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(480px, 1fr));
  gap: 24px;
}

@media (max-width: 768px) {
  .chart-grid {
    grid-template-columns: 1fr;
  }
}

.legend-badge {
  font-size: 12px;
  font-weight: 600;
  margin-left: 12px;
}
.legend-badge.gross { color: #3B82F6; }
.legend-badge.net { color: #10B981; }

/* 年次比較カード */
.annual-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.annual-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.annual-card h4 {
  font-size: 18px;
  font-weight: 800;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 10px;
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  color: var(--text-main);
}

.annual-card h4 span {
  font-size: 11px;
  font-weight: 600;
  background: #F1F5F9;
  color: var(--text-sub);
  padding: 2px 8px;
  border-radius: 12px;
}

.annual-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 8px;
}

.annual-row .label { color: var(--text-sub); }
.annual-row .val { font-weight: 700; }

/* タイムライン */
.timeline-intro {
  margin-bottom: 24px;
}
.timeline-intro h3 { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.timeline-intro p { color: var(--text-sub); font-size: 13px; }

.timeline-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  padding-left: 28px;
}

.timeline-container::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--surface-border);
}

.timeline-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.timeline-card::before {
  content: '';
  position: absolute;
  left: -24px;
  top: 26px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid #FFFFFF;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.4);
}

.timeline-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.tl-date {
  font-size: 12px;
  font-weight: 700;
  color: #065F46;
  background: var(--primary-light);
  padding: 2px 10px;
  border-radius: 12px;
}

.tl-cat {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 6px;
  background: #F1F5F9;
  color: var(--text-sub);
}

.tl-cat.cat-family {
  background: #DCFCE7;
  color: #15803D;
  font-weight: 700;
}

.timeline-card h4 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text-main);
}

.timeline-card p {
  font-size: 13px;
  color: var(--text-sub);
  line-height: 1.6;
}

/* 家族の前提条件カード */
.family-context-card {
  background: #FFFFFF;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.family-card-header .family-tag {
  display: inline-block;
  background: #ECFDF5;
  color: #047857;
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 8px;
}

.family-card-header h3 {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 6px;
}

.family-card-header p {
  font-size: 13px;
  color: var(--text-sub);
}

.family-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.family-member-card {
  background: #F8FAFC;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  padding: 20px;
  border-left: 5px solid #10B981;
}

.family-member-card.second-son {
  border-left-color: #3B82F6;
}

.family-member-card h4 {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.family-member-card h4 .age-pill {
  background: #FFFFFF;
  border: 1px solid var(--surface-border);
  padding: 2px 10px;
  border-radius: 9999px;
  font-size: 12px;
  color: var(--primary);
  font-weight: 700;
}

.family-info-row {
  display: flex;
  font-size: 13px;
  margin-bottom: 6px;
  line-height: 1.5;
}

.family-info-row .label {
  width: 90px;
  color: var(--text-sub);
  flex-shrink: 0;
}

.family-info-row .val {
  color: var(--text-main);
  font-weight: 500;
}

.family-future-tip {
  margin-top: 20px;
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  gap: 12px;
  font-size: 13px;
  line-height: 1.6;
}

.family-future-tip .tip-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.family-future-tip strong {
  color: #92400E;
  display: block;
  margin-bottom: 2px;
}

.family-future-tip p {
  color: #78350F;
  margin: 0;
}

/* 全件台帳テーブル */
.ledger-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.filter-group {
  display: flex;
  gap: 8px;
}

.filter-btn {
  background: #FFFFFF;
  border: 1px solid var(--surface-border);
  color: var(--text-sub);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn.active {
  background: var(--primary-light);
  color: #065F46;
  border-color: var(--primary-border);
}

.year-filter select {
  background: #FFFFFF;
  border: 1px solid var(--surface-border);
  color: var(--text-main);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-family: inherit;
}

.table-container {
  overflow-x: auto;
  background: #FFFFFF;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  white-space: nowrap;
}

.data-table th {
  background: #F8FAFC;
  color: var(--text-sub);
  font-weight: 700;
  text-align: right;
  padding: 12px 16px;
  border-bottom: 1px solid var(--surface-border);
}

.data-table th:first-child,
.data-table th:nth-child(2) {
  text-align: center;
}

.data-table td {
  padding: 12px 16px;
  text-align: right;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-main);
}

.data-table td:first-child,
.data-table td:nth-child(2) {
  text-align: center;
}

.data-table tr.bonus-row {
  background: #FFFDF5;
}

.data-table tr.bonus-row td:nth-child(2) span {
  background: var(--bonus-bg);
  color: var(--bonus-text);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
}

.data-table tr:hover {
  background: #F8FAFC;
}

.note-badge {
  display: inline-block;
  background: #FEF3C7;
  color: #92400E;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
