/* ===== Oshi image edit (form preview) ===== */
.oshi-image-edit {
  position: relative;
  display: inline-block;
}
.oshi-image-preview {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-size: cover;
  background-position: center;
  font-size: 44px;
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, var(--oshi), var(--oshi-strong));
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  transition: border-radius 0.2s;
}
.oshi-image-preview.has-image {
  border-radius: 22%;
  color: transparent;
}
.oshi-image-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--danger);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  border: 2px solid var(--bg);
}

/* ===== Cropper ===== */
.cropper-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: #000;
  display: flex;
  flex-direction: column;
  color: white;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}
.cropper-toolbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
}
.cropper-title {
  text-align: center;
  font-weight: 700;
}
.cropper-stage {
  position: relative;
  flex: 1;
  overflow: hidden;
  touch-action: none;
  user-select: none;
}
.cropper-img {
  position: absolute;
  pointer-events: none;
  -webkit-user-drag: none;
}
.cropper-frame {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 22%;
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.55);
  border: 2px solid white;
  pointer-events: none;
}
.cropper-controls {
  display: flex;
  justify-content: center;
  gap: var(--sp-3);
  padding: var(--sp-3);
}
.cropper-ctrl-btn {
  background: rgba(255,255,255,0.12);
  color: white;
  width: 56px;
  height: 44px;
  border-radius: var(--r-pill);
  font-size: var(--fs-md);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cropper-ctrl-btn:hover { background: rgba(255,255,255,0.2); }

/* ===== Icons ===== */
.ico {
  display: inline-block;
  flex-shrink: 0;
  vertical-align: middle;
}
.ico-inline { vertical-align: -3px; }

.icon-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  flex-shrink: 0;
}
.icon-tile.lg { width: 48px; height: 48px; border-radius: var(--r-lg); }
.icon-tile.oshi { background: var(--oshi-soft); color: var(--oshi); }

/* ===== Cards ===== */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  transition: transform 0.15s, border-color 0.15s;
}
.card.tap:active { transform: scale(0.98); }
.card.tap:hover { border-color: var(--border-strong); }

.card-link { display: block; color: inherit; }

.card-title {
  font-size: var(--fs-md);
  font-weight: 600;
  margin-bottom: var(--sp-1);
}
.card-sub {
  font-size: var(--fs-sm);
  color: var(--text-mute);
}

/* ===== Section title ===== */
.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: var(--sp-5) 0 var(--sp-3);
}
.section-title h2 {
  font-size: var(--fs-md);
  letter-spacing: 0.04em;
  color: var(--text-mute);
  text-transform: uppercase;
  font-weight: 600;
}
.section-title a {
  font-size: var(--fs-sm);
  color: var(--oshi);
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  height: 44px;
  padding: 0 var(--sp-4);
  border-radius: var(--r-pill);
  font-weight: 600;
  font-size: var(--fs-md);
  transition: transform 0.1s, opacity 0.15s;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

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

.btn-ghost {
  background: var(--surface);
  color: var(--text);
}
.btn-ghost:hover { background: var(--surface-strong); }

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-strong);
}

.btn-block { width: 100%; }
.btn-sm { height: 36px; padding: 0 var(--sp-3); font-size: var(--fs-sm); }

/* FAB (floating action button) */
.fab {
  position: fixed;
  right: var(--sp-4);
  bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + var(--sp-3));
  z-index: 40;
  width: 56px;
  height: 56px;
  border-radius: var(--r-pill);
  background: var(--oshi);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.3), 0 0 0 1px var(--oshi-soft);
  transition: transform 0.15s;
}
.fab:active { transform: scale(0.92); }

@media (min-width: 768px) {
  .fab { bottom: var(--sp-6); }
}

/* ===== Form ===== */
.form-group {
  margin-bottom: var(--sp-4);
}
.form-label {
  display: block;
  font-size: var(--fs-sm);
  color: var(--text-mute);
  margin-bottom: var(--sp-2);
  font-weight: 600;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  height: 44px;
  padding: 0 var(--sp-3);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: var(--fs-md);
  transition: border-color 0.15s;
}
.form-textarea {
  height: auto;
  min-height: 96px;
  padding: var(--sp-3);
  resize: vertical;
  font-family: inherit;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--oshi);
}
.form-hint {
  font-size: var(--fs-xs);
  color: var(--text-faint);
  margin-top: var(--sp-1);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
}

/* ===== Badge / Chip ===== */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 4px 10px;
  border-radius: var(--r-pill);
  background: var(--surface);
  font-size: var(--fs-xs);
  color: var(--text-mute);
  font-weight: 600;
}
.chip-oshi { background: var(--oshi-soft); color: var(--oshi); }
.chip-success { background: rgba(52,211,153,0.16); color: var(--success); }
.chip-warn { background: rgba(251,191,36,0.16); color: var(--warn); }
.chip-danger { background: rgba(248,113,113,0.16); color: var(--danger); }

/* ===== Empty state ===== */
.empty {
  text-align: center;
  padding: var(--sp-7) var(--sp-4);
  color: var(--text-mute);
}
.empty-icon { font-size: 48px; margin-bottom: var(--sp-3); }
.empty-title { font-size: var(--fs-md); font-weight: 600; color: var(--text); margin-bottom: var(--sp-1); }
.empty-sub { font-size: var(--fs-sm); }

/* ===== Toast ===== */
.toast-container {
  position: fixed;
  top: calc(var(--header-h) + var(--safe-top) + var(--sp-3));
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  pointer-events: none;
}
.toast {
  background: var(--bg-elev-2);
  color: var(--text);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-pill);
  box-shadow: var(--shadow);
  font-size: var(--fs-sm);
  border: 1px solid var(--border);
  animation: toastIn 0.25s ease, toastOut 0.25s ease 2.4s forwards;
  pointer-events: auto;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-8px); } }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: var(--backdrop);
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal {
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  background: var(--bg-elev);
  border-top-left-radius: var(--r-xl);
  border-top-right-radius: var(--r-xl);
  padding: var(--sp-5) var(--sp-4) calc(var(--sp-5) + var(--safe-bottom));
  overflow-y: auto;
  animation: modalIn 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}
@keyframes modalIn { from { transform: translateY(100%); } }

@media (min-width: 768px) {
  .modal-overlay { align-items: center; }
  .modal { border-radius: var(--r-xl); }
}

.modal-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--border-strong);
  margin: 0 auto var(--sp-4);
}

.modal-title {
  font-size: var(--fs-lg);
  margin-bottom: var(--sp-4);
}

/* ===== List items ===== */
.list { display: flex; flex-direction: column; gap: var(--sp-2); }

.list-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: transform 0.1s;
}
.list-item:active { transform: scale(0.99); }
.list-item-body { flex: 1; min-width: 0; }
.list-item-title {
  font-weight: 600;
  font-size: var(--fs-md);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-item-sub {
  font-size: var(--fs-sm);
  color: var(--text-mute);
  margin-top: 2px;
}
.list-item-meta {
  font-size: var(--fs-sm);
  color: var(--text-mute);
  white-space: nowrap;
}

/* ===== Stat ===== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-3);
}
.stat-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
}
.stat-label {
  font-size: var(--fs-xs);
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.stat-value {
  font-size: var(--fs-2xl);
  font-weight: 700;
  margin-top: var(--sp-1);
  letter-spacing: -0.01em;
}
.stat-value-sub {
  font-size: var(--fs-sm);
  color: var(--text-mute);
  font-weight: 500;
  margin-left: 4px;
}
.stat-trend {
  font-size: var(--fs-xs);
  margin-top: var(--sp-1);
}
.stat-trend.up { color: var(--success); }
.stat-trend.down { color: var(--danger); }

@media (min-width: 480px) {
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
}
