:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-soft: #fbfaf6;
  --ink: #202522;
  --muted: #68726c;
  --line: #dad7ce;
  --teal: #14756f;
  --teal-dark: #0d5752;
  --yellow: #f3c63f;
  --yellow-soft: #fff4c2;
  --green: #2e7d4f;
  --red: #b44b40;
  --blue: #386fa4;
  --shadow: 0 18px 45px rgba(31, 38, 35, 0.08);
  font-family: "Yu Gothic", "Meiryo", "Hiragino Kaku Gothic ProN", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--teal-dark);
}

.icon-sprite {
  display: none;
}

.app-shell {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  min-height: 100vh;
}

.side-nav {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px;
  background: #292d28;
  color: #f8f5e9;
}

.brand-block {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 12px;
  align-items: center;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: var(--yellow);
  color: #24231d;
  font-weight: 800;
}

.brand-block h1,
.topbar h2,
.section-title h3,
.panel-heading h4 {
  margin: 0;
  letter-spacing: 0;
}

.brand-block h1 {
  font-size: 20px;
  line-height: 1.3;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.side-nav .eyebrow {
  color: rgba(248, 245, 233, 0.62);
}

.view-tabs {
  display: grid;
  gap: 8px;
}

.nav-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: transparent;
  color: #f8f5e9;
  text-align: left;
}

.nav-button.is-active {
  border-color: var(--yellow);
  background: rgba(243, 198, 63, 0.15);
}

.source-box {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(248, 245, 233, 0.78);
  font-size: 13px;
  line-height: 1.6;
}

.source-box p {
  margin: 0;
}

.source-box a {
  display: inline-flex;
  margin-top: 10px;
  color: var(--yellow);
  font-weight: 700;
  text-decoration: none;
}

.workspace {
  min-width: 0;
  padding: 24px;
}

.topbar,
.section-title,
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  margin-bottom: 18px;
}

.topbar h2 {
  font-size: 30px;
  line-height: 1.2;
}

.role-switch,
.filter-group {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.role-pill,
.filter-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.role-pill.is-active,
.filter-button.is-active {
  background: var(--ink);
  color: #fff;
}

.filter-button svg,
.primary-button svg,
.search-field svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metric-strip article {
  min-height: 104px;
  padding: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric-strip span,
.metric-strip small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.metric-strip strong {
  display: block;
  margin: 8px 0 6px;
  font-size: 23px;
  line-height: 1.2;
}

.view-panel {
  display: none;
}

.view-panel.is-active {
  display: block;
}

.section-title {
  margin-bottom: 14px;
}

.section-title h3 {
  font-size: 22px;
  line-height: 1.3;
}

.save-state,
.status-dot,
.private-badge,
.sheet-link {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.save-state.positive,
.status-dot {
  border-color: rgba(46, 125, 79, 0.24);
  background: rgba(46, 125, 79, 0.1);
  color: var(--green);
}

.status-dot.amber {
  border-color: rgba(243, 198, 63, 0.38);
  background: var(--yellow-soft);
  color: #755a00;
}

.private-badge {
  border-color: rgba(180, 75, 64, 0.25);
  background: rgba(180, 75, 64, 0.08);
  color: var(--red);
}

.staff-grid,
.family-grid,
.admin-grid,
.requirements-grid {
  display: grid;
  gap: 14px;
}

.staff-grid {
  grid-template-columns: minmax(220px, 0.75fr) minmax(360px, 1.25fr) minmax(300px, 1fr);
}

.family-grid {
  grid-template-columns: minmax(280px, 0.75fr) minmax(0, 1.25fr);
}

.admin-grid,
.requirements-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.wide-panel {
  grid-column: 1 / -1;
}

.visual-panel {
  padding: 0;
  overflow: hidden;
  background: #ece9df;
}

.visual-panel img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 290px;
  object-fit: cover;
}

.panel-heading {
  margin-bottom: 14px;
}

.panel-heading h4 {
  font-size: 16px;
}

.search-field {
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: center;
  gap: 8px;
  width: min(170px, 100%);
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
}

.search-field input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
}

.user-list,
.record-list,
.feature-list,
.issue-list,
.success-list,
.screen-map,
.phase-track {
  display: grid;
  gap: 10px;
}

.user-card,
.record-row,
.feature-card,
.issue-card,
.success-item,
.screen-card,
.phase-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.user-card {
  width: 100%;
  text-align: left;
}

.user-card.is-active {
  border-color: var(--teal);
  background: rgba(20, 117, 111, 0.08);
}

.user-main,
.record-main,
.feature-top,
.phase-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.user-name,
.record-title,
.feature-name,
.phase-name {
  font-weight: 800;
}

.user-meta,
.record-meta,
.feature-desc,
.phase-desc,
.issue-card p,
.success-item p,
.screen-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.mini-tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  background: #ede9dd;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.mini-tag.high {
  background: rgba(180, 75, 64, 0.11);
  color: var(--red);
}

.mini-tag.mvp {
  background: rgba(46, 125, 79, 0.12);
  color: var(--green);
}

.record-form {
  display: grid;
  gap: 14px;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

label {
  display: grid;
  gap: 7px;
}

label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--ink);
  outline-color: var(--teal);
}

input,
select {
  min-height: 42px;
  padding: 0 10px;
}

textarea {
  min-height: 96px;
  padding: 10px;
  resize: vertical;
  line-height: 1.6;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.primary-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--ink);
  font-weight: 800;
}

.primary-button {
  background: var(--ink);
  color: #fff;
}

.ghost-button {
  background: transparent;
  color: var(--ink);
}

.preview-stack {
  display: grid;
  gap: 12px;
}

.record-preview {
  padding: 12px;
  border-left: 4px solid var(--teal);
  background: var(--surface-soft);
}

.record-preview.internal {
  border-left-color: var(--red);
}

.record-preview span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.record-preview p {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.7;
}

.record-row {
  width: 100%;
  text-align: left;
}

.record-row.is-active {
  border-color: var(--blue);
  background: rgba(56, 111, 164, 0.08);
}

.family-detail {
  display: grid;
  gap: 14px;
}

.detail-title {
  margin: 0;
  font-size: 22px;
}

.detail-body {
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  line-height: 1.8;
  white-space: pre-wrap;
}

.confirm-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.confirm-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--green);
  background: rgba(46, 125, 79, 0.1);
  color: var(--green);
  font-weight: 800;
}

.confirm-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.comment-box {
  display: grid;
  gap: 10px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  line-height: 1.55;
}

th {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.feature-card {
  grid-template-columns: 1fr;
}

.feature-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.lead-text {
  margin: 0 0 14px;
  font-size: 16px;
  line-height: 1.8;
}

.success-item {
  grid-template-columns: 132px 1fr;
}

.success-item strong,
.issue-card strong,
.screen-card strong {
  font-size: 14px;
}

.issue-card {
  grid-template-columns: minmax(140px, 0.34fr) minmax(0, 1fr);
}

.screen-map {
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  align-items: stretch;
}

.screen-card {
  min-height: 160px;
  border-top: 4px solid var(--teal);
}

.phase-track {
  grid-template-columns: repeat(5, minmax(150px, 1fr));
}

.phase-card {
  border-top: 4px solid var(--yellow);
}

.empty-state {
  margin: 0;
  padding: 20px;
  border: 1px dashed var(--line);
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .side-nav {
    position: static;
    height: auto;
  }

  .view-tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .source-box {
    margin-top: 0;
  }

  .staff-grid,
  .family-grid,
  .admin-grid,
  .requirements-grid {
    grid-template-columns: 1fr;
  }

  .screen-map,
  .phase-track {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .workspace,
  .side-nav {
    padding: 16px;
  }

  .topbar,
  .section-title,
  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .role-switch,
  .filter-group,
  .view-tabs,
  .metric-strip,
  .field-row,
  .screen-map,
  .phase-track {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .role-switch,
  .filter-group {
    display: grid;
  }

  .metric-strip {
    display: grid;
  }

  .success-item,
  .issue-card {
    grid-template-columns: 1fr;
  }

  .topbar h2 {
    font-size: 24px;
  }
}
