:root {
  color-scheme: light;
  --bg: #f7f8f5;
  --surface: #ffffff;
  --surface-soft: #f2f6f3;
  --surface-amber: #fff7e7;
  --ink: #1f2933;
  --muted: #5f6d7a;
  --line: #d7ded8;
  --line-strong: #aab8ae;
  --green: #2d6a4f;
  --green-dark: #1f4d39;
  --blue: #315f8c;
  --plum: #7b4969;
  --amber: #b86b16;
  --rose: #a33a4b;
  --shadow: 0 18px 38px rgba(31, 41, 51, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(45, 106, 79, 0.055) 1px, transparent 1px),
    linear-gradient(rgba(49, 95, 140, 0.045) 1px, transparent 1px),
    var(--bg);
  background-size: 34px 34px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

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

button {
  border: 0;
}

.app-shell {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
  padding: 22px 0 14px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--green);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4,
h5,
p {
  margin-top: 0;
}

h1 {
  max-width: 920px;
  margin-bottom: 10px;
  color: #17212b;
  font-size: clamp(2.2rem, 4.4vw, 4.7rem);
  line-height: 1;
  letter-spacing: 0;
}

.lead {
  max-width: 840px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.55;
}

.instagram-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  margin-top: 16px;
  border: 1px solid rgba(123, 73, 105, 0.28);
  border-radius: 8px;
  padding: 0 13px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--plum);
  font-weight: 820;
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(31, 41, 51, 0.06);
}

.instagram-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(31, 41, 51, 0.12);
}

.top-actions,
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.top-actions {
  justify-content: flex-end;
}

.notice {
  border: 1px solid #e2bd76;
  border-left: 5px solid var(--amber);
  border-radius: 8px;
  padding: 14px 16px;
  background: var(--surface-amber);
  color: #4c381d;
  line-height: 1.48;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.status-card {
  min-height: 88px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 26px rgba(31, 41, 51, 0.06);
}

.status-card strong {
  display: block;
  margin-bottom: 5px;
  color: var(--green-dark);
  font-size: 1.28rem;
  line-height: 1.1;
}

.status-card span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 740;
  line-height: 1.32;
}

.tabbar {
  position: sticky;
  top: 0;
  z-index: 8;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 18px 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 12px 30px rgba(31, 41, 51, 0.08);
  backdrop-filter: blur(12px);
}

.tab,
.primary-button,
.quiet-button,
.danger-button,
.file-button {
  min-height: 42px;
  border-radius: 8px;
  cursor: pointer;
  transition:
    transform 150ms ease,
    background 150ms ease,
    border-color 150ms ease,
    box-shadow 150ms ease;
}

.tab {
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 820;
}

.tab.is-active,
.tab:hover {
  background: var(--green);
  color: #fff;
  box-shadow: 0 10px 24px rgba(45, 106, 79, 0.22);
}

.primary-button,
.quiet-button,
.danger-button,
.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid var(--line);
  font-weight: 780;
  white-space: nowrap;
}

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

.quiet-button,
.file-button {
  background: var(--surface);
  color: var(--ink);
}

.danger-button {
  border-color: rgba(163, 58, 75, 0.3);
  background: #fff1f3;
  color: var(--rose);
}

.small-button {
  min-height: 36px;
  padding: 0 11px;
  font-size: 0.86rem;
}

.file-button input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.primary-button:hover,
.quiet-button:hover,
.danger-button:hover,
.file-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(31, 41, 51, 0.12);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(49, 95, 140, 0.24);
  outline-offset: 2px;
}

.view {
  display: none;
}

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

.section-heading,
.panel-heading,
.technique-head,
.area-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.section-heading {
  margin: 24px 0 14px;
}

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

.section-heading h2,
.panel-heading h3,
.technique-head h3,
.area-card-head h3 {
  margin-bottom: 0;
  line-height: 1.15;
}

.section-heading h2 {
  font-size: clamp(1.45rem, 2vw, 2.1rem);
}

.panel-heading h3,
.technique-head h3,
.area-card-head h3 {
  font-size: 1.16rem;
}

.section-note,
.muted {
  max-width: 590px;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.form-grid,
.panel,
.technique-card,
.area-card,
.report-output,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
}

.synthesis-form {
  border: 0;
  box-shadow: none;
  padding: 0;
  background: transparent;
}

label {
  display: grid;
  gap: 7px;
  color: #33414d;
  font-size: 0.85rem;
  font-weight: 780;
}

.wide {
  grid-column: span 2;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

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

input[readonly] {
  background: #f2f5f3;
  color: var(--muted);
}

textarea {
  min-height: 88px;
  resize: vertical;
  padding: 11px;
  line-height: 1.5;
}

input::placeholder,
textarea::placeholder {
  color: #97a3ad;
}

.panel {
  margin-top: 14px;
  padding: 16px;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.check-item {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 10px;
  min-height: 62px;
  padding: 12px;
  border: 1px solid rgba(45, 106, 79, 0.18);
  border-radius: 8px;
  background: var(--surface-soft);
  line-height: 1.35;
}

.check-item input {
  width: 18px;
  min-height: 18px;
  margin-top: 1px;
  accent-color: var(--green);
}

.compact-toolbar {
  min-width: min(520px, 100%);
  align-items: stretch;
}

.compact-toolbar select {
  min-width: 250px;
}

.technique-list {
  display: grid;
  gap: 14px;
}

.technique-card {
  padding: 16px;
}

.technique-head {
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
  padding-bottom: 12px;
}

.technique-head span,
.area-card-head span {
  display: inline-block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 740;
}

.technique-fields {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.empty-state {
  display: grid;
  gap: 6px;
  min-height: 150px;
  align-content: center;
  justify-items: center;
  padding: 26px;
  text-align: center;
}

.empty-state strong {
  color: var(--green-dark);
  font-size: 1.08rem;
}

.empty-state span {
  max-width: 560px;
  color: var(--muted);
  line-height: 1.5;
}

.area-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.area-card {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.area-card-head {
  align-items: center;
  min-height: 70px;
}

.area-card-head select {
  width: min(230px, 100%);
  flex: 0 0 210px;
}

.synthesis-panel {
  margin-top: 18px;
}

.report-output {
  padding: 26px;
  line-height: 1.6;
}

.report-output h3 {
  margin-bottom: 14px;
  font-size: 1.68rem;
  line-height: 1.2;
}

.report-output h4 {
  margin: 24px 0 8px;
  color: var(--green-dark);
  font-size: 1.04rem;
}

.report-output h5 {
  margin: 16px 0 6px;
  color: var(--plum);
  font-size: 0.98rem;
}

.report-output p,
.report-output li {
  color: #2d3843;
}

.report-output ul {
  padding-left: 21px;
}

.report-output table {
  width: 100%;
  margin: 12px 0 18px;
  border: 1px solid var(--line);
  border-collapse: collapse;
  font-size: 0.88rem;
}

.report-output th,
.report-output td {
  border-bottom: 1px solid var(--line);
  padding: 9px;
  text-align: left;
  vertical-align: top;
}

.report-output th {
  background: #eaf1ed;
}

.report-output tr:last-child td {
  border-bottom: 0;
}

.report-header {
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
  padding-bottom: 12px;
}

.report-header p {
  margin-bottom: 5px;
  color: var(--muted);
  font-weight: 720;
}

.report-area {
  break-inside: avoid;
  border-left: 4px solid rgba(123, 73, 105, 0.38);
  margin: 14px 0;
  padding-left: 12px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 32px));
  transform: translateY(14px);
  opacity: 0;
  pointer-events: none;
  border-radius: 8px;
  padding: 12px 14px;
  background: #17212b;
  color: #fff;
  box-shadow: var(--shadow);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 1180px) {
  .topbar,
  .section-heading,
  .panel-heading,
  .technique-head {
    flex-direction: column;
  }

  .status-grid,
  .form-grid,
  .check-grid,
  .technique-fields,
  .area-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .wide {
    grid-column: span 2;
  }

  .top-actions,
  .toolbar {
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 14px;
  }

  h1 {
    font-size: clamp(2.05rem, 11vw, 3.15rem);
  }

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

  .status-grid,
  .form-grid,
  .check-grid,
  .technique-fields,
  .area-grid {
    grid-template-columns: 1fr;
  }

  .wide {
    grid-column: auto;
  }

  .top-actions,
  .toolbar,
  .compact-toolbar {
    width: 100%;
  }

  .primary-button,
  .quiet-button,
  .danger-button,
  .file-button,
  .compact-toolbar select {
    flex: 1 1 150px;
    min-width: 0;
  }

  .area-card-head {
    flex-direction: column;
    align-items: stretch;
  }

  .area-card-head select {
    width: 100%;
    flex: initial;
  }

  .report-output {
    padding: 18px;
    overflow-x: auto;
  }
}

@media print {
  body {
    background: #fff;
  }

  .topbar,
  .notice,
  .status-grid,
  .tabbar,
  .section-heading,
  .toast,
  #caseView,
  #techniquesView,
  #areasView {
    display: none !important;
  }

  .app-shell {
    width: 100%;
    padding: 0;
  }

  #reportView,
  #reportView.is-active {
    display: block;
  }

  .report-output {
    border: 0;
    box-shadow: none;
    padding: 0;
  }

  .report-output table {
    page-break-inside: auto;
  }

  .report-area {
    page-break-inside: avoid;
  }
}
