/* ========================================
   YUME tasks — スモーキーグリーン × クリーム × テラコッタ
   ======================================== */
:root {
  --sage: #7a9e7e;
  --sage-light: #a8c5ab;
  --sage-dark: #5a7e5e;
  --cream: #f8f4ec;
  --cream-dark: #ede7d6;
  --terracotta: #c47a5a;
  --terracotta-light: #d4956e;
  --terracotta-dark: #a05a3a;
  --charcoal: #3d3d3d;
  --gray-mid: #888;
  --gray-light: #ccc;
  --white: #fff;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 24px rgba(0,0,0,0.12);
  --radius: 16px;
  --radius-sm: 10px;
  --font: 'Noto Sans JP', sans-serif;
}

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

html, body {
  font-family: var(--font);
  background: var(--cream);
  color: var(--charcoal);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

#app { min-height: 100vh; }

/* ========== NAVIGATION ========== */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--white);
  border-top: 1px solid var(--cream-dark);
  display: flex;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 4px 8px;
  cursor: pointer;
  transition: all .2s;
  border: none;
  background: none;
  color: var(--gray-mid);
  font-size: 10px;
  font-family: var(--font);
  gap: 4px;
}

.nav-item i { font-size: 20px; transition: .2s; }
.nav-item span { font-size: 9px; font-weight: 500; }
.nav-item.active { color: var(--sage-dark); }
.nav-item.active i { transform: translateY(-2px); }

/* ========== LAYOUT ========== */
.page {
  padding: 0 0 80px;
  min-height: 100vh;
}

.page-header {
  background: linear-gradient(135deg, var(--sage-dark) 0%, var(--sage) 100%);
  color: white;
  padding: 20px 20px 24px;
  position: relative;
  overflow: hidden;
}

.page-header::after {
  content: '🍶';
  position: absolute;
  right: 20px; top: 12px;
  font-size: 40px;
  opacity: .25;
}

.page-header h1 { font-size: 20px; font-weight: 700; }
.page-header .subtitle { font-size: 12px; opacity: .85; margin-top: 3px; }

.section { padding: 16px; }
.section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--sage-dark);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* ========== CARDS ========== */
.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}

.card-sm {
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  box-shadow: var(--shadow);
  margin-bottom: 8px;
}

/* ========== HOME - CONSTRAINT BANNER ========== */
.constraint-banner {
  margin: 16px;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
}

.constraint-banner.gray {
  background: #f0f0f0;
  color: var(--gray-mid);
}

.constraint-banner.yellow {
  background: #fff8e6;
  color: #9a7a20;
  border: 1px solid #f5d87a;
}

.constraint-banner.red {
  background: #fef0ee;
  color: var(--terracotta-dark);
  border: 1px solid #f0b09a;
}

.constraint-banner.green {
  background: #edf5ee;
  color: var(--sage-dark);
}

/* ========== HOME - DATE CARD ========== */
.date-card {
  background: var(--white);
  margin: 0 16px 4px;
  border-radius: var(--radius);
  padding: 14px 18px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.date-main { font-size: 22px; font-weight: 700; color: var(--charcoal); }
.date-sub { font-size: 12px; color: var(--gray-mid); margin-top: 2px; }
.week-badge {
  background: var(--sage);
  color: white;
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 700;
}

/* ========== PROGRESS BAR ========== */
.progress-wrap { margin: 0 16px 16px; }
.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--gray-mid);
  margin-bottom: 6px;
}

.progress-bar {
  height: 8px;
  background: var(--cream-dark);
  border-radius: 99px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--sage), var(--sage-light));
  border-radius: 99px;
  transition: width .6s ease;
}

.progress-fill.terra {
  background: linear-gradient(90deg, var(--terracotta), var(--terracotta-light));
}

/* ========== TASK ITEMS ========== */
.task-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--cream-dark);
  cursor: pointer;
  transition: opacity .2s;
}

.task-item:last-child { border-bottom: none; }
.task-item.done { opacity: .45; }
.task-item.done .task-text { text-decoration: line-through; }

.task-checkbox {
  width: 22px; height: 22px;
  border: 2px solid var(--sage);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all .2s;
}

.task-checkbox.checked {
  background: var(--sage);
  border-color: var(--sage);
}

.task-checkbox.checked::after {
  content: '✓';
  color: white;
  font-size: 12px;
  font-weight: 700;
}

.task-text { font-size: 14px; flex: 1; }
.task-tag {
  font-size: 10px;
  background: var(--cream-dark);
  padding: 2px 8px;
  border-radius: 99px;
  color: var(--gray-mid);
}

.task-tag.reel { background: #fff3e8; color: var(--terracotta); }
.task-tag.story { background: #f0e8ff; color: #7a5aad; }

/* ========== MOOD SELECTOR ========== */
.mood-row {
  display: flex;
  gap: 10px;
  margin: 0 16px 16px;
}

.mood-btn {
  flex: 1;
  border: 2px solid var(--cream-dark);
  border-radius: var(--radius-sm);
  padding: 10px 6px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: var(--white);
  font-family: var(--font);
}

.mood-btn .emoji { font-size: 24px; display: block; }
.mood-btn .label { font-size: 10px; color: var(--gray-mid); margin-top: 3px; }
.mood-btn.selected { border-color: var(--sage); background: #edf5ee; }
.mood-btn.selected .label { color: var(--sage-dark); font-weight: 700; }

/* ========== COMPLETION BANNER ========== */
.complete-banner {
  background: linear-gradient(135deg, var(--terracotta) 0%, var(--terracotta-light) 100%);
  color: white;
  border-radius: var(--radius);
  padding: 14px 18px;
  text-align: center;
  margin: 0 16px 16px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: var(--shadow);
}

/* ========== CALENDAR ========== */
.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
}

.cal-month { font-size: 18px; font-weight: 700; }
.cal-nav-btn {
  background: var(--white);
  border: 1px solid var(--cream-dark);
  border-radius: 50%;
  width: 34px; height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  color: var(--charcoal);
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  padding: 0 14px 16px;
}

.cal-day-header {
  text-align: center;
  font-size: 11px;
  color: var(--gray-mid);
  padding: 6px 0;
  font-weight: 600;
}

.cal-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  cursor: pointer;
  position: relative;
  font-size: 13px;
  gap: 2px;
  transition: all .2s;
}

.cal-day:hover { background: var(--cream-dark); }
.cal-day.today {
  background: var(--sage);
  color: white;
  font-weight: 700;
}

.cal-day.reel-day { background: #fff3e8; border: 1.5px solid var(--terracotta-light); }
.cal-day.story-day { background: #f5eeff; }
.cal-day.no-shoot { background: #f5f5f5; color: var(--gray-light); }
.cal-day.other-month { opacity: .35; }

.cal-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cal-dot.orange { background: var(--terracotta); }
.cal-dot.purple { background: #9b7cd4; }

.cal-legend {
  display: flex;
  gap: 14px;
  padding: 0 16px 16px;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--gray-mid);
}

.legend-dot {
  width: 10px; height: 10px;
  border-radius: 3px;
}

/* ========== POST DETAIL ========== */
.post-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin: 0 16px 12px;
}

.post-id-badge {
  display: inline-block;
  background: var(--terracotta);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 99px;
  margin-bottom: 8px;
}

.post-title { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.post-subtitle { font-size: 12px; color: var(--gray-mid); }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 99px;
  font-weight: 600;
}

.status-badge.todo { background: #f5f5f5; color: var(--gray-mid); }
.status-badge.wip { background: #fff3e8; color: var(--terracotta); }
.status-badge.done { background: #edf5ee; color: var(--sage-dark); }

.field-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--cream-dark);
  font-size: 13px;
}

.field-row:last-child { border-bottom: none; }
.field-label { font-weight: 600; color: var(--sage-dark); min-width: 100px; flex-shrink: 0; }
.field-value { color: var(--charcoal); line-height: 1.5; }

/* ========== STORY ========== */
.story-slide {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin: 0 16px 12px;
  position: relative;
}

.slide-num {
  font-size: 11px;
  color: var(--gray-mid);
  font-weight: 700;
  margin-bottom: 6px;
}

.slide-label {
  font-size: 12px;
  color: var(--terracotta);
  font-weight: 700;
  margin-bottom: 8px;
}

.story-textarea {
  width: 100%;
  border: 1.5px solid var(--cream-dark);
  border-radius: var(--radius-sm);
  padding: 10px;
  font-size: 13px;
  font-family: var(--font);
  color: var(--charcoal);
  resize: none;
  line-height: 1.6;
  background: var(--cream);
  min-height: 80px;
  outline: none;
  transition: border-color .2s;
}

.story-textarea:focus { border-color: var(--sage); }

.copy-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--sage);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  margin-top: 8px;
  transition: background .2s;
  width: 100%;
}

.copy-btn:active { background: var(--sage-dark); }

.stamp-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.stamp-btn {
  background: var(--cream-dark);
  border: none;
  border-radius: 99px;
  padding: 5px 12px;
  font-size: 11px;
  font-family: var(--font);
  cursor: pointer;
  color: var(--charcoal);
  transition: all .2s;
}

.stamp-btn.active { background: #f5eeff; color: #7a5aad; border: 1px solid #c5aaee; }

/* ========== KPI ========== */
.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0 16px 16px;
}

.kpi-cell {
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 12px;
  box-shadow: var(--shadow);
  text-align: center;
}

.kpi-label { font-size: 10px; color: var(--gray-mid); margin-bottom: 4px; }
.kpi-value { font-size: 22px; font-weight: 700; color: var(--charcoal); }
.kpi-unit { font-size: 11px; color: var(--gray-mid); }
.kpi-target { font-size: 10px; color: var(--sage); margin-top: 2px; }
.kpi-calc { font-size: 16px; font-weight: 700; color: var(--terracotta); }

.kpi-input-group {
  margin: 0 16px 10px;
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi-input-label { font-size: 13px; font-weight: 600; }
.kpi-input {
  width: 90px;
  border: 1.5px solid var(--cream-dark);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 16px;
  font-family: var(--font);
  text-align: right;
  color: var(--charcoal);
  outline: none;
  transition: border-color .2s;
  background: var(--cream);
  font-weight: 600;
}

.kpi-input:focus { border-color: var(--sage); }

/* ========== FERMENT CALENDAR ========== */
.ferment-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 0 16px 16px;
}

.ferment-cell {
  width: calc((100% - 5px * 6) / 7);
  aspect-ratio: 1;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--gray-mid);
  background: var(--cream-dark);
  position: relative;
}

.ferment-cell.active {
  background: var(--sage);
  color: white;
  font-weight: 700;
}

.ferment-cell.active::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 6px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Ctext y='15' font-size='14'%3E🍶%3C/text%3E%3C/svg%3E") center/60% no-repeat;
}

.streak-badge {
  background: linear-gradient(135deg, var(--terracotta), var(--terracotta-light));
  color: white;
  border-radius: var(--radius);
  padding: 14px 18px;
  margin: 0 16px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
}

.streak-num { font-size: 32px; font-weight: 700; }
.streak-label { font-size: 12px; opacity: .9; }
.streak-msg { font-size: 13px; font-weight: 600; text-align: right; line-height: 1.4; }

/* ========== BUTTONS ========== */
.btn-primary {
  background: var(--sage);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  width: 100%;
  transition: background .2s;
}

.btn-primary:active { background: var(--sage-dark); }

.btn-secondary {
  background: var(--cream-dark);
  color: var(--charcoal);
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background .2s;
}

.btn-terra {
  background: var(--terracotta);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background .2s;
}

/* ========== FLOATING BTN ========== */
.fab {
  position: fixed;
  bottom: 74px;
  right: 18px;
  width: 52px; height: 52px;
  background: var(--terracotta);
  color: white;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  z-index: 99;
  transition: transform .2s;
}

.fab:active { transform: scale(.92); }

/* ========== MODAL ========== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 200;
  display: flex;
  align-items: flex-end;
}

.modal-sheet {
  background: var(--white);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 20px 20px 32px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  animation: slideUp .25s ease;
  box-sizing: border-box;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-handle {
  width: 40px; height: 4px;
  background: var(--cream-dark);
  border-radius: 99px;
  margin: 0 auto 16px;
}

.modal-title { font-size: 16px; font-weight: 700; margin-bottom: 16px; }

/* ========== CHARTS ========== */
.chart-wrap {
  position: relative;
  margin: 0 16px 16px;
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

/* ========== TOAST ========== */
.toast {
  position: fixed;
  top: 20px; left: 50%;
  transform: translateX(-50%);
  background: var(--sage-dark);
  color: white;
  padding: 10px 20px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 600;
  z-index: 300;
  box-shadow: var(--shadow-lg);
  animation: fadeInOut 2s ease forwards;
  white-space: nowrap;
}

@keyframes fadeInOut {
  0% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  15% { opacity: 1; transform: translateX(-50%) translateY(0); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
}

/* ========== PRODUCTION TRACKER ========== */
.tracker-item {
  background: var(--white);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  margin: 0 16px 10px;
}

.tracker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.tracker-title { font-size: 14px; font-weight: 700; }
.tracker-steps {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.step-chip {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 99px;
  background: var(--cream-dark);
  color: var(--gray-mid);
  cursor: pointer;
  border: none;
  font-family: var(--font);
  transition: all .2s;
}

.step-chip.done { background: var(--sage); color: white; }
.step-chip.current { background: var(--terracotta); color: white; }

/* ========== FORMS ========== */
.form-group { margin-bottom: 14px; }
.form-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--sage-dark);
  margin-bottom: 5px;
  display: block;
}

.form-input {
  width: 100%;
  border: 1.5px solid var(--cream-dark);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  font-family: var(--font);
  color: var(--charcoal);
  background: var(--cream);
  outline: none;
  transition: border-color .2s;
}

.form-input:focus { border-color: var(--sage); }

.form-select {
  width: 100%;
  border: 1.5px solid var(--cream-dark);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  font-family: var(--font);
  color: var(--charcoal);
  background: var(--cream);
  outline: none;
  appearance: none;
  cursor: pointer;
}

/* ========== TAB TOGGLE ========== */
.tab-row {
  display: flex;
  gap: 6px;
  padding: 0 16px 12px;
}

.tab-btn {
  flex: 1;
  border: 1.5px solid var(--cream-dark);
  border-radius: var(--radius-sm);
  padding: 8px 4px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font);
  background: var(--white);
  cursor: pointer;
  color: var(--gray-mid);
  transition: all .2s;
}

.tab-btn.active {
  background: var(--sage);
  border-color: var(--sage);
  color: white;
}

/* ========== EMPTY STATE ========== */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--gray-mid);
}

.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; line-height: 1.6; }

/* ========== CHIP ========== */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--cream-dark);
  border-radius: 99px;
  padding: 3px 10px;
  font-size: 11px;
  color: var(--charcoal);
}

/* ========== ANIM ========== */
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.bounce { animation: bounce .5s ease; }

@keyframes popIn {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

.pop-in { animation: popIn .35s ease; }

/* ========== DM TEMPLATES ========== */
.dm-card {
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  box-shadow: var(--shadow);
  margin: 0 16px 8px;
}

.dm-keyword {
  display: inline-block;
  background: var(--terracotta);
  color: white;
  border-radius: 99px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 6px;
}

.dm-text { font-size: 12px; color: var(--charcoal); line-height: 1.5; }

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--cream-dark); border-radius: 2px; }
