/* ===== 폰트 (기존 앱과 동일: Pretendard + JetBrains Mono) ===== */
@font-face { font-family: 'Pretendard'; font-weight: 300; src: url('../fonts/Pretendard-Light.otf') format('opentype'); }
@font-face { font-family: 'Pretendard'; font-weight: 400; src: url('../fonts/Pretendard-Regular.otf') format('opentype'); }
@font-face { font-family: 'Pretendard'; font-weight: 600; src: url('../fonts/Pretendard-SemiBold.otf') format('opentype'); }
@font-face { font-family: 'Pretendard'; font-weight: 700; src: url('../fonts/Pretendard-Bold.otf') format('opentype'); }
@font-face { font-family: 'JetBrains Mono'; font-weight: 400; src: url('../fonts/JetBrainsMono-Regular.ttf') format('truetype'); }

/* ===== 디자인 토큰 (기존 AppStyles.axaml 그대로) ===== */
:root {
    --bg: #FFFFFF;
    --bg-darker: #F1F4F8;
    --bg-darkest: #F5F7FA;
    --bg-lighter: #E2E8F0;
    --bg-lightest: #CBD5E1;
    --bg-middle: #EEF3F9;
    --accent: #1C86D5;
    --accent-bright: #29ABE2;
    --accent-mid: #1670B8;
    --accent-dark: #0F5A94;
    --yellow: #FFC60B;
    --warning: #E5484D;
    --text: #1A2330;
    --text-secondary: #6B7785;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-darkest);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

#app { height: 100%; }

.mono { font-family: 'JetBrains Mono', monospace; }

/* ===== 로딩 인디케이터 ===== */
.loading-progress {
    position: absolute; display: block;
    width: 8rem; height: 8rem; top: 50%; left: 50%;
    margin-top: -4rem; margin-left: -4rem;
}
.loading-progress circle {
    fill: none; stroke: var(--bg-lighter); stroke-width: 0.4rem;
    transform-origin: 50% 50%; transform: rotate(-90deg);
}
.loading-progress circle:last-child {
    stroke: var(--accent);
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}
.loading-progress-text {
    position: absolute; text-align: center; font-weight: 600;
    inset: calc(50% - 0.8rem) 0 auto 0; color: var(--text-secondary);
}
.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "로딩 중...");
}

/* ===== Blazor 오류 UI ===== */
#blazor-error-ui {
    background: #fff3cd; color: #664d03; bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,0.2);
    display: none; left: 0; padding: 0.8rem 1.2rem; position: fixed; width: 100%; z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

/* ===== 공통 페이지 컨테이너 (모바일 폭) ===== */
.page {
    max-width: 480px; margin: 0 auto; min-height: 100%;
    background: var(--bg-darkest);
    display: flex; flex-direction: column;
}

/* ===== 버튼 ===== */
.btn-primary {
    width: 100%; border: none; border-radius: 14px;
    background: var(--accent); color: #fff;
    font-family: 'Pretendard'; font-weight: 600; font-size: 16px;
    padding: 15px 0; cursor: pointer; transition: background 0.15s;
}
.btn-primary:active { background: var(--accent-dark); }
.btn-primary:disabled { background: var(--bg-lightest); color: #fff; cursor: default; }

.link-btn {
    background: none; border: none; color: var(--accent);
    font-family: 'Pretendard'; font-size: 14px; cursor: pointer; padding: 4px;
}

/* ===== 입력 ===== */
.field { margin-bottom: 8px; }
.field label { display: block; font-size: 13px; color: var(--text-secondary); margin: 0 0 3px 2px; }
.input {
    width: 100%; border: 1px solid var(--bg-lighter); border-radius: 14px;
    background: var(--bg); color: var(--text);
    font-family: 'Pretendard'; font-size: 15px; padding: 12px 16px; outline: none;
    transition: border-color 0.15s;
}
.input:focus { border-color: var(--accent); }

/* ===== 로그인 화면 ===== */
.login-wrap {
    flex: 1; display: flex; flex-direction: column; justify-content: center;
    padding: 24px; max-width: 480px; margin: 0 auto; width: 100%;
}
.login-logo { width: 240px; height: auto; object-fit: contain; display: block; margin: 0 auto 16px; }
.login-error {
    color: var(--warning); font-size: 13px; text-align: center;
    margin: 4px 0 12px; min-height: 18px;
}
.login-toggle { text-align: center; margin-top: 18px; }
.autologin { display: flex; align-items: center; gap: 8px; margin: 4px 2px 12px; font-size: 14px; color: var(--text-secondary); }
.autologin input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ===== 헤더 (페이지 타이틀) ===== */
.app-header {
    display: flex; align-items: center; gap: 6px;
    padding: 12px 12px 8px; background: var(--bg-darkest);
}
.app-header .back { background: none; border: none; font-size: 24px; color: var(--text); cursor: pointer; padding: 4px 8px; line-height: 1; }
.app-header .title { font-weight: 600; font-size: 22px; }

/* ===== 홈 허브 ===== */
.home { flex: 1; display: flex; flex-direction: column; }

/* 상단 바: 로고 타이틀 + 아바타 */
.home-topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px 10px; background: var(--bg-darkest);
}
.home-topbar .brand { font-weight: 700; font-size: 24px; color: var(--accent); }
.avatar {
    width: 40px; height: 40px; border-radius: 20px; flex-shrink: 0;
    background: var(--bg-darker); border: 1px solid var(--bg-lighter);
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 15px; color: var(--accent);
    cursor: pointer; overflow: hidden; padding: 0; object-fit: cover;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* 본문 스크롤 영역 */
.home-body { flex: 1; overflow-y: auto; padding: 6px 16px 20px; }
.greeting { font-size: 20px; font-weight: 600; margin: 6px 2px 16px; }

/* 검색 박스 */
.home-search {
    display: flex; align-items: center; gap: 8px;
    background: var(--bg); border: 1px solid var(--bg-lighter);
    border-radius: 14px; padding: 12px 16px; margin-bottom: 18px;
}
.home-search input {
    flex: 1; border: none; outline: none; background: none;
    font-family: 'Pretendard'; font-size: 15px; color: var(--text);
}
.home-search svg { fill: var(--text-secondary); flex-shrink: 0; }

/* 네비 행 (약값 DB 등) */
.navrow {
    display: flex; align-items: baseline; gap: 10px; width: 100%;
    background: var(--bg); border: 1px solid var(--bg-lighter);
    border-radius: 14px; padding: 16px 18px; margin-bottom: 10px;
    cursor: pointer; text-align: left; transition: background 0.12s;
}
.navrow:active { background: var(--bg-darker); }
.navrow .label { font-weight: 600; font-size: 16px; color: var(--text); }
.navrow .desc { font-size: 13px; color: var(--text-secondary); }

/* 보조 메뉴 2열 */
.quick-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-top: 6px; }
.quick-card {
    background: var(--bg); border: 1px solid var(--bg-lighter); border-radius: 14px;
    padding: 16px 8px; cursor: pointer; text-align: center;
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    transition: background 0.12s;
}
.quick-card:active { background: var(--bg-darker); }
.quick-card svg { fill: var(--accent); }
.quick-card .qlabel { font-size: 13px; font-weight: 600; color: var(--text); }

.section-strip { height: 10px; background: var(--bg-darker); margin: 16px -16px; }

/* 하단 탭바 */
.tabbar {
    display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; height: 62px;
    background: var(--bg); border-top: 1px solid var(--bg-lighter);
}
.tabbar button {
    background: none; border: none; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    color: var(--text-secondary); font-family: 'Pretendard'; font-size: 11px;
}
.tabbar button svg { fill: var(--text-secondary); }
.tabbar button.active { color: var(--accent); font-weight: 600; }
.tabbar button.active svg { fill: var(--accent); }

/* 준비중 / 빈 화면 안내 */
.placeholder-note {
    flex: 1; display: flex; align-items: center; justify-content: center;
    color: var(--text-secondary); font-size: 14px; padding: 40px; text-align: center;
}

/* ===== 본문 스크롤 영역 (페이지 공통) ===== */
.body-scroll { flex: 1; overflow-y: auto; padding: 18px 20px 24px; }
.section-title { font-weight: 600; font-size: 15px; margin: 4px 2px 10px; }

/* ===== 고객 목록 카드 ===== */
.cust-card {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    width: 100%; text-align: left; cursor: pointer;
    background: var(--bg); border: 1px solid var(--bg-lighter); border-radius: 14px;
    padding: 16px; margin-bottom: 10px; transition: background 0.12s;
}
.cust-card:active { background: var(--bg-darker); }
.cust-card .cname { font-weight: 600; font-size: 16px; color: var(--text); }
.cust-card .cmeta { font-size: 13px; color: var(--text-secondary); margin-top: 3px; }
.cust-card .cdate { font-size: 12px; color: var(--text-secondary); margin-top: 3px; }
.badge {
    flex-shrink: 0; font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 999px;
}
.badge.pending { background: var(--bg-darker); color: var(--text-secondary); }
.badge.absent  { background: #FDECEC; color: var(--warning); }
.badge.meeting { background: #E7F2FB; color: var(--accent); }
.list-empty { text-align: center; color: var(--text-secondary); font-size: 14px; padding: 40px 0; }

/* ===== 상세 정보 카드 ===== */
.frame {
    background: var(--bg); border: 1px solid var(--bg-lighter); border-radius: 14px;
    padding: 18px; margin-bottom: 16px;
}
.info-row { display: flex; gap: 10px; padding: 5px 0; }
.info-row .k { flex: 0 0 90px; font-size: 13px; color: var(--text-secondary); }
.info-row .v { flex: 1; font-size: 14px; color: var(--text); word-break: break-word; }
.info-row .v.strong { font-weight: 600; }
.divider { height: 1px; background: var(--bg-lighter); margin: 6px 0; }

/* 사진 미리보기 */
.photo-wrap { border-radius: 10px; overflow: hidden; background: var(--bg); margin-bottom: 16px; }
.photo-wrap img { width: 100%; display: block; max-height: 360px; object-fit: contain; }

/* select / textarea (메모·상태) */
.select, .memo {
    width: 100%; border: 1px solid var(--bg-lighter); border-radius: 14px;
    background: var(--bg); color: var(--text);
    font-family: 'Pretendard'; font-size: 15px; padding: 14px 16px; outline: none;
}
.select:focus, .memo:focus { border-color: var(--accent); }
.memo { min-height: 90px; resize: vertical; }
.block { margin-bottom: 16px; }
.block > .section-title { margin-left: 2px; }
.status-msg { font-size: 13px; color: var(--accent); margin-top: 4px; }

/* 하단 2버튼 액션 바 */
.action-bar {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
    padding: 12px 16px; background: var(--bg); border-top: 1px solid var(--bg-lighter);
}
.btn-secondary {
    width: 100%; border: 1px solid var(--bg-lighter); border-radius: 14px;
    background: var(--bg); color: var(--text);
    font-family: 'Pretendard'; font-weight: 600; font-size: 15px;
    padding: 14px 0; cursor: pointer; text-align: center; text-decoration: none;
    display: flex; align-items: center; justify-content: center;
}
.btn-secondary:active { background: var(--bg-darker); }
.btn-upload-label {
    width: 100%; border: none; border-radius: 14px; background: var(--accent); color: #fff;
    font-family: 'Pretendard'; font-weight: 600; font-size: 14px;
    padding: 14px 0; cursor: pointer; text-align: center;
    display: flex; align-items: center; justify-content: center;
}
.btn-upload-label:active { background: var(--accent-dark); }
.btn-upload-label input { display: none; }

/* ===== 검색 입력 바 (페이지 상단) ===== */
.search-bar {
    display: flex; align-items: center; gap: 8px; margin-bottom: 16px;
    background: var(--bg); border: 1px solid var(--bg-lighter); border-radius: 14px;
    padding: 12px 16px;
}
.search-bar svg { fill: var(--text-secondary); flex-shrink: 0; }
.search-bar input {
    flex: 1; border: none; outline: none; background: none;
    font-family: 'Pretendard'; font-size: 15px; color: var(--text);
}

/* ===== 알림(공지) 카드 ===== */
.notif-card {
    background: var(--bg); border: 1px solid var(--bg-lighter); border-radius: 14px;
    padding: 16px; margin-bottom: 10px;
}
.notif-card .ntitle { font-weight: 600; font-size: 15px; color: var(--text); margin-bottom: 4px; }
.notif-card .nbody { font-size: 14px; color: var(--text); white-space: pre-wrap; word-break: break-word; }
.notif-card .ntime { font-size: 12px; color: var(--text-secondary); margin-top: 8px; }

/* ===== 마이페이지 ===== */
.mypage-avatar-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; margin: 8px 0 24px; }
.avatar-lg {
    width: 96px; height: 96px; border-radius: 48px; overflow: hidden; flex-shrink: 0;
    background: var(--bg-darker); border: 1px solid var(--bg-lighter);
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 30px; color: var(--accent);
}
.avatar-lg img { width: 100%; height: 100%; object-fit: cover; }
.avatar-actions { display: flex; gap: 10px; }
.avatar-actions .btn-secondary { width: auto; padding: 10px 18px; font-size: 14px; }
.label-sm { display: block; font-size: 13px; color: var(--text-secondary); margin: 0 0 6px 2px; }
