:root {
  --bg: #f4f8ff;
  --panel: #ffffff;
  --panel-soft: #f7fbff;
  --border: #e3edf9;
  --border-soft: #d8e6f8;
  --text: #1f2937;
  --muted: #7c8ca0;
  --primary: #7db5ff;
  --primary-soft: #eef6ff;
  --danger-soft: #fff1f3;
  --danger: #a05f70;
  --success-soft: #e7f8ee;
  --success: #2f8f60;
  --pending-soft: #fff3e6;
  --pending: #bd7a32;
  --shadow: 0 4px 14px rgba(83, 118, 164, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

button {
  border: 0;
  cursor: pointer;
}

body {
  display: flex;
  justify-content: center;
}

.app-shell {
  width: 100%;
  max-width: 520px;
  min-height: 100vh;
  background: var(--bg);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 14px;
  background: rgba(244, 248, 255, 0.95);
  backdrop-filter: blur(12px);
}

.brand {
  font-size: 24px;
  font-weight: 800;
}

.brand-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

.status-chip,
.badge,
.task-status {
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
}

.status-chip,
.badge-blue,
.task-status-progress {
  background: #e6f2ff;
  color: #3a6fa6;
}

.badge-green,
.task-status-done {
  background: var(--success-soft);
  color: var(--success);
}

.task-card-with-actions {
  cursor: pointer;
}

.task-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.task-delete-btn {
  padding: 6px 10px;
}

.badge-orange {
  background: var(--pending-soft);
  color: var(--pending);
}

.badge-red {
  background: var(--danger-soft);
  color: var(--danger);
}

.app-main {
  padding: 0 16px 126px;
}

.view-page {
  display: none;
}

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

.container {
  min-height: calc(100vh - 180px);
}

.screenshot-task-page,
.detail-page,
.create-task-page,
.generic-page {
  background: var(--bg);
}

.search-wrap {
  height: 48px;
  border-radius: 16px;
  background: #ffffff;
  display: flex;
  align-items: center;
  padding: 0 14px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.search-icon {
  color: #9db0c6;
  font-size: 18px;
  margin-right: 10px;
}

.search-input {
  flex: 1;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 12px;
}

.filter-row-second {
  padding-top: 10px;
}

.filter-pill {
  padding: 8px 12px;
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  font-size: 13px;
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(83, 118, 164, 0.04);
}

.filter-pill-active {
  background: #d9ebff;
  color: #335372;
  border-color: #cfe2fb;
}

.task-list-panel {
  padding-top: 14px;
}

.concise-task-card,
.section-card,
.field-row-card,
.checkpoint-card,
.list-card,
.issue-card,
.asset-card,
.report-card,
.template-item,
.upload-card,
.field-row-card-inline {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.concise-task-card,
.issue-card,
.report-card,
.asset-card,
.list-card,
.template-item {
  padding: 16px;
  margin-bottom: 12px;
}

.section-card {
  padding: 16px;
  margin-bottom: 14px;
}

.row,
.section-head,
.attachment-head,
.task-row-top,
.action-row,
.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.task-row-title,
.section-title,
.info-title,
.attachment-title,
.field-row-value,
.card-title {
  font-weight: 700;
  color: var(--text);
}

.section-title {
  font-size: 22px;
}

.task-row-title,
.info-title,
.attachment-title,
.field-row-value,
.card-title {
  font-size: 16px;
}

.task-row-meta,
.empty-hint,
.info-desc,
.field-row-label,
.inline-meta,
.attachment-remove,
.attachment-placeholder,
.print-export-desc,
.print-export-link,
.helper-text,
.stack-list .empty-text {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.top-gap {
  margin-top: 12px;
}

.form-list {
  margin-top: 8px;
}

.section-input,
.section-textarea,
.section-select,
.result-textarea,
.remark-textarea,
.issue-textarea,
.select-input {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 14px 15px;
  border-radius: 14px;
  border: 1px solid var(--border-soft);
  background: var(--panel-soft);
  color: var(--text);
  outline: none;
}

.section-input,
.section-select,
.select-input {
  min-height: 46px;
}

.section-textarea,
.result-textarea,
.remark-textarea,
.issue-textarea {
  min-height: 108px;
  resize: vertical;
}

.form-grid {
  display: grid;
  gap: 10px;
}

.upload-grid,
.asset-grid,
.attachment-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.upload-card {
  padding: 12px;
  background: var(--panel-soft);
}

.upload-thumb,
.asset-thumb,
.attachment-thumb,
.attachment-placeholder {
  width: 100%;
  height: 132px;
  border-radius: 14px;
  background: #edf5ff;
  overflow: hidden;
}

.upload-thumb img,
.asset-thumb img,
.attachment-thumb img,
.asset-thumb,
.attachment-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.upload-thumb-placeholder,
.attachment-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--muted);
}

.field-row-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.field-row-card,
.field-row-card-inline {
  padding: 14px 16px;
  background: var(--panel-soft);
  border-color: #e8f0fb;
  box-shadow: none;
}

.field-row-card-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.field-row-label {
  font-weight: 600;
}

.stack-list {
  margin-top: 10px;
}

.checkpoint-card {
  padding: 14px;
  margin-top: 10px;
  background: var(--panel-soft);
  box-shadow: none;
}

.attachment-block {
  margin-top: 12px;
  padding: 12px;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid #e8f0fb;
}

.primary-btn,
.ghost-btn,
.mini-ghost-btn,
.mini-danger-btn,
.link-btn {
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
}

.primary-btn {
  background: var(--primary);
  color: #ffffff;
}

.ghost-btn,
.mini-ghost-btn,
.link-btn {
  background: #edf5ff;
  color: #45607d;
}

.mini-danger-btn {
  background: var(--danger-soft);
  color: var(--danger);
}

.link-btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.full-btn {
  width: 100%;
  margin-top: 14px;
  padding: 14px 0;
  font-size: 16px;
}

.file-btn {
  position: relative;
  overflow: hidden;
}

.file-btn input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.top-module-scroll {
  overflow-x: auto;
  white-space: nowrap;
  background: #ffffff;
  padding: 0 16px;
  border-bottom: 1px solid #e8eef6;
  border-radius: 16px;
  margin-bottom: 14px;
}

.top-module-inner {
  display: inline-flex;
  gap: 22px;
}

.top-module-item {
  position: relative;
  flex-shrink: 0;
  padding: 16px 0 14px;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
}

.top-module-item-active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  border-radius: 999px;
  background: #ef4444;
}

.bottom-nav-shell {
  height: 108px;
}

.bottom-nav.screenshot-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 12px;
  width: min(496px, calc(100vw - 24px));
  height: 86px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 -2px 12px rgba(83, 118, 164, 0.08);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  z-index: 999;
}

.nav-item {
  width: 25%;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  color: #9db0c6;
}

.nav-icon {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
}

.nav-label {
  margin-top: 5px;
  font-size: 12px;
  line-height: 1.2;
}

.nav-item-active,
.nav-item-active .nav-icon,
.nav-item-active .nav-label {
  color: #45607d;
}

.nav-item-active .nav-icon {
  background: var(--primary-soft);
}

.empty-hint,
.empty-text {
  padding: 16px;
  text-align: center;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 112px;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 10px 14px;
  background: rgba(31, 41, 55, 0.88);
  color: #ffffff;
  border-radius: 12px;
  z-index: 1200;
  font-size: 13px;
}

.hidden {
  display: none !important;
}

.action-card {
  padding-bottom: 20px;
}

.create-safe-gap {
  height: 110px;
}

.print-export-link {
  word-break: break-all;
}

.template-card-active {
  border-color: #b9d7ff;
  background: #eef6ff;
}

.template-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.template-meta-chip {
  padding: 6px 10px;
  border-radius: 999px;
  background: #f3f7fd;
  color: #5f748d;
  font-size: 12px;
  line-height: 1.4;
}

.template-module-card {
  padding: 14px;
  margin-top: 10px;
  background: var(--panel-soft);
  border: 1px solid #e8f0fb;
  border-radius: 16px;
}

.template-checkpoint-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.template-checkpoint-item {
  padding: 10px 12px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid #e8f0fb;
}

.template-checkpoint-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.template-checkpoint-desc {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.template-preview-empty {
  padding: 24px 12px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.module-card {
  padding: 14px;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid #e8f0fb;
  margin-top: 10px;
}

.module-card-active,
.template-checkpoint-item-active,
.template-item-active {
  border-color: #7db5ff;
  background: #e8f3ff;
  box-shadow: 0 0 0 2px rgba(125, 181, 255, 0.18);
}

.template-link-button {
  padding: 0;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  text-align: left;
}

.preview-checkpoint-card {
  padding: 14px;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid #e8f0fb;
}

.checkpoint-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.action-row.compact {
  gap: 8px;
}

.compact-wrap-actions {
  flex-wrap: wrap;
}

.template-field-block {
  display: block;
}

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

.toggle-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid #e8f0fb;
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
}

.toggle-card input {
  margin: 0;
}

@media (max-width: 400px) {
  .template-toggle-grid,
  .upload-grid,
  .asset-grid,
  .attachment-grid {
    grid-template-columns: 1fr;
  }

  .app-main {
    padding-left: 12px;
    padding-right: 12px;
  }
}
