:root {
  --bg: #f5f7f6;
  --panel: #ffffff;
  --panel-strong: #edf6f1;
  --ink: #17211c;
  --muted: #607069;
  --line: #dbe4df;
  --brand: #0d7a58;
  --brand-dark: #07513d;
  --accent: #d96c2c;
  --warn: #b85525;
  --blue: #245c8f;
  --shadow: 0 14px 32px rgba(28, 50, 43, 0.1);
  color-scheme: light;
  font-family: "Segoe UI", "Noto Sans JP", Meiryo, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  min-width: 320px;
}

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

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 256px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: #5f7f72;
  color: #f8fbf9;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.account-card,
.project-card,
.report-item,
.report-card,
.photo-card,
.capture-box {
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--brand);
  color: white;
  font-weight: 800;
}

.brand-logo {
  width: 210px;
  height: 64px;
  object-fit: contain;
  object-position: center;
  flex: 0 0 auto;
}

.brand strong {
  display: block;
  font-size: 20px;
}

.brand span,
.account-card span,
.account-card small {
  color: #e2ece7;
  font-size: 12px;
}

.main-nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  border: 0;
  color: #f7fbf8;
  background: transparent;
  text-align: left;
  padding: 12px 14px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
}

.nav-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
  object-position: center;
  flex: 0 0 auto;
  opacity: 0.92;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255, 255, 255, 0.18);
  color: white;
}

.account-card {
  margin-top: auto;
  padding: 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.18);
}

.account-card strong {
  display: block;
  margin: 4px 0;
}

.main {
  padding: 24px clamp(22px, 4vw, 56px);
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

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

h1 {
  font-size: 28px;
  margin-bottom: 0;
}

.page-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
  object-position: center;
  filter: brightness(0);
  flex: 0 0 auto;
}

h2 {
  font-size: 18px;
}

.eyebrow {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 4px;
}

.top-actions,
.quick-stack,
.form-actions,
.format-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.primary-button,
.secondary-button,
.ghost-button,
.text-button {
  min-height: 42px;
  border-radius: 8px;
  padding: 0 16px;
  border: 1px solid transparent;
  font-weight: 700;
}

.primary-button {
  background: var(--brand);
  color: white;
}

.primary-button:hover {
  background: var(--brand-dark);
}

.secondary-button {
  background: #fff3ec;
  color: var(--warn);
  border-color: #f1c9b5;
}

.ghost-button {
  background: white;
  color: var(--ink);
  border-color: var(--line);
}

.text-button {
  background: transparent;
  color: var(--brand-dark);
  padding: 0 8px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.view:not(#home) {
  max-width: 1180px;
  margin: 0 auto;
}

#reports.view {
  max-width: none;
}

.hero-panel,
.panel,
.metric-card,
.detail-header {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hero-panel {
  min-height: 190px;
  background:
    linear-gradient(90deg, rgba(13, 122, 88, 0.92), rgba(13, 122, 88, 0.7)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='900' height='360' viewBox='0 0 900 360'%3E%3Crect width='900' height='360' fill='%23d7e5dc'/%3E%3Crect x='44' y='58' width='232' height='168' rx='8' fill='%2396b6a7'/%3E%3Crect x='314' y='42' width='210' height='240' rx='8' fill='%23f6f0e9'/%3E%3Crect x='552' y='74' width='270' height='176' rx='8' fill='%23b6c8d7'/%3E%3Cpath d='M44 196l80-72 54 42 58-58 40 88z' fill='%236a8f7c'/%3E%3Cpath d='M552 224l82-70 48 38 72-66 68 98z' fill='%237196b0'/%3E%3C/svg%3E");
  background-size: cover;
  background-position: center;
  color: white;
  padding: 28px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.hero-panel p {
  max-width: 660px;
  margin-bottom: 0;
}

.hero-panel .eyebrow {
  color: #dceee6;
}

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

.metric-card {
  padding: 18px;
}

.metric-card span,
.metric-card small {
  color: var(--muted);
}

.metric-card strong {
  display: block;
  font-size: 32px;
  margin: 8px 0;
}

.metric-card.warning strong {
  color: var(--warn);
}

.split-layout,
.mobile-workflow,
.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 18px;
}

.panel {
  padding: 18px;
}

.panel-header,
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.toolbar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}

.search-field,
.select-field,
.input-field,
.textarea-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.search-field {
  flex: 1 1 320px;
}

.select-field {
  min-width: 180px;
}

.full {
  width: 100%;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  min-height: 42px;
  padding: 10px 12px;
}

textarea {
  min-height: 90px;
  resize: vertical;
}

.table-wrap {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow-x: auto;
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 820px;
}

th,
td {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 13px;
  background: #f7faf8;
}

tr:hover td {
  background: #fbfdfc;
}

.status-pill,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--panel-strong);
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 800;
}

.status-pill.sent {
  background: #eef3fa;
  color: var(--blue);
}

.status-pill.warning {
  background: #fff0e5;
  color: var(--warn);
}

.project-list,
.report-list,
.report-cards {
  display: grid;
  gap: 10px;
}

.project-card,
.report-item,
.report-card {
  border-color: var(--line);
  background: white;
  border-radius: 8px;
  padding: 14px;
}

.project-card {
  display: grid;
  gap: 8px;
}

.row-meta {
  display: flex;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  flex-wrap: wrap;
}

.detail-header {
  padding: 18px;
  margin-bottom: 14px;
  display: grid;
  gap: 12px;
}

.detail-title-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
  overflow-x: auto;
}

.tab {
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0 16px;
  font-weight: 800;
  border-bottom: 3px solid transparent;
}

.tab.active {
  color: var(--brand-dark);
  border-color: var(--brand);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}

.photo-card {
  border-color: var(--line);
  border-radius: 8px;
  background: white;
  overflow: hidden;
}

.photo-card.selected {
  outline: 3px solid rgba(13, 122, 88, 0.24);
}

.mock-photo {
  min-height: 145px;
  background:
    linear-gradient(150deg, rgba(19, 36, 29, 0.1), rgba(13, 122, 88, 0.08)),
    var(--photo-bg, #dce7e1);
  position: relative;
}

.mock-photo::after {
  content: "";
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: 18%;
  height: 34%;
  border-radius: 8px 8px 0 0;
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.38);
}

.mock-photo.large {
  width: 132px;
  min-height: 112px;
  border-radius: 8px;
  flex: 0 0 auto;
}

.photo-body {
  padding: 12px;
  display: grid;
  gap: 10px;
}

.photo-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.capture-box {
  border-color: var(--line);
  background: #f7fbf9;
  border-radius: 8px;
  padding: 14px;
  display: flex;
  gap: 14px;
  align-items: center;
  margin: 14px 0;
}

.type-picker {
  border: 0;
  padding: 0;
  margin: 0 0 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.type-picker legend {
  width: 100%;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 8px;
}

.chip {
  border: 1px solid var(--line);
  background: white;
  min-height: 40px;
  border-radius: 999px;
  padding: 0 14px;
  font-weight: 800;
}

.chip.selected,
.chip:hover {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
}

.sticky-note {
  align-self: start;
  background: #fffaf4;
}

.sticky-note li {
  margin: 10px 0;
}

.builder-grid {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

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

.full-width {
  width: 100%;
}

.report-preview {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfbf8;
  min-height: 250px;
  padding: 18px;
}

.preview-page {
  background: white;
  border: 1px solid #ccd7d1;
  border-radius: 4px;
  min-height: 220px;
  padding: 18px;
}

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

.report-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.report-workspace {
  display: grid;
  grid-template-columns: minmax(520px, 720px) minmax(280px, 360px);
  gap: 28px;
  align-items: start;
  width: min(1120px, 100%);
  margin: 0 auto;
}

.report-builder-panel {
  position: sticky;
  top: 24px;
  background: #fff;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 8px 8px 24px;
}

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

.report-builder-panel .form-grid {
  row-gap: 18px;
}

.report-builder-panel .input-field,
.report-builder-panel .select-field,
.report-builder-panel .textarea-field {
  gap: 4px;
}

.report-builder-panel input,
.report-builder-panel select,
.report-builder-panel textarea {
  border: 0;
  border-bottom: 1px solid #cfd9d4;
  border-radius: 0;
  background: transparent;
  padding: 10px 2px 9px;
}

.report-builder-panel input:focus,
.report-builder-panel select:focus,
.report-builder-panel textarea:focus {
  outline: 0;
  border-bottom-color: var(--brand);
  box-shadow: 0 1px 0 var(--brand);
}

.report-builder-panel textarea {
  min-height: 84px;
}

.report-builder-panel .form-actions {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #eef2ef;
}

.report-side-rail {
  display: grid;
  gap: 14px;
}

.report-history-panel {
  min-width: 0;
  box-shadow: 0 8px 20px rgba(28, 50, 43, 0.08);
}

.compact-toolbar {
  margin-bottom: 14px;
  border: 0;
  box-shadow: none;
  background: #f8faf9;
  padding: 12px;
}

.report-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

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

.info-box {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.info-box span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 5px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: #13241d;
  color: white;
  padding: 12px 16px;
  border-radius: 8px;
  opacity: 0;
  transform: translateY(12px);
  transition: 0.2s ease;
  pointer-events: none;
  max-width: min(360px, calc(100vw - 32px));
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

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

  .sidebar {
    height: auto;
    position: static;
    padding: 14px;
  }

  .main-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .nav-item {
    text-align: center;
  }

  .account-card {
    display: none;
  }

  .main {
    padding: 16px;
  }

  .metric-grid,
  .split-layout,
  .mobile-workflow,
  .settings-grid,
  .builder-grid,
  .report-workspace {
    grid-template-columns: 1fr;
  }

  .report-builder-panel {
    position: static;
  }

  .hero-panel,
  .topbar,
  .detail-title-row {
    align-items: stretch;
    flex-direction: column;
  }

  .preview-panel {
    grid-column: auto;
  }
}

@media (max-width: 560px) {
  h1 {
    font-size: 23px;
  }

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

  .hero-panel {
    min-height: 220px;
    padding: 18px;
  }

  .metric-grid {
    gap: 10px;
  }

  .metric-card,
  .panel,
  .detail-header {
    padding: 14px;
  }

  .capture-box,
  .report-card {
    grid-template-columns: 1fr;
    display: grid;
  }

  .mock-photo.large {
    width: 100%;
    min-height: 150px;
  }

  .preview-photo-row,
  .info-grid {
    grid-template-columns: 1fr;
  }
}
