:root {
  --primary: #406fa6;
  --primary-dark: #2f5583;
  --bg: #f7f4f1;
  --text: #1f2933;
  --danger: #b42318;
  --success: #067647;
  --border: #d9dde3;
}

* {
  box-sizing: border-box;
}

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

.page,
.app-shell {
  min-height: 100vh;
}

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: white;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.logo {
  width: 48px;
  height: 48px;
  display: block;
  margin: 0 auto 12px;
}

h1, h2 {
  margin: 0 0 12px;
}

.subtitle,
.hint,
.user-info {
  color: #5c6670;
}

label {
  display: block;
  margin-bottom: 16px;
  font-weight: 600;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="date"] {
  width: 100%;
  margin-top: 8px;
  padding: 14px 16px;
  font-size: 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.btn {
  border: none;
  border-radius: 14px;
  padding: 14px 18px;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
}

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

.btn-secondary {
  background: white;
  color: var(--primary);
  border: 1px solid var(--border);
}

.btn-text {
  background: transparent;
  color: white;
  padding: 8px 12px;
}

.btn-block {
  width: 100%;
  margin-top: 12px;
}

.btn-xl {
  width: 100%;
  min-height: 72px;
  font-size: 22px;
  margin-top: 16px;
}

.error {
  color: var(--danger);
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: var(--primary);
  color: white;
}

.wizard {
  padding: 20px;
  max-width: 720px;
  margin: 0 auto;
}

.step {
  display: none;
}

.step.active {
  display: block;
}

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

.choice-btn {
  min-height: 64px;
  text-align: left;
  background: white;
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  font-size: 20px;
  cursor: pointer;
}

.choice-btn.selected {
  border-color: var(--primary);
  background: #eef4fb;
}

.btn-with-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.btn-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.photo-preview {
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  margin-top: 16px;
  border-radius: 12px;
  background: #111;
}

.pieces-list {
  list-style: none;
  padding: 0;
  margin: 16px 0;
}

.piece-item {
  display: flex;
  gap: 12px;
  align-items: center;
  background: white;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
}

.piece-item.missing {
  border-color: #f5c518;
  background: #fff9e6;
}

.piece-item img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  background: #ddd;
}

.piece-meta {
  flex: 1;
}

.movement-context {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 6px 10px;
  background: white;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 0.875rem;
  line-height: 1.3;
}

.movement-context-kind {
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--primary);
}

.movement-context-reason {
  color: #5c6670;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.subsection-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 20px 0 8px;
}

.subsection-header .subsection-title {
  margin: 0;
}

.pieces-stats {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.stat-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
}

.stat-total {
  background: #eef4fb;
  color: var(--primary);
}

.stat-missing {
  background: #fff9e6;
  color: #9a6700;
  font-size: 0.78rem;
}

.subsection-title {
  margin: 20px 0 8px;
  font-size: 1.1rem;
}

.piece-meta strong {
  display: block;
}

.add-piece {
  display: flex;
  gap: 8px;
}

.add-piece input {
  flex: 1;
}

.review-summary {
  background: white;
  border-radius: 12px;
  padding: 16px;
  border: 1px solid var(--border);
}

.review-summary dt {
  font-weight: 700;
  margin-top: 8px;
}

.review-summary dd {
  margin: 0 0 8px;
}

.status {
  margin: 12px 0;
  font-weight: 600;
}

.workflow-success {
  margin: 12px 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: #ecfdf3;
  color: var(--success);
  font-weight: 600;
}

.workflow-choice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-height: 72px;
}

.workflow-choice strong {
  font-size: 1.1rem;
}

.workflow-choice span {
  font-size: 0.9rem;
  font-weight: 500;
  color: #5c6670;
}

.workflow-choice-primary {
  border-color: var(--primary);
  background: #eef4fb;
}

.workflow-choice-primary span {
  color: #3d5f87;
}

.box-info {
  font-weight: 600;
}

.spinner {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.7);
  align-items: center;
  justify-content: center;
  z-index: 1000;
  display: none;
}

.spinner:not([hidden]) {
  display: flex;
}

.spinner-inner {
  width: 48px;
  height: 48px;
  border: 4px solid #ddd;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
