/*
  의전 플래너 · css/app.css  (v001)
  ─────────────────────────────────────────────
  이 파일이 하는 일:
    화면의 색·글자·모양·배치를 정합니다. "디자인 규칙 v2"를 그대로 옮겼습니다.
    - 애플 스타일. 반투명 유리(.glass)는 떠 있는 조작부에만, 내용 카드(.card)는 불투명 흰색
    - 버튼·칩·탭·입력칸은 모두 캡슐형, 누르는 곳은 최소 44px(휴대폰)

  화면 폭별 배치 (맨 아래 @media 부분):
    1280px 이상   : PC — 왼쪽 목록(248px) + 타임라인 + 지도·편집(500px)
    1024~1279px   : 태블릿 가로 — 목록은 아이콘 줄(64px)로 접고, 누르면 서랍으로
    600~1023px    : 폴더블 펼침·태블릿 세로 — 좌우 같은 폭 2단, 가운데 24px 틈(접히는 선 자리)
    600px 미만    : 휴대폰 — 한 줄 목록, 편집은 아래에서 올라오는 시트, 하단 캡슐 버튼
*/

/* ── 1. 색·크기 약속값 (디자인 규칙 v2) ───────────── */
:root {
  --bg: #F2F2F7;          /* 바탕 */
  --card: #FFFFFF;        /* 내용 카드 */
  --text: #1C1C1E;        /* 글자 기본 */
  --text2: #3A3A40;       /* 글자 본문 보조 */
  --muted: #55555C;       /* 글자 보조 */
  --faint: #8E8E93;       /* 비활성 */
  --accent: #0066CC;      /* 주 색: 버튼·선택 */
  --accent-soft: rgba(0, 102, 204, 0.12);
  --late: #C93400;        /* 지연·변경·확인 필요 */
  --late-soft: rgba(255, 149, 0, 0.16);
  --ok: #248A3D;          /* 정시·완료 */
  --ok-soft: rgba(52, 199, 89, 0.16);
  --danger: #A12A00;      /* 삭제 */
  --danger-soft: rgba(201, 52, 0, 0.10);
  --fill: rgba(118, 118, 128, 0.12);  /* 회색 채움 (보조 버튼·탭 바탕) */
  --line: rgba(60, 60, 67, 0.15);     /* 구분선 */
  --r-card: 22px; --r-list: 18px; --r-sheet: 34px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Apple SD Gothic Neo", "Pretendard", "Malgun Gothic", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button, input { font-family: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }

/* ── 2. 공통 부품 ─────────────────────────────── */

/* 반투명 유리: 떠 있는 조작부 전용 */
.glass {
  background: rgba(255, 255, 255, 0.58);
  -webkit-backdrop-filter: blur(20px) saturate(190%);
  backdrop-filter: blur(20px) saturate(190%);
  border: 1px solid rgba(255, 255, 255, 0.75);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.08), inset 0 1.5px 0 rgba(255, 255, 255, 1), inset 0 -1px 0 rgba(255, 255, 255, 0.45);
}
/* 흐림 효과를 지원하지 않는 브라우저는 흰색 불투명으로 대체 */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: rgba(255, 255, 255, 0.96); }
}

/* 불투명 내용 카드 */
.card { background: var(--card); border-radius: var(--r-card); }

.muted { color: var(--muted); }
.error-text { color: var(--danger); font-size: 13px; line-height: 1.5; }
.version { color: var(--faint); font-size: 12px; margin: 14px 0 0; }

/* 버튼 */
.btn {
  height: 44px; padding: 0 16px; border: none; border-radius: 999px;
  background: var(--fill); font-size: 14px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; font-weight: 700; box-shadow: 0 4px 12px rgba(0, 102, 204, 0.25); }
.btn-tint { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-small { height: 34px; padding: 0 12px; font-size: 13px; }
.btn-icon { width: 44px; padding: 0; }
.btn-wide { width: 100%; }
.btn.is-later { opacity: 0.55; }   /* 다음 단계에서 제공되는 버튼 */
.btn svg { flex-shrink: 0; }

/* 분할 버튼(세그먼트): 탭 */
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: rgba(118, 118, 128, 0.14); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button {
  height: 34px; padding: 0 13px; border: none; border-radius: 999px; background: transparent;
  font-size: 13.5px; font-weight: 500; white-space: nowrap; flex-shrink: 0;
}
.seg button.on { background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12); font-weight: 700; }
.seg button:disabled { color: var(--faint); }
.seg.fill { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); width: 100%; }

/* 작은 표시(배지) */
.badge { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--fill); color: var(--text2); white-space: nowrap; }
.badge.late { background: var(--late-soft); color: #9A3412; }
.badge.accent { background: var(--accent-soft); color: #004C99; }
.badge.ok { background: var(--ok-soft); color: #1C6B30; }

/* 입력칸 */
.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); min-width: 0; }
/* 아이폰 사파리는 시간·날짜 입력칸에 자체 최소 폭이 있어 옆 칸을 침범함 → 기본 모양을 끄고 폭을 칸에 맞춤 */
.field input[type="time"], .field input[type="date"] { -webkit-appearance: none; appearance: none; display: block; line-height: 40px; text-align: left; }
.field input::-webkit-date-and-time-value { text-align: left; margin: 0; }
.field input {
  height: 42px; padding: 0 14px; border: 1px solid rgba(60, 60, 67, 0.18); border-radius: 999px;
  background: #fff; font-size: 16px; font-weight: 400; color: var(--text); width: 100%; min-width: 0;
}
.field input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid2 > * { min-width: 0; }

/* 가운데 정렬 화면 (불러오는 중, 로그인) */
.center-screen { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.small-card { padding: 20px 28px; }
.login-card { width: min(380px, 100%); padding: 32px 24px; text-align: center; display: flex; flex-direction: column; gap: 14px; }
.login-icon { align-self: center; width: 88px; height: 88px; border-radius: 22px; box-shadow: 0 8px 20px rgba(0, 40, 100, 0.25); }
.brand-icon { width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0; }
.login-title { margin: 0; font-size: 26px; letter-spacing: -0.4px; }
.login-card p { margin: 0; line-height: 1.5; }

/* 안내 문구 (토스트) */
#toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  /* v007: left:50%로 두면 폭이 화면 절반으로 줄어 두 줄로 꺾였음 → 글자 길이만큼 넓히고 화면 폭을 넘으면만 줄바꿈 */
  width: max-content; max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: 999px; text-align: center;
  background: rgba(28, 28, 30, 0.88); color: #fff; font-size: 14px; font-weight: 600; z-index: 100;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

/* ── 3. 전체 틀 ───────────────────────────────── */
#shell { min-height: 100dvh; padding: 16px; display: grid; grid-template-columns: 248px minmax(0, 1fr); gap: 16px; align-items: start; align-content: start; }
.main { min-width: 0; display: flex; flex-direction: column; gap: 12px; }

/* 왼쪽 목록 */
#sidebar { position: sticky; top: 16px; height: calc(100dvh - 32px); }
#sidebar .panel { height: 100%; border-radius: 26px; padding: 18px 14px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }
#sidebar .rail { display: none; }
.brand { padding: 0 6px; display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 700; letter-spacing: -0.3px; }
.side-label { padding: 0 6px; font-size: 12px; font-weight: 700; color: var(--muted); }
.event-list { display: flex; flex-direction: column; gap: 4px; }
/* 목록 항목 길게 누르기 메뉴 (v006) */
.event-item { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; transition: transform 0.2s var(--spring); }
.event-item.pressing { transform: scale(0.97); background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); }
.event-item .pin-mark { color: var(--accent); display: inline-flex; flex-shrink: 0; }
.side-hint { padding: 0 6px; font-size: 11.5px; color: var(--faint); white-space: nowrap; }
/* 안내 문구: 손가락 기기는 "길게 눌러", 마우스 기기는 "오른쪽 클릭" (v011) */
.only-mouse { display: none; }
@media (hover: hover) and (pointer: fine) { .only-touch { display: none; } .only-mouse { display: inline; } }
.ctx-menu { position: fixed; z-index: 60; min-width: 190px; padding: 6px; border-radius: 16px; display: flex; flex-direction: column; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18); transform-origin: top right; animation: ctxIn 0.28s var(--spring) both; }
.ctx-menu.out { transition: opacity 0.18s, transform 0.18s; opacity: 0; transform: scale(0.94); }
.ctx-menu button { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border: none; background: transparent; border-radius: 10px; font: inherit; font-size: 15px; color: var(--text); text-align: left; }
.ctx-menu button:active, .ctx-menu button:hover { background: rgba(0, 0, 0, 0.06); }
.ctx-menu button.danger { color: var(--danger); }
.ctx-menu button + button { border-top: 0.5px solid rgba(0, 0, 0, 0.08); }
@keyframes ctxIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: none; } }
.event-item { text-align: left; padding: 10px 12px; border: none; border-radius: 16px; background: transparent; display: flex; flex-direction: column; gap: 3px; }
.event-item.on { background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); }
.event-item .row { display: flex; align-items: center; gap: 6px; }
.event-item .t { flex-grow: 1; font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-item .d { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-item .u { color: var(--faint); }   /* 날짜 옆 최종 수정 시각 (v005: 한 줄로 합침) */
.last-edit { font-size: 12px; color: var(--faint); white-space: nowrap; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.user-line { padding: 0 6px; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-note { padding: 8px 6px; font-size: 13px; color: var(--muted); line-height: 1.5; }

/* 아이콘 줄 (태블릿 가로) */
.rail { flex-direction: column; align-items: center; gap: 10px; padding: 12px 0; border-radius: 26px; height: 100%; }
.rail .btn-icon { border-radius: 14px; }
.rail .spacer { flex-grow: 1; }

/* 서랍 뒤 어두운 막 */
#backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.2); z-index: 40; }

/* 상단 유리 바 */
#topbar { position: sticky; top: 16px; z-index: 20; border-radius: 26px; padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }
.top-row { display: flex; align-items: center; gap: 8px; }
.empty-title { font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.title-block { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.title-input { border: none; background: transparent; font-size: 22px; font-weight: 700; letter-spacing: -0.3px; padding: 2px 0; width: 100%; min-width: 0; border-radius: 8px; }
.title-input:focus { outline: 2px solid var(--accent); background: rgba(255, 255, 255, 0.7); }
.meta-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.date-input { border: none; background: transparent; font-size: 13px; color: var(--muted); padding: 0; -webkit-appearance: none; appearance: none; min-width: 0; }
.save-state { font-size: 12px; font-weight: 600; white-space: nowrap; }
.save-state.ok { color: #1C6B30; } .save-state.busy { color: var(--muted); } .save-state.off { color: #9A3412; } .save-state.err { color: var(--danger); }
.tab-row { display: flex; align-items: center; gap: 10px; }
.tab-row .grow { flex-grow: 1; }
.only-compact { display: none; }

/* 내용: 타임라인 + 오른쪽(지도·편집) */
.content { display: grid; grid-template-columns: minmax(0, 1fr) 500px; gap: 16px; align-items: start; }
#timeline { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
#side { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 12px; max-height: calc(100dvh - 32px); overflow-y: auto; }

/* 타임라인 */
.tl-head { display: flex; align-items: center; gap: 8px; padding: 0 6px; flex-wrap: wrap; }
.tl-head .sum { flex-grow: 1; font-size: 13px; font-weight: 600; color: var(--muted); }
.tl-list { background: var(--card); border-radius: var(--r-card); overflow: hidden; }
.tl-item + .tl-item { border-top: 0.5px solid var(--line); }
.tl-move { display: flex; align-items: center; gap: 10px; padding: 8px 16px 8px 20px; background: rgba(118, 118, 128, 0.05); font-size: 12.5px; color: var(--text2); }
.tl-move .ico { width: 56px; display: flex; justify-content: center; color: var(--muted); }
.tl-move .txt { flex-grow: 1; }
.tl-move .dep { font-weight: 700; color: var(--text); }
.tl-row { width: 100%; text-align: left; display: flex; align-items: center; gap: 12px; padding: 14px 16px 14px 17px; border: none; border-left: 3px solid transparent; background: transparent; }
.tl-row.on { border-left-color: var(--accent); background: rgba(0, 102, 204, 0.06); }
.tl-row .num { width: 26px; height: 26px; border-radius: 999px; background: #AEAEB2; color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.tl-row.on .num { background: var(--accent); }
.tl-row .time { width: 52px; font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.tl-row .body { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.tl-row .line1 { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tl-row .place { font-size: 15.5px; font-weight: 600; }
.tl-row .place.empty { color: var(--faint); font-weight: 500; }
.tl-row .memo { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-row .issues { display: flex; gap: 4px; flex-wrap: wrap; }
.tl-row .end { font-size: 12px; color: var(--muted); white-space: nowrap; flex-shrink: 0; }
.tl-empty { padding: 28px 20px; text-align: center; color: var(--muted); font-size: 14px; line-height: 1.6; }
.tl-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 0 6px; flex-wrap: wrap; }

/* 지도 자리 */
#mapcard { padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.map-box { height: 220px; border-radius: 16px; overflow: hidden; background: #ECEFEA; position: relative; }
.map-box.empty { display: flex; align-items: center; justify-content: center; text-align: center; padding: 12px; height: 150px; }
.map-box.empty::after { content: attr(data-msg); font-size: 13px; color: var(--muted); line-height: 1.5; }
.map-pin { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 13px; font-weight: 800; display: flex; align-items: center; justify-content: center; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3); }
/* 이동 수단 선택 (v012): 4칸 × 2줄, "기타"는 2칸 차지 → 누르면 아래 줄에 항공·택시·자전거·그 밖 */
.move-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.move-grid.sub { margin-top: -2px; padding: 6px; border-radius: 16px; background: rgba(118, 118, 128, 0.08); }
.move-grid button { min-height: 40px; padding: 0 4px; border: none; border-radius: 999px; background: rgba(118, 118, 128, 0.12); font: inherit; font-size: 13px; font-weight: 600; color: var(--text); display: flex; align-items: center; justify-content: center; gap: 4px; white-space: nowrap; overflow: hidden; }
.move-grid button span { overflow: hidden; text-overflow: ellipsis; }
.move-grid button.on { background: #fff; color: var(--accent); box-shadow: 0 0 0 1.5px var(--accent) inset, 0 2px 6px rgba(0, 0, 0, 0.08); font-weight: 800; }
.move-grid .more { grid-column: span 2; }
.move-grid .more .car { font-size: 10px; color: var(--muted); }
.move-grid.sub button { background: #fff; }
.stepper .lbl small { display: block; font-size: 11px; font-weight: 500; color: var(--muted); }
/* 장소 검색 (v011) */
.place-field { display: flex; flex-direction: column; gap: 6px; }
.place-row { display: flex; gap: 6px; align-items: center; }
.place-row input { flex: 1; min-width: 0; }
.place-row .btn { flex-shrink: 0; min-height: 40px; }
.place-addr { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--accent); }
.place-addr.muted { color: var(--muted); }
.place-results { display: flex; flex-direction: column; border-radius: 14px; background: rgba(118, 118, 128, 0.07); overflow: hidden; }
.place-results button { text-align: left; border: none; background: transparent; padding: 9px 12px; font: inherit; display: flex; flex-direction: column; gap: 1px; min-height: 44px; }
.place-results button + button { border-top: 0.5px solid var(--line); }
.place-results button:hover { background: rgba(0, 0, 0, 0.04); }
.place-results b { font-size: 14px; }
.place-results span { font-size: 12px; color: var(--muted); }
.map-ph { height: 150px; border-radius: 16px; background: #ECEFEA; display: flex; align-items: center; justify-content: center; text-align: center; font-size: 13px; color: var(--muted); line-height: 1.5; padding: 12px; }
.card-title { font-size: 15px; font-weight: 700; }

/* 편집 */
#editor { padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }
.ed-head { display: flex; align-items: center; gap: 8px; }
.ed-head .card-title { flex-grow: 1; }
.ed-box { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: var(--r-list); background: rgba(118, 118, 128, 0.06); }
.ed-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper .lbl { flex-grow: 1; font-size: 14px; color: var(--text2); }
.stepper .val { min-width: 52px; text-align: center; font-size: 16px; font-weight: 700; }
.stepper .btn-icon { width: 40px; height: 40px; font-size: 18px; font-weight: 700; }
.dep-pill { align-self: flex-start; padding: 6px 12px; border-radius: 999px; background: rgba(0, 102, 204, 0.10); color: #004C99; font-size: 13px; font-weight: 700; line-height: 1.4; }
.ed-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ed-actions .grow { flex-grow: 1; }
.copy-menu { display: flex; flex-wrap: wrap; gap: 6px; }
.sheet-close { display: none; }
.sheet-grip { display: none; }

/* 휴대폰 하단 캡슐 바 */
#bottombar { display: none; }

/* ── 4. 화면 폭별 배치 ─────────────────────────── */

/* 태블릿 가로 (1024~1279): 목록은 아이콘 줄, 누르면 서랍 */
@media (max-width: 1279px) {
  #shell { grid-template-columns: 64px minmax(0, 1fr); }
  #sidebar .rail { display: flex; }
  #sidebar .panel { display: none; }
  .content { grid-template-columns: minmax(0, 1fr) 440px; }
  body.drawer #sidebar .panel {
    display: flex; position: fixed; left: 12px; top: 12px; bottom: 12px; width: 290px; height: auto; z-index: 50;
    background: rgba(255, 255, 255, 0.9);
  }
}

/* 폴더블 펼침·태블릿 세로 (600~1023): 사이드바 없이 좌우 같은 폭 2단 */
@media (max-width: 1023px) {
  #shell { grid-template-columns: minmax(0, 1fr); }
  #sidebar { position: static; height: 0; }
  #sidebar .rail { display: none; }
  .only-compact { display: inline-flex; }
  .content { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; }  /* 가운데 24px = 접히는 선 자리 */
  .hide-compact { display: none !important; }
  .title-input { font-size: 19px; }
}

/* 휴대폰 (600 미만): 한 줄, 편집은 아래 시트, 하단 캡슐 바 */
@media (max-width: 599px) {
  #shell { padding: 12px 12px 110px; gap: 12px; }
  #topbar { top: 12px; padding: 10px 12px; }
  .content { grid-template-columns: minmax(0, 1fr); }
  .hide-phone { display: none !important; }
  .title-input { font-size: 17px; }
  .tl-row .time { width: 48px; font-size: 15px; }
  .tl-row .end { display: none; }
  .tl-move .ico { width: 50px; }

  /* 편집: 평소에는 숨기고, 일정을 누르면 아래에서 올라오는 시트로 */
  #side { display: none; }
  body.sheet #side {
    display: flex; position: fixed; left: 8px; right: 8px; bottom: 8px; top: auto; max-height: 86dvh; z-index: 60;
    border-radius: var(--r-sheet); padding: 10px 8px 12px;
    background: rgba(255, 255, 255, 0.9);
    -webkit-backdrop-filter: blur(30px) saturate(190%); backdrop-filter: blur(30px) saturate(190%);
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.18);
  }
  body.sheet #mapcard { display: none; }
  body.sheet #editor { background: transparent; }
  .sheet-close { display: inline-flex; }
  .sheet-grip { display: block; align-self: center; width: 36px; height: 5px; border-radius: 3px; background: rgba(60, 60, 67, 0.3); }

  #bottombar {
    display: flex; position: fixed; left: 12px; right: 12px; bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 30;
    gap: 6px; padding: 6px; border-radius: 999px;
  }
  #bottombar .btn { height: 56px; font-size: 15px; }
  #bottombar .btn-primary { flex-grow: 1; font-size: 16px; }
  #toast { bottom: 104px; }
}

/* ── 5. 움직임 (v003) ─────────────────────────────
   애플 기기처럼 "살짝 튕기듯 자연스럽게" 움직이도록, 짧고 부드러운 곡선을 씁니다.
   - --spring : 빠르게 출발해서 부드럽게 멈추는 곡선 (iOS 시트·서랍과 비슷한 느낌)
   - 움직임 줄이기를 켠 기기(설정 → 손쉬운 사용)에서는 모든 움직임을 끕니다.
*/
:root { --spring: cubic-bezier(0.32, 0.72, 0, 1); --ease: cubic-bezier(0.25, 0.1, 0.25, 1); }

/* 누르면 살짝 눌리는 느낌 */
.btn, .event-item, .tl-row, .seg button { transition: transform 0.18s var(--spring), background-color 0.25s var(--ease), box-shadow 0.25s var(--ease), color 0.25s var(--ease), opacity 0.25s var(--ease); }
.btn:active, .event-item:active, .seg button:active { transform: scale(0.96); }
.tl-row:active { transform: scale(0.99); }
.tl-row { transition: background-color 0.25s var(--ease), border-color 0.25s var(--ease), transform 0.18s var(--spring); }

/* 로그인 카드: 아래에서 살짝 떠오름 */
.login-card { animation: rise 0.6s var(--spring) both; }
.login-icon { animation: pop 0.7s var(--spring) 0.05s both; }

/* 의전·플랜을 바꿀 때 타임라인이 부드럽게 바뀜 */
#timeline.swap, #editor.swap { animation: fadeUp 0.35s var(--spring) both; }

/* 새로 추가한 일정은 살짝 내려앉으며 나타남 */
.tl-item.enter { animation: dropIn 0.45s var(--spring) both; }

/* 저장 중 표시는 숨 쉬듯 깜빡임 */
.save-state.busy { animation: breathe 1.1s var(--ease) infinite; }

/* 안내 문구(토스트): 작게 튀어나왔다가 사라짐 */
#toast { transition: opacity 0.25s var(--ease), transform 0.35s var(--spring); }
#toast.in { animation: toastIn 0.4s var(--spring) both; }
#toast.out { opacity: 0; transform: translateX(-50%) translateY(8px) scale(0.96); }

/* 서랍(의전 목록)과 뒤 어두운 막 */
#backdrop { animation: fadeIn 0.3s var(--ease) both; }
body.drawer #sidebar .panel { animation: slideRight 0.45s var(--spring) both; }
body.closing #backdrop { animation: fadeOut 0.25s var(--ease) both; }
body.closing.drawer #sidebar .panel { animation: slideLeftOut 0.25s var(--ease) both; }

/* 휴대폰 편집 시트: 아래에서 올라오고, 닫을 때 내려감 */
@media (max-width: 599px) {
  body.sheet #side { animation: sheetUp 0.5s var(--spring) both; }
  body.closing.sheet #side { animation: sheetDown 0.25s var(--ease) both; }
}

@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(0.8); } to { opacity: 1; transform: none; } }
@keyframes fadeUp { from { opacity: 0.2; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes dropIn { from { opacity: 0; transform: translateY(-8px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes breathe { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(12px) scale(0.92); } to { opacity: 1; transform: translateX(-50%); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes slideRight { from { transform: translateX(-24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slideLeftOut { from { transform: none; opacity: 1; } to { transform: translateX(-24px); opacity: 0; } }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
@keyframes sheetDown { from { transform: none; } to { transform: translateY(100%); } }

/* ── 7. 날씨 카드 (v010, 확정 시안 B: 오른쪽 열 맨 위, 휴대폰 제외) ── */
#wxcard { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
@media (max-width: 599px) { #wxcard { display: none !important; } }
.wx-head { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.wx-head .wx-ic { color: var(--accent); }
.wx-place { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wx-time { font-size: 12px; color: var(--muted); }
.wx-now { display: flex; align-items: center; gap: 10px; }
.wx-temp { font-size: 34px; font-weight: 800; letter-spacing: -1px; line-height: 1; }
.wx-desc { flex: 1; min-width: 0; font-size: 13px; line-height: 1.45; }
.wx-desc .muted { font-size: 12px; }
.wx-sky { display: inline-flex; flex-shrink: 0; color: #636366; }
.wx-sky.sun, .wx-sky.partly { color: #C26A00; }
.wx-sky.rain, .wx-sky.storm { color: var(--accent); }
.wx-tag { flex-shrink: 0; font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--late-soft); color: #9A3412; white-space: nowrap; }
.wx-tag.rain { background: rgba(0, 102, 204, 0.12); color: var(--accent); }
.wx-tag.dust { background: rgba(122, 92, 0, 0.14); color: #7A5C00; }
.wx-tag.uv { background: rgba(137, 68, 171, 0.14); color: #8944AB; }
.wx-hours { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.wx-hours div { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; border-radius: 12px; background: rgba(118, 118, 128, 0.07); font-size: 11.5px; color: var(--muted); }
.wx-hours b { font-size: 13.5px; color: var(--text); }
.wx-hours em { font-style: normal; font-size: 10.5px; color: var(--accent); font-weight: 700; }
.wx-ask { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; font-size: 13px; line-height: 1.45; }
.wx-search { display: flex; align-items: center; gap: 6px; padding: 0 12px; height: 40px; border-radius: 999px; background: rgba(118, 118, 128, 0.1); color: var(--muted); }
.wx-search input { flex: 1; min-width: 0; border: none; background: transparent; font: inherit; font-size: 14px; color: var(--text); outline: none; -webkit-appearance: none; appearance: none; }
.wx-search input:disabled { color: var(--faint); }
.wx-results { display: flex; flex-direction: column; border-radius: 14px; background: rgba(118, 118, 128, 0.06); overflow: hidden; }
.wx-results button { text-align: left; border: none; background: transparent; padding: 9px 12px; font: inherit; display: flex; flex-direction: column; gap: 1px; min-height: 44px; }
.wx-results button + button { border-top: 0.5px solid var(--line); }
.wx-results button:hover { background: rgba(0, 0, 0, 0.04); }
.wx-results b { font-size: 13.5px; }
.wx-results span { font-size: 12px; color: var(--muted); }
.wx-area { display: flex; align-items: center; gap: 8px; padding-top: 10px; border-top: 0.5px solid var(--line); font-size: 13px; }
.wx-area b { font-size: 17px; }
.wx-area .muted { font-size: 12px; white-space: nowrap; }
.wx-x { width: 32px; height: 32px; min-width: 32px; }
.wx-msg { font-size: 12px; }
.wx-src { font-size: 11px; color: var(--faint); }
.wx-src a { color: inherit; }

/* ── 6. 현장 모드 (v009, 확정 시안 FieldModeV7) ─────────────
   전체 화면을 덮는 당일 진행 화면. 상단·하단은 떠 있는 유리, 내용은 불투명 흰 카드.
   PC·태블릿에서는 가운데 560px 폭으로 보여 줌 */
body.field { overflow: hidden; }
body.field #shell { visibility: hidden; }
#field { position: fixed; inset: 0; z-index: 50; overflow-y: auto; -webkit-overflow-scrolling: touch; background: var(--bg); }
#field.in { animation: fadeUp 0.35s var(--spring) both; }
#field.out { transition: opacity 0.2s, transform 0.2s; opacity: 0; transform: translateY(12px); }
.f-wrap { max-width: 560px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 96px) 14px calc(env(safe-area-inset-bottom) + 110px); display: flex; flex-direction: column; gap: 10px; }
.f-bar { display: flex; gap: 4px; margin-top: -2px; }
.f-bar i { flex: 1; height: 5px; border-radius: 3px; background: rgba(118, 118, 128, 0.2); }
.f-bar i.done { background: var(--accent); }
.f-bar i.cur { background: #7FB2E5; }
.f-top { position: fixed; z-index: 3; top: calc(env(safe-area-inset-top) + 8px); left: 50%; transform: translateX(-50%); width: min(560px, calc(100vw - 16px)); box-sizing: border-box; display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 26px; }
.f-head { flex: 1; min-width: 0; }
.f-now { font-size: 20px; font-weight: 800; letter-spacing: -0.3px; font-variant-numeric: tabular-nums; }
.f-step { font-size: 12px; font-weight: 600; color: var(--muted); margin-left: 4px; }
.f-title { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.f-seg button { min-height: 36px; padding: 0 12px; }
.f-x, .f-gear { flex-shrink: 0; }
.f-cur { background: var(--card); border: 1.5px solid var(--accent); border-radius: 22px; padding: 16px 18px; box-shadow: 0 4px 16px rgba(0, 102, 204, 0.1); display: flex; flex-direction: column; gap: 6px; }
.f-cur.f-done-card { border-color: transparent; box-shadow: none; text-align: center; padding: 22px 18px; }
.f-cur-top { display: flex; align-items: center; gap: 8px; }
.f-cur-now { font-size: 13px; font-weight: 800; color: var(--accent); }
.f-cur-plan { flex: 1; font-size: 12px; color: var(--muted); }
.f-cur-place { font-size: 26px; font-weight: 800; letter-spacing: -0.4px; line-height: 1.2; word-break: keep-all; }
.f-cur-memo { font-size: 14px; color: #3A3A40; line-height: 1.45; }
.f-cur-time { font-size: 12.5px; color: var(--muted); }
.f-next { margin-top: 4px; display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 14px; background: rgba(118, 118, 128, 0.08); font-size: 13.5px; }
.f-next .t { flex: 1; min-width: 0; font-weight: 600; }
.f-next b { font-weight: 800; white-space: nowrap; }
.f-next.soon { background: var(--late-soft); color: #9A3412; }
.f-label { padding: 6px 6px 0; font-size: 13px; font-weight: 700; color: var(--muted); }
.f-list { background: var(--card); border-radius: 20px; overflow: hidden; }
.f-none { padding: 16px; font-size: 13.5px; color: var(--muted); text-align: center; }
.f-move { display: flex; align-items: center; gap: 8px; padding: 9px 14px; background: rgba(118, 118, 128, 0.06); font-size: 12.5px; }
.f-move .t { flex: 1; min-width: 0; color: var(--muted); }
.f-move b { font-size: 13px; font-weight: 800; white-space: nowrap; }
.f-move .l { font-size: 12px; color: var(--muted); white-space: nowrap; }
.f-move.soon { background: rgba(255, 149, 0, 0.1); }
.f-move.soon b, .f-move.soon .l { color: var(--late); }
.f-row { display: flex; gap: 12px; padding: 12px 14px; }
.f-row + .f-row, .f-row + .f-move { border-top: 0.5px solid var(--line); }
.f-row-time { width: 58px; flex-shrink: 0; font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; display: flex; flex-direction: column; gap: 2px; }
.f-proj { font-size: 11px; font-weight: 700; color: var(--ok); }
.f-proj.late { color: var(--late); }
.f-row-main { flex: 1; min-width: 0; }
.f-row-main .p, .f-past .p, .f-det .p { font-size: 15.5px; font-weight: 700; word-break: keep-all; }
.f-row-main .m, .f-past .m, .f-det .m { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.f-row-main .l { font-size: 12px; color: var(--muted); margin-top: 4px; }
.f-row-main .l.soon { color: var(--late); font-weight: 700; }
.f-past { display: flex; align-items: center; gap: 10px; padding: 11px 14px; }
.f-past + .f-past { border-top: 0.5px solid var(--line); }
.f-past .ck { width: 24px; height: 24px; border-radius: 50%; background: #8E8E93; color: #fff; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.f-past .p { flex: 1; min-width: 0; font-size: 14.5px; color: #3A3A40; }
.f-past .late, .f-past .ok { font-size: 12.5px; font-weight: 800; white-space: nowrap; }
.f-past .late { color: var(--late); }
.f-past .ok { color: var(--ok); }
.f-det { background: var(--card); border-radius: 18px; padding: 12px 14px; border: 1.5px solid transparent; }
.f-det.cur { border-color: var(--accent); }
.f-det.done { background: rgba(255, 255, 255, 0.6); }
.f-det.done .p { color: #6C6C72; }
.f-det-top { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 12.5px; }
.f-det-top .num { width: 22px; height: 22px; border-radius: 50%; background: #AEAEB2; color: #fff; font-size: 12px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
.f-det.cur .num { background: var(--accent); }
.f-det.done .num { background: #8E8E93; }
.f-det-top .st { font-weight: 800; color: #3A3A40; }
.f-det.cur .st { color: var(--accent); }
.f-det-top .tl { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.f-info { display: flex; gap: 8px; font-size: 12.5px; margin-top: 6px; color: #3A3A40; }
.f-info span { width: 34px; flex-shrink: 0; color: var(--muted); font-weight: 700; }
.f-notice { padding: 10px 14px; border-radius: 14px; background: rgba(118, 118, 128, 0.1); font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.f-empty { padding: 24px 18px; text-align: center; color: var(--muted); line-height: 1.6; }
.f-alert { position: fixed; z-index: 4; top: calc(env(safe-area-inset-top) + 84px); left: 50%; transform: translateX(-50%); width: min(544px, calc(100vw - 24px)); box-sizing: border-box; display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 14px; border-radius: 20px; animation: toastIn 0.4s var(--spring) both; }
.f-alert-ic { color: var(--late); display: inline-flex; }
.f-alert-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.f-alert-txt b { font-size: 15px; color: #9A3412; }
.f-alert-txt span { font-size: 12.5px; color: #3A3A40; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.f-wrap.has-alert { padding-top: calc(env(safe-area-inset-top) + 160px); }   /* 알림 배너가 "지금" 카드를 가리지 않게 */
.f-bottom { position: fixed; z-index: 3; bottom: calc(env(safe-area-inset-bottom) + 12px); left: 50%; transform: translateX(-50%); width: min(560px, calc(100vw - 24px)); box-sizing: border-box; display: flex; align-items: center; gap: 2px; padding: 6px; border-radius: 999px; }
.f-tool { width: 54px; height: 56px; flex-shrink: 0; border: none; border-radius: 999px; background: transparent; color: var(--text); font: inherit; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.f-tool span { font-size: 10px; font-weight: 700; white-space: nowrap; }
.f-tool:active { background: rgba(0, 0, 0, 0.06); }
.f-main { position: relative; overflow: hidden; flex: 1; height: 56px; border: none; border-radius: 999px; background: var(--accent); color: #fff; font: inherit; font-size: 17px; font-weight: 800; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 4px 12px rgba(0, 102, 204, 0.25); transition: transform 0.15s var(--spring); }
.f-main:active { transform: scale(0.97); }
.f-main.end { background: #8E8E93; box-shadow: none; }
.f-main .lb { position: relative; }
.f-main .fill { position: absolute; inset: 0; background: rgba(255, 255, 255, 0.28); transform: scaleX(0); transform-origin: left; }
.f-main.holding .fill { transform: scaleX(1); transition: transform 0.6s linear; }
.f-dim { position: fixed; inset: 0; z-index: 5; border: none; padding: 0; background: rgba(0, 0, 0, 0.22); animation: fadeIn 0.2s both; }
.f-sheet { position: fixed; z-index: 6; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 8px); transform: translateX(-50%); width: min(560px, calc(100vw - 16px)); max-height: 80vh; overflow-y: auto; box-sizing: border-box; padding: 14px 18px 18px; border-radius: 28px; background: rgba(255, 255, 255, 0.92); animation: sheetUpC 0.4s var(--spring) both; }
.f-sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 17px; }
.f-set { padding: 12px 0; border-top: 0.5px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.f-set.row { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; }
.f-set .k { font-size: 15px; font-weight: 700; }
.f-set .d, .f-plan-desc { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.f-switch { flex-shrink: 0; width: 52px; height: 32px; border-radius: 999px; border: none; padding: 2px; background: rgba(120, 120, 128, 0.32); transition: background 0.2s; }
.f-switch i { display: block; width: 28px; height: 28px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); transition: transform 0.25s var(--spring); }
.f-switch.on { background: #34C759; }
.f-switch.on i { transform: translateX(20px); }
.f-plans { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.f-plan { text-align: left; border: 1.5px solid transparent; border-radius: 16px; background: #fff; padding: 12px 14px; font: inherit; display: flex; flex-direction: column; gap: 2px; min-height: 44px; }
.f-plan b { font-size: 15px; }
.f-plan span { font-size: 12.5px; color: var(--muted); }
.f-plan em { font-style: normal; font-size: 12px; font-weight: 700; color: var(--accent); }
.f-plan.on { border-color: var(--accent); }
@keyframes sheetUpC { from { opacity: 0.6; transform: translate(-50%, 40px); } to { opacity: 1; transform: translate(-50%, 0); } }
@media (max-width: 380px) { .f-tool { width: 46px; } .f-seg button { padding: 0 9px; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
