:root {
  --bg: #f3f3f2;
  --surface: #ffffff;
  --ink: #111113;
  --muted: #6e6e75;
  --line: #e5e5e8;
  --accent: #ad0503;
  --accent-fg: #ad0503;
  --accent-soft: rgba(173, 5, 3, 0.1);
  --ok: #30a46c;
  --ok-bg: rgba(48, 164, 108, 0.14);
  --warn: #f5a524;
  --alert: #e5484d;
  --pill-bg: #ececf0;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #08080a;
    --surface: #161618;
    --ink: #f4f4f6;
    --muted: #9898a0;
    --line: #2a2a2f;
    --accent: #ad0503;
    --accent-fg: #ff625f;
    --accent-soft: rgba(173, 5, 3, 0.24);
    --ok: #34b27b;
    --ok-bg: rgba(48, 164, 108, 0.2);
    --pill-bg: #232328;
  }
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.ci-shell {
  max-width: 600px;
  margin: 0 auto;
  padding: 18px 14px 48px;
}

.ci-brand-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.ci-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ci-brand img {
  width: auto;
  height: 34px;
  object-fit: contain;
}

.ci-brand-light {
  display: none;
}

@media (prefers-color-scheme: dark) {
  .ci-brand-dark {
    display: none;
  }
  .ci-brand-light {
    display: block;
  }
}

.ci-brand-txt strong {
  display: block;
  font-size: 15px;
  letter-spacing: -0.02em;
}

.ci-brand-txt span {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
}

.ci-pill-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
}

.ci-hero {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px 16px 14px;
  margin-bottom: 14px;
}

.ci-hero h1 {
  margin: 0 0 4px;
  font-size: 21px;
  letter-spacing: -0.025em;
}

.ci-hero p {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}

.ci-last-chip {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent-fg);
  background: var(--accent-soft);
  padding: 5px 10px;
  border-radius: 999px;
}

.ci-mode-switch {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  border-radius: 14px;
  background: var(--bg);
  border: 1px solid var(--line);
}

.ci-mode-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ci-mode-btn.on {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.ci-schedule-banner {
  margin-top: 10px;
  padding: 8px 11px;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.4;
  color: var(--ink);
  font-weight: 600;
}

.ci-schedule-gate {
  text-align: center;
  padding: 22px 18px;
}

.ci-gate-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-fg);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 10px;
}

.ci-schedule-gate h2 {
  margin: 0 0 6px;
  font-size: 18px;
}

.ci-gate-desc {
  margin: 0 0 14px;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--muted);
}

.ci-gate-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.ci-gate-meta > div {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
}

.ci-gate-meta span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 2px;
}

.ci-gate-meta strong {
  font-size: 14px;
  color: var(--ink);
}

.ci-gate-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ci-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px;
  margin-bottom: 12px;
}

.ci-card-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.ci-card-hd h2 {
  margin: 0;
  font-size: 15px;
  letter-spacing: -0.015em;
}

.ci-card-hd small {
  font-size: 11.5px;
  color: var(--muted);
}

.ci-sub-note {
  margin: -4px 0 12px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}

.ci-field-group {
  margin-bottom: 12px;
}

.ci-field-group:last-child {
  margin-bottom: 0;
}

.ci-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}

.ci-label .req {
  color: var(--accent-fg);
  font-size: 11px;
  font-weight: 600;
}

.ci-input,
.ci-textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ci-input:focus,
.ci-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.ci-textarea {
  resize: vertical;
  min-height: 74px;
  font-size: 14px;
}

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

@media (max-width: 440px) {
  .ci-grid2 {
    grid-template-columns: 1fr;
  }
}

.ci-weight-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ci-weight-row .ci-input {
  font-size: 20px;
  font-weight: 700;
  padding: 11px 14px;
}

.ci-delta-pill {
  flex: none;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--pill-bg);
  color: var(--muted);
}

.ci-delta-pill.down {
  background: var(--ok-bg);
  color: var(--ok);
}

.ci-delta-pill.up {
  background: var(--accent-soft);
  color: var(--accent-fg);
}

.ci-scale-row {
  display: grid;
  grid-template-columns: repeat(11, minmax(0, 1fr));
  gap: 4px;
}

.ci-scale-btn {
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  border-radius: 10px;
  min-height: 40px;
  padding: 9px 0;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

@media (max-width: 480px) {
  .ci-scale-row {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 6px;
  }
  .ci-scale-btn {
    min-height: 44px;
    font-size: 14px;
  }
}

.ci-scale-btn.on {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.ci-scale-legend {
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 4px;
}

.ci-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ci-chip {
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ci-chip.on {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

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

.ci-photo-slot {
  position: relative;
  border: 1.5px dashed var(--line);
  border-radius: 14px;
  background: var(--bg);
  aspect-ratio: 3 / 4;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.ci-photo-slot.has-img {
  border-style: solid;
  border-color: var(--ok);
}

.ci-photo-slot input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.ci-goal-photo-sec {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ci-goal-photo-hd {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.ci-goal-photo-hd strong {
  display: block;
  font-size: 13.5px;
  color: var(--ink);
  margin-bottom: 2px;
}

.ci-goal-photo-hd small {
  display: block;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}

.ci-opt-pill {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--pill-bg, rgba(142, 142, 147, 0.14));
  color: var(--muted);
}

.ci-goal-photo-slot-wrap {
  display: flex;
  justify-content: flex-start;
}

.ci-photo-slot.is-goal {
  width: 100%;
  max-width: 230px;
  aspect-ratio: 4 / 3;
}

.ci-photo-slot.is-goal .ci-photo-preview {
  object-fit: contain;
}

.ci-photo-empty {
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.ci-photo-empty svg {
  width: 24px;
  height: 24px;
  color: var(--muted);
}

.ci-photo-empty strong {
  font-size: 12px;
  color: var(--ink);
  line-height: 1.25;
}

.ci-photo-empty span {
  font-size: 10.5px;
  color: var(--muted);
}

.ci-photo-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ci-photo-caption {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 6px;
  background: rgba(17, 17, 19, 0.72);
  color: #ffffff;
  font-size: 10.5px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.ci-photo-del {
  border: none;
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
}

.ci-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 18px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  background: var(--surface);
  color: var(--ink);
}

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

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

.ci-err-box {
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  color: var(--accent-fg);
  border-radius: 14px;
  padding: 11px 13px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
}

.ci-state-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 28px 20px;
  text-align: center;
  margin-top: 18px;
}

.ci-state-ico {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: var(--accent-soft);
  color: var(--accent-fg);
  display: inline-grid;
  place-items: center;
  margin-bottom: 12px;
}

.ci-state-ico.ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.ci-state-card h2 {
  margin: 0 0 6px;
  font-size: 19px;
}

.ci-state-card p {
  margin: 0 0 16px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--muted);
}

.ci-btn.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
  margin-top: 8px;
}

.ci-support-footer {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

.ci-support-label {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 500;
}

.ci-support-links {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.ci-support-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  transition: color 0.16s ease, border-color 0.16s ease, background-color 0.16s ease;
}

.ci-support-link.is-wa {
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(22, 163, 74, 0.14);
  border: 1px solid rgba(22, 163, 74, 0.32);
  color: #15803d;
}

@media (prefers-color-scheme: dark) {
  .ci-support-link.is-wa {
    color: #4ade80;
    background: rgba(34, 197, 94, 0.14);
    border-color: rgba(34, 197, 94, 0.34);
  }
}

.ci-support-link.is-wa:hover {
  background: rgba(22, 163, 74, 0.22);
}

.ci-support-link.is-email {
  border-bottom: 1px dashed var(--line);
}

.ci-support-link.is-email:hover {
  color: var(--accent-fg);
  border-bottom-color: var(--accent-fg);
}

.ci-support-sep {
  color: var(--muted);
  opacity: 0.65;
}

[hidden] {
  display: none !important;
}

@keyframes ciCardEnter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ci-draft-banner {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 12px;
  background: var(--accent-soft);
  border: 1px solid rgba(217, 119, 6, 0.35);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
}

.ci-draft-clear {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}

.ci-draft-clear:hover {
  border-color: var(--accent);
  color: var(--accent-fg);
}

.ci-state-card:not([hidden]),
.ci-schedule-gate:not([hidden]),
.ci-schedule-banner:not([hidden]),
.ci-draft-banner:not([hidden]),
.ci-err-box:not([hidden]),
.ci-card:not([hidden]),
#ciDailyNoteWrap:not([hidden]) {
  animation: ciCardEnter 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.ci-btn,
.ci-mode-btn,
.ci-chip,
.ci-scale-btn {
  transition: transform 0.14s ease, background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.ci-btn:active,
.ci-mode-btn:active,
.ci-chip:active,
  .ci-scale-btn:active {
    transform: scale(0.97);
  }

.ci-sub-divider {
  height: 1px;
  background: var(--line);
  margin: 14px 0 12px;
}

.ob-cond-box {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

select.ci-input {
  appearance: auto;
}

.ci-card {
  overflow-x: hidden;
}

.ci-field-group {
  min-width: 0;
}

.ci-grid2 {
  margin-bottom: 12px;
}

.ci-grid2:last-child {
  margin-bottom: 0;
}

.ci-grid2 > .ci-field-group {
  margin-bottom: 0;
  min-width: 0;
}

input[type="date"].ci-input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  display: block;
  text-align: left;
  min-height: 44px;
  font-size: 16px;
  line-height: 22px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
