:root {
  color-scheme: light;
  --bg: #FAF4EC;
  --card: #FFFFFF;
  --border: #EDE2D4;
  --divider: #F4EBDF;
  --ink: #3D3229;
  --text-2: #6B5F51;
  --muted: #8C7F70;
  --faint: #B5A794;
  --error: #C0392B;
  --accent: #D9704C;
  --accent-hover: #C25B39;
  --accent-tint: #F8E4DA;
  --accent-line: #E8C9BB;
  --success: #2E7D46;
  --success-tint: #E9F6EE;
  --warn: #B4690E;
  --warn-tint: #FBEFDD;
  --info: #4A6785;
  --info-tint: #E9EFF6;
  --shadow-card: 0 2px 10px rgba(60, 40, 20, 0.06);
  --focus-ring: 0 0 0 3px rgba(217, 112, 76, 0.18);
  --radius-card: 20px;
  --radius-pill: 999px;
  --radius-icon: 14px;
  --font: "Nunito", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  padding: 40px 20px;
  -webkit-text-size-adjust: 100%;
}

header,
main {
  max-width: 680px;
  margin: 0 auto;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---- Header ---- */

.app-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.app-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-icon);
  flex-shrink: 0;
}

.app-title {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
}

.app-subtitle {
  margin: 4px 0 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-2);
}

.disclaimer {
  margin: 0 0 20px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}

/* ---- Cards & shared bits ---- */

.map-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 20px;
  margin-bottom: 20px;
}

.section-title {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 800;
}

.field-label {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
}

.field-help {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}

.map-input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #FFF;
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  margin-bottom: 14px;
}

textarea.map-input {
  resize: vertical;
  line-height: 1.5;
}

.map-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.field-error {
  margin: -10px 0 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--error);
}

.field-row {
  display: flex;
  gap: 12px;
}

.field-col {
  flex: 1 1 0;
  min-width: 0;
}

/* ---- Buttons ---- */

.btn-primary,
.btn-outline {
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  border-radius: var(--radius-pill);
  padding: 11px 22px;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  color: #FFF;
  border: none;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-outline {
  background: var(--card);
  color: var(--accent-hover);
  border: 1.5px solid var(--accent-line);
}

.btn-outline:hover {
  background: var(--accent-tint);
}

.form-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ---- Guide ---- */

.guide summary {
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
}

.guide-list {
  margin: 12px 0 0;
  padding-left: 20px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-2);
}

.guide-list li {
  margin-bottom: 6px;
}

.guide-note {
  margin: 12px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

/* ---- Add section ---- */

.add-section {
  margin-bottom: 24px;
}

/* ---- List head, search, filters ---- */

.list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.list-head .section-title {
  margin: 0;
}

.report-count {
  font-size: 13px;
  color: var(--muted);
}

.search-input {
  border-radius: var(--radius-pill);
  margin-bottom: 12px;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.filter-chip {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  cursor: pointer;
}

.filter-chip:hover {
  background: var(--accent-tint);
}

.filter-chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #FFF;
}

/* ---- Empty state ---- */

.empty-state p {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-2);
  text-align: center;
}

/* ---- Report card ---- */

.report-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.report-card {
  border-left: 4px solid var(--accent);
}

.report-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.report-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.company-name {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

/* 会社名そのものが「レポートを開く」ボタン */
.company-name-btn {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.company-name-btn::before {
  content: '▸';
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}

.report-card.is-open .company-name-btn::before {
  content: '▾';
}

.company-name-btn:hover {
  color: var(--accent-hover);
}

.company-name-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.report-body {
  margin-top: 4px;
}

.chip {
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  border-radius: var(--radius-pill);
  padding: 3px 10px;
}

.chip-ticker {
  background: var(--accent-tint);
  color: var(--accent-hover);
}

.status-btn {
  font-family: var(--font);
  font-size: 12px;
  font-weight: 800;
  border-radius: var(--radius-pill);
  padding: 4px 12px;
  border: 1.5px solid transparent;
  cursor: pointer;
}

.status-watching {
  background: var(--divider);
  color: var(--text-2);
}

.status-candidate {
  background: var(--accent-tint);
  color: var(--accent-hover);
}

.status-holding {
  background: var(--success-tint);
  color: var(--success);
}

.status-passed {
  background: var(--card);
  border-color: var(--border);
  color: var(--faint);
}

.report-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.text-btn {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  background: none;
  border: none;
  border-radius: var(--radius-pill);
  padding: 6px 10px;
  cursor: pointer;
}

.text-btn:hover {
  background: var(--accent-tint);
  color: var(--accent-hover);
}

.icon-btn {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1;
  color: var(--faint);
  background: none;
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  cursor: pointer;
}

.icon-btn:hover {
  color: var(--error);
  background: rgba(192, 57, 43, 0.08);
}

.report-meta {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.report-meta a {
  color: var(--accent-hover);
}

.info-block {
  margin-top: 14px;
}

.info-label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 4px;
}

.info-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-2);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.asof {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--faint);
}

.no-basics {
  margin: 12px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--faint);
}

/* ---- Notes ---- */

.notes-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--divider);
}

.notes-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.notes-title {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
}

.notes-count {
  font-size: 12px;
  color: var(--muted);
}

.note-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.note-input {
  flex: 1 1 100%;
  margin-bottom: 0;
  font-size: 14px;
}

.note-tag-select {
  flex: 1 1 140px;
  margin-bottom: 0;
  font-size: 14px;
  padding: 9px 12px;
}

.note-add-btn {
  flex: 0 0 auto;
  padding: 9px 20px;
  font-size: 14px;
}

.note-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.note-item {
  padding: 10px 0;
  border-top: 1px solid var(--divider);
}

.note-item:first-child {
  border-top: none;
}

.note-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.note-date {
  font-size: 12px;
  color: var(--faint);
}

.note-head .icon-btn {
  margin-left: auto;
  font-size: 14px;
  width: 26px;
  height: 26px;
}

.note-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-2);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.tag-strength {
  background: var(--success-tint);
  color: var(--success);
}

.tag-risk {
  background: var(--warn-tint);
  color: var(--warn);
}

.tag-event {
  background: var(--info-tint);
  color: var(--info);
}

.tag-idea {
  background: var(--accent-tint);
  color: var(--accent-hover);
}

.earlier-notes {
  margin-top: 4px;
}

.earlier-notes summary {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  padding: 6px 0;
}

.no-notes {
  margin: 0;
  font-size: 13px;
  color: var(--faint);
}

/* ---- Backup ---- */

.backup-note {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-2);
}

.backup-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* ---- Toast ---- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  max-width: calc(100% - 40px);
  background: var(--ink);
  color: var(--bg);
  font-size: 14px;
  font-weight: 700;
  border-radius: var(--radius-pill);
  padding: 10px 20px;
  box-shadow: 0 8px 24px rgba(60, 40, 20, 0.25);
  z-index: 10;
}

/* ---- Narrow screens ---- */

@media (max-width: 480px) {
  body {
    padding: 24px 14px;
  }

  .app-header {
    gap: 12px;
  }

  .app-icon {
    width: 44px;
    height: 44px;
  }

  .field-row {
    display: block;
  }

  .report-actions {
    margin-left: 0;
  }

  .note-add-btn {
    flex: 1 1 auto;
  }
}
