:root {
  --bg: #f4f0e8;
  --bg-2: #e7f2ef;
  --panel: rgba(255, 255, 255, 0.82);
  --panel-strong: #ffffff;
  --text: #17312b;
  --muted: #5f746d;
  --line: rgba(23, 49, 43, 0.12);
  --shadow: 0 20px 50px rgba(13, 33, 29, 0.12);
  --shadow-soft: 0 8px 24px rgba(13, 33, 29, 0.08);
  --brand: #1b7f6a;
  --brand-2: #2a9d8f;
  --brand-3: #0f5d4d;
  --accent: #d97706;
  --danger: #b42318;
  --success: #2f855a;
  --warning: #b7791f;
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--text);
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", "Noto Sans JP", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
  background:
    radial-gradient(circle at top left, rgba(27, 127, 106, 0.16), transparent 34%),
    radial-gradient(circle at right 20%, rgba(217, 119, 6, 0.12), transparent 28%),
    linear-gradient(135deg, var(--bg), var(--bg-2));
}

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

button {
  border: 0;
  background: none;
  color: inherit;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  padding: 12px 14px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

textarea { min-height: 100px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: rgba(27, 127, 106, 0.45);
  box-shadow: 0 0 0 4px rgba(27, 127, 106, 0.12);
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
  border-right: 1px solid rgba(23, 49, 43, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(244, 240, 232, 0.76));
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 10px 10px 22px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.06em;
  background: linear-gradient(145deg, var(--brand), var(--brand-3));
  box-shadow: var(--shadow-soft);
}

.brand h1 {
  margin: 0;
  font-size: 19px;
  line-height: 1.1;
}

.brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

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

.nav button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 13px 14px;
  border-radius: 16px;
  color: var(--muted);
  background: transparent;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.nav button:hover {
  background: rgba(27, 127, 106, 0.08);
  color: var(--text);
  transform: translateX(2px);
}

.nav button.active {
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: var(--shadow-soft);
}

.nav .icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 18px;
}

.mini-card {
  border: 1px solid rgba(23, 49, 43, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
  padding: 16px;
  box-shadow: var(--shadow-soft);
}

.main {
  min-width: 0;
  padding: 24px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  margin-bottom: 22px;
  border: 1px solid rgba(23, 49, 43, 0.08);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-soft);
}

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

.title-wrap p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

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

.content {
  display: grid;
  gap: 18px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
  gap: 18px;
}

.panel {
  border: 1px solid rgba(23, 49, 43, 0.08);
  border-radius: var(--radius-xl);
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.panel.pad {
  padding: 22px;
}

.hero-card {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(140deg, rgba(27, 127, 106, 0.92), rgba(42, 157, 143, 0.84)),
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.14), transparent 30%);
  color: #fff;
}

.hero-card::after {
  content: "";
  position: absolute;
  inset: auto -70px -60px auto;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  filter: blur(8px);
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  font-size: 12px;
  margin-bottom: 16px;
}

.hero h3 {
  margin: 0;
  font-size: clamp(26px, 4vw, 42px);
  line-height: 1.06;
}

.hero p {
  margin: 14px 0 0;
  max-width: 60ch;
  line-height: 1.8;
  color: rgba(255, 255, 255, 0.92);
}

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

.stat {
  padding: 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.stat .value {
  display: block;
  font-size: 30px;
  font-weight: 800;
  line-height: 1.1;
}

.stat .label {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  opacity: 0.92;
}

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

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

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-title h4 {
  margin: 0;
  font-size: 17px;
}

.section-title .hint {
  color: var(--muted);
  font-size: 12px;
}

.cards {
  display: grid;
  gap: 14px;
}

.card {
  padding: 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(23, 49, 43, 0.08);
  box-shadow: var(--shadow-soft);
}

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

.muted { color: var(--muted); }
.tiny { font-size: 12px; }
.strong { font-weight: 700; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge.green { background: rgba(47, 133, 90, 0.12); color: var(--success); }
.badge.amber { background: rgba(183, 121, 31, 0.14); color: var(--warning); }
.badge.rose { background: rgba(180, 35, 24, 0.12); color: var(--danger); }
.badge.teal { background: rgba(27, 127, 106, 0.12); color: var(--brand); }
.badge.gray { background: rgba(95, 116, 109, 0.12); color: var(--muted); }
.badge.attention { background: rgba(217, 119, 6, 0.18); color: #8a4b00; border: 1px solid rgba(217, 119, 6, 0.28); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn:hover { transform: translateY(-1px); }
.btn.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 10px 18px rgba(27, 127, 106, 0.22);
}
.btn.secondary {
  color: var(--text);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
}
.btn.ghost {
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
}
.btn.danger {
  color: #fff;
  background: linear-gradient(135deg, #b42318, #d92d20);
}
.btn.small { min-height: 34px; padding: 0 10px; border-radius: 12px; font-size: 13px; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.toolbar .group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.context-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(27, 127, 106, 0.16);
  background: linear-gradient(135deg, rgba(27, 127, 106, 0.08), rgba(42, 157, 143, 0.05));
}

.table-wrap {
  overflow: auto;
  border-radius: 18px;
  border: 1px solid rgba(23, 49, 43, 0.08);
  background: rgba(255, 255, 255, 0.72);
}

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

th, td {
  padding: 14px 14px;
  border-bottom: 1px solid rgba(23, 49, 43, 0.08);
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  background: rgba(250, 248, 244, 0.96);
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  z-index: 1;
}

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

.list {
  display: grid;
  gap: 12px;
}

.list-item {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(23, 49, 43, 0.08);
}

.attention-item {
  border-color: rgba(217, 119, 6, 0.38);
  background: linear-gradient(180deg, rgba(255, 248, 235, 0.96), rgba(255, 255, 255, 0.98));
  box-shadow: 0 10px 26px rgba(217, 119, 6, 0.12);
}

.list-item-head {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: flex-start;
}

.avatar {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  flex: 0 0 auto;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
}

.stack {
  display: grid;
  gap: 4px;
}

.stack h5 {
  margin: 0;
  font-size: 16px;
}

.stack .meta {
  color: var(--muted);
  font-size: 13px;
}

.item-cell {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.item-photo-cell {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  overflow: hidden;
  flex: 0 0 auto;
  border: 1px solid rgba(23, 49, 43, 0.08);
  background: rgba(231, 242, 239, 0.9);
}

.item-photo-cell.detail {
  width: 72px;
  height: 72px;
  border-radius: 18px;
}

.photo-thumb {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.photo-empty {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  background:
    linear-gradient(135deg, rgba(27, 127, 106, 0.08), rgba(42, 157, 143, 0.18)),
    repeating-linear-gradient(45deg, transparent, transparent 8px, rgba(255, 255, 255, 0.28) 8px, rgba(255, 255, 255, 0.28) 16px);
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.filters > * {
  min-width: 180px;
  flex: 1 1 180px;
}

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

.form-grid.full { grid-template-columns: 1fr; }

.field {
  display: grid;
  gap: 7px;
}

.field label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.photo-upload-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  border: 1px dashed rgba(27, 127, 106, 0.24);
  background: rgba(231, 242, 239, 0.45);
}

.photo-preview {
  width: 100%;
  max-width: 240px;
  aspect-ratio: 4 / 3;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(23, 49, 43, 0.1);
  background: rgba(255, 255, 255, 0.85);
}

.photo-preview .photo-empty {
  font-size: 13px;
}

.photo-paste-target {
  display: grid;
  place-items: center;
  min-height: 48px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px dashed rgba(27, 127, 106, 0.22);
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 13px;
}

.photo-paste-target:focus {
  outline: none;
  border-color: rgba(27, 127, 106, 0.45);
  box-shadow: 0 0 0 4px rgba(27, 127, 106, 0.12);
}

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

.progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}

.progress-track {
  flex: 1 1 auto;
  min-width: 140px;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(23, 49, 43, 0.1);
}

.progress-bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
}

.progress-label {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.camera-capture-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  border: 1px dashed rgba(27, 127, 106, 0.24);
  background: rgba(231, 242, 239, 0.45);
}

.camera-stage {
  overflow: hidden;
  border-radius: 20px;
  border: 1px solid rgba(23, 49, 43, 0.1);
  background: #102722;
}

.camera-preview {
  width: 100%;
  max-height: 320px;
  display: block;
  object-fit: cover;
  aspect-ratio: 4 / 3;
}

.shot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.shot-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
}

.shot-thumb-wrap {
  overflow: hidden;
  border-radius: 16px;
  background: rgba(23, 49, 43, 0.06);
  aspect-ratio: 4 / 3;
}

.shot-thumb {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.shot-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.shot-meta.editable {
  align-items: flex-end;
}

.empty {
  padding: 32px;
  text-align: center;
  color: var(--muted);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: grid;
  place-items: center;
  padding: 18px;
  z-index: 50;
}

.modal {
  width: min(780px, 100%);
  max-height: min(90vh, 900px);
  overflow: auto;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.42);
  box-shadow: 0 30px 80px rgba(12, 24, 22, 0.3);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 22px 12px;
}

.modal-head h3 {
  margin: 0;
  font-size: 20px;
}

.modal-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.modal-body {
  padding: 0 22px 22px;
}

.modal-foot {
  padding: 0 22px 22px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.mobile-nav {
  display: none;
  position: sticky;
  bottom: 0;
  z-index: 30;
  padding: 10px 10px calc(12px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, rgba(244, 240, 232, 0.05), rgba(244, 240, 232, 0.95));
  backdrop-filter: blur(18px);
}

.mobile-nav .wrap {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(23, 49, 43, 0.08);
  box-shadow: var(--shadow-soft);
}

.mobile-nav button {
  display: grid;
  place-items: center;
  gap: 4px;
  padding: 11px 4px 9px;
  border-radius: 16px;
  color: var(--muted);
}

.mobile-nav button.active {
  color: var(--brand);
  background: rgba(27, 127, 106, 0.1);
}

.icon-btn {
  width: 42px;
  min-width: 42px;
  padding: 0;
}

.icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .hero { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .main { padding: 14px; }
  .topbar { padding: 16px; border-radius: 22px; }
  .grid-2, .grid-3, .form-grid { grid-template-columns: 1fr; }
  table { min-width: 680px; }
  .mobile-nav { display: block; }
  .context-banner,
  .card-row,
  .list-item-head,
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }
}

@media print {
  body { background: #fff; }
  .sidebar, .topbar, .mobile-nav, .btn, .toolbar { display: none !important; }
  .panel, .card, .list-item, .table-wrap { box-shadow: none !important; background: #fff !important; }
}
