:root {
  --bg: #f4f6f2;
  --ink: #202522;
  --muted: #65716d;
  --soft: #eef3ef;
  --surface: #fffdf9;
  --surface-2: #f8faf6;
  --line: #d9e1dc;
  --line-strong: #bfcbc4;
  --accent: #2f6f68;
  --accent-dark: #214f4b;
  --gold: #b98944;
  --blue: #3f667d;
  --success: #31745a;
  --warning: #a96e2b;
  --danger: #b94a48;
  --shadow: 0 10px 28px rgba(32, 37, 34, 0.08);
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  font-size: 15px;
  line-height: 1.65;
  letter-spacing: 0;
}

a { color: inherit; text-decoration: none; }

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

.app-shell {
  width: min(100%, 980px);
  margin: 0 auto;
  min-height: 100vh;
  padding: 12px 16px 64px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  padding: 10px 0 12px;
  background: rgba(244, 246, 242, 0.96);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(217, 225, 220, 0.8);
}

.brand {
  display: grid;
  gap: 1px;
  min-width: 118px;
}

.brand span {
  font-size: 18px;
  font-weight: 900;
  line-height: 1.15;
}

.brand small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
}

.nav {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav::-webkit-scrollbar { display: none; }

.nav a,
.button,
button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 13px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 1px 0 rgba(32, 37, 34, 0.03);
}

button:disabled {
  cursor: progress;
  opacity: .68;
}

.nav a {
  min-height: 38px;
  padding: 8px 12px;
  color: var(--muted);
  background: transparent;
  box-shadow: none;
}

.nav a.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.button:hover,
button:hover,
.nav a:hover {
  border-color: var(--accent);
}

.danger {
  background: #fff3f2;
  border-color: #ebb2af;
  color: var(--danger);
}

.button:focus-visible,
button:focus-visible,
.nav a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(47, 111, 104, 0.22);
  outline-offset: 2px;
}

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

.primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.ghost {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--accent-dark);
}

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

.guide-section {
  display: grid;
  gap: 12px;
}

.page-head {
  padding: 16px 2px 2px;
}

.page-head h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.18;
  letter-spacing: 0;
}

.page-head p {
  margin: 6px 0 0;
  color: var(--muted);
}

.split {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.panel,
.client-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 16px;
}

.panel h2,
.client-card h2 {
  margin: 0 0 10px;
  font-size: 18px;
  line-height: 1.35;
  letter-spacing: 0;
}

.panel h3,
.panel h4 {
  margin: 12px 0 6px;
}

.muted { color: var(--muted); }

.flash,
.error {
  margin: 10px 0 14px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #fff7e7;
  border: 1px solid #e7c885;
  white-space: pre-line;
}

.error {
  color: var(--danger);
  background: #fff2f1;
  border-color: #e0a9a6;
}

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

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

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

.client-card {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  border-left: 4px solid var(--accent);
}

.client-card p {
  margin: 0 0 6px;
  color: var(--muted);
}

.client-card small,
.list-row small {
  color: var(--muted);
  font-weight: 700;
}

.card-actions {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.list-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.list-row:first-of-type { border-top: 0; }

.list-row p {
  margin: 2px 0;
  color: var(--muted);
}

.link-row {
  display: flex;
  border-radius: 6px;
}

.link-row:hover {
  background: var(--surface-2);
}

.pill,
.status-pill,
.day-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
}

.pill {
  background: #edf2ee;
  color: var(--accent-dark);
  border: 1px solid var(--line);
}

.day-badge {
  flex: 0 0 auto;
  background: var(--ink);
  color: #fff;
  width: fit-content;
  min-width: 64px;
}

.status-pill {
  margin-left: auto;
  flex: 0 0 auto;
}

.status-pill.done {
  background: #e7f2eb;
  color: var(--success);
  border: 1px solid #bfd7c7;
}

.status-pill.pending {
  background: #fff2de;
  color: var(--warning);
  border: 1px solid #e7c996;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.quick-actions .button {
  min-height: 46px;
  padding: 8px 6px;
  font-size: 14px;
}

.form-stack,
.form-grid {
  display: grid;
  gap: 13px;
}

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

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  font-size: 16px;
}

input::placeholder,
textarea::placeholder {
  color: #9aa7a1;
}

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

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

.history-section {
  box-shadow: none;
}

.history-section h2 {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.history-item {
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.history-section h2 + .history-item,
.history-item:first-of-type {
  border-top: 0;
}

.history-item strong {
  color: var(--ink);
}

.status-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 140px minmax(180px, 1.4fr) auto;
  gap: 8px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.status-row:first-of-type { border-top: 0; }

.tour-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  border-left: 4px solid var(--gold);
}

.tour-banner p {
  margin: 0;
  color: var(--muted);
}

.tour-intro {
  border-left: 4px solid var(--accent);
}

.tour-intro p,
.mini-step p,
.tour-step p {
  color: var(--muted);
}

.tour-progress {
  display: grid;
  gap: 10px;
  background: var(--surface-2);
}

.progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.progress-head h2 { margin: 0; }

.progress-head strong {
  font-size: 22px;
  color: var(--accent-dark);
}

.progress-bar {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe7e2;
}

.progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.tour-timeline {
  display: grid;
  gap: 14px;
}

.tour-step {
  display: grid;
  gap: 14px;
  border-left: 4px solid var(--warning);
}

.tour-step.is-done {
  border-color: var(--success);
  background: #fbfdf8;
}

.upload-panel {
  display: grid;
  gap: 12px;
  border-left: 4px solid var(--blue);
}

.screenshot-result {
  display: grid;
  gap: 10px;
  border-left: 4px solid var(--accent);
}

.screenshot-result .screenshot-head {
  margin-bottom: 0;
}

.result-summary {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
}

.analysis-review {
  display: grid;
  gap: 5px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.analysis-review.compact {
  margin: 8px 0;
  padding: 10px 12px;
}

.analysis-review p {
  margin: 0;
}

.review-label {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
}

.analysis-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.analysis-facts span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 13px;
}

.analysis-facts strong {
  color: var(--muted);
  font-size: 12px;
}

.analysis-facts.compact {
  gap: 6px;
  margin-bottom: 8px;
}

.upload-form .wide textarea {
  min-height: 88px;
}

.upload-status {
  min-height: 22px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.upload-status[data-tone="working"] {
  color: var(--blue);
}

.upload-status[data-tone="ok"] {
  color: var(--success);
}

.upload-status[data-tone="error"] {
  color: var(--danger);
}

.screenshot-card {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.screenshot-card:first-of-type {
  border-top: 0;
}

.screenshot-thumb img {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
}

.screenshot-fallback {
  display: grid;
  gap: 8px;
  align-content: start;
  width: 120px;
  min-height: 120px;
  padding: 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--surface-2);
}

.screenshot-fallback strong {
  font-size: 13px;
}

.screenshot-fallback p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  word-break: break-word;
}

.screenshot-fallback .button {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 13px;
}

.screenshot-body {
  min-width: 0;
}

.screenshot-editor {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.screenshot-editor > summary {
  cursor: pointer;
  color: var(--accent-dark);
  font-weight: 900;
}

.screenshot-edit-form {
  margin-top: 10px;
}

.screenshot-mini-grid {
  gap: 10px;
}

.screenshot-mini-grid label {
  font-size: 12px;
}

.copy-panel {
  display: grid;
  gap: 12px;
}

.copy-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.copy-head h2 {
  margin-bottom: 0;
}

.copy-textarea {
  min-height: 520px;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.caption-textarea {
  min-height: 180px;
}

.report-summary {
  display: grid;
  gap: 12px;
  border-left: 4px solid var(--gold);
}

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

.screenshot-body h3 {
  margin: 0 0 8px;
  font-size: 17px;
}

.step-title {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.step-title h2 { margin-bottom: 4px; }

.step-title p { margin: 0; }

.checklist {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 12px 12px 12px 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
}

.checklist li::marker {
  color: var(--accent);
  font-weight: 900;
}

.compact textarea { min-height: 86px; }

dl {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 4px 12px;
}

dt {
  color: var(--muted);
  font-weight: 900;
}

dd { margin: 0; }

pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  font: inherit;
}

.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 18px;
}

.login-card {
  width: min(100%, 390px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 4px solid var(--accent);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 24px;
}

.login-card h1 {
  margin: 0;
  font-size: 30px;
}

@media (max-width: 840px) {
  .profile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  body { font-size: 14px; }
  .app-shell { padding: 8px 10px 40px; }
  .topbar {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .brand {
    min-width: 0;
    display: flex;
    align-items: baseline;
    gap: 8px;
  }
  .nav {
    width: 100%;
    justify-content: stretch;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 5px;
  }
  .nav a {
    min-width: 0;
    padding: 8px 6px;
    font-size: 13px;
  }
  .grid,
  .profile-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }
  .split,
  .client-card,
  .tour-banner,
  .step-title {
    display: grid;
  }
  .card-actions { justify-items: stretch; }
  .quick-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .screenshot-card {
    grid-template-columns: 1fr;
  }
  .screenshot-thumb img {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
  }
  .screenshot-fallback {
    width: 100%;
    min-height: 0;
  }
  .status-pill {
    margin-left: 0;
    width: fit-content;
  }
  .day-badge {
    justify-self: start;
  }
  .status-row { grid-template-columns: 1fr; }
  .copy-head { display: grid; }
  .copy-textarea { min-height: 420px; }
  .page-head h1 { font-size: 25px; }
  .panel,
  .client-card {
    padding: 14px;
  }
}
