/* ELW 経営管理システム — App Store Connect Style */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Noto+Sans+JP:wght@300;400;500;700&display=swap');

:root {
  --sidebar-w: 220px;

  /* Backgrounds */
  --bg:       #f2f2f7;
  --surface:  #ffffff;

  /* Borders — thin, only where truly needed */
  --border:   rgba(0,0,0,0.09);
  --border2:  rgba(0,0,0,0.05);

  /* Sidebar */
  --sb-bg:    #1c1c1e;
  --sb-text:  rgba(255,255,255,0.45);
  --sb-border:rgba(255,255,255,0.05);
  --sb-label: rgba(255,255,255,0.18);
  --sb-active:#ffffff;
  --sb-hover: rgba(255,255,255,0.05);
  --sb-active-bg: rgba(255,255,255,0.08);

  /* Text */
  --text:  #1d1d1f;
  --text2: #3d3d3f;
  --muted: #6e6e73;
  --faint: #aeaeb2;

  /* Accent — Apple blue, used ONLY for interactive elements & key numbers */
  --accent:    #0071e3;
  --accent-lt: rgba(0,113,227,0.07);

  /* Semantic — sparingly. red=bad only. accent=highlight. no green in data. */
  --green:      #34c759;
  --green-dark: #248a3d;
  --red:        #ff3b30;
  --red-dark:   #c0392b;
  --amber:      #ff9f0a;
}

/* ── Reset ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; }
body {
  font-family: 'Inter', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sb-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
}
.sidebar-header {
  padding: 24px 18px 20px;
  border-bottom: 1px solid var(--sb-border);
  flex-shrink: 0;
}
.logo { display: flex; align-items: center; gap: 10px; }
.logo-icon { font-size: 20px; }
.logo-title { font-size: 15px; font-weight: 700; color: #fff; letter-spacing: -0.3px; }
.logo-sub { font-size: 10px; color: var(--sb-text); margin-top: 1px; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 10px 0 16px; }
.sidebar-nav::-webkit-scrollbar { display: none; }

.nav-section-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1.8px;
  color: var(--sb-label);
  padding: 16px 18px 5px;
  font-weight: 600;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px 7px 18px;
  cursor: pointer;
  color: var(--sb-text);
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 400;
  transition: color 0.12s;
  margin: 0 8px 1px;
  border-radius: 7px;
}
.nav-item:hover { background: var(--sb-hover); color: rgba(255,255,255,0.75); }
.nav-item.active { color: var(--sb-active); font-weight: 600; background: var(--sb-active-bg); }
.nav-icon { font-size: 13px; width: 17px; flex-shrink: 0; text-align: center; opacity: 0.65; }
.nav-item.active .nav-icon { opacity: 1; }

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--sb-border);
  flex-shrink: 0;
}
.sidebar-date { font-size: 10px; color: var(--sb-label); margin-bottom: 7px; }
.phase-badge {
  font-size: 10px;
  color: rgba(255,255,255,0.6);
  background: rgba(255,255,255,0.07);
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: 500;
}

/* ── Main ── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  overflow-y: auto;
  background: var(--bg);
  min-height: 100vh;
}

/* ── Page Header ── */
.page-header {
  background: var(--surface);
  padding: 36px 48px 28px;
  border-bottom: 1px solid var(--border);
}
.page-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
  line-height: 1.2;
  margin-bottom: 6px;
}
.page-sub {
  font-size: 14px;
  color: var(--muted);
  font-weight: 400;
}

/* Topbar */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 24px 48px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.topbar .page-title { font-size: 20px; margin-bottom: 0; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

/* ── Content ── */
.content { padding: 28px 48px 48px; }

/* ── KPI Cards — no color bars, no shadows, space-based structure ── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.kpi-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 20px 22px;
  border: 1px solid var(--border);
}
.kpi-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 10px;
  letter-spacing: 0.2px;
}
.kpi-val {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.8px;
  margin-bottom: 4px;
  line-height: 1.1;
}
.kpi-sub { font-size: 11px; color: var(--faint); }
.kpi-variance { font-size: 12px; font-weight: 600; margin-top: 8px; }
.kpi-variance.pos { color: var(--green-dark); }
.kpi-variance.neg { color: var(--red-dark); }
.kpi-variance.neu { color: var(--faint); }

/* ── Cards — clean white box, no decorative borders ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; margin-bottom: 14px; }

.card {
  background: var(--surface);
  border-radius: 12px;
  padding: 20px 24px;
  border: 1px solid var(--border);
}
.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: -0.1px;
}
.card-title span { color: var(--muted); font-weight: 400; }

/* ── Tables — rows separated by space, not lines ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: right;
  padding: 8px 12px;
  color: var(--muted);
  font-weight: 500;
  font-size: 11px;
  white-space: nowrap;
  background: transparent;
  border-bottom: 1px solid var(--border);
}
th:first-child { text-align: left; }
td {
  padding: 10px 12px;
  text-align: right;
  color: var(--text2);
  font-size: 13px;
  border-bottom: 1px solid var(--border2);
}
td:first-child { text-align: left; color: var(--text); font-weight: 500; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(0,0,0,0.012); }
/* val-pos: positive delta — subtle, not colorful */
.val-pos { color: var(--text2); font-weight: 600; }
/* val-neg: only red for truly bad numbers (churn, loss) */
.val-neg { color: var(--red-dark); font-weight: 600; }
.val-neu { color: var(--faint); }

/* ── Tabs — underline only for active, no full-width border ── */
.month-tabs { display: flex; gap: 4px; margin-bottom: 16px; flex-wrap: wrap; }
.month-tab {
  padding: 5px 12px;
  border-radius: 7px;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid var(--border);
  color: var(--muted);
  background: var(--surface);
  transition: all 0.1s;
  font-weight: 500;
}
.month-tab:hover { color: var(--text); }
.month-tab.active { background: var(--text); color: #fff; border-color: var(--text); }
/* has-data: just accent dot, don't color the whole tab green */
.month-tab.has-data { color: var(--text); }
.month-tab.active.has-data { background: var(--text); border-color: var(--text); color: #fff; }

/* ── Forms ── */
.input-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }
.form-label { font-size: 11px; color: var(--muted); font-weight: 500; }
.form-label .plan-val { color: var(--accent); font-weight: 700; }
.form-input {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  width: 100%;
  transition: border-color 0.1s;
  font-family: inherit;
}
.form-input:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
}
.form-textarea { resize: vertical; min-height: 72px; }

.btn {
  padding: 7px 16px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  transition: opacity 0.1s;
  letter-spacing: -0.1px;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { opacity: 0.88; }
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg); }
.btn-row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; }

/* FY selector */
.fy-selector {
  padding: 5px 10px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

/* ── Phase cards ── */
.phase-timeline { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.phase-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  position: relative;
}
.phase-card.current { border-color: rgba(0,113,227,0.3); background: rgba(0,113,227,0.03); }
.phase-card.current::after {
  content: 'NOW';
  position: absolute; top: 14px; right: 14px;
  font-size: 9px; background: var(--text); color: #fff;
  padding: 2px 6px; border-radius: 4px; font-weight: 700; letter-spacing: 0.8px;
}
.phase-num { font-size: 9px; color: var(--faint); margin-bottom: 4px; font-weight: 600; text-transform: uppercase; letter-spacing: 1.2px; }
.phase-name { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 4px; letter-spacing: -0.3px; }
.phase-period { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.phase-kpi { font-size: 13px; color: var(--text); font-weight: 700; letter-spacing: -0.2px; }

/* ── Bu tabs — pill style, no underline bar ── */
.bu-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.bu-tab {
  padding: 6px 14px;
  font-size: 12px;
  cursor: pointer;
  color: var(--muted);
  font-weight: 500;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: transparent;
  transition: all 0.1s;
}
.bu-tab:hover { color: var(--text); background: var(--bg); }
.bu-tab.active { color: var(--text); background: var(--surface); font-weight: 600; border-color: var(--border); box-shadow: 0 1px 4px rgba(0,0,0,0.08); }

/* ── Risk ── */
.risk-item { display: flex; gap: 14px; padding: 16px 0; }
.risk-item + .risk-item { border-top: none; }
.risk-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 5px;
  white-space: nowrap;
  height: fit-content;
  margin-top: 2px;
  letter-spacing: 0.3px;
}
.risk-badge.high { background: rgba(255,59,48,0.1); color: var(--red-dark); }
.risk-badge.mid  { background: rgba(255,159,10,0.1); color: #b45309; }
.risk-badge.low  { background: rgba(26,127,46,0.1); color: var(--green-dark); }
.risk-content h4 { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.risk-content p  { font-size: 13px; color: var(--muted); margin-bottom: 5px; line-height: 1.65; }
.risk-hedge { font-size: 13px; color: var(--muted); font-weight: 500; }

/* ── TODO ── */
.todo-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 8px;
}
.todo-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 8px;
  margin-bottom: 2px;
  cursor: pointer;
  transition: background 0.1s;
}
.todo-item:hover { background: var(--bg); }
.todo-check {
  width: 17px; height: 17px;
  border-radius: 5px;
  border: 1.5px solid var(--border);
  flex-shrink: 0;
  margin-top: 2px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px;
  transition: all 0.1s;
  background: #fff;
}
/* todo check: accent blue when done, not green */
.todo-check.done { background: var(--accent); border-color: var(--accent); color: #fff; }
.todo-body { flex: 1; }
.todo-title { font-size: 13px; color: var(--text); margin-bottom: 4px; line-height: 1.4; }
.todo-title.done { text-decoration: line-through; color: var(--faint); }
.todo-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.todo-id { font-size: 10px; color: var(--faint); font-family: monospace; }
.todo-priority { font-size: 10px; font-weight: 700; }
.todo-priority.must { color: var(--red-dark); }
.todo-priority.high { color: #b45309; }
/* med priority: muted, not green */
.todo-priority.med  { color: var(--muted); }
.todo-dep { font-size: 10px; color: var(--faint); }

/* ── Charts ── */
.chart-wrap      { position: relative; height: 200px; }
.chart-wrap-tall { position: relative; height: 260px; }

/* ── Layer items ── */
.layer-item {
  display: flex;
  gap: 18px;
  padding: 18px 20px;
  background: var(--surface);
  border-radius: 12px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
}
.layer-num {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  opacity: 0.06;
  line-height: 1;
  flex-shrink: 0;
  width: 30px;
}
.layer-body h3 { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 5px; }
.layer-body p  { font-size: 13px; color: var(--muted); line-height: 1.7; }

/* utility colors — use sparingly */
.c-green  { color: var(--green-dark); }
.c-red    { color: var(--red-dark); }
.c-gold   { color: #b45309; }
.c-accent { color: var(--accent); }
.c-muted  { color: var(--muted); }

/* KPI variance: pos=accent (not green), neg=red */
.kpi-variance.pos { color: var(--accent); }
.kpi-variance.neg { color: var(--red-dark); }
.kpi-variance.neu { color: var(--faint); }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 2px; }

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 24px; right: 24px;
  background: var(--text);
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.2s;
  z-index: 9999;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }
