/* ========== 디자인 시스템 — "지식 기록실" 정체성
   따뜻한 종이톤 + 딥 에메랄드 + 모노스페이스 메타데이터
   ========== */
:root {
    /* === Surfaces — 종이톤 다층 === */
    --bg: #faf7ef;             /* page — 따뜻한 종이톤 */
    --bg-alt: #f3eee2;         /* 살짝 진한 surface (사이드바·코드 블록) */
    --paper: #fffefb;          /* 카드 배경 — 거의 흰색 + 미세한 따뜻함 */
    --paper-elevated: #ffffff;  /* 강조 카드 (모달·드롭다운) */

    /* === Ink (text 5단계) === */
    --ink: #1c1917;            /* 본문 */
    --ink-strong: #0c0a09;     /* heading — 거의 검정 */
    --ink-soft: #44403c;       /* secondary */
    --ink-muted: #78716c;      /* tertiary — 메타·캡션 */
    --ink-faint: #a8a29e;      /* hint — placeholder */

    /* === Accent — 케첩 레드 === */
    --accent: #dc2626;         /* primary actions */
    --accent-strong: #b91c1c;  /* hover·active */
    --accent-soft: #f87171;    /* subtle highlights */
    --accent-bg: rgba(220, 38, 38, 0.08);
    --accent-border: rgba(220, 38, 38, 0.22);

    /* === Borders === */
    --border: #e7e5e0;         /* default — 따뜻한 회색 */
    --border-soft: #f0ede5;    /* 미세 구분선 */
    --border-strong: #d6d3c9;

    /* === Status (semantic) === */
    --danger: #b91c1c;
    --warning: #c2410c;
    --success: #047857;
    --info: #0369a1;

    /* === Status dots (작은 상태 표시) === */
    --dot-active: #10b981;
    --dot-warn: #f59e0b;
    --dot-error: #ef4444;
    --dot-neutral: #a8a29e;

    /* === Shadows — 매우 절제. line-driven 디자인 === */
    --shadow-sm: 0 1px 0 rgba(28, 25, 23, 0.04);
    --shadow-md: 0 1px 3px rgba(28, 25, 23, 0.06);
    --shadow-lg: 0 6px 18px rgba(28, 25, 23, 0.10);

    /* === Typography family === */
    --font-serif: 'Noto Serif KR', 'Apple SD Gothic Neo', serif;
    --font-sans: 'Noto Sans KR', 'Inter', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', 'Menlo', Monaco, 'Courier New', monospace;
    --font-ui: 'Inter', 'Noto Sans KR', -apple-system, sans-serif;

    /* === Type scale (compact, app-like) === */
    --text-xs: 11px;
    --text-sm: 12px;
    --text-base: 13.5px;
    --text-md: 15px;
    --text-lg: 17px;
    --text-xl: 21px;
    --text-2xl: 26px;
    --text-3xl: 32px;

    /* === Spacing rhythm === */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;

    /* === Radius — 일관 적용 === */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 10px;
    --radius-xl: 14px;

    /* === Transitions === */
    --transition: 0.12s ease;

    /* === Legacy aliases (역호환 유지) === */
    --sidebar-bg: var(--bg-alt);
    --hover-bg: rgba(28, 25, 23, 0.05);
    --cat-knowledge: #4a7ba6;
    --cat-emotion: #d4604a;
    --cat-event: #6b9a6b;
}

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

/* 모든 textarea의 native resize handle(우하단 사선) 제거 — 자동 스크롤로 대체 */
textarea { resize: none; }

/* Lucide SVG 기본 크기 — 어디서든 작고 일관된 인라인 아이콘 (특정 클래스에서 override) */
svg.lucide {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    stroke-width: 1.75;
}
i[data-lucide] {
    display: inline-flex;
    width: 14px; height: 14px;
    line-height: 0;
    vertical-align: -2px;
}

/* 모든 텍스트 입력 필드 — 종이톤 배경으로 통일 (순백 ❌) */
input[type="text"], input[type="password"], input[type="email"],
input[type="number"], input[type="date"], input[type="time"],
input[type="search"], input[type="tel"], input[type="url"],
input:not([type]), textarea, select {
    background: var(--paper);
    color: var(--ink);
    font-family: inherit;
}

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--ink);
    font-size: var(--text-base);
    line-height: 1.65;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "kern" 1, "liga" 1;
}

/* 헤더 — 고딕 (UI는 sans, 명조는 인용·본문에 한정 사용) */
h1, h2, h3, .page-title {
    font-family: var(--font-sans);
    color: var(--ink-strong);
    font-weight: 700;
    letter-spacing: -0.015em;
}

/* 모노스페이스 — 시각·메타 데이터·ID·코드 */
code, kbd, .font-mono, time, .meta-mono,
.row-date, .rec-time, .bls-time, .br-time,
.cbm-time, .cmd-shortcut {
    font-family: var(--font-mono);
    font-feature-settings: 'tnum' 1, 'zero' 1;
}

/* ========== 레이아웃 ========== */
.layout {
    display: flex;
    min-height: 100vh;
    max-width: 900px;
    margin: 0 auto;
}

/* ========== 사이드바 — 고정 폭 (hover-expand 제거, 항상 같은 모습) ========== */
.sidebar {
    width: 185px;
    flex-shrink: 0;
    background: var(--bg-alt);
    color: var(--ink);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    align-self: flex-start;
    height: 100vh;
    overflow-y: auto;
    border-right: 1px solid var(--border);
    z-index: 50;
}

/* hover 시 폭 변경 없음 — 정적인 사이드바 */
.sidebar:hover,
.sidebar.expanded {
    box-shadow: none;
    width: 185px;
}

.sidebar-header {
    padding: 12px 10px 10px;
    border-bottom: 1px solid var(--border);
}

.logo {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: inherit;
    padding: 4px 6px;
    border-radius: var(--radius-md);
    transition: background var(--transition);
    overflow: hidden;
}

.logo:hover { background: var(--hover-bg); }

.logo-img {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    object-fit: contain;
}

/* 로고 텍스트 — 절반 크기 (이전 14px → 7px). 인라인, 한 줄 */
.logo-text {
    flex: 1; min-width: 0;
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 11px;
    line-height: 1.2;
    color: var(--ink-strong);
    letter-spacing: -0.025em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.logo-title {
    font-family: inherit;
    font-size: inherit;
}

/* 모바일 드로어 활성 시에도 동일 (모바일.css에서 width 따로 처리) */
.sidebar.drawer-open .logo-text { font-size: 13px; }

/* 사용자 정보·달력은 항상 표시 (사이드바 고정 폭이므로) */
.sidebar-user-info,
.calendar,
.api-warning-small {
    opacity: 1;
    pointer-events: auto;
    max-height: none;
    overflow: visible;
}
.sidebar:hover .sidebar-user-info,
.sidebar:hover .calendar,
.sidebar:hover .api-warning-small,
.sidebar.expanded .sidebar-user-info,
.sidebar.expanded .calendar,
.sidebar.expanded .api-warning-small,
.sidebar.drawer-open .sidebar-user-info,
.sidebar.drawer-open .calendar,
.sidebar.drawer-open .api-warning-small {
    opacity: 1;
    pointer-events: auto;
    max-height: 400px;
    margin-top: 8px;
}

/* sidebar drawer-open(모바일)·expanded 시 logo-text·chevron 표시 */
.sidebar.drawer-open .logo-text { opacity: 1; }
.sidebar.drawer-open .chevron { opacity: 1; }

.logo-title {
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: -0.01em;
    line-height: 1.3;
}

/* ========== 사이드바 캘린더 ========== */
.calendar {
    padding: 6px 4px 4px;
    background: rgba(0, 0, 0, 0.025);
    border-radius: 6px;
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1px 2px 5px;
}

.calendar-month {
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 10px;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: 0.01em;
    flex: 1;
    text-align: center;
}

.cal-nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    font-size: 13px;
    color: var(--ink-muted);
    text-decoration: none;
    border-radius: 3px;
    transition: background 0.1s;
    line-height: 1;
}

.cal-nav:hover {
    background: var(--hover-bg);
    color: var(--ink);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
}

.calendar-weekday {
    text-align: center;
    font-size: 8px;
    font-weight: 500;
    color: var(--ink-muted);
    padding: 2px 0 3px;
    letter-spacing: 0;
}

.calendar-weekday.sun { color: #d9534f; }
.calendar-weekday.sat { color: #3a86ff; }

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    color: var(--ink);
    text-decoration: none;
    border-radius: 3px;
    transition: background 0.1s;
    position: relative;
    min-height: 17px;
}

.calendar-day:hover {
    background: var(--hover-bg);
}

.calendar-day.sun { color: #d9534f; }
.calendar-day.sat { color: #3a86ff; }

.calendar-day.today {
    background: var(--accent);
    color: white !important;
    font-weight: 600;
}

.calendar-day.today:hover {
    background: var(--accent);
    opacity: 0.92;
}

.calendar-day.has-records:not(.today)::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 3px;
    height: 3px;
    background: var(--accent);
    border-radius: 50%;
}

.calendar-day.empty {
    visibility: hidden;
    pointer-events: none;
}

.api-warning-small {
    display: block;
    margin-top: 10px;
    padding: 6px 10px;
    background: #fff4e6;
    color: #c86016;
    border: 1px solid #ffd8a8;
    border-radius: 6px;
    font-size: 11px;
    text-align: center;
    text-decoration: none;
}

/* ========== 메뉴 — 고정 폭 사이드바 (라벨 항상 표시) ========== */
.menu {
    flex: 1;
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.menu-group { display: flex; flex-direction: column; }

.menu-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--ink-soft);
    font-family: var(--font-ui);
    font-size: 14.5px;
    font-weight: 500;
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: background var(--transition), color var(--transition);
    width: 100%;
    text-align: left;
    position: relative;
    white-space: nowrap;
    overflow: hidden;
}

.menu-head:hover {
    background: var(--hover-bg);
    color: var(--ink);
}

.menu-head.link.active {
    background: var(--accent-bg);
    color: var(--accent-strong);
    font-weight: 600;
}

.menu-head.link.active::before {
    content: '';
    position: absolute;
    left: 0; top: 7px; bottom: 7px;
    width: 3px;
    background: var(--accent);
    border-radius: 0 2px 2px 0;
}

.menu-head.link.active::after { display: none; }

.menu-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 18px; height: 18px;
    flex-shrink: 0;
    color: currentColor;
    opacity: 0.85;
}
.menu-icon svg { width: 16px; height: 16px; }
.menu-icon-emoji { font-size: 15px; line-height: 1; }

.menu-label { flex: 1; }

.chevron {
    font-size: 10px;
    color: var(--ink-muted);
    transition: all 0.2s;
    padding: 3px 5px;
    border-radius: 4px;
    cursor: pointer;
}

.chevron:hover {
    color: var(--ink);
    background: rgba(0, 0, 0, 0.05);
}

.menu-group.expanded > .menu-head .chevron { transform: rotate(90deg); }

.submenu {
    list-style: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    margin-left: 16px;
    padding-left: 8px;
    border-left: 1px solid var(--border);
}

.menu-group.expanded > .submenu { max-height: 600px; margin-top: 2px; margin-bottom: 4px; }
.submenu li { margin: 0; }

.submenu a, .submenu-head {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    color: var(--ink-soft);
    text-decoration: none;
    font-size: 13px;
    border-radius: var(--radius-md);
    transition: background 0.1s;
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-ui);
    width: 100%;
    text-align: left;
}
.submenu a svg, .submenu-head svg {
    width: 12px; height: 12px;
    color: var(--ink-muted);
    flex-shrink: 0;
}

.submenu-head { display: flex; justify-content: space-between; align-items: center; }

.submenu a:hover, .submenu-head:hover {
    background: var(--hover-bg);
    color: var(--ink);
}

.submenu a.active {
    color: var(--ink);
    background: var(--hover-bg);
    font-weight: 500;
}

.sub-submenu {
    list-style: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s;
    margin-left: 10px;
    padding-left: 8px;
    border-left: 1px solid var(--border);
}

.sub-submenu.expanded { max-height: 300px; margin-top: 2px; }

/* ========== 사이드바 푸터 ========== */
.sidebar-footer {
    padding: 12px 12px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.add-cat { display: flex; gap: 6px; margin-bottom: 6px; }

.add-cat input {
    flex: 1;
    padding: 7px 11px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--paper);
    color: var(--ink);
    font-size: 12px;
    font-family: inherit;
}

.add-cat input::placeholder { color: var(--ink-muted); }

.add-cat input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--paper);
}

.add-cat button {
    width: 30px;
    background: var(--paper);
    color: var(--ink-soft);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.1s;
}

.add-cat button:hover {
    background: var(--hover-bg);
    color: var(--ink);
}

.settings-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    color: var(--ink-soft);
    text-decoration: none;
    border-radius: 6px;
    font-size: 13px;
    transition: background 0.1s;
}

.settings-link:hover {
    background: var(--hover-bg);
    color: var(--ink);
}

.settings-icon { font-size: 14px; }

.shutdown-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    color: var(--ink-soft);
    background: none;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    width: 100%;
    text-align: left;
    transition: background 0.1s;
}

.shutdown-link:hover {
    background: #fef1f1;
    color: #c53030;
}

/* ========== 메인 콘텐츠 ========== */
.main {
    flex: 1;
    min-width: 0;
    padding: 40px 16px;
    min-height: 100vh;
    background: var(--bg);
}
.desktop-back-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}
.desktop-back-btn, .desktop-home-btn {
    font-size: 12px;
    color: #6b7280;
    background: transparent;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 4px 12px;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
}
.desktop-back-btn:hover, .desktop-home-btn:hover {
    background: #f3f4f6;
    color: #374151;
}

.page-header {
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-soft);
}

.page-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}

.page-title-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 16px; height: 16px;
    color: var(--ink-muted);
    flex-shrink: 0;
}
.page-title-icon svg { width: 14px; height: 14px; }
/* legacy emoji 잔존 시 폰트 크기 유지 */
.page-title-icon:not(:has(svg)) { font-size: 16px; opacity: 0.7; }

.page-title {
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 700;
    color: var(--ink-strong);
    margin: 0;
    letter-spacing: -0.018em;
    line-height: 1.3;
}

.page-subtitle {
    color: var(--ink-muted);
    font-size: var(--text-xs);
    margin-left: 32px;
    font-style: italic;
}

.btn-back-text {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px 7px 10px;
    color: var(--ink-soft);
    text-decoration: none;
    border-radius: 6px;
    font-size: 13px;
    background: none;
    transition: all 0.1s;
    margin-left: -10px;
}

.btn-back-text:hover {
    background: var(--hover-bg);
    color: var(--ink);
}

.back-arrow {
    font-size: 18px;
    display: inline-block;
    line-height: 1;
    transition: transform 0.15s ease-out;
}

.btn-back-text:hover .back-arrow {
    transform: translateX(-3px);
}

.records-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 18px;
}

.record-card {
    background: var(--paper);
    padding: 16px 18px;
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    color: var(--ink);
    transition: all 0.15s;
    border: 1px solid var(--border);
    border-top: 3px solid var(--accent);
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 140px;
}

.record-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.record-card.cat-knowledge { border-top-color: var(--cat-knowledge); }
.record-card.cat-emotion { border-top-color: var(--cat-emotion); }
.record-card.cat-event { border-top-color: var(--cat-event); }

.card-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: nowrap;
    overflow: hidden;
}

.card-cat {
    background: var(--accent); color: white;
    padding: 2px 9px; border-radius: 12px;
    font-size: 10px; font-weight: 600; letter-spacing: 0.02em;
    flex-shrink: 0;
    white-space: nowrap;
}

.cat-knowledge .card-cat { background: var(--cat-knowledge); }
.cat-emotion .card-cat { background: var(--cat-emotion); }
.cat-event .card-cat { background: var(--cat-event); }

.card-title {
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
    letter-spacing: -0.01em;
}

.card-body {
    color: var(--ink-soft);
    font-size: 13px;
    line-height: 1.55;
    margin: 0;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 6px;
    border-top: 1px solid rgba(0,0,0,0.04);
    gap: 8px;
}

.card-time { color: var(--ink-muted); font-size: 11px; flex-shrink: 0; }
.card-tags { display: flex; gap: 4px; flex-wrap: nowrap; overflow: hidden; }
.tag {
    font-size: 10px; color: var(--accent); background: var(--accent-bg);
    padding: 1px 7px; border-radius: 3px;
    white-space: nowrap;
}

/* ===== 리스트 툴바 (검색·필터) ===== */
.list-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: 8px;
    flex: 1;
    min-width: 240px;
    max-width: 400px;
    transition: border-color 0.1s;
}

.search-bar:focus-within {
    border-color: var(--accent);
}

.search-icon {
    font-size: 14px;
    opacity: 0.6;
    flex-shrink: 0;
}

.search-input {
    border: none;
    outline: none;
    background: transparent;
    flex: 1;
    font-family: inherit;
    font-size: 13px;
    color: var(--ink);
    min-width: 0;
}

.search-input::placeholder { color: var(--ink-muted); }

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

.filter-chip {
    padding: 6px 12px;
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: 16px;
    text-decoration: none;
    color: var(--ink-soft);
    font-size: 12px;
    transition: all 0.1s;
}

.filter-chip:hover { border-color: var(--accent); color: var(--accent); }
.filter-chip.active { background: var(--accent); color: white; border-color: var(--accent); }

/* ===== 리스트 (컴팩트 한 줄) ===== */
.records-list {
    display: flex;
    flex-direction: column;
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.record-row {
    display: grid;
    grid-template-columns: 48px 70px minmax(140px, 240px) 1fr;
    gap: 14px;
    align-items: center;
    padding: 9px 16px;
    background: var(--paper);
    text-decoration: none;
    color: var(--ink);
    border-bottom: 1px solid var(--border);
    transition: background 0.08s;
    border-left: 3px solid transparent;
}

.record-row:last-child { border-bottom: none; }
.record-row:hover { background: var(--hover-bg); }
.record-row.cat-knowledge { border-left-color: var(--cat-knowledge); }
.record-row.cat-emotion { border-left-color: var(--cat-emotion); }
.record-row.cat-event { border-left-color: var(--cat-event); }

.row-date {
    font-size: 12px;
    color: var(--ink-muted);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

.row-cat-mini {
    font-size: 11px;
    color: var(--ink-soft);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cat-knowledge .row-cat-mini { color: var(--cat-knowledge); }
.cat-emotion .row-cat-mini { color: var(--cat-emotion); }
.cat-event .row-cat-mini { color: var(--cat-event); }

.row-title {
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.01em;
}

.row-preview {
    font-size: 12.5px;
    color: var(--ink-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-count {
    margin-top: 12px;
    font-size: 12px;
    color: var(--ink-muted);
    text-align: right;
    padding-right: 4px;
}

.empty-state { text-align: center; padding: 80px 20px; }
.empty-icon { font-size: 56px; margin-bottom: 20px; opacity: 0.5; }
.empty-text { font-family: 'Noto Serif KR', serif; font-size: 20px; color: var(--ink-soft); margin-bottom: 6px; }
.empty-sub { color: var(--ink-muted); margin-bottom: 24px; }

.auto-form { max-width: 960px; }
.auto-textarea {
    width: 100%;
    min-height: 440px;
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--paper);
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 13.5px;
    line-height: 1.65;
    color: var(--ink);
    resize: none;
    transition: all 0.1s;
}

.auto-textarea::placeholder {
    color: var(--ink-muted);
}

.auto-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-bg);
}

.write-form {
    max-width: 960px;
    background: none;
    padding: 0;
    border: none;
    box-shadow: none;
}

.form-row { display: flex; gap: 14px; }
.form-row .form-group { flex: 1; min-width: 0; }
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 5px;
    font-size: 12px;
    color: var(--ink-soft);
    letter-spacing: -0.01em;
}
.optional { color: var(--ink-muted); font-weight: 400; font-size: 10.5px; margin-left: 4px; }
.required { color: var(--accent); }

.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 9px 13px;
    border: 1px solid var(--border); border-radius: 7px;
    font-size: 13.5px; font-family: inherit;
    background: var(--paper); color: var(--ink); transition: all 0.1s;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-bg);
}

.form-group textarea {
    resize: none;
    line-height: 1.65;
    font-family: 'Noto Sans KR', sans-serif;
    padding: 12px 14px;
}

/* ===== 분류입력 폼 — 필드 그룹별 섹션감 ===== */
.write-form .form-group { margin-bottom: 14px; }

/* 제목/본문처럼 단독 필드 주변엔 공간 더 */
.write-form > .form-group + .form-row,
.write-form > .form-row + .form-group,
.write-form > .form-group + .form-group { margin-top: 2px; }

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 22px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.btn-primary {
    padding: 6px 12px; background: var(--accent); color: white;
    border: none; border-radius: 6px; font-family: inherit;
    font-size: 12px; font-weight: 600; cursor: pointer;
    text-decoration: none; display: inline-block; transition: all 0.15s;
    line-height: 1.3;
    white-space: nowrap;
}

.btn-primary:hover { background: var(--accent-strong); transform: translateY(-1px); }
.btn-primary:disabled { background: var(--ink-muted); cursor: not-allowed; transform: none; opacity: 0.6; }
/* .btn-large — 인증 폼 등 특별 강조용 (회원가입 등) */
.btn-large { padding: 14px 48px; font-size: 16px; border-radius: 10px; }

.btn-ghost {
    padding: 6px 12px; background: none; border: none;
    color: var(--ink-muted); font-family: inherit;
    font-size: 12px; cursor: pointer; text-decoration: none;
    line-height: 1.3;
    white-space: nowrap;
}

.btn-ghost:hover { color: var(--ink); }

.btn-back { color: var(--ink-muted); text-decoration: none; font-size: 14px; }
.btn-back:hover { color: var(--accent); }

.record-detail {
    background: var(--paper); padding: 40px 48px;
    border-radius: 16px; box-shadow: var(--shadow-md);
    border-left: 4px solid var(--accent); max-width: 820px;
}

.record-detail.cat-knowledge { border-left-color: var(--cat-knowledge); }
.record-detail.cat-emotion { border-left-color: var(--cat-emotion); }
.record-detail.cat-event { border-left-color: var(--cat-event); }

.detail-meta { display: flex; gap: 12px; align-items: center; margin-bottom: 20px; flex-wrap: wrap; }
.detail-time { font-size: 12px; color: var(--ink-muted); }

.detail-title {
    font-family: 'Noto Serif KR', serif;
    font-size: 26px; font-weight: 700;
    margin-bottom: 24px; color: var(--ink); line-height: 1.4;
}

.detail-body {
    font-family: 'Noto Serif KR', serif;
    font-size: 16px; line-height: 1.9; color: var(--ink);
    white-space: pre-wrap; margin-bottom: 24px;
}

.detail-source {
    padding: 14px 18px; background: var(--bg); border-radius: 10px;
    font-size: 13px; color: var(--ink-soft); margin-bottom: 16px;
}

.detail-actions {
    margin-top: 32px; padding-top: 20px;
    border-top: 1px solid var(--border); text-align: right;
}

.btn-delete {
    padding: 6px 14px; background: none;
    border: 1px solid #d94e4e; color: #d94e4e;
    border-radius: 6px; cursor: pointer;
    font-family: inherit; font-size: 12px; transition: all 0.15s;
    line-height: 1.3;
}

.btn-delete:hover { background: #d94e4e; color: white; }

.alert {
    padding: 14px 20px; border-radius: 10px;
    margin-bottom: 24px; font-size: 14px;
}

.alert-success { background: #e7f5e7; color: #2e7d32; border: 1px solid #a5d6a7; }
.alert-warning { background: #fff3e0; color: #c96f2e; border: 1px solid #ffcc80; }
.alert-error { background: #ffebee; color: #c62828; border: 1px solid #ef9a9a; }

.settings-box {
    background: var(--paper); padding: 18px 20px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: none;
}

.settings-box h3 {
    font-family: var(--font-sans);
    font-size: 14px; font-weight: 700;
    margin-bottom: var(--space-3);
    color: var(--ink-strong);
    letter-spacing: -0.015em;
}

.status-ok, .status-ng {
    display: flex; gap: 16px; align-items: flex-start;
    padding: 20px 24px; border-radius: 12px; margin-bottom: 24px;
}

.status-ok { background: #e7f5e7; border: 1px solid #a5d6a7; }
.status-ng { background: #ffebee; border: 1px solid #ef9a9a; }

.status-icon {
    width: 36px; height: 36px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; font-weight: bold; flex-shrink: 0;
}

.status-ok .status-icon { background: #2e7d32; color: white; }
.status-ng .status-icon { background: #c62828; color: white; }

.status-text strong {
    display: block; font-size: 16px; margin-bottom: 4px; color: var(--ink);
}

.status-text p { font-size: 13px; color: var(--ink-soft); margin-bottom: 4px; }
.status-path code {
    font-family: 'Consolas', monospace; font-size: 11px;
    color: var(--ink-muted); background: rgba(0,0,0,0.04);
    padding: 2px 6px; border-radius: 4px;
}

.settings-help {
    margin-top: 32px; padding-top: 24px;
    border-top: 1px solid var(--border);
}

.settings-help h4 { font-size: 14px; margin-bottom: 14px; }

.feature-list {
    list-style: none;
    display: flex; flex-direction: column; gap: 10px;
}

.feature-list li {
    padding: 12px 16px; background: var(--bg);
    border-radius: 8px; font-size: 13px; color: var(--ink-soft);
    border-left: 3px solid var(--accent);
}

.feature-list li strong { color: var(--ink); }

.feedback-form {
    max-width: 960px; background: var(--paper);
    padding: 36px 40px; border-radius: 16px; box-shadow: var(--shadow-md);
}

.feedback-section { margin-bottom: 32px; }
.feedback-section h3 {
    font-family: 'Noto Serif KR', serif;
    font-size: 18px; margin-bottom: 14px; color: var(--ink);
}

.radio-group { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }

.radio-card {
    cursor: pointer; padding: 18px 20px;
    border: 2px solid var(--border); border-radius: 12px;
    transition: all 0.15s; background: var(--bg);
}

.radio-card input { display: none; }
.radio-card:hover { border-color: var(--accent-soft); }
.radio-card:has(input:checked) { border-color: var(--accent); background: var(--accent-bg); }

.radio-title {
    font-family: 'Noto Serif KR', serif;
    font-size: 17px; font-weight: 600; margin-bottom: 4px; color: var(--ink);
}
.radio-desc { font-size: 12px; color: var(--ink-muted); }

.type-grid-main {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    margin-bottom: 8px;
}

.type-grid-custom {
    display: grid;
    grid-template-columns: 1fr 5fr;
    gap: 8px;
    align-items: stretch;
}

.custom-prompt-input {
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    background: var(--bg-alt);
    color: var(--ink);
    resize: none;
    transition: all 0.12s;
    line-height: 1.5;
}

.custom-prompt-input::placeholder { color: var(--ink-muted); }

.custom-prompt-input:focus {
    outline: none;
    background: var(--paper);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-bg);
}

.type-card {
    cursor: pointer;
    padding: 9px 8px 8px;
    text-align: center;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    transition: all 0.12s;
    background: var(--bg-alt);
}

.type-card input { display: none; }
.type-card:hover { border-color: var(--accent-soft); }
.type-card:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-bg);
}

.type-icon {
    font-size: 16px;
    margin-bottom: 2px;
    line-height: 1;
}
.type-title {
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 12.5px;
    font-weight: 600;
    margin-bottom: 1px;
    color: var(--ink);
    letter-spacing: -0.01em;
}
.type-desc {
    font-size: 10px;
    color: var(--ink-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#custom-section textarea {
    width: 100%; padding: 14px 18px;
    border: 1px solid var(--border); border-radius: 10px;
    font-size: 14px; font-family: inherit;
    background: var(--bg); resize: none;
}

.feedback-submit {
    text-align: center; padding-top: 20px;
    border-top: 1px solid var(--border);
}

.feedback-report {
    background: var(--paper); padding: 36px 44px;
    border-radius: 12px; box-shadow: var(--shadow-md);
    max-width: 860px;
    border: 1px solid var(--border);
    border-top: 3px solid var(--accent);
}

.report-meta { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }

.report-badge {
    background: var(--accent); color: white;
    padding: 3px 11px; border-radius: 16px;
    font-size: 11px; font-weight: 600;
}

.report-info { font-size: 11.5px; color: var(--ink-muted); }

.report-title {
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.4;
    color: var(--ink);
    margin-bottom: 22px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
    letter-spacing: -0.015em;
}

.report-body {
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 14.5px;
    line-height: 1.75;
    color: var(--ink);
    white-space: pre-wrap;
}

.report-period-label {
    background: var(--bg-alt);
    color: var(--ink-soft);
    padding: 3px 11px;
    border-radius: 16px;
    font-size: 11px;
    font-weight: 500;
    font-family: 'Noto Sans KR', sans-serif;
    border: 1px solid var(--border);
}

.report-summary {
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 14px;
    line-height: 1.7;
    color: var(--ink-soft);
    padding: 16px 22px;
    background: var(--bg-alt);
    border-left: 3px solid var(--accent);
    border-radius: 6px;
    margin-bottom: 28px;
    font-style: italic;
}

.report-sections {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.report-section {
    /* 개별 섹션 */
}

.section-heading {
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
    letter-spacing: -0.01em;
}

.section-content {
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 14px;
    line-height: 1.75;
    color: var(--ink);
    white-space: pre-wrap;
}

/* ===== 스트리밍 컨테이너 ===== */
.stream-container {
    max-width: 860px;
    padding: 24px 0;
}

.stream-status {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding: 10px 16px;
    background: var(--bg-alt);
    border-radius: 8px;
    font-size: 13px;
    color: var(--ink-soft);
    border-left: 3px solid var(--accent);
}

.stream-dot {
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
    animation: streamPulse 1.2s ease-in-out infinite;
}

@keyframes streamPulse {
    0%, 100% { opacity: 0.4; transform: scale(0.9); }
    50% { opacity: 1; transform: scale(1.1); }
}

.stream-output {
    font-family: 'Noto Sans KR', sans-serif;
    line-height: 1.75;
    color: var(--ink);
}

.stream-output .md-title {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 16px 0;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border);
    letter-spacing: -0.015em;
}

.stream-output .md-summary {
    font-size: 14px;
    line-height: 1.7;
    color: var(--ink-soft);
    padding: 14px 20px;
    background: var(--bg-alt);
    border-left: 3px solid var(--accent);
    border-radius: 6px;
    margin-bottom: 24px;
    font-style: italic;
}

.stream-output .md-section-heading {
    font-size: 15px;
    font-weight: 700;
    color: var(--accent);
    margin: 22px 0 10px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.stream-output .md-para {
    font-size: 14px;
    line-height: 1.75;
    margin: 0 0 10px 0;
    color: var(--ink);
}

/* ===== 기존 loading-overlay (자동입력 등에서 사용) ===== */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(43, 36, 32, 0.88);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-content { text-align: center; color: white; }

.spinner {
    width: 64px;
    height: 64px;
    border: 5px solid rgba(255,255,255,0.15);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 24px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-family: 'Noto Serif KR', serif;
    font-size: 20px;
    margin-bottom: 8px;
    letter-spacing: 0.05em;
}

.loading-sub { font-size: 13px; opacity: 0.7; }

/* ===== 날짜 선택 (기록 대상 날짜) ===== */
.date-picker-row {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 14px 18px; background: var(--accent-bg);
    border: 1px solid var(--border); border-radius: 10px;
    margin-bottom: 20px;
}
.date-picker-label {
    font-weight: 600; color: var(--accent); font-size: 14px;
}
.date-picker-row input[type="date"] {
    padding: 7px 10px; border: 1px solid var(--border);
    border-radius: 6px; font-family: inherit; font-size: 14px;
    background: var(--paper);
}
.date-quick-btns { display: flex; gap: 6px; }
.date-quick-btns button {
    padding: 6px 14px; background: var(--paper); border: 1px solid var(--border);
    border-radius: 16px; font-family: inherit; font-size: 12px;
    color: var(--ink-soft); cursor: pointer; transition: all 0.1s;
}
.date-quick-btns button:hover {
    border-color: var(--accent); color: var(--accent);
}

/* ===== 정렬 토글 ===== */
.sort-toggle { display: flex; gap: 6px; margin-left: auto; }
.sort-chip {
    padding: 6px 12px; background: var(--paper);
    border: 1px solid var(--border); border-radius: 16px;
    text-decoration: none; color: var(--ink-soft);
    font-size: 12px; transition: all 0.1s;
}
.sort-chip:hover { border-color: var(--accent); color: var(--accent); }
.sort-chip.active { background: var(--accent); color: white; border-color: var(--accent); }

/* ===== 수정 버튼 ===== */
.detail-actions { display: flex; gap: 10px; justify-content: flex-end; align-items: center; }
.btn-edit {
    padding: 6px 14px; background: none;
    border: 1px solid var(--accent); color: var(--accent);
    border-radius: 6px; cursor: pointer; text-decoration: none;
    font-family: inherit; font-size: 12px; transition: all 0.15s;
    line-height: 1.3;
}
.btn-edit:hover { background: var(--accent); color: white; }

/* ===== 로그인/회원가입 ===== */
.auth-wrap {
    max-width: 420px; margin: 80px auto; padding: 40px 36px;
    background: var(--paper); border: 1px solid var(--border);
    border-radius: 16px; box-shadow: var(--shadow-md);
}
.auth-wrap h2 {
    font-family: 'Noto Serif KR', serif;
    font-size: 24px; margin-bottom: 8px; color: var(--ink);
    text-align: center;
}
.auth-wrap .auth-sub {
    text-align: center; color: var(--ink-muted);
    font-size: 13px; margin-bottom: 28px;
}
.auth-wrap .form-group { margin-bottom: 16px; }
.auth-wrap label {
    display: block; font-size: 13px; font-weight: 500;
    color: var(--ink-soft); margin-bottom: 6px;
}
.auth-wrap input[type="text"],
.auth-wrap input[type="password"],
.auth-wrap input[type="tel"] {
    width: 100%; padding: 10px 12px;
    border: 1px solid var(--border); border-radius: 8px;
    font-family: inherit; font-size: 14px;
}
.auth-wrap .btn-primary { width: 100%; margin-top: 8px; }
.auth-wrap .auth-links {
    margin-top: 20px; text-align: center; font-size: 13px;
}
.auth-wrap .auth-links a { color: var(--accent); text-decoration: none; }
.auth-wrap .auth-links a:hover { text-decoration: underline; }
.auth-logo {
    text-align: center; margin-bottom: 14px;
}
.auth-logo img {
    width: 140px; height: 168px;
    display: inline-block;
}

/* PWA 설치 안내는 /install 페이지로 분리. 자동 배너·모달 CSS 제거. */
.auth-wrap .auth-error {
    background: #ffebee; color: #c62828; border: 1px solid #ef9a9a;
    padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 16px;
}
.auth-wrap .auth-info {
    background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0;
    padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 16px;
    line-height: 1.5;
}
.auth-wrap input[type="email"] {
    width: 100%; padding: 10px 12px;
    border: 1px solid var(--border); border-radius: 6px;
    font-size: 14px; box-sizing: border-box;
}
.auth-wrap input[disabled] {
    background: #f9fafb; color: #6b7280;
}
.auth-remember {
    display: flex; align-items: center; gap: 8px;
    margin: 4px 0 14px;
    font-size: 13px; color: var(--ink);
    cursor: pointer;
    user-select: none;
}
.auth-remember input[type="checkbox"] {
    width: 16px; height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}
.auth-choose { margin-top: 20px; }
.password-reveal {
    background: #fff3e0; border: 2px dashed #c96f2e;
    padding: 20px; border-radius: 10px; margin: 20px 0;
    text-align: center;
}
.password-reveal .label {
    font-size: 12px; color: var(--ink-muted); margin-bottom: 6px;
}
.password-reveal .value {
    font-family: 'Courier New', monospace; font-size: 20px;
    font-weight: 700; color: #c96f2e; word-break: break-all;
}

/* ===== 사이드바 사용자 ===== */
.sidebar-user {
    padding: 10px 14px; font-size: 12px; color: var(--ink-muted);
    border-top: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
}
.sidebar-user a { color: var(--ink-muted); text-decoration: none; }
.sidebar-user a:hover { color: var(--accent); }

/* ===== 계획 이월 (carry-in) 표시 ===== */
/* view 모드: li 단위 */
.plan-summary-tasks li.plan-carry-in {
    background: #f0f9f6;
    border-left: 3px solid var(--accent, #10a37f);
    padding: 6px 10px;
    margin-bottom: 4px;
    border-radius: 4px;
    list-style: none;
}
/* edit 모드: read-only 행 */
.plan-task-carry-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    margin-bottom: 6px;
    background: #f0f9f6;
    border: 1px dashed #b8dccd;
    border-radius: 6px;
    font-size: 13px;
    color: #2c5e4a;
}
.plan-carry-badge {
    display: inline-block;
    background: var(--accent, #10a37f);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 10px;
    white-space: nowrap;
}
.plan-carry-title { font-weight: 500; }
.plan-carry-roadmap {
    background: var(--paper);
    color: var(--accent, #10a37f);
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 8px;
    border: 1px solid #b8dccd;
}
.plan-carry-csf {
    color: #666;
    font-size: 12px;
    font-style: italic;
}
.plan-carry-area {
    font-size: 12px;
    font-weight: 600;
}
.plan-carry-list {
    margin-bottom: 18px;
}

/* ===== 인생지도 ===== */
.lifemap-header {
    margin-bottom: 14px;
}
.lifemap-header h1 {
    margin: 0 0 4px 0;
    font-size: 22px;
}
.lifemap-hint {
    color: var(--ink-muted, #6b7280);
    font-size: 13px;
    margin: 0;
}

.lifemap-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 8px;
    margin-bottom: 14px;
}
.lifemap-tab {
    padding: 7px 14px;
    border-radius: 6px 6px 0 0;
    background: #f3f4f6;
    color: #4b5563;
    text-decoration: none;
    font-size: 13px;
    transition: background 0.15s;
}
.lifemap-tab:hover {
    background: #e5e7eb;
}
.lifemap-tab.active {
    background: var(--accent, #10a37f);
    color: white;
    font-weight: 600;
}
.lifemap-tab-new {
    background: var(--paper);
    border: 2px dashed var(--accent, #10a37f);
    color: var(--accent, #10a37f);
    font-weight: 500;
}
.lifemap-tab-new.active {
    background: var(--accent, #10a37f);
    color: white;
    border-style: solid;
}

.lifemap-board {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    gap: 14px;
    max-width: 1280px;
    margin: 16px auto;
}

.lifemap-cell {
    background: var(--paper);
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 10px 0;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow: hidden;
    transition: box-shadow 0.15s;
}
.lifemap-cell:hover {
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.lifemap-cell-pos-0 { grid-row: 1; grid-column: 1; }
.lifemap-cell-pos-1 { grid-row: 1; grid-column: 2; }
.lifemap-cell-pos-2 { grid-row: 1; grid-column: 3; }
.lifemap-cell-pos-3 { grid-row: 2; grid-column: 1; }
.lifemap-cell-pos-4 { grid-row: 2; grid-column: 3; }
.lifemap-cell-pos-5 { grid-row: 3; grid-column: 1; }
.lifemap-cell-pos-6 { grid-row: 3; grid-column: 2; }
.lifemap-cell-pos-7 { grid-row: 3; grid-column: 3; }

/* 인생목표 중앙 셀 — 페이퍼 톤 + 작은 accent 좌측 띠 (다른 카드와 동급) */
.lifemap-center {
    grid-row: 2;
    grid-column: 2;
    background: var(--paper);
    color: var(--ink);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    text-align: left;
    min-height: 280px;
}
.lifemap-center-label {
    font-size: 15px;
    font-weight: 600;
    color: var(--ink-strong);
    margin-bottom: 6px;
    border-bottom: 2px solid var(--accent);
    padding-bottom: 4px;
}
.lifemap-center-goal {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: keep-all;
    color: var(--ink-strong);
}
.lifemap-center-input {
    width: 100%;
    flex: 1;
    min-height: 200px;
    background: var(--paper);
    color: var(--ink);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    font-size: var(--text-sm);
    line-height: 1.6;
    resize: vertical;
    font-family: inherit;
}
.lifemap-center-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-bg);
}

/* edit 모드 */
.lifemap-name-input {
    width: 100%;
    border: none;
    border-bottom: 2px solid var(--accent, #10a37f);
    padding: 8px 10px 7px;
    font-size: 15px;
    font-weight: 600;
    background: transparent;
    color: #111827;
    box-sizing: border-box;
}
.lifemap-name-input:focus {
    outline: none;
    background: #f0f9f6;
}
.lifemap-section {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 8px 10px;
    width: 100%;
    box-sizing: border-box;
}
.lifemap-section + .lifemap-section {
    padding-top: 4px;
    border-top: 1px solid #f3f4f6;
}
.lifemap-section-label {
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    margin-bottom: 2px;
}
.lifemap-asis-input,
.lifemap-tobe-input {
    width: 100%;
    border: 1px solid #e5e7eb;
    border-radius: 5px;
    padding: 6px 8px;
    font-size: 13px;
    background: #f9fafb;
    box-sizing: border-box;
}
.lifemap-asis-input:focus,
.lifemap-tobe-input:focus {
    outline: none;
    border-color: #212529;
    background: var(--paper);
}
.lifemap-tobe-input {
    border-color: var(--border-strong);
    background: var(--paper);
}
.lifemap-tobe-input:focus {
    border-color: #212529;
}

/* view 모드 */
.lifemap-view-mode .lifemap-cell-name {
    font-size: 15px;
    font-weight: 600;
    color: #111827;
    border-bottom: 2px solid var(--accent, #10a37f);
    padding-bottom: 4px;
    margin-bottom: 4px;
}
.lifemap-asis {
    font-size: 13px;
    color: #374151;
    line-height: 1.4;
}
.lifemap-tobe {
    font-size: 13px;
    color: #92400e;
    background: #fffbeb;
    border-left: 3px solid #fbbf24;
    padding: 4px 8px;
    border-radius: 3px;
    line-height: 1.4;
}
.lifemap-empty {
    color: #9ca3af;
    font-size: 12px;
    font-style: italic;
}

/* 모바일 — 세로 스택 */
@media (max-width: 800px) {
    .lifemap-board {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
    }
    .lifemap-cell-pos-0, .lifemap-cell-pos-1, .lifemap-cell-pos-2,
    .lifemap-cell-pos-3, .lifemap-cell-pos-4,
    .lifemap-cell-pos-5, .lifemap-cell-pos-6, .lifemap-cell-pos-7,
    .lifemap-center {
        grid-row: auto;
        grid-column: 1;
    }
    .lifemap-center {
        order: -1; /* 모바일에선 인생목표를 맨 위로 */
    }
}

/* 보기 모드 — 개조식 문서 (박스 없음) */
.lifemap-view-doc {
    max-width: 760px;
    margin: 12px 0;
    padding: 4px 0;
    line-height: 1.7;
    color: var(--ink);
}
.lifemap-view-center {
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.lifemap-view-center-label {
    font-size: 15px;
    font-weight: 600;
    color: var(--ink-strong);
    margin-bottom: 4px;
}
.lifemap-view-center-goal {
    font-size: 15px;
    font-weight: 500;
    color: var(--ink-strong);
    white-space: pre-wrap;
    word-break: keep-all;
}
.lifemap-view-area {
    margin-bottom: 14px;
}
.lifemap-view-area-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--ink-strong);
    margin-bottom: 2px;
}
.lifemap-view-list {
    margin: 0;
    padding-left: 16px;
    list-style: disc;
}
.lifemap-view-list li {
    font-size: 13.5px;
    color: var(--ink);
    line-height: 1.6;
    padding: 1px 0;
}
.lvl-tag {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--ink-muted);
    background: var(--bg-alt, #f3f4f6);
    padding: 1px 5px;
    border-radius: 3px;
    margin-right: 4px;
    vertical-align: 1px;
}
.lvl-tobe {
    color: var(--accent);
    background: var(--accent-bg, #ecfdf5);
}

/* 인생지도 AI 피드백 */
.lifemap-feedback-wrap {
    max-width: 900px;
    margin: 16px auto;
}
.lifemap-feedback-header {
    background: var(--paper);
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 16px 18px;
    margin-bottom: 16px;
}
.lifemap-feedback-header h2 {
    margin: 0 0 6px 0;
    font-size: 18px;
}
.lifemap-fb-result {
    background: var(--paper);
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 24px 28px;
    line-height: 1.7;
    color: #1f2937;
    min-height: 150px;
    font-size: 15px;
}
.lifemap-fb-result h2 {
    font-size: 19px;
    margin: 22px 0 10px 0;
    color: #111827;
    border-bottom: 2px solid var(--accent, #10a37f);
    padding-bottom: 4px;
}
.lifemap-fb-result h3 {
    font-size: 16px;
    margin: 18px 0 6px 0;
    color: var(--accent, #10a37f);
}
.lifemap-fb-result h3:first-child,
.lifemap-fb-result h2:first-child {
    margin-top: 0;
}
.lifemap-fb-result p {
    margin: 8px 0;
}
.lifemap-fb-result strong {
    color: #111827;
}

/* 종합 해석 탭 — 톤다운 (accent 통일) */
.lifemap-tab-synthesis {
    background: var(--paper);
    color: var(--ink-soft);
    border: 1px solid var(--border-strong);
    margin-left: auto; /* 우측 끝 정렬 */
    font-weight: 600;
}
.lifemap-tab-synthesis:hover {
    background: var(--accent-bg);
    color: var(--accent-strong);
    border-color: var(--accent-border);
}
.lifemap-tab-synthesis.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* 종합 해석 메타 표시 */
.lifemap-synth-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 10px 14px;
    margin-bottom: 12px;
    font-size: var(--text-sm);
    color: var(--ink-muted);
}
.lifemap-synth-count { font-weight: 600; }
.lifemap-synth-time { color: var(--accent); }
.lifemap-synth-redo {
    margin-left: auto;
    padding: 5px 12px;
    border: 1px solid var(--accent);
    background: var(--paper);
    color: var(--accent);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
}
.lifemap-synth-redo:hover { background: var(--accent-bg); }
.lifemap-synth-redo:disabled { opacity: 0.6; cursor: wait; }

/* 완료된 프로젝트 리스트 (관리 모드 하단) */
.pmg-done-list {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px dashed #d1d5db;
}
.pmg-done-title {
    font-size: 16px;
    margin: 0 0 12px 0;
    color: #6b7280;
    font-weight: 600;
}
.pmg-done-ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.pmg-done-item {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 10px 14px;
    background: #f9fafb;
    border-left: 4px solid var(--proj-color, #9ca3af);
    border-radius: 6px;
    color: #4b5563;
    font-size: 14px;
    opacity: 0.85;
}
.pmg-done-name { font-weight: 600; color: #1f2937; }
.pmg-done-date {
    font-size: 12px;
    background: var(--paper);
    padding: 2px 8px;
    border-radius: 10px;
    color: #6b7280;
}
.pmg-done-desc {
    font-size: 13px;
    color: #6b7280;
    flex-basis: 100%;
    margin-top: 2px;
}

/* 복수 선택 토글 버튼 그룹 */
.ptr-toggles {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 3px;
    align-items: center;
}
.ptr-tog {
    border: 1px solid #d1d5db;
    background: var(--paper);
    color: #6b7280;
    padding: 3px 7px;
    border-radius: 5px;
    font-size: 12px;
    cursor: pointer;
    user-select: none;
    transition: all 0.1s;
    line-height: 1.2;
}
.ptr-tog:hover { background: #f3f4f6; }
.ptr-tog.on {
    background: var(--accent, #10a37f);
    color: white;
    border-color: var(--accent, #10a37f);
    font-weight: 600;
}
/* carry-in 옆 요일 토글 — 즉시 저장, 약간 다른 색조 */
.ptr-toggles-carry {
    margin-left: auto;
}
.ptr-tog-carry {
    background: var(--paper);
    border-color: var(--accent-border);
    color: var(--accent);
}
.ptr-tog-carry:hover { background: var(--accent-bg); }
.ptr-tog-carry.on {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* 로그인 화면 — Google 로그인 */
.auth-divider {
    margin: 18px 0;
    text-align: center;
    position: relative;
    color: #9ca3af;
    font-size: 12px;
}
.auth-divider::before, .auth-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: #e5e7eb;
}
.auth-divider::before { left: 0; }
.auth-divider::after { right: 0; }
.auth-divider span { background: var(--paper); padding: 0 10px; }

.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 11px 14px;
    background: var(--paper);
    border: 1px solid #dadce0;
    border-radius: 6px;
    color: #3c4043;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: box-shadow 0.15s, background 0.15s;
}
.btn-google:hover {
    box-shadow: 0 1px 3px rgba(60,64,67,0.15);
    background: #f8f9fa;
}

/* ════════════════════════════════════════════════════════════════
   입력 박스 focus 색 통일 — 검정(#212529).
   phase1.css 의 border-color:var(--accent)=#dc2626 (빨강) 룰을
   !important 로 덮어써서 전체 프로그램 일관성 확보.
   ════════════════════════════════════════════════════════════════ */
input:focus, textarea:focus, select:focus,
input:focus-visible, textarea:focus-visible, select:focus-visible {
    border-color:#212529 !important;
    outline-color:#212529 !important;
}
.search-row:focus-within,
.search-bar:focus-within,
.k-search:focus-within,
.k-search-bar:focus-within,
.pn-search-bar:focus-within,
.global-search:focus-within,
.input-bar:focus-within,
.dash-input:focus-within,
.post-form:focus-within,
.byok-form:focus-within {
    border-color:#212529 !important;
}
