/* ===== ワンナポータル - Mobile First CSS ===== */

:root {
  --primary: #2B7CE9;
  --primary-light: #E8F0FE;
  --text: #1C2B4A;
  --sub: #8294AA;
  --line-green: #06C755;
  --danger: #EF4444;
  --danger-bg: #FEF2F2;
  --border: #E8EDF5;
  --bg: #EFF3F8;
  --warm: #FFF8E7;
  --white: #FFFFFF;
  --orange: #F5A623;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Hiragino Sans', 'Noto Sans JP', -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

/* ===== Welcome Screen ===== */
.welcome-screen {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 0 40px;
  background: linear-gradient(170deg, #F5F8FC 0%, #EAF0F9 40%, #E4ECF7 70%, #EFF3F8 100%);
  position: relative; overflow: hidden;
}
.welcome-bg-paw { position: absolute; width: 180px; height: 180px; opacity: 0.04; font-size: 160px; }
.welcome-bg-paw.top-right { top: 40px; right: -20px; transform: rotate(20deg); }
.welcome-bg-paw.top-right::after { content: "🐾"; }
.welcome-bg-paw.bottom-left { bottom: 60px; left: -30px; transform: rotate(-15deg); }
.welcome-bg-paw.bottom-left::after { content: "🐾"; }
.welcome-logo-circle {
  width: 180px; height: 180px; border-radius: 50%;
  background: rgba(255,255,255,0.7);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 40px rgba(43,124,233,0.08);
  margin-bottom: 28px; overflow: hidden;
}
.welcome-mascot { width: 170px; height: 170px; object-fit: contain; border-radius: 8px; }
.welcome-title { font-size: 32px; font-weight: 800; color: var(--text); margin-bottom: 8px; letter-spacing: -1px; }
.welcome-subtitle { font-size: 14px; color: var(--sub); margin-bottom: 44px; text-align: center; }
.welcome-terms { font-size: 11px; color: var(--sub); margin-top: 16px; text-align: center; line-height: 1.6; }
.welcome-terms a { color: var(--primary); text-decoration: underline; }

/* ===== LINE Login Button (公式ボタン画像) ===== */
/* button_to は <form> を生成するため、ラッパで余白をリセット */
form.btn-line-img-wrapper { margin: 0; padding: 0; display: inline-block; }

.btn-line-img-wrapper {
  background: none; border: none; padding: 0; cursor: pointer;
  display: inline-block; line-height: 0;
  -webkit-tap-highlight-color: transparent;
}
.btn-line-img {
  display: block;
  width: 200px; height: 44px;
  /* Propshaft が fingerprint 付きパスに自動書き換えるため、ファイル名だけ指定する */
  background-image: url("/assets/btn_login_base-63c6fda9.png");
  background-size: contain; background-repeat: no-repeat; background-position: center;
}
@media (hover: hover) {
  .btn-line-img-wrapper:hover .btn-line-img {
    background-image: url("/assets/btn_login_hover-71e75b80.png");
  }
}
.btn-line-img-wrapper:active .btn-line-img {
  background-image: url("/assets/btn_login_press-d62236f2.png");
}
/* Retina（@2x 画像があれば差し替え。今は同じ画像をそのまま使用） */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .btn-line-img { image-rendering: -webkit-optimize-contrast; }
}

/* ===== App Layout ===== */
.app-screen {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; background: var(--bg);
}
.app-header {
  padding: 12px 20px; background: white;
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.header-brand { display: flex; align-items: center; gap: 8px; }
.header-logo { width: 32px; height: 32px; border-radius: 6px; object-fit: contain; }
.header-title { font-size: 19px; font-weight: 800; color: var(--primary); }
.header-icon { background: none; border: none; cursor: pointer; color: var(--sub); padding: 4px; }

.sub-header {
  padding: 12px 20px; background: white;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 20;
}
.sub-header h2 { font-size: 18px; font-weight: 700; flex: 1; text-align: center; }
.back-btn { background: none; border: none; cursor: pointer; color: var(--text); padding: 0; }

.pet-sub-header .pet-header-title {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; min-width: 0;
}
.pet-header-avatar {
  width: 28px; height: 28px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
  background: #F3F4F6; display: flex; align-items: center; justify-content: center;
}
.pet-header-avatar img { width: 100%; height: 100%; object-fit: cover; }
.pet-header-emoji { font-size: 16px; }
.pet-sub-header h2 { flex: 0 1 auto; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pet-header-right { min-width: 24px; display: flex; align-items: center; justify-content: flex-end; }

/* ===== Home ===== */
.home-content { flex: 1; overflow-y: auto; padding-bottom: 80px; }
.group-header {
  padding: 14px 20px 6px;
  display: flex; justify-content: space-between; align-items: center;
}
.group-name-row { display: flex; align-items: center; gap: 8px; }
.group-label { font-size: 15px; font-weight: 700; }
.pet-count { font-size: 12px; color: var(--sub); }
.btn-add {
  background: var(--primary); color: white; border: none; border-radius: 20px;
  padding: 6px 14px; font-size: 12px; font-weight: 600;
  display: flex; align-items: center; gap: 4px; cursor: pointer;
}

/* ===== Pet Cards ===== */
.pet-list { padding: 8px 16px 20px; }
.pet-card {
  background: white; border-radius: 16px; padding: 16px;
  margin-bottom: 10px; display: flex; align-items: center; gap: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04); cursor: pointer;
}
.pet-avatar {
  width: 56px; height: 56px; border-radius: 28px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; flex-shrink: 0;
  border: 3px solid white; box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.pet-info { flex: 1; }
.pet-name { font-size: 16px; font-weight: 700; }
.pet-type { font-size: 13px; color: var(--sub); margin-top: 2px; }
.pet-bday { font-size: 12px; color: #bbb; margin-top: 2px; }

/* ===== Pet Detail ===== */
.pet-detail { flex: 1; overflow-y: auto; padding: 16px; padding-bottom: 80px; }

.pet-profile-card {
  background: white; border-radius: 20px; padding: 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.pet-profile-top { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.pet-profile-avatar {
  width: 76px; height: 76px; border-radius: 50%; flex-shrink: 0;
  border: 3px solid var(--orange);
  overflow: hidden; background: var(--warm);
  display: flex; align-items: center; justify-content: center;
}
.pet-profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.pet-profile-emoji { font-size: 34px; }
.pet-profile-info { flex: 1; min-width: 0; }
.pet-profile-name { font-size: 20px; font-weight: 800; color: var(--text); line-height: 1.2; }
.pet-profile-gender { color: var(--orange); margin-left: 2px; }
.pet-profile-breed { font-size: 13px; color: var(--sub); margin-top: 2px; }

.pet-date-grid { display: flex; flex-direction: column; gap: 8px; }
.pet-date-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg); border-radius: 12px; padding: 10px 14px;
}
.pet-date-icon { font-size: 18px; flex-shrink: 0; }
.pet-date-content { flex: 1; }
.pet-date-label { font-size: 10px; color: var(--sub); font-weight: 600; line-height: 1; margin-bottom: 2px; }
.pet-date-value { font-size: 13px; font-weight: 700; color: var(--text); }

/* Gender Radio Select */
.gender-select { display: flex; gap: 8px; }
.gender-option { flex: 1; }
.gender-radio { display: none; }
.gender-label {
  display: block; text-align: center; padding: 10px 0; border-radius: 12px;
  border: 1.5px solid var(--border); background: var(--bg);
  font-size: 14px; font-weight: 600; color: var(--sub); cursor: pointer;
  transition: all 0.15s;
}
.gender-radio:checked + .gender-label {
  border-color: var(--primary); background: var(--primary-light);
  color: var(--primary);
}

/* ===== Empty State ===== */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state p { font-size: 14px; color: var(--sub); margin-bottom: 20px; }

/* ===== Bottom Nav ===== */
.bottom-nav {
  display: flex; background: white; border-top: 1px solid var(--border);
  padding: 8px 0 max(24px, env(safe-area-inset-bottom));
  position: fixed; bottom: 0; left: 0; right: 0;
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 10px; font-weight: 600; color: #bbb; background: none; border: none; cursor: pointer;
  padding: 4px 0;
}
.nav-item.active { color: var(--primary); }
.nav-item svg { width: 24px; height: 24px; }

/* ===== Settings ===== */
.settings-content { flex: 1; overflow-y: auto; padding: 16px; padding-bottom: 80px; }
.profile-card {
  background: white; border-radius: 16px; padding: 20px;
  margin-bottom: 12px; display: flex; align-items: center; gap: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.profile-avatar {
  width: 56px; height: 56px; border-radius: 28px;
  background: linear-gradient(135deg, var(--orange), #E8941A);
  display: flex; align-items: center; justify-content: center; font-size: 24px;
  overflow: hidden;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-name { font-size: 16px; font-weight: 700; }
.profile-sub { font-size: 12px; color: var(--sub); }

.settings-section { margin-bottom: 12px; }
.section-title { font-size: 12px; font-weight: 600; color: var(--sub); padding: 8px 4px 6px; }
.menu-card { background: white; border-radius: 14px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,0.04); }
.menu-item {
  width: 100%; padding: 14px 16px; display: flex; align-items: center; gap: 12px;
  background: none; border: none; border-top: 1px solid var(--border);
  cursor: pointer; font-size: 15px; color: var(--text); text-align: left;
}
.menu-item:first-child { border-top: none; }
.menu-item svg:first-child { color: var(--sub); flex-shrink: 0; }
.menu-label { flex: 1; font-weight: 500; }
.menu-item-btn { font-family: inherit; }
.menu-danger { color: var(--danger); }
.menu-danger svg:first-child { color: var(--danger); }

/* ===== Profile Edit ===== */
.profile-avatar-edit { display: flex; justify-content: center; margin-bottom: 28px; }
.profile-avatar-large {
  width: 88px; height: 88px; border-radius: 44px;
  background: linear-gradient(135deg, var(--orange), #E8941A);
  display: flex; align-items: center; justify-content: center; font-size: 36px;
  overflow: hidden;
}
.profile-avatar-large img { width: 100%; height: 100%; object-fit: cover; }

/* ===== Group Settings ===== */
.group-info-card {
  background: white; border-radius: 16px; padding: 20px;
  margin-bottom: 12px; display: flex; align-items: center; gap: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.group-icon {
  width: 50px; height: 50px; border-radius: 14px;
  background: var(--warm); display: flex; align-items: center; justify-content: center; font-size: 24px;
}
.group-info-text { flex: 1; }
.group-info-name { font-size: 16px; font-weight: 700; }
.group-info-stats { font-size: 12px; color: var(--sub); }

.invite-section { margin-bottom: 16px; }
.btn-invite-line {
  width: 100%; padding: 14px; border-radius: 14px; border: none;
  background: #06C755; color: white; font-size: 15px; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px;
  box-shadow: 0 4px 12px rgba(6,199,85,0.25);
}
.btn-invite-line:active { opacity: 0.85; }
.invite-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 14px 0; color: var(--sub); font-size: 12px;
}
.invite-divider::before, .invite-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--border);
}
.invite-code-section { }
.invite-code-display {
  background: white; border-radius: 14px; padding: 14px 16px;
  display: flex; align-items: center; gap: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04); margin-bottom: 4px;
}
.invite-label { font-size: 12px; color: var(--sub); }
.invite-code { font-size: 16px; font-weight: 700; font-family: monospace; flex: 1; letter-spacing: 1px; }
.btn-copy {
  padding: 6px 12px; border-radius: 8px; border: 1px solid var(--primary);
  background: var(--primary-light); color: var(--primary);
  font-size: 12px; font-weight: 600; cursor: pointer;
}
.invite-url { font-size: 11px; color: var(--sub); padding: 4px 8px; word-break: break-all; }

.member-list { background: white; border-radius: 14px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,0.04); }
.member-item {
  padding: 14px 16px; display: flex; align-items: center; gap: 12px;
  border-top: 1px solid var(--border);
}
.member-item:first-child { border-top: none; }
.member-avatar {
  width: 40px; height: 40px; border-radius: 20px;
  background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 20px;
  overflow: hidden;
}
.member-avatar img { width: 100%; height: 100%; object-fit: cover; }
.member-info { flex: 1; }
.member-name { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.you-badge { font-size: 11px; color: var(--sub); font-weight: 400; }
.role-badge {
  display: inline-flex; align-items: center; gap: 3px;
  margin-top: 3px; padding: 2px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 600;
}
.role-owner { background: var(--warm); color: #D97706; }
.role-member { background: #F0F0F0; color: #888; }
.member-actions { display: flex; gap: 6px; }
.btn-sm {
  padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: white; font-size: 11px; cursor: pointer; color: #555;
}
.btn-sm-danger { border-color: #FEE2E2; background: var(--danger-bg); color: var(--danger); }

/* ===== Join Group ===== */
.join-content { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px; }
.join-icon { width: 72px; height: 72px; border-radius: 20px; background: var(--warm); display: flex; align-items: center; justify-content: center; font-size: 32px; margin-bottom: 16px; }
.join-group-name { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.join-subtitle { font-size: 14px; color: var(--sub); margin-bottom: 24px; }
.join-pets-card { background: var(--bg); border-radius: 14px; padding: 16px; width: 100%; margin-bottom: 28px; }
.join-pets-label { font-size: 13px; color: var(--sub); margin-bottom: 8px; }
.join-pet-item { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.join-pet-emoji { font-size: 20px; }
.join-pet-name { font-size: 14px; font-weight: 600; }
.join-pet-type { font-size: 12px; color: var(--sub); }

/* ===== Forms ===== */
.form-content { flex: 1; overflow-y: auto; padding: 24px 20px; }
.form-description { font-size: 13px; color: var(--sub); margin-bottom: 20px; }
.form-group { margin-bottom: 18px; }
.form-label { font-size: 13px; font-weight: 600; color: #556; display: flex; align-items: center; gap: 4px; margin-bottom: 6px; }
.required { color: var(--danger); font-size: 11px; }
.form-input {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  border: 1.5px solid var(--border); font-size: 16px;
  background: var(--bg); outline: none; color: var(--text);
  font-family: inherit;
  -webkit-appearance: none; appearance: none;
}
.form-input:focus { border-color: var(--primary); }
.text-center { text-align: center; }
.form-errors { background: var(--danger-bg); border-radius: 12px; padding: 12px 16px; margin-bottom: 16px; }
.form-errors p { font-size: 13px; color: var(--danger); }
.form-actions { padding: 12px 0 28px; }

/* ===== Buttons ===== */
.btn-primary {
  display: block; width: auto; padding: 15px 32px; border-radius: 14px;
  border: none; background: var(--primary); color: white;
  font-size: 16px; font-weight: 700; cursor: pointer;
  text-align: center; font-family: inherit;
}
.btn-danger {
  display: block; width: auto; padding: 15px 32px; border-radius: 14px;
  border: none; background: var(--danger); color: white;
  font-size: 16px; font-weight: 700; cursor: pointer;
  text-align: center; font-family: inherit;
}
.btn-danger:disabled { background: #ddd; cursor: default; }
.btn-full { width: 100%; }

/* ===== Info/Warning Boxes ===== */
.info-box {
  padding: 12px 16px; background: var(--warm); border-radius: 12px;
  font-size: 13px; color: #8B7355; line-height: 1.6; margin-bottom: 16px;
}
.warning-box {
  padding: 14px; background: #FFFBEB; border-radius: 14px;
  font-size: 13px; color: #92400E; line-height: 1.6; margin-bottom: 16px;
}
.warning-icon { width: 64px; height: 64px; border-radius: 32px; background: var(--danger-bg); display: flex; align-items: center; justify-content: center; margin: 0 auto 20px; font-size: 28px; }
.text-danger { color: var(--danger); }
.danger-list { background: var(--danger-bg); border-radius: 14px; padding: 16px; margin-bottom: 20px; }
.danger-item { padding: 10px 0; border-top: 1px solid #FEE2E2; font-size: 14px; color: #B91C1C; }
.danger-item:first-child { border-top: none; }

/* ===== Toast ===== */
.toast {
  position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: rgba(28,43,74,0.9); color: white;
  padding: 10px 24px; border-radius: 24px; font-size: 13px;
  opacity: 0; transition: all 0.3s; white-space: nowrap; z-index: 100;
  pointer-events: none; font-weight: 500;
}
.toast-show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-alert { background: rgba(239,68,68,0.9); }

/* ===== Avatar Upload ===== */
.avatar-upload-area {
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: 120px; border-radius: 16px;
  border: 2px dashed #ccc; background: var(--bg);
  cursor: pointer; overflow: hidden; position: relative;
}
.avatar-upload-area:hover { border-color: var(--primary); background: var(--primary-light); }
.avatar-upload-placeholder {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: var(--sub); font-size: 13px;
}
.avatar-file-input { position: absolute; opacity: 0; width: 100%; height: 100%; cursor: pointer; top: 0; left: 0; }
.avatar-preview { width: 100%; }
.avatar-preview-img { width: 100%; max-height: 200px; object-fit: cover; border-radius: 14px; display: block; }
.avatar-current { margin-bottom: 10px; }
.pet-avatar-img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.avatar-preview { position: relative; width: 100%; }
.avatar-change-hint {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,0.5); color: white;
  text-align: center; padding: 8px; font-size: 12px; font-weight: 600;
  border-radius: 0 0 14px 14px;
}
.pet-detail-avatar-img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

/* Avatar Upload Overlay */
.avatar-overlay {
  position: absolute; inset: 0; border-radius: 14px;
  background: rgba(0,0,0,0.5); backdrop-filter: blur(2px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; color: white; font-size: 13px; font-weight: 600;
  transition: opacity 0.4s;
}
.avatar-overlay--done { background: rgba(22,163,106,0.55); }
.avatar-overlay--error { background: rgba(239,68,68,0.6); }
.avatar-overlay--fade { opacity: 0; }
.avatar-spinner {
  width: 32px; height: 32px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: white;
  animation: spin 0.7s linear infinite;
}
.avatar-check {
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255,255,255,0.25);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 700;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Daily Log ===== */
.log-content { flex: 1; overflow-y: auto; padding: 0 12px 100px; }
.log-form { display: flex; flex-direction: column; gap: 8px; }

/* Date Nav */
.date-nav {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  padding: 10px 16px; background: white; border-bottom: 1px solid var(--border);
  position: sticky; top: 49px; z-index: 19;
}
.date-nav-btn {
  background: none; border: none; cursor: pointer; color: var(--sub);
  padding: 4px; border-radius: 8px;
}
.date-nav-btn:disabled { opacity: 0.3; cursor: default; }
.date-nav-label { font-size: 15px; font-weight: 700; color: var(--text); }

/* Log Cards */
.log-card {
  background: white; border-radius: 10px; padding: 10px 12px;
  border: 0.5px solid var(--border); box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}
.log-card-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px;
}
.log-card-title { font-size: 13px; font-weight: 700; color: var(--text); }
.log-card-prev { font-size: 11px; color: var(--sub); }
.log-card-badge {
  font-size: 10px; padding: 2px 8px; border-radius: 10px;
  background: var(--primary-light); color: var(--primary); font-weight: 600;
}
.log-card-ai-tag { display: flex; align-items: center; gap: 4px; }
.ai-badge {
  font-size: 10px; padding: 1px 6px; border-radius: 6px;
  background: #E8F5E9; color: #2E7D32; font-weight: 700;
}
.ai-camera-btn {
  width: 26px; height: 26px; border-radius: 6px; border: 1.5px dashed #ccc;
  background: none; display: flex; align-items: center; justify-content: center;
  color: #aaa; cursor: not-allowed;
}

.log-card-body { }
.log-card-inline { display: flex; align-items: center; gap: 8px; }

/* Log Inputs */
.log-input {
  padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border);
  font-size: 16px; background: var(--bg); color: var(--text);
  font-family: inherit; outline: none;
}
.log-input:focus { border-color: var(--primary); }
.log-input-sm { width: 64px; text-align: right; }
.log-unit { font-size: 13px; color: var(--sub); font-weight: 600; flex-shrink: 0; }
.log-hint { font-size: 12px; color: var(--sub); text-align: center; padding: 8px 0; }
.log-hint-inline { font-size: 11px; color: var(--sub); }
.log-diff { font-size: 12px; font-weight: 700; }
.diff-up { color: var(--danger); }
.diff-down { color: #16a34a; }

.log-select {
  flex: 1; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border);
  font-size: 14px; background: var(--bg); color: var(--text);
  font-family: inherit; outline: none; -webkit-appearance: none; appearance: none;
  font-size: 16px;
}

.log-row {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
}
.log-row:last-child { margin-bottom: 0; }
.log-row-label { font-size: 12px; color: var(--sub); font-weight: 600; width: 36px; flex-shrink: 0; }

.log-textarea {
  width: 100%; height: 44px; padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--border); font-size: 16px; background: var(--bg);
  color: var(--text); font-family: inherit; outline: none; resize: none;
}
.log-textarea:focus { border-color: var(--primary); }

/* Stepper */
.stepper { display: flex; align-items: center; gap: 0; }
.stepper-btn {
  width: 32px; height: 32px; border: 1px solid var(--border); background: var(--bg);
  font-size: 16px; font-weight: 700; cursor: pointer; color: var(--text);
  display: flex; align-items: center; justify-content: center;
  touch-action: manipulation;
}
.stepper-btn:first-child { border-radius: 8px 0 0 8px; }
.stepper-btn:last-child { border-radius: 0 8px 8px 0; }
.stepper-value {
  width: 40px; height: 32px; border: 1px solid var(--border); border-left: none; border-right: none;
  text-align: center; font-size: 16px; font-weight: 700; background: white; color: var(--text);
}
.stepper-value-wide {
  width: 56px;
}

/* Eaten Level */
.eaten-level { display: flex; gap: 4px; margin-top: 10px; }
.eaten-btn { flex: 1; }
.eaten-radio { display: none; }
.eaten-label {
  display: block; text-align: center; padding: 8px 2px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg);
  font-size: 12px; font-weight: 600; color: var(--sub); cursor: pointer;
}
.eaten-radio:checked + .eaten-label {
  border-color: var(--primary); background: var(--primary-light); color: var(--primary);
}

/* Meal Card */
.meal-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.meal-food-label {
  display: flex; flex-direction: column; min-width: 0; flex: 1;
}
.meal-name { font-size: 14px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meal-brand { font-size: 11px; color: var(--sub); }
.meal-amount { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.meal-empty { text-align: center; padding: 12px 0; }
.meal-register-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 16px; border: 2px dashed #ccc; border-radius: 12px;
  font-size: 14px; font-weight: 600; color: var(--sub); margin-bottom: 8px;
}
.input-with-unit { display: flex; align-items: center; gap: 8px; }

/* Medication Card */
.med-list { margin-bottom: 12px; }
.med-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.med-item:last-child { border-bottom: none; }
.med-check { flex-shrink: 0; cursor: pointer; }
.med-checkbox { display: none; }
.med-checkmark {
  width: 22px; height: 22px; border-radius: 6px; border: 2px solid #ccc;
  display: flex; align-items: center; justify-content: center;
}
.med-checkbox:checked + .med-checkmark {
  background: var(--primary); border-color: var(--primary);
}
.med-checkbox:checked + .med-checkmark::after {
  content: "✓"; color: white; font-size: 13px; font-weight: 700;
}
.med-info { flex: 1; }
.med-name { font-size: 14px; font-weight: 700; color: var(--text); }
.med-dosage { font-size: 12px; color: var(--sub); }
.med-delete {
  background: none; border: none; color: #ccc; font-size: 16px; cursor: pointer; padding: 4px;
}
.med-add-form { margin-top: 4px; }
.med-add-inline { display: flex; gap: 6px; align-items: center; }
.med-add-name { flex: 1; }
.med-add-dosage { width: 70px; }

/* Settings Panel */
.settings-panel {
  margin: 0 12px; background: white; border-radius: 14px;
  padding: 16px; box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  border: 1px solid var(--border); margin-bottom: 8px;
}
.settings-panel-title { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 12px; }
.settings-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.settings-item:last-of-type { border-bottom: none; }
.settings-item-name { font-size: 14px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 6px; }
.badge-default {
  font-size: 10px; padding: 1px 6px; border-radius: 8px;
  background: var(--primary-light); color: var(--primary); font-weight: 600;
}

/* Toggle Switch */
.toggle { position: relative; width: 44px; height: 24px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: #ccc; border-radius: 24px; transition: 0.2s;
}
.toggle-slider::before {
  content: ""; position: absolute; width: 20px; height: 20px;
  left: 2px; bottom: 2px; background: white; border-radius: 50%; transition: 0.2s;
}
.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* Save Section */
.log-save-section { padding: 16px 0 20px; }
.log-save-hint { font-size: 11px; color: var(--sub); text-align: center; margin-top: 8px; }

/* Daily Log Link on Pet Detail */
.pet-daily-log-link { margin-top: 12px; }
.btn-daily-log {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  background: white; border-radius: 14px; box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  border: 1.5px solid var(--primary-light);
}
.daily-log-icon { font-size: 24px; }
.daily-log-text { flex: 1; }
.daily-log-text strong { font-size: 15px; color: var(--text); display: block; }
.daily-log-text small { font-size: 12px; color: var(--sub); }

/* ===== Photos ===== */
.photo-content { flex: 1; overflow-y: auto; padding: 0 12px 100px; }

/* Tab Bar */
.photo-tabbar {
  display: flex; background: white; border-top: 1px solid var(--border);
  padding: 8px 0 max(16px, env(safe-area-inset-bottom));
}
.tabbar-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 10px; font-weight: 600; color: #bbb; background: none; border: none; cursor: pointer;
}
.tabbar-item.active { color: var(--primary); }
.tabbar-ico { font-size: 18px; }

/* FAB */
.photo-fab {
  position: fixed; bottom: 70px; right: 16px; width: 52px; height: 52px;
  border-radius: 50%; background: var(--primary); color: white;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(43,124,233,0.35); z-index: 10;
}

/* Date Group */
.photo-date-group {
  background: white; border-radius: 12px; padding: 12px;
  margin-bottom: 8px; box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.photo-date-header {
  font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 8px;
  margin-bottom: 10px;
}
.photo-date-count { font-size: 11px; color: var(--sub); font-weight: 400; }

/* Area Group */
.photo-area-group { margin-bottom: 10px; }
.photo-area-group:last-child { margin-bottom: 0; }
.photo-area-header {
  font-size: 11px; color: #777; margin-bottom: 6px;
  display: flex; align-items: center; gap: 3px;
}
.photo-area-pin { font-size: 12px; }
.photo-area-name { font-weight: 600; }
.photo-area-spot { font-size: 10px; color: #aaa; margin-left: 4px; }
.photo-area-count { font-size: 10px; color: #bbb; margin-left: 2px; }

/* Photo Strip (horizontal swipe) */
.photo-strip {
  display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px;
  scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch;
}
.photo-strip::-webkit-scrollbar { display: none; }
.photo-card {
  flex-shrink: 0; width: 130px; height: 130px; border-radius: 10px;
  overflow: hidden; position: relative; scroll-snap-align: start;
}
.photo-card-img { width: 100%; height: 100%; object-fit: cover; }
.photo-card-counter {
  position: absolute; top: 5px; right: 5px;
  font-size: 9px; background: rgba(0,0,0,0.45); color: white;
  padding: 2px 6px; border-radius: 8px;
}

/* More Card (+N) */
.photo-more-card {
  flex-shrink: 0; width: 90px; height: 130px; border-radius: 10px;
  background: var(--bg); border: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  scroll-snap-align: start;
}
.photo-more-num { font-size: 18px; font-weight: 700; color: var(--primary); }
.photo-more-label { font-size: 10px; color: var(--sub); }

/* Empty State */
.photo-empty { text-align: center; padding: 60px 20px; }
.photo-empty-icon { font-size: 48px; margin-bottom: 12px; }
.photo-empty-text { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.photo-empty-hint { font-size: 13px; color: var(--sub); }

/* Calendar Shortcut */
.photo-cal-shortcut {
  margin: 8px 0; border-radius: 10px; overflow: hidden;
}
.photo-cal-link {
  display: flex; align-items: center; gap: 6px; justify-content: center;
  padding: 12px; background: white; border-radius: 10px;
  border: 1px solid var(--border);
}
.photo-cal-text { font-size: 12px; color: var(--sub); }
.photo-cal-action { font-size: 13px; color: var(--primary); font-weight: 600; }

/* Upload Screen */
.photo-upload-area {
  text-align: center; padding: 40px 20px; margin: 12px 0;
  border: 2px dashed var(--border); border-radius: 16px;
  background: white; cursor: pointer;
}
.photo-upload-icon { font-size: 48px; margin-bottom: 8px; }
.photo-upload-text { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.photo-upload-hint { font-size: 12px; color: var(--sub); }

.photo-preview-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px;
  margin: 12px 0;
}
.photo-preview-grid .photo-grid-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-sel-count { font-size: 12px; color: var(--sub); text-align: center; margin-bottom: 12px; }

.photo-meta-section {
  background: white; border-radius: 12px; padding: 14px;
  margin-bottom: 12px; border: 1px solid var(--border);
}
.photo-meta-title { font-size: 12px; font-weight: 600; margin-bottom: 10px; }
.photo-meta-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 0;
  border-top: 1px solid var(--border);
}
.photo-meta-row:first-of-type { border-top: none; }
.photo-meta-icon { font-size: 16px; flex-shrink: 0; }
.photo-meta-body { flex: 1; }
.photo-meta-label { font-size: 10px; color: var(--sub); }
.photo-meta-value { font-size: 13px; font-weight: 500; }
.photo-meta-badge {
  font-size: 9px; color: var(--primary); border: 1px solid var(--primary);
  border-radius: 4px; padding: 2px 6px; flex-shrink: 0;
}
.photo-meta-input {
  width: 100%; border: none; outline: none; font-size: 13px;
  font-family: inherit; color: var(--text); background: transparent;
}
.photo-meta-input::placeholder { color: #bbb; }

.photo-upload-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }

.photo-upload-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255,255,255,0.9); z-index: 100;
  display: flex; align-items: center; justify-content: center;
}
.photo-upload-progress { text-align: center; }
.photo-upload-spinner {
  width: 40px; height: 40px; border: 3px solid var(--border);
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin 0.8s linear infinite; margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.photo-upload-progress-text { font-size: 14px; color: var(--text); font-weight: 600; }

/* Detail Screen */
.photo-detail-strip {
  display: flex; gap: 0; overflow-x: auto; scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch; margin: 0 -12px;
}
.photo-detail-strip::-webkit-scrollbar { display: none; }
.photo-detail-slide {
  flex-shrink: 0; width: 100%; scroll-snap-align: start;
}
.photo-detail-img {
  width: 100%; aspect-ratio: 4/3; object-fit: cover;
}
.photo-detail-fields {
  display: flex; flex-direction: column; gap: 8px; margin-top: 12px;
}
.photo-field {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px;
  background: white; border-radius: 10px; border: 1px solid var(--border);
}
.photo-field-icon { padding-top: 2px; }
.photo-field-icon { font-size: 14px; flex-shrink: 0; }
.photo-field-body { flex: 1; }
.photo-field-label { font-size: 10px; color: var(--sub); }
.photo-field-value { font-size: 13px; font-weight: 500; }
.photo-delete-btn { background: none; border: none; cursor: pointer; padding: 4px; }
.photo-detail-actions { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }

.photo-detail-form { display: flex; flex-direction: column; gap: 8px; }
.photo-field-input {
  width: 100%; font-size: 16px; font-weight: 500; padding: 4px 0;
  border: none; background: transparent; color: var(--text);
  appearance: none; -webkit-appearance: none;
}
.photo-field-input:focus { outline: none; }
.photo-field-textarea { resize: vertical; min-height: 60px; line-height: 1.4; }
.photo-field-readonly { background: #fafafa; }
.photo-upload-note {
  font-size: 12px; color: var(--sub); margin: 8px 0 12px; text-align: center;
}

/* Calendar Screen */
.photo-month-nav {
  display: flex; align-items: center; gap: 12px; justify-content: center;
  padding: 8px 0;
}
.photo-month-arrow { color: var(--sub); padding: 4px; }
.photo-month-label { font-size: 14px; font-weight: 700; }

.photo-cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px;
  text-align: center; margin: 8px 0;
}
.photo-cal-hd { font-size: 10px; color: var(--sub); padding: 4px 0; font-weight: 600; }
.photo-cal-day {
  font-size: 12px; padding: 8px 0; border-radius: 6px; color: #555;
  display: flex; align-items: center; justify-content: center;
}
.photo-cal-day.has {
  background: var(--primary); color: white; font-weight: 600; cursor: pointer;
}
.photo-cal-day.off { color: #ddd; }
.photo-cal-legend {
  display: flex; align-items: center; gap: 6px; font-size: 11px;
  color: var(--sub); justify-content: center; margin-bottom: 12px;
}
.photo-cal-legend-dot {
  width: 10px; height: 10px; border-radius: 3px; background: var(--primary);
}
.photo-cal-preview-empty {
  text-align: center; padding: 24px; color: var(--sub); font-size: 13px;
}
.photo-cal-result { margin-top: 8px; }
.photo-cal-result-hd {
  font-size: 13px; font-weight: 700; margin-bottom: 10px;
  display: flex; align-items: center; gap: 6px;
}
.photo-cal-result-count { font-size: 11px; color: var(--sub); font-weight: 400; }
.photo-cal-area-group { margin-bottom: 10px; }

/* Grid Views */
.photo-grid-sm {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px;
}
.photo-grid-full {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px;
  margin-top: 8px;
}
.photo-grid-thumb {
  aspect-ratio: 1; border-radius: 8px; overflow: hidden;
  background: var(--bg); border: 1px solid var(--border);
}
.photo-grid-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-grid-more {
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: var(--primary); background: #edf2f7;
}
.photo-grid-subtitle { font-size: 12px; color: var(--sub); margin: 8px 0; }

/* Filter Screen */
.photo-filter-section { margin-bottom: 16px; }
.photo-filter-label { font-size: 12px; font-weight: 600; color: #777; margin-bottom: 8px; }
.photo-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.photo-chip {
  font-size: 12px; padding: 6px 12px; border-radius: 16px;
  border: 1px solid var(--border); color: var(--sub); background: white;
}
.photo-chip.on { background: var(--primary); color: white; border-color: var(--primary); }
.photo-chip.loc { border-color: #0F6E56; color: #0F6E56; background: #E1F5EE; }
.photo-chip.loc.on { background: #0F6E56; color: white; }
.photo-chip-count { font-size: 10px; margin-left: 4px; opacity: 0.7; }
.photo-filter-preview { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.photo-filter-preview-title { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.photo-filter-actions {
  margin-top: auto; padding-top: 16px;
  display: flex; flex-direction: column; gap: 8px;
}

/* Header action link */
.header-action { font-size: 13px; color: var(--primary); font-weight: 600; }

/* Shared button styles */
.btn-sm { font-size: 13px; padding: 10px; }
.btn-outline {
  display: flex; align-items: center; justify-content: center;
  background: white; border: 1px solid var(--border); border-radius: 10px;
  padding: 12px; font-size: 14px; font-weight: 600; color: var(--text);
  cursor: pointer;
}
.btn-full { width: 100%; }

/* Photo link on pet detail */
.pet-photos-link { margin-top: 8px; }
.btn-photos {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  background: white; border-radius: 14px; box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  border: 1.5px solid var(--primary-light);
}
.photos-icon { font-size: 24px; }
.photos-text { flex: 1; }
.photos-text strong { font-size: 15px; color: var(--text); display: block; }
.photos-text small { font-size: 12px; color: var(--sub); }
