/* =====================================================================
   업무관리시스템 디자인 시스템
   경로: /assets/css/app.css
   - 모바일 우선(mobile-first) 반응형: 1024px 이상에서 사이드바 고정
   - 인라인 스타일 금지. 페이지 개별 스타일이 필요하면 custom.css 사용
   ===================================================================== */

/* ---------- 1. 리셋 & 변수 ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }

/* hidden 속성은 어떤 클래스보다 우선한다.
   [hidden] 은 브라우저 기본 스타일에 있어 명시도가 클래스와 같고 작성자 스타일이 항상 이긴다.
   그래서 `.btn { display:inline-flex }` 같은 선언 하나가 hidden 을 무력화하고,
   JS 로 숨긴 요소가 화면에 그대로 남는다. 아래쪽에서 클래스마다 따로 막던 것을 여기서 한 번에 끝낸다. */
[hidden] { display: none !important; }

:root {
    /* 브랜드 */
    --primary:        #4f46e5;
    --primary-hover:  #4338ca;
    --primary-soft:   #eef2ff;
    --primary-grad:   linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);

    /* 상태 */
    --success:        #16a34a;
    --success-soft:   #f0fdf4;
    --danger:         #dc2626;
    --danger-soft:    #fef2f2;
    --warning:        #d97706;
    --warning-soft:   #fffbeb;
    --info:           #0284c7;
    --info-soft:      #f0f9ff;

    /* 표면 */
    --bg:             #f4f6fa;
    --bg-grad:        linear-gradient(180deg, #eef1f7 0%, #f4f6fa 360px);
    --surface:        #ffffff;
    --border:         #e8ebf1;
    --border-strong:  #d7dce6;
    --field-bg:       #fbfcfe;
    --hover-row:      #f6f8fc;
    --login-grad:     radial-gradient(1100px 560px at 50% -120px, #e4e8ff 0%, #f4f6fa 60%);

    /* 텍스트 */
    --text:           #101828;
    --text-body:      #344054;
    --text-muted:     #667085;
    --text-faint:     #98a2b3;

    /* 사이드바 */
    --sidebar-bg:     #0c1222;
    --sidebar-grad:   linear-gradient(180deg, #0e1526 0%, #0a0f1d 100%);
    --sidebar-border: rgba(255, 255, 255, 0.06);
    --sidebar-text:   #97a1b4;
    --sidebar-active: rgba(255, 255, 255, 0.055);

    /* 치수 */
    --sidebar-w:      250px;
    --topbar-h:       60px;
    --radius:         14px;
    --radius-sm:      10px;
    --shadow:         0 1px 2px rgba(16, 24, 40, 0.04), 0 2px 8px rgba(16, 24, 40, 0.04);
    --shadow-md:      0 6px 20px rgba(16, 24, 40, 0.08);
    --shadow-lg:      0 16px 40px rgba(16, 24, 40, 0.16);
    --ring:           0 0 0 4px rgba(79, 70, 229, 0.13);
}

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: "Pretendard Variable", "Pretendard", -apple-system, BlinkMacSystemFont,
                 "Apple SD Gothic Neo", "Malgun Gothic", "맑은 고딕", "Segoe UI", sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-body);
    background-color: var(--bg);
    background-image: var(--bg-grad);
    background-repeat: no-repeat;
    background-size: 100% 100%;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

::selection { background: rgba(99, 102, 241, 0.18); }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
button { font-family: inherit; }

/* ---------- 2. 앱 레이아웃 ---------- */
.app { min-height: 100vh; }

.main {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding-left: 0;               /* 모바일: 사이드바 없음 */
}

.content {
    flex: 1;
    padding: 16px;
    width: 100%;
    max-width: 2400px;
}

.app-footer {
    padding: 14px 16px;
    font-size: 12px;
    color: var(--text-faint);
    border-top: 1px solid var(--border);
}

/* ---------- 3. 사이드바 (모바일: 오버레이 드로어) ---------- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    z-index: 60;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    overflow-y: auto;
}
.app.sidebar-open .sidebar { transform: translateX(0); }

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 55;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}
.app.sidebar-open .sidebar-backdrop { opacity: 1; visibility: visible; }

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--topbar-h);
    padding: 0 16px;
    border-bottom: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    min-width: 0;
}
.brand-link:hover { text-decoration: none; }

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}

.brand-name {
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-sidebar-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--sidebar-text);
    cursor: pointer;
}
.btn-sidebar-close:hover { background: var(--sidebar-active); color: #fff; }

.sidebar-nav { padding: 12px 10px 24px; }

.nav-section { margin-top: 14px; }
.nav-section:first-child { margin-top: 0; }

.nav-section-title {
    padding: 0 10px;
    margin-bottom: 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: #475569;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 10px;
    margin-bottom: 2px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    font-size: 14px;
    transition: background 0.15s ease, color 0.15s ease;
}
.nav-item:hover { background: var(--sidebar-active); color: #e2e8f0; text-decoration: none; }
.nav-item.active { background: var(--primary); color: #fff; font-weight: 600; }

.nav-icon { display: inline-flex; flex-shrink: 0; }
.nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- 4. 상단바 ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 12px;
    height: var(--topbar-h);
    padding: 0 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.btn-menu {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-body);
    cursor: pointer;
    flex-shrink: 0;
}
.btn-menu:hover { background: var(--bg); }

.topbar-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

/* 사용자 칩 + 드롭다운 */
.topbar-user { position: relative; flex-shrink: 0; }

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-body);
    cursor: pointer;
    transition: background 0.15s ease;
}
.user-chip:hover { background: var(--bg); }

.user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}

.user-meta { display: none; text-align: left; line-height: 1.25; }
/* 이름/권한명이 아무리 길어도 상단바를 밀어내지 않도록 폭 제한 + 말줄임 */
.user-name,
.user-role {
    display: block;
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-name { font-size: 13px; font-weight: 600; color: var(--text); }
.user-role { font-size: 11px; color: var(--text-muted); }

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 180px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    display: none;
    z-index: 70;
}
.dropdown-menu.open { display: block; }

.dropdown-header {
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
}
.dropdown-header small { display: block; font-weight: 400; color: var(--text-muted); font-size: 12px; }

.dropdown-item {
    display: block;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-body);
    font-size: 13px;
}
.dropdown-item:hover { background: var(--bg); text-decoration: none; }

/* 폼 버튼을 드롭다운 항목처럼 보이게 (로그아웃은 POST 전송) */
.dropdown-button {
    width: 100%;
    text-align: left;
    border: 0;
    background: transparent;
    font-family: inherit;
    cursor: pointer;
}

/* ---------- 5. 페이지 공통 ---------- */
.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 16px;
}
.page-head h1 { font-size: 20px; font-weight: 700; color: var(--text); }
.page-head .page-desc { width: 100%; font-size: 13px; color: var(--text-muted); }

/* ---------- 6. 카드 ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}
.card-head h2 { font-size: 15px; font-weight: 700; color: var(--text); }

.card-body { padding: 16px; }
.card-body.no-pad { padding: 0; }

/* 통계 카드 그리드 */
.stat-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
}

.stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    flex-shrink: 0;
}
.stat-icon.indigo { background: var(--primary-soft); color: var(--primary); }
.stat-icon.green  { background: var(--success-soft); color: var(--success); }
.stat-icon.amber  { background: var(--warning-soft); color: var(--warning); }
.stat-icon.sky    { background: var(--info-soft);    color: var(--info); }

.stat-info { min-width: 0; }
.stat-label { font-size: 12px; color: var(--text-muted); }
.stat-value { font-size: 22px; font-weight: 700; color: var(--text); line-height: 1.3; }
.stat-sub   { font-size: 12px; color: var(--text-faint); }

/* 대시보드 2단 배치 */
.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.dash-grid .card { margin-bottom: 0; }
/* 한 컬럼 안에 카드를 여러 장 쌓을 때 간격 유지 (.mb-16 보다 우선순위가 높아야 함) */
.dash-grid .card.mb-16 { margin-bottom: 16px; }

/* ---------- 7. 테이블 ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    min-width: 560px;   /* 좁은 화면에서는 wrap 안에서 가로 스크롤 */
}

.table th {
    text-align: left;
    padding: 10px 14px;
    background: #f8fafc;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    vertical-align: middle;
}

.table td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text-body);
    vertical-align: middle;
}

/* 셀 안의 배지·버튼은 텍스트 baseline이 아니라 셀 중앙에 맞춘다 (정렬 어긋남 방지) */
.table td .badge { vertical-align: middle; }

.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #f8fafc; }

/* 정렬 유틸리티가 .table th/td 보다 우선하도록 명시
   (이게 없으면 헤더만 왼쪽 정렬로 남아 본문 셀과 어긋나 보인다) */
.table th.text-center, .table td.text-center { text-align: center; }
.table th.text-right,  .table td.text-right  { text-align: right; }
.table th.text-left,   .table td.text-left   { text-align: left; }
.table .num { text-align: right; }

/* 가운데/오른쪽 정렬 컬럼은 짧은 값(날짜·배지·건수·금액) 전용이므로 줄바꿈 금지.
   좁은 화면에서 "2026-08-05" 같은 날짜가 서너 줄로 꺾이는 것을 막는다.
   (긴 안내 배지는 .badge-wrap 이 자체 white-space:normal 로 예외 처리) */
.table td.text-center,
.table td.text-right { white-space: nowrap; }

/* 셀 안에서 값이 여러 개일 때 줄바꿈 없이 정돈되게 */
.cell-stack { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cell-main {
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cell-sub {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cell-actions { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: nowrap; }
/* 가운데 정렬 컬럼(예: 프로젝트 목록 관리)에서는 버튼도 가운데로 */
.table td.text-center .cell-actions { justify-content: center; }
/* 가운데 정렬 셀 안의 2줄 스택 (날짜 범위 + D-day 배지 등) */
.cell-stack-center { align-items: center; text-align: center; }

/* 고객사명 강조 (프로젝트 목록에서 고객사가 가장 먼저 눈에 들어오게) */
.cell-client {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cell-client:hover { color: var(--primary); }

/* 심플 리스트 (대시보드 공지/일정) */
.simple-list { list-style: none; }
.simple-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
}
.simple-list li:last-child { border-bottom: 0; }
.simple-list .item-title {
    color: var(--text-body);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.simple-list .item-meta { color: var(--text-faint); font-size: 12px; flex-shrink: 0; }

/* ---------- 8. 버튼 ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
    white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }

.btn-outline { background: var(--surface); border-color: var(--border-strong); color: var(--text-body); }
.btn-outline:hover { background: var(--bg); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }

.btn-sm { padding: 6px 10px; font-size: 13px; }
.btn-block { width: 100%; }

/* ---------- 9. 폼 ---------- */
.form-group { margin-bottom: 16px; }

.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}
.form-label .req { color: var(--danger); }

.form-control {
    display: block;
    width: 100%;
    padding: 9px 12px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}
.form-control::placeholder { color: var(--text-faint); }

textarea.form-control { resize: vertical; min-height: 96px; line-height: 1.6; }

.form-hint { margin-top: 5px; font-size: 12px; color: var(--text-muted); }
.form-error { margin-top: 5px; font-size: 12px; color: var(--danger); }

.form-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 14px; }

.form-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding-top: 8px;
}

/* ---------- 10. 배지 & 알림 ---------- */
.badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
}
/* 긴 안내 문구를 담는 배지는 줄바꿈 허용 (좁은 화면에서 넘침 방지) */
.badge-wrap { white-space: normal; text-align: right; }

.badge-gray   { background: var(--bg);           color: var(--text-muted); }
.badge-indigo { background: var(--primary-soft); color: var(--primary); }
.badge-green  { background: var(--success-soft); color: var(--success); }
.badge-red    { background: var(--danger-soft);  color: var(--danger); }
.badge-amber  { background: var(--warning-soft); color: var(--warning); }
.badge-sky    { background: var(--info-soft);    color: var(--info); }

.alert {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    margin-bottom: 16px;
    border: 1px solid transparent;
}
.alert-success { background: var(--success-soft); border-color: #bbf7d0; color: #166534; }
.alert-error   { background: var(--danger-soft);  border-color: #fecaca; color: #991b1b; }
.alert-info    { background: var(--info-soft);    border-color: #bae6fd; color: #075985; }
.alert-warning { background: var(--warning-soft); border-color: #fde68a; color: #92400e; }

/* ---------- 11. 토스트 (플래시 메시지) ---------- */
.toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: calc(100vw - 32px);
    padding: 12px 16px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    color: #fff;
    z-index: 90;
    animation: toast-in 0.25s ease;
}
@keyframes toast-in {
    from { opacity: 0; transform: translate(-50%, 12px); }
    to   { opacity: 1; transform: translate(-50%, 0); }
}
.toast-success { background: #15803d; }
.toast-error   { background: #b91c1c; }
.toast-info    { background: #1d4ed8; }
.toast.hide    { display: none; }

.toast-close {
    border: 0;
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}
.toast-close:hover { color: #fff; }

/* ---------- 12. 빈 상태 ---------- */
.empty-state {
    padding: 48px 20px;
    text-align: center;
    color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 34px; margin-bottom: 10px; }
.empty-state h3 { font-size: 15px; color: var(--text); margin-bottom: 6px; }
.empty-state p { font-size: 13px; }

/* ---------- 13. 로그인 / 에러 단독 페이지 ---------- */
.login-page,
.error-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--bg);
}

.login-box {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    padding: 36px 28px;
}

.login-brand { text-align: center; margin-bottom: 26px; }
.login-brand .brand-mark {
    width: 46px;
    height: 46px;
    font-size: 22px;
    border-radius: 12px;
    margin-bottom: 12px;
}
.login-brand h1 { font-size: 19px; font-weight: 700; color: var(--text); }
.login-brand p { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.error-box {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 40px 28px;
    text-align: center;
}
.error-code { font-size: 40px; font-weight: 800; color: var(--primary); margin-bottom: 8px; }
.error-box h1 { font-size: 18px; color: var(--text); margin-bottom: 10px; }
.error-box p { font-size: 13.5px; color: var(--text-muted); margin-bottom: 20px; }

/* ---------- 14. 유틸리티 ---------- */
.text-muted  { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-right  { text-align: right; }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mt-8 { margin-top: 8px; }
.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.w-100 { width: 100%; }

/* ---------- 15. 대시보드 ---------- */

/* 상단 KPI 카드 */
.kpi-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.kpi-card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px 18px;
    overflow: hidden;
}
/* 카드 왼쪽 색 띠로 성격을 구분 */
.kpi-card::before {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--border-strong);
}
.kpi-card.kpi-primary::before { background: var(--primary); }
.kpi-card.kpi-danger::before  { background: var(--danger); }
.kpi-card.kpi-warning::before { background: var(--warning); }

.kpi-label { font-size: 12px; color: var(--text-muted); margin-bottom: 5px; }
.kpi-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.kpi-value small { font-size: 13px; font-weight: 600; color: var(--text-muted); margin-left: 3px; }
.kpi-foot { margin-top: 6px; font-size: 12px; color: var(--text-muted); }
.kpi-foot strong { color: var(--text-body); font-weight: 600; }

.trend { font-weight: 700; }
.trend.up   { color: var(--success); }
.trend.down { color: var(--danger); }

.stat-value small { font-size: 13px; font-weight: 600; color: var(--text-muted); margin-left: 3px; }

/* 본문 3단 배치
   grid 트랙에 minmax(0, 1fr)을 쓰는 이유: 기본값 1fr은 내용물의 최소 너비 아래로
   줄어들지 않아, 좁은 화면에서 캘린더 같은 넓은 요소가 페이지 전체를 밀어낸다. */
.dash-cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.dash-main, .dash-mid, .dash-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.dash-main .card, .dash-mid .card, .dash-side .card { margin-bottom: 0; }

.dash-pair { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.dash-pair .card { margin-bottom: 0; }

/* 캘린더는 3단 밖에서 전체 폭을 쓴다 (가로로 넓어야 읽기 쉬운 요소) */
.dash-calendar { margin-top: 16px; margin-bottom: 0; }

/* 상세 화면용 2단 (본문 + 우측 보조)
   대시보드의 3단 그리드(.dash-cols)를 재사용하면 가운데 열이 비므로 별도로 둔다. */
.detail-cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.detail-main, .detail-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.detail-main .card, .detail-side .card { margin-bottom: 0; }

/* 막대 차트 (외부 라이브러리 없이 순수 CSS) */
.bar-chart {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
    align-items: end;
    height: 190px;
}
.bar-col { display: flex; flex-direction: column; height: 100%; min-width: 0; }
.bar-amount {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 4px;
    white-space: nowrap;
}
.bar-slot {
    flex: 1;
    display: flex;
    align-items: flex-end;
    background: linear-gradient(to top, #f8fafc 0, #f8fafc 100%);
    border-radius: 6px 6px 0 0;
}
.bar-fill {
    width: 100%;
    height: 0;
    min-height: 3px;
    background: #c7d2fe;
    border-radius: 6px 6px 0 0;
    transition: height 0.5s ease;
}
.bar-fill.current { background: var(--primary); }
.bar-label {
    margin-top: 6px;
    font-size: 11.5px;
    color: var(--text-muted);
    text-align: center;
}

/* 도넛 차트 */
.donut-box { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }

.donut { width: 132px; height: 132px; flex-shrink: 0; }
.donut-ring { fill: none; stroke: var(--bg); stroke-width: 5; }
.donut-seg {
    fill: none;
    stroke-width: 5;
    stroke-linecap: butt;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
}
.donut-seg.seg-1 { stroke: var(--primary); }
.donut-seg.seg-2 { stroke: #38bdf8; }
.donut-seg.seg-3 { stroke: #34d399; }
.donut-seg.seg-4 { stroke: #fbbf24; }

.donut-center { font-size: 7px; font-weight: 700; fill: var(--text); text-anchor: middle; }
.donut-sub    { font-size: 3.2px; fill: var(--text-muted); text-anchor: middle; }

.donut-legend { list-style: none; flex: 1; min-width: 150px; }
.donut-legend li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    font-size: 13px;
}
.legend-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; background: var(--border-strong); }
.legend-dot.seg-1 { background: var(--primary); }
.legend-dot.seg-2 { background: #38bdf8; }
.legend-dot.seg-3 { background: #34d399; }
.legend-dot.seg-4 { background: #fbbf24; }
.legend-name {
    flex: 1;
    color: var(--text-body);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.legend-val { color: var(--text); font-weight: 600; flex-shrink: 0; font-size: 12.5px; }
.legend-val em { display: block; font-style: normal; font-weight: 400; color: var(--text-faint); font-size: 11.5px; }

/* 프로젝트 진행률 */
.progress-row { margin-bottom: 16px; }
.progress-row:last-child { margin-bottom: 0; }

.progress-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}
.progress-title {
    font-size: 13.5px;
    color: var(--text-body);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.progress-title strong { color: var(--text); font-weight: 600; }
.progress-pct { font-size: 13px; font-weight: 700; color: var(--primary); flex-shrink: 0; }

.progress-track {
    height: 8px;
    background: var(--bg);
    border-radius: 999px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    width: 0;
    background: var(--primary);
    border-radius: 999px;
    transition: width 0.4s ease;
}
.progress-fill.green { background: var(--success); }

/* 캘린더 */
.cal-nav { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.cal-title { font-size: 14px; font-weight: 700; color: var(--text); padding: 0 4px; white-space: nowrap; }

.cal-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.calendar { width: 100%; border-collapse: collapse; table-layout: fixed; min-width: 560px; }

.calendar th {
    padding: 8px 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
}
.calendar th.sun { color: var(--danger); }
.calendar th.sat { color: var(--info); }

.cal-cell {
    height: 92px;
    vertical-align: top;
    padding: 5px 6px;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    overflow: hidden;
}
.calendar tbody tr td:last-child { border-right: 0; }
.calendar tbody tr:last-child td { border-bottom: 0; }

.cal-cell.out { background: #fafbfc; }
.cal-cell.today { background: #fffbeb; }

.cal-day { font-size: 12px; font-weight: 600; color: var(--text-body); margin-bottom: 3px; }
.cal-cell.sun .cal-day { color: var(--danger); }
.cal-cell.sat .cal-day { color: var(--info); }
.cal-cell.today .cal-day { color: var(--warning); }

.cal-ev {
    font-size: 11px;
    line-height: 1.45;
    padding: 1px 5px;
    margin-bottom: 2px;
    border-radius: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: var(--primary-soft);
    color: var(--primary);
}
.cal-ev-deadline { background: var(--danger-soft); color: var(--danger); }
.cal-ev-contract { background: var(--warning-soft); color: var(--warning); }
.cal-ev-meeting  { background: var(--info-soft);    color: var(--info); }
.cal-ev-vacation { background: var(--success-soft); color: var(--success); }
.cal-ev-etc      { background: var(--bg);           color: var(--text-muted); }

.cal-more { font-size: 10.5px; color: var(--text-faint); padding-left: 5px; }

/* 캘린더 이벤트가 링크일 때 */
a.cal-ev { display: block; text-decoration: none; }
a.cal-ev:hover { filter: brightness(0.95); text-decoration: none; }
.cal-ev-time { font-weight: 700; opacity: 0.8; }

/* 큰 캘린더 (일정 관리 페이지) */
.calendar-lg .cal-cell { height: 116px; }
.cal-cell.cal-clickable { cursor: pointer; }
.cal-cell.cal-clickable:hover { background: var(--primary-soft); }

/* 캘린더 범례 */
.cal-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    padding: 12px 4px 0;
    font-size: 12.5px;
    color: var(--text-muted);
}
.cal-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.cal-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.cal-dot.cal-ev-meeting  { background: var(--info); }
.cal-dot.cal-ev-deadline { background: var(--danger); }
.cal-dot.cal-ev-contract { background: var(--warning); }
.cal-dot.cal-ev-vacation { background: var(--success); }
.cal-dot.cal-ev-etc      { background: var(--text-faint); }

/* 시각 입력 필드 (하루종일이면 숨김) */
.time-field.hidden { display: none; }

/* 캘린더 헤더의 필터 + 이동 버튼 */
.cal-head { flex-wrap: wrap; gap: 10px; }
.cal-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cal-filter .form-sm { min-width: 130px; }

/* 비공개(나만 보기) 일정: 점선 테두리 + 자물쇠 */
.cal-ev-private { border: 1px dashed currentColor; opacity: 0.92; }
.cal-ev-lock { font-size: 9px; margin-right: 1px; }

/* 업무 메모 */
.memo-form { margin-bottom: 12px; }
.memo-empty { font-size: 13px; padding: 6px 2px; }

.memo-list { list-style: none; }

.memo-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 0;
    border-bottom: 1px solid var(--border);
}
.memo-item:last-child { border-bottom: 0; }

.memo-toggle, .memo-del { display: flex; flex-shrink: 0; }

.memo-check {
    width: 17px;
    height: 17px;
    border: 2px solid var(--border-strong);
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    padding: 0;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.memo-check:hover { border-color: var(--primary); }

.memo-text {
    flex: 1;
    font-size: 13.5px;
    color: var(--text-body);
    word-break: break-word;
    min-width: 0;
}

.memo-item.done .memo-check { background: var(--success); border-color: var(--success); }
.memo-item.done .memo-text { color: var(--text-faint); text-decoration: line-through; }

.memo-x {
    border: 0;
    background: transparent;
    color: var(--text-faint);
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
}
.memo-x:hover { color: var(--danger); }

/* ---------- 16. 목록 화면 공통 (검색바 / 페이징 / 정의표) ---------- */

.head-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* 검색 필터 바 */
.filter-bar { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.filter-bar .btn { white-space: nowrap; }

/* 카드 하단 (페이징 영역) */
.card-foot {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: center;
}

.pagination { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-body);
    font-size: 13px;
}
.page-link:hover { background: var(--bg); text-decoration: none; }
.page-link.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    font-weight: 700;
}

/* 정의형 표 (항목명 | 값) */
.def-table { min-width: 0; }
.def-table th {
    width: 110px;
    background: #f8fafc;
    color: var(--text-muted);
    font-size: 12.5px;
    vertical-align: middle;
    border-right: 1px solid var(--border);
}
.def-table td { font-size: 13.5px; }
.pre-line { white-space: pre-line; }

.link-strong { font-weight: 600; color: var(--text); }
.link-strong:hover { color: var(--primary); }

.text-faint { color: var(--text-faint); }

/* 표 안에 버튼과 폼을 나란히 놓기 */
.inline-form { display: inline-block; }

/* 연락처 목록 */
.contact-list { list-style: none; }
.contact-list li {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}
.contact-list li:last-child { border-bottom: 0; }

.contact-name {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 3px;
}
.contact-name .text-muted { font-weight: 400; font-size: 12.5px; }
.contact-line { font-size: 13px; color: var(--text-body); }

/* 연락처 입력 줄 */
.contact-row { margin-bottom: 10px; }
.contact-row:last-child { margin-bottom: 0; }

.contact-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    padding: 12px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

/* 상담/통화/메모 타임라인 */
.log-form { margin-bottom: 14px; }
.log-form-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }

.log-list { list-style: none; }
.log-item {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.log-item:last-child { border-bottom: 0; padding-bottom: 0; }

.log-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.log-meta { font-size: 12px; color: var(--text-faint); flex: 1; }
.log-del { margin-left: auto; }

.log-content {
    font-size: 13.5px;
    color: var(--text-body);
    line-height: 1.6;
    white-space: pre-line;
    word-break: break-word;
}

.log-peek { display: block; min-width: 0; }
.log-peek:hover { text-decoration: none; }
.log-peek:hover .log-snippet { color: var(--primary); }
.log-snippet { font-weight: 400; color: var(--text-body); }
.cell-log { max-width: 260px; }

/* 관리자 영역 */
.admin-tabs {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.admin-tab {
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}
.admin-tab:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.admin-tab.active { background: var(--primary); color: #fff; }

/* 관리자 홈 카드 */
.admin-cards {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}
.admin-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    color: var(--text-body);
    transition: box-shadow 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}
.admin-card:hover {
    text-decoration: none;
    box-shadow: 0 6px 16px rgba(16, 24, 40, 0.1);
    transform: translateY(-2px);
    border-color: var(--border-strong);
}
.admin-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    background: var(--primary-soft);
    color: var(--primary);
    flex-shrink: 0;
}
.admin-card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.admin-card-title { font-size: 15px; font-weight: 700; color: var(--text); }
.admin-card-desc { font-size: 12.5px; color: var(--text-muted); }
.admin-card-meta { font-size: 12px; color: var(--text-faint); margin-top: 2px; }
.admin-card-arrow { color: var(--text-faint); font-size: 18px; flex-shrink: 0; }
.admin-card:hover .admin-card-arrow { color: var(--primary); }

.admin-lastlog {
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--text-muted);
}

/* 코드/메뉴 편집 표 안의 작은 입력 */
.form-sm { padding: 6px 9px; font-size: 13px; }
.num-input { width: 74px; margin: 0 auto; text-align: center; }
.code-key {
    font-family: Consolas, Monaco, monospace;
    font-size: 12px;
    background: var(--bg);
    padding: 2px 6px;
    border-radius: 5px;
    color: var(--text-body);
}

.icon-pick { display: flex; align-items: center; gap: 8px; }
.icon-preview {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 7px;
    background: var(--bg);
    color: var(--text-body);
    flex-shrink: 0;
}

/* 코드 그룹 선택 칩 */
.group-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.group-chip {
    padding: 7px 12px;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    font-size: 13px;
    color: var(--text-body);
    background: var(--surface);
}
.group-chip:hover { background: var(--bg); text-decoration: none; }
.group-chip.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    font-weight: 600;
}

/* 권한 매트릭스 */
.matrix-table th, .matrix-table td { white-space: nowrap; }
.matrix-sub th { font-size: 10.5px; padding-top: 4px; padding-bottom: 8px; }
.matrix-cell { border-left: 1px dashed var(--border); }
.matrix-cell input[type=checkbox] { width: 15px; height: 15px; cursor: pointer; }
.matrix-cell-end { border-right: 1px solid var(--border); }

/* 이름변경 인라인 폼 */
.rename-form { display: inline-flex; gap: 4px; align-items: center; }
.rename-input { width: 120px; }

/* 등록/수정 폼은 와이드 모니터에서 너무 퍼지지 않도록 폭 제한 */
.form-page { max-width: 1080px; }

/* 중앙 정렬 좁은 폼 래퍼 (제목 + 폼을 함께 가운데로) */
.form-narrow { max-width: 760px; margin: 0 auto; }

/* 폼 하단 액션 버튼 (크게, 우측 정렬) */
.form-actions-lg { padding-top: 4px; }
.form-actions-lg .btn { min-width: 120px; padding: 11px 22px; }

/* 담당자 배정 - 이름표 그리드 (가로로 채워 빈 공간 최소화) */
.member-check-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}
.member-check-grid .member-check {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    margin: 0;
}
.member-check-grid .member-check:hover { background: var(--bg); border-color: var(--border-strong); }
.member-check-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.member-check-grid .member-check-meta { margin-left: 0; }

/* 목록 진행률 미니 바 - 고정폭으로 묶어 모든 행에서 바 시작점·숫자 위치를 일렬로 맞춘다 */
.progress-mini {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 108px;
    margin: 0 auto;   /* 셀 중앙에 고정폭 묶음 배치 */
}
.progress-mini-track {
    width: 70px;
    height: 6px;
    background: #eef0f3;
    border-radius: 999px;
    overflow: hidden;
    flex-shrink: 0;
}
.progress-mini-label { font-size: 12px; font-weight: 600; color: var(--text-muted); width: 30px; text-align: right; flex-shrink: 0; }
.progress-fill.over { background: var(--danger); }

/* 프로젝트 정보표 안의 진행률 */
.progress-inline { display: flex; align-items: center; gap: 10px; max-width: 320px; }
.progress-inline .progress-track { flex: 1; }

/* 진행률 슬라이더 (텍스트 입력과 세로 중심을 맞추기 위해 높이 확보) */
.form-range { width: 100%; height: 38px; cursor: pointer; accent-color: var(--primary); }

/* 고객사 선택기 (기존/신규 탭) - 재계약 필터 탭줄로도 쓰이므로 좁은 화면에서 줄바꿈 */
.client-mode-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.client-mode-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    font-size: 13px;
    color: var(--text-body);
    cursor: pointer;
}
.client-mode-tab input { accent-color: var(--primary); }

/* 담당자 체크 목록 */
.member-check-list { display: flex; flex-direction: column; gap: 2px; max-height: 360px; overflow-y: auto; }
.member-check {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 6px;
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.member-check:hover { background: var(--bg); }
.member-check input { width: 15px; height: 15px; accent-color: var(--primary); flex-shrink: 0; }
.member-check-name { font-weight: 600; color: var(--text); font-size: 13.5px; }
.member-check-meta { font-size: 12px; color: var(--text-muted); margin-left: auto; white-space: nowrap; }

/* 광고 예산 (모바일 1열 → 640px 이상 3열) */
.budget-summary { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin-bottom: 16px; }
.budget-sum-item { padding: 12px 14px; background: #f8fafc; border: 1px solid var(--border); border-radius: var(--radius); }
.budget-sum-label { font-size: 12px; color: var(--text-muted); margin-bottom: 3px; }
.budget-sum-value { font-size: 20px; font-weight: 700; color: var(--text); }
.budget-sum-value small { font-size: 12px; font-weight: 600; color: var(--text-muted); margin-left: 2px; }
.budget-form-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }

.guideline-body {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-body);
    word-break: break-word;
    overflow-wrap: anywhere;   /* 가이드라인 안의 긴 URL이 카드 밖으로 밀고 나가지 않게 */
}
/* 서식 본문 공통 (에디터 입력 영역 · 상세 표시 영역)
   전역 리셋(* { margin:0; padding:0 })으로 죽은 목록/문단 여백을 되살린다 */
.guideline-body p,
.rte-body p { margin: 0 0 8px; }
.guideline-body p:last-child,
.rte-body p:last-child { margin-bottom: 0; }
.guideline-body ul, .guideline-body ol,
.rte-body ul, .rte-body ol { margin: 6px 0 10px; padding-left: 22px; }
.guideline-body ul, .rte-body ul { list-style: disc; }
.guideline-body ol, .rte-body ol { list-style: decimal; }
.guideline-body li, .rte-body li { margin-bottom: 3px; }
.guideline-body h3, .rte-body h3 { font-size: 15px; font-weight: 700; color: var(--text); margin: 10px 0 6px; }
.guideline-body h4, .rte-body h4 { font-size: 14px; font-weight: 700; color: var(--text); margin: 10px 0 6px; }
.guideline-body blockquote, .rte-body blockquote {
    margin: 8px 0;
    padding: 6px 12px;
    border-left: 3px solid var(--border-strong);
    color: var(--text-muted);
}
.guideline-body a, .rte-body a { color: var(--primary); text-decoration: underline; }

/* =====================================================================
   서식 에디터 (assets/js/editor.js)
   ===================================================================== */
.rte {
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    overflow: hidden;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.rte:focus-within { border-color: var(--primary); box-shadow: var(--ring); }

.rte-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    padding: 6px 8px;
    background: var(--field-bg);
    border-bottom: 1px solid var(--border);
}

.rte-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 30px;
    padding: 0 6px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-body);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.14s ease, color 0.14s ease;
}
.rte-btn:hover { background: var(--bg); color: var(--text); }
.rte-btn.is-on { background: var(--primary-soft); color: var(--primary); }
.rte-btn:focus-visible { outline: none; box-shadow: var(--ring); }

/* 서식 버튼의 글자 모양으로 기능을 바로 알 수 있게 */
.rte-b { font-weight: 800; }
.rte-i { font-style: italic; }
.rte-u { text-decoration: underline; }
.rte-s { text-decoration: line-through; }

.rte-sep {
    width: 1px;
    height: 18px;
    margin: 0 4px;
    background: var(--border);
}

.rte-body {
    min-height: 190px;
    /* 내용만큼 늘어나되 한 화면을 넘으면 안에서 스크롤한다.
       460px 고정이던 시절에는 .form-lg 기준 15줄만 보여서 긴 가이드라인이 통째로 잘렸다. */
    max-height: calc(100vh - 240px);
    overflow-y: auto;
    /* 안쪽 끝에 닿으면 페이지 스크롤로 바로 넘어가게 (스크롤이 창 안에 갇히지 않게) */
    overscroll-behavior: auto;
    padding: 12px 14px;
    font-size: 14px;
    line-height: 1.7;
    color: var(--text);
    outline: none;
    word-break: break-word;
    overflow-wrap: anywhere;
}
/* 비어 있을 때 안내 문구 */
.rte-body:empty::before {
    content: attr(data-placeholder);
    color: var(--text-faint);
    pointer-events: none;
}

/* 공지 목록 (표 형태 - 제목 시작점이 필독/일반 무관하게 통일) */
.notice-table th:first-child, .notice-table td:first-child { width: 70px; }
.notice-table tr.notice-pinned { background: #fffdf5; }
.notice-title-link { font-weight: 600; color: var(--text); }
.notice-title-link:hover { color: var(--primary); }

/* 공지 상세 (게시글 형태) */
.notice-detail { overflow: hidden; }

.notice-detail-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border);
    background: #fafbfc;
}
.notice-detail-title {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 19px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.4;
    margin-bottom: 10px;
}
.notice-detail-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--text-muted);
}
.notice-detail-author { font-weight: 600; color: var(--text-body); }

.notice-detail-body {
    padding: 24px;
    min-height: 140px;
    font-size: 14.5px;
    line-height: 1.9;
    color: var(--text-body);
    word-break: break-word;
}

.notice-detail-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding: 14px 24px;
    border-top: 1px solid var(--border);
    background: #fafbfc;
}

.notice-nav { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.notice-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-body);
}
.notice-nav-item:hover { background: var(--bg); text-decoration: none; }
.notice-nav-dir { font-size: 12px; color: var(--text-muted); font-weight: 600; flex-shrink: 0; width: 64px; }
.notice-nav-title { font-size: 13.5px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 재무 월 이동 바 */
.fin-month-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.fin-month-label { font-size: 16px; font-weight: 700; color: var(--text); }
/* 내역이 2017년부터 쌓여 있어 한 달씩 넘기면 수십 번을 눌러야 한다. 바로 뛰는 칸. */
.fin-month-jump { margin-left: auto; }
.fin-month-jump select { min-width: 190px; }
@media (max-width: 640px) {
    .fin-month-jump { margin-left: 0; width: 100%; }
    .fin-month-jump select { width: 100%; }
}

/* 매출/지출 토글 */
.type-toggle { display: flex; gap: 8px; }
.type-toggle-wrap { flex-wrap: wrap; }
.type-opt {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 11px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-body);
}
.type-opt input { accent-color: var(--primary); }
.type-opt:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }

/* 유지보수 처리 로그 입력 */
.maint-log-form { margin-bottom: 14px; }
.maint-log-actions { display: grid; grid-template-columns: minmax(0, 150px) minmax(0, 1fr) auto; gap: 8px; }
@media (max-width: 640px) {
    .maint-log-actions { grid-template-columns: minmax(0, 1fr); }
}

/* 빠른 상태 변경 버튼 목록 */
.quick-status { display: flex; flex-direction: column; gap: 8px; }
.quick-status .btn:disabled { opacity: 1; }

/* 체크박스 라벨 */
.form-check {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13.5px;
    color: var(--text-body);
    cursor: pointer;
}
.form-check input { width: 15px; height: 15px; cursor: pointer; }

/* 연락처 대표 체크박스 (입력 줄 안에서 세로 가운데 정렬) */
.contact-primary-check { white-space: nowrap; justify-content: center; }

/* =====================================================================
   반응형 분기
   ===================================================================== */

/* 태블릿 이상 */
/* 모바일(≤640px): 목록 표에서 핵심 컬럼만 남기고 나머지는 숨긴다.
   (상세 화면으로 들어가면 전체 정보가 다 보이므로 목록은 가볍게 유지) */
@media (max-width: 639.98px) {
    /* 고객사 목록: 회사명(1) + 상태(6) 만 노출 */
    .tbl-clients th:not(:first-child):not(:nth-child(6)),
    .tbl-clients td:not(:first-child):not(:nth-child(6)) { display: none; }
    /* 프로젝트 목록: 고객사(1) + 상태(7) 만 노출 */
    .tbl-projects th:not(:first-child):not(:nth-child(7)),
    .tbl-projects td:not(:first-child):not(:nth-child(7)) { display: none; }
    /* 도메인·호스팅 목록: 고객사 · 주소 · 만료일 · 남은기간만 남긴다.
       열 번호가 아니라 클래스로 거는 이유는, 권한이 없으면 선택 칸이 통째로 빠져
       nth-child 번호가 한 칸씩 밀리기 때문이다. */
    .tbl-assets .col-pick,
    .tbl-assets .col-type,
    .tbl-assets .col-prov,
    .tbl-assets .col-cost,
    .tbl-assets .col-act { display: none; }

    /* 컬럼을 2개만 남겼으므로 최소폭 강제(560px)를 해제 - 안 하면 상태 컬럼이 화면 밖으로 잘린다 */
    .tbl-clients,
    .tbl-projects,
    .tbl-assets { min-width: 0; }

    /* 정의표(항목|값 4열): 세로 스택으로 재배치.
       4열을 375px에 욱여넣으면 표가 화면을 뚫고 나가 페이지가 옆으로 밀리고
       좁은 셀에서 글자가 한두 자씩 세로로 흘러내린다. */
    .def-table,
    .def-table tbody { display: block; }
    .def-table tr {
        display: grid;
        grid-template-columns: 104px minmax(0, 1fr);
    }
    .def-table th,
    .def-table td { width: auto; }
    .def-table th { display: flex; align-items: center; }
    .def-table td {
        display: block;
        word-break: break-word;
        overflow-wrap: anywhere;
    }
    .def-table tr:last-child th { border-bottom: 0; }
}

@media (min-width: 640px) {
    .content { padding: 24px; }
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .kpi-grid  { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .user-meta { display: block; }
    .form-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .fin-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .filter-bar { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) auto auto; }
    .filter-bar-1 { grid-template-columns: minmax(0, 1fr) auto auto; }
    .filter-bar-3 { grid-template-columns: minmax(0, 2.5fr) minmax(0, 1fr) auto auto; }
    .filter-bar-add { grid-template-columns: minmax(0, 1fr) auto; }
    .filter-bar-add2 { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) auto; }
    .filter-bar-code { grid-template-columns: minmax(0, 2fr) minmax(0, 1.4fr) minmax(0, 1fr) auto; }
    .filter-bar-logs { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 0.9fr) minmax(0, 0.9fr) auto auto; }
    .filter-bar-mem { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 0.9fr) auto auto; }
    .contact-grid { grid-template-columns: 100px minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 1.5fr) auto auto; }
    .log-form-grid { grid-template-columns: 110px 150px minmax(0, 1fr) auto; }
    .admin-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .filter-bar-proj { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) auto auto; }
    .budget-form-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) auto; }
    .budget-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 1280px) {
    .admin-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* 데스크톱: 사이드바 상시 고정 + 대시보드 2단 */
@media (min-width: 1024px) {
    .sidebar { transform: none; }
    .sidebar-backdrop { display: none; }
    .btn-sidebar-close { display: none; }
    .btn-menu { display: none; }
    .main { padding-left: var(--sidebar-w); }
    .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .kpi-grid  { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .dash-grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
    .content { padding: 28px 32px; }

    /* 2단: 좌측에 본문·중간 영역을 쌓고 우측에 위젯 열 고정 */
    .dash-cols {
        grid-template-columns: minmax(0, 1fr) 340px;
        grid-template-areas: "main side" "mid side";
    }
    .dash-main { grid-area: main; }
    .dash-mid  { grid-area: mid; }
    .dash-side { grid-area: side; }

    .detail-cols { grid-template-columns: minmax(0, 1fr) 340px; }
}

/* 와이드 모니터: 3단으로 펼쳐 화면을 끝까지 채운다 */
@media (min-width: 1600px) {
    .kpi-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .dash-cols {
        grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.95fr) 360px;
        grid-template-areas: "main mid side";
    }
    .dash-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .cal-cell { height: 104px; }
    .detail-cols { grid-template-columns: minmax(0, 1fr) 400px; }
}

/* 초와이드(2560px급): 여백 없이 꽉 차게 */
@media (min-width: 2000px) {
    .dash-cols { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) 400px; }
    .cal-cell { height: 118px; }
}

/* =====================================================================
   17. 모던 SaaS 스킨 v2 (디자인 리프레시 - 기존 규칙을 세밀하게 덮어씀)
   - 마크업/클래스는 그대로 두고 이 레이어에서만 스킨을 올린다.
   - 하드코딩 색은 최소화하고 토큰을 쓴다 (다크 테마는 19장에서 토큰만 갈아끼움).
   ===================================================================== */

/* 타이포그래피: 제목은 좁은 자간으로 또렷하게 */
.page-head h1,
.card-head h2,
.kpi-value,
.stat-value,
.login-brand h1 { letter-spacing: -0.025em; }

.page-head h1 { font-size: 22px; font-weight: 800; }
.card-head h2 { font-size: 15px; }

/* 페이지 진입 모션: 콘텐츠가 살짝 떠오르며 나타난다 */
@keyframes page-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.content { animation: page-in 0.28s cubic-bezier(0.22, 0.8, 0.3, 1) both; }

/* 카드: 얇은 테두리 + 겹층 그림자, 통계 카드는 호버 시 떠오름 */
.card,
.stat-card,
.kpi-card {
    border-color: var(--border);
    transition: box-shadow 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}
.card-head { padding: 15px 16px; }
.kpi-card:hover,
.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

/* KPI: 큰 숫자 + 왼쪽 그라데이션 띠 */
.kpi-value { font-size: 25px; font-weight: 800; }
.kpi-card::before {
    width: 3px;
    top: 12px;
    bottom: 12px;
    border-radius: 0 3px 3px 0;
}
.kpi-card.kpi-primary::before { background: var(--primary-grad); }

/* 상단바: 반투명 + 블러 (콘텐츠가 비쳐 보이는 글래스 스타일) */
.topbar {
    background: rgba(255, 255, 255, 0.78);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    backdrop-filter: blur(14px) saturate(160%);
    border-bottom-color: rgba(16, 24, 40, 0.06);
}

/* 사이드바: 딥 네이비 그라데이션 + 그라데이션 pill 활성 항목 */
.sidebar { background: var(--sidebar-grad); }
.nav-item {
    padding: 9px 11px;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.nav-item:hover { background: var(--sidebar-active); color: #e8ecf4; }
.nav-item.active {
    background: var(--primary-grad);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.38);
}
.nav-icon { opacity: 0.9; }
.nav-section { margin-top: 18px; }
.nav-section-title {
    font-size: 10.5px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #55617a;
}
.sidebar-brand { border-bottom-color: var(--sidebar-border); }
.brand-mark {
    background: var(--primary-grad);
    border-radius: 9px;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.45);
}

/* 테이블: 헤더는 작고 흐리게, 본문은 여유 있는 패딩 + 부드러운 행 호버 */
.table th {
    font-size: 11.5px;
    letter-spacing: 0.05em;
    color: var(--text-faint);
    background: var(--field-bg);
    padding: 10px 16px;
}
.table td { padding: 13px 16px; transition: background 0.12s ease; }
.table tbody tr:hover { background: var(--hover-row); }

/* 배지: 둥근 사각 칩 */
.badge {
    border-radius: 6px;
    padding: 2.5px 7px;
    font-size: 11.5px;
}

/* 버튼: 그라데이션 주 버튼 + 호버 리프트 + 포커스 링 */
.btn {
    border-radius: var(--radius-sm);
    transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease,
                box-shadow 0.16s ease, transform 0.16s ease, filter 0.16s ease;
}
.btn:active { transform: translateY(0.5px); }
.btn-primary {
    background: var(--primary-grad);
    box-shadow: 0 1px 2px rgba(79, 70, 229, 0.35);
}
.btn-primary:hover {
    background: var(--primary-grad);
    filter: brightness(1.07);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.35);
}
.btn-outline:hover { border-color: var(--border-strong); background: var(--hover-row); }
.btn-danger:hover { transform: translateY(-1px); box-shadow: 0 5px 14px rgba(220, 38, 38, 0.3); }
.btn:focus-visible,
.page-link:focus-visible,
.nav-item:focus-visible,
.theme-toggle:focus-visible,
.topbar-icon-btn:focus-visible,
.alert-bell:focus-visible,
.user-chip:focus-visible { outline: none; box-shadow: var(--ring); }

/* 폼: 은은한 필드 배경 → 포커스 시 흰 배경 + 링 */
.form-control {
    border-radius: var(--radius-sm);
    background: var(--field-bg);
}
.form-control:hover { border-color: var(--border-strong); }
.form-control:focus { background: var(--surface); box-shadow: var(--ring); }

/* 드롭다운/콤보: 살짝 튀어나오는 팝 모션 */
@keyframes pop-in {
    from { opacity: 0; transform: translateY(-5px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.dropdown-menu.open,
.combo-list:not([hidden]) {
    animation: pop-in 0.16s cubic-bezier(0.2, 0.9, 0.35, 1.1);
    transform-origin: top right;
}
.combo-list:not([hidden]) { transform-origin: top left; }

/* 활성 요소(페이지네이션/탭/세그먼트)는 그라데이션으로 통일 */
.page-link { transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease; }
.page-link.active,
.admin-tab.active,
.seg-tab.active,
.group-chip.active { background: var(--primary-grad); border-color: transparent; }
.status-pill.status-ongoing { background: var(--primary-grad); }

/* 진행률 바: 그라데이션 채움 */
.progress-track { height: 7px; background: var(--bg); }
.progress-fill { background: var(--primary-grad); }

/* 플래시 알림: 왼쪽 컬러 바 강조 + 슬라이드 인 */
.alert { border-left-width: 3px; animation: page-in 0.24s ease both; }

/* 로그인: 은은한 브랜드 그라데이션 배경 + 큰 라운드 카드 */
.login-page { background: var(--login-grad); }
.login-box {
    border-radius: 20px;
    padding: 42px 34px;
    border-color: rgba(16, 24, 40, 0.05);
    box-shadow: var(--shadow-lg);
}

/* 사용자 칩/아이콘 버튼: 호버 시 살짝 떠오름 */
.user-chip { transition: background 0.15s ease, box-shadow 0.15s ease; }
.user-chip:hover { box-shadow: var(--shadow); }

/* 스크롤바 (웹킷): 가늘고 흐리게 */
.sidebar::-webkit-scrollbar,
.table-wrap::-webkit-scrollbar,
.cal-wrap::-webkit-scrollbar { width: 8px; height: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: #2a3447; border-radius: 4px; }
.table-wrap::-webkit-scrollbar-thumb,
.cal-wrap::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }

/* 빈 상태: 아이콘을 은은한 그라데이션 원 안에 */
.empty-state .empty-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-soft) 0%, var(--bg) 100%);
    font-size: 28px;
    margin-bottom: 12px;
}

/* 모션 최소화 설정 존중 (접근성) */
@media (prefers-reduced-motion: reduce) {
    .content, .alert, .dropdown-menu.open, .combo-list:not([hidden]) { animation: none; }
    .btn, .kpi-card, .stat-card, .nav-item, .admin-card { transition: none; }
}

/* =====================================================================
   18. 공용 컴포넌트 (테마 토글 / 고객사 콤보 / 링크 반복행 / 전화 링크)
   - 라이트/다크 양쪽에서 자연스럽게 보이도록 토큰만 사용
   ===================================================================== */

/* 상단바 테마 토글 버튼 (해/달) */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-body);
    cursor: pointer;
    flex-shrink: 0;
}
.theme-toggle:hover { background: var(--bg); }
.theme-toggle .icon-sun,
.theme-toggle .icon-moon { display: inline-flex; }
/* 라이트에서는 달(다크로 전환), 다크에서는 해(라이트로 전환)만 노출 */
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: inline-flex; }

/* 상단바 회사 서류 버튼 (벨/테마 버튼과 동일한 아이콘 버튼) */
.topbar-docs { position: relative; flex-shrink: 0; }
.topbar-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-body);
    cursor: pointer;
    flex-shrink: 0;
}
.topbar-icon-btn:hover { background: var(--bg); }

/* 상단바 알림 벨 + 알림 드롭다운 */
.topbar-alert { position: relative; flex-shrink: 0; }

.alert-bell {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-body);
    cursor: pointer;
    flex-shrink: 0;
}
.alert-bell:hover { background: var(--bg); }

.alert-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    box-shadow: 0 0 0 2px var(--surface);
}

.alert-menu {
    width: 340px;
    max-width: calc(100vw - 32px);
    padding: 0;
    overflow: hidden;
}
.alert-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 0;
}
.alert-head .text-muted { font-size: 12px; font-weight: 400; }

.alert-list { max-height: 360px; overflow-y: auto; padding: 4px; }

.alert-empty {
    padding: 24px 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

.alert-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-radius: var(--radius-sm);
    color: var(--text-body);
}
.alert-item:hover { background: var(--bg); text-decoration: none; }
.alert-item + .alert-item { border-top: 1px solid var(--border); }

.alert-kind,
.alert-dday { flex-shrink: 0; }

.alert-item-body { flex: 1; min-width: 0; line-height: 1.35; }
.alert-item-title {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.alert-item-sub {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.alert-more {
    padding: 6px 12px;
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
}
.alert-foot {
    display: block;
    padding: 10px 12px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    text-align: center;
}
.alert-foot:hover { background: var(--bg); text-decoration: none; }

/* 프로젝트 목록 계약기간 셀 (더 크고 진하게, 줄바꿈 방지) */
.cell-period {
    display: inline-block;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.2px;
}

/* 복수 상품 선택 (칩 UI)
   선택 컨트롤이 먼저 오고 고른 항목(칩)이 아래에 쌓인다.
   → 2단 폼(.form-row)에서 옆 칸의 select 와 입력 위치가 정확히 맞는다. */
.product-multi { display: flex; flex-direction: column; gap: 8px; }
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-list:empty { display: none; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 6px 5px 12px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 13px;
    font-weight: 600;
}
.chip-x {
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0 4px;
    border-radius: 50%;
}
.chip-x:hover { background: rgba(0, 0, 0, 0.08); }
.product-add-row { display: flex; gap: 8px; }
.product-add-row select { flex: 1; min-width: 0; }
.form-hint-inline { font-weight: 400; color: var(--text-muted); font-size: 12px; }

/* 프로젝트 상태 탭 (세그먼트 컨트롤) */
.seg-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.seg-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-body);
    font-size: 14px;
    font-weight: 600;
}
.seg-tab:hover { background: var(--bg); text-decoration: none; }
.seg-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.seg-count {
    display: inline-block;
    min-width: 22px;
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--bg);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}
.seg-tab.active .seg-count { background: rgba(255, 255, 255, 0.22); color: #fff; }

/* 프로젝트 목록 상태 강조 배지 (채운 색으로 뚜렷하게) */
.status-pill {
    display: inline-block;
    padding: 5px 14px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 700;
    line-height: 1.5;
    white-space: nowrap;
    background: var(--bg);
    color: var(--text-body);
}
.status-pill.status-ongoing { background: var(--primary); color: #fff; }
.status-pill.status-pending { background: var(--text-muted); color: #fff; }
.status-pill.status-review  { background: var(--info);    color: #fff; }
.status-pill.status-done    { background: var(--success); color: #fff; }
.status-pill.status-hold    { background: var(--warning); color: #fff; }

/* 대시보드 소형 빈 상태 (큰 empty-state 대신 한 줄로 - 데이터 없어도 허전하지 않게) */
.mini-empty {
    padding: 16px 16px;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.5;
}

/* 고객사 검색 콤보 (input + 드롭다운 목록) */
.combo { position: relative; }
.combo-input { width: 100%; }

.combo-list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 50;
    max-height: 280px;
    overflow-y: auto;
    padding: 4px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    display: block;
}
/* JS가 element.hidden = true/false 로 여닫는다 */
.combo-list[hidden] { display: none; }

.combo-item {
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 13.5px;
    color: var(--text-body);
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.combo-item:hover,
.combo-item.is-active {
    background: var(--primary-soft);
    color: var(--primary);
}

.combo-create {
    margin-top: 4px;
    padding: 8px 10px;
    border-top: 1px solid var(--border);
    border-radius: 0 0 6px 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
}
.combo-create:hover { background: var(--primary-soft); }

/* 링크 반복행 (종류 select + url input + 라벨 input + 삭제버튼) */
.link-rows { display: flex; flex-direction: column; gap: 8px; }
.link-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.link-row > select { flex: 0 0 130px; min-width: 120px; }
.link-row > input { flex: 1 1 160px; min-width: 140px; }
.link-row > .btn { flex-shrink: 0; }
/* 입력 줄과 붙어 보이지 않게 간격 확보 */
.link-row-add { align-self: flex-start; margin-top: 10px; }

/* 타겟 키워드 배지 묶음 (프로젝트 상세) */
.kw-badges { display: flex; flex-wrap: wrap; gap: 6px; }

/* 상태 빠른 변경 (프로젝트 상세 카드 헤더) */
.status-quick { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.status-quick .form-control { width: auto; padding: 6px 10px; font-size: 13px; }
.status-quick select.form-control { min-width: 90px; }
.status-quick .sq-prog { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--text-muted); }
.status-quick .sq-prog input { width: 62px; text-align: right; }

/* 자산 종류 다중 선택 칩 (도메인 + 호스팅 등) */
.type-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.type-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 13px;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-body);
    font-size: 13px;
    cursor: pointer;
    user-select: none;
    transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}
.type-chip:hover { background: var(--hover-row); }
.type-chip input { width: 14px; height: 14px; accent-color: var(--primary); cursor: pointer; }
/* 체크된 항목은 브랜드색으로 (JS 없이 CSS 만으로) */
.type-chip:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 600;
}

/* 목록의 종류 배지 묶음 (한 줄에 도메인+호스팅) */
.type-badges { display: inline-flex; flex-wrap: wrap; gap: 4px; }

/* 종류별 업체 입력 (도메인=가비아 / 호스팅=위드컴)
   grid 로 라벨/입력을 2열로 묶는다. 첫 열은 max-content 라
   "지금 보이는 라벨 중 가장 긴 것"에 딱 맞게 잡히므로
   짧은 이름일 때 생기던 빈 공간이 사라지고, 여러 줄의 입력 시작점은 서로 정확히 맞는다. */
.prov-rows {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 6px 10px;
    align-items: center;
}
/* 행 자체는 자리를 차지하지 않고 자식(라벨·입력)이 grid 칸에 들어가게 한다 */
.prov-rows > .prov-row { display: contents; }
.prov-rows.is-empty::before {
    content: "위에서 종류를 먼저 골라 주세요.";
    font-size: 12px;
    color: var(--text-faint);
}
.prov-row { display: flex; align-items: center; gap: 8px; }
.prov-row[hidden] { display: none; }
/* 종류 이름은 왼쪽 정렬 — 위의 「업체 (공통)」 제목과 글자 시작점을 맞춘다.
   (오른쪽 정렬이면 짧은 이름일 때 왼쪽에 빈 자리가 생겨 들쭉날쭉해 보인다)
   min-width 로 입력칸 시작점을 서로 맞추되, 긴 이름은 잘리지 않고 늘어난다. */
/* 종류 이름: 왼쪽 정렬로 위의 항목 제목과 글자 시작점을 맞춘다.
   폭은 grid(max-content)가 잡아 주므로 따로 지정하지 않는다. */
.prov-label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-muted);
    text-align: left;
    white-space: nowrap;
}
.prov-row .form-control { flex: 1 1 auto; min-width: 0; }

/* 3단 폼 행 (업체 · 계정 ID · 연간 비용 처럼 종류별 입력 셋을 나란히)
   좁은 화면에서는 .form-row 기본값(1단 → 640px에서 2단)을 그대로 따른다. */
@media (min-width: 1100px) {
    .form-row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* 다른 입력칸과 높이를 맞춰야 하는 체크박스 (2단 배치에서 짝이 맞도록) */
.form-check-boxed {
    min-height: 38px;
    padding: 0 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--field-bg);
}

/* 목록의 업체 칸 (종류가 여럿이면 종류명을 앞에 붙여 구분) */
.prov-list { display: flex; flex-direction: column; gap: 2px; }
.prov-item { font-size: 13px; white-space: nowrap; }
.prov-type {
    display: inline-block;
    min-width: 46px;
    margin-right: 5px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-faint);
}

/* 자산 일괄 처리 바 (고객사 상세 - 목록 하단) */
.asset-bulkbar {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: var(--field-bg);
}
.asset-bulkbar-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.asset-bulkbar .form-control { width: auto; }
.asset-bulkbar select.form-control { min-width: 168px; }
.bulk-count {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    margin-right: 2px;
}
.bulk-count strong { color: var(--primary); font-size: 14px; }
.asset-bulkbar .form-hint { margin-top: 0; }

/* 선택 체크박스 열 */
.table th.pick-col, .table td.pick-cell { width: 38px; padding-right: 0; text-align: center; }
.table td.pick-cell input, .table th.pick-col input { width: 15px; height: 15px; cursor: pointer; accent-color: var(--primary); }

/* 목록에서 바로 고치는 날짜 칸 */
.date-cell { width: 148px; min-width: 140px; }
.date-cell.is-changed {
    border-color: var(--warning);
    background: var(--warning-soft);
    font-weight: 600;
}
/* 즉시 저장 상태 표시 (저장 중 → 저장됨 → 잠시 후 원래대로) */
.date-cell.is-saving { border-color: var(--info); background: var(--info-soft); opacity: 0.75; }
.date-cell.is-saved {
    border-color: var(--success);
    background: var(--success-soft);
    font-weight: 600;
    transition: background 0.4s ease, border-color 0.4s ease;
}
.date-cell.is-failed { border-color: var(--danger); background: var(--danger-soft); font-weight: 600; }

/* 등록 방식 탭 (한 건씩 / 여러 건) */
.asset-tabs { margin-bottom: 14px; }
.asset-tabs .seg-tab { cursor: pointer; font-size: 13.5px; padding: 8px 16px; }

/* 자산 등록/수정 접이식 폼 (고객사 상세 - 목록 바로 아래) */
.asset-add { border-top: 1px solid var(--border); }
.asset-add-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 13px 16px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
    list-style: none;
    user-select: none;
    transition: background 0.14s ease;
}
.asset-add-toggle::-webkit-details-marker { display: none; }
.asset-add-toggle:hover { background: var(--hover-row); }
.asset-add-toggle::after {
    content: "▾";
    margin-left: auto;
    font-size: 11px;
    color: var(--text-faint);
    transition: transform 0.18s ease;
}
.asset-add[open] > .asset-add-toggle {
    background: var(--primary-soft);
    border-bottom: 1px solid var(--border);
}
.asset-add[open] > .asset-add-toggle::after { transform: rotate(180deg); }
.asset-add-body { padding: 16px; }

/* 발행 실적 인라인 추가 (프로젝트 상세) */
.deliv-add { padding: 14px 16px; }
.deliv-add-sep { border-top: 1px solid var(--border); }
.deliv-add-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
@media (min-width: 640px) {
    .deliv-add-grid { grid-template-columns: 150px minmax(0, 1fr) minmax(0, 1.3fr) auto; }
}

/* 좁은 화면: 카드 헤더의 인라인 컨트롤(상태 빠른 변경 등)은 제목 아래로 내린다 */
@media (max-width: 639.98px) {
    .card-head { flex-wrap: wrap; }
    .status-quick { width: 100%; }
}

/* 전화 링크 (재계약 콜리스트) */
.call-link { color: var(--primary); font-weight: 600; white-space: nowrap; }
.call-link:hover { color: var(--primary-hover); }

/* =====================================================================
   드래그 정렬 (관리자 상품/코드/메뉴 표 - assets/js/sortable.js)
   ===================================================================== */
.table th.drag-col, .table td.drag-cell { width: 40px; padding-left: 10px; padding-right: 0; }

/* 화면에는 안 보이고 스크린리더만 읽는 텍스트 */
.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.drag-handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--text-faint);
    cursor: grab;
    touch-action: none;           /* 터치에서 스크롤 대신 드래그로 인식 */
    transition: background 0.14s ease, color 0.14s ease;
}
.drag-handle:hover { background: var(--primary-soft); color: var(--primary); }
.drag-handle:active { cursor: grabbing; }
.drag-handle:focus-visible { outline: none; box-shadow: var(--ring); color: var(--primary); }

/* 끌고 있는 행 */
.table tbody tr.is-dragging {
    background: var(--primary-soft);
    box-shadow: var(--shadow-md);
    position: relative;
    z-index: 2;
}
.table tbody tr.is-dragging td { border-bottom-color: transparent; }

/* 드래그 중 페이지 전체: 글자 선택 방지 */
body.is-sorting { user-select: none; -webkit-user-select: none; cursor: grabbing; }

/* 순서 변경 후 저장 유도 */
.sort-note {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--warning);
}
.btn.is-dirty {
    box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.25);
    animation: dirty-pulse 1.6s ease-in-out infinite;
}
@keyframes dirty-pulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.25); }
    50%      { box-shadow: 0 0 0 6px rgba(217, 119, 6, 0.10); }
}
@media (prefers-reduced-motion: reduce) {
    .btn.is-dirty { animation: none; }
}

/* =====================================================================
   19. 다크 테마 (html[data-theme="dark"]) - 저위험 오버라이드
   - 표면/텍스트/보더 토큰만 어둡게 재정의. 브랜드/상태색(--primary 등)은 유지.
   - 라이트에 하드코딩된 밝은 배경(#f8fafc 등)이 다크에서 흰 얼룩이 되지 않도록
     해당 선택자만 어두운 값으로 덮는다. (라이트 결과는 그대로)
   ===================================================================== */
:root[data-theme="dark"] {
    /* 표면 */
    --bg:             #0e1420;
    --bg-grad:        linear-gradient(180deg, #0b101c 0%, #0e1420 360px);
    --surface:        #171d2b;
    --border:         #262d3d;
    --border-strong:  #38415a;
    --field-bg:       #121a2a;
    --hover-row:      #1c2331;
    --login-grad:     radial-gradient(1100px 560px at 50% -120px, #1a2140 0%, #0e1420 60%);

    /* 텍스트 */
    --text:           #f1f3f7;
    --text-body:      #c8cfda;
    --text-muted:     #8b95a6;
    --text-faint:     #6a7486;

    /* 상태 배경(soft): 밝은 파스텔 대신 반투명 틴트로 (흰 얼룩 방지) */
    --primary-soft:   rgba(99, 102, 241, 0.18);
    --success-soft:   rgba(34, 197, 94, 0.16);
    --danger-soft:    rgba(239, 68, 68, 0.16);
    --warning-soft:   rgba(245, 158, 11, 0.16);
    --info-soft:      rgba(56, 189, 248, 0.16);

    /* 그림자: 어두운 배경에서는 더 진하게 */
    --shadow:         0 1px 2px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.5);
    --shadow-lg:      0 12px 32px rgba(0, 0, 0, 0.55);
}

/* 반투명 soft 위에 얹히는 브랜드/상태 텍스트는 어두운 배경에서 더 밝게 */
:root[data-theme="dark"] .badge-indigo,
:root[data-theme="dark"] .stat-icon.indigo,
:root[data-theme="dark"] .user-avatar,
:root[data-theme="dark"] .admin-card-icon,
:root[data-theme="dark"] .cal-ev,
:root[data-theme="dark"] .combo-item:hover,
:root[data-theme="dark"] .combo-item.is-active,
:root[data-theme="dark"] .progress-pct { color: #a5b4fc; }
:root[data-theme="dark"] .badge-green, :root[data-theme="dark"] .stat-icon.green, :root[data-theme="dark"] .text-success { color: #4ade80; }
:root[data-theme="dark"] .badge-red,   :root[data-theme="dark"] .text-danger      { color: #f87171; }
:root[data-theme="dark"] .badge-amber, :root[data-theme="dark"] .stat-icon.amber  { color: #fbbf24; }
:root[data-theme="dark"] .badge-sky,   :root[data-theme="dark"] .stat-icon.sky    { color: #56c5f5; }
:root[data-theme="dark"] .badge-gray { background: var(--bg); color: var(--text-muted); }

/* 상단바: 라이트의 흰 반투명 → 다크 반투명 */
:root[data-theme="dark"] .topbar { background: rgba(23, 29, 43, 0.86); }

/* 테이블/정의표/캘린더 헤더의 하드코딩 밝은 배경 */
:root[data-theme="dark"] .table th,
:root[data-theme="dark"] .def-table th,
:root[data-theme="dark"] .calendar th { background: #1c2331; color: var(--text-faint); }
:root[data-theme="dark"] .table tbody tr:hover { background: #1c2331; }

/* 캘린더 셀 */
:root[data-theme="dark"] .cal-cell.out { background: #131a26; }
:root[data-theme="dark"] .cal-cell.today { background: rgba(245, 158, 11, 0.12); }
:root[data-theme="dark"] .cal-cell.cal-clickable:hover { background: var(--primary-soft); }

/* 막대 차트 */
:root[data-theme="dark"] .bar-slot { background: #1c2331; }
:root[data-theme="dark"] .bar-fill { background: #3730a3; }
:root[data-theme="dark"] .bar-fill.current { background: var(--primary); }

/* 진행률 트랙 */
:root[data-theme="dark"] .progress-track,
:root[data-theme="dark"] .progress-mini-track { background: #232a3a; }

/* 공지/예산/연락처의 밝은 배경 블록 */
:root[data-theme="dark"] .notice-detail-header,
:root[data-theme="dark"] .notice-detail-actions,
:root[data-theme="dark"] .budget-sum-item,
:root[data-theme="dark"] .contact-grid { background: #1c2331; }
:root[data-theme="dark"] .notice-table tr.notice-pinned { background: rgba(245, 158, 11, 0.08); }

/* 알림(alert): soft 배경 위 진한 텍스트를 밝게, 테두리도 톤 다운 */
:root[data-theme="dark"] .alert-success { color: #86efac; border-color: rgba(34, 197, 94, 0.4); }
:root[data-theme="dark"] .alert-error   { color: #fca5a5; border-color: rgba(239, 68, 68, 0.4); }
:root[data-theme="dark"] .alert-info    { color: #7dd3fc; border-color: rgba(56, 189, 248, 0.4); }
:root[data-theme="dark"] .alert-warning { color: #fcd34d; border-color: rgba(245, 158, 11, 0.4); }

/* 매출/지출 토글 선택 상태 텍스트 가독 */
:root[data-theme="dark"] .type-opt:has(input:checked) { color: #a5b4fc; }

/* 스크롤바(테이블/캘린더) 썸을 어둡게 */
:root[data-theme="dark"] .table-wrap::-webkit-scrollbar-thumb,
:root[data-theme="dark"] .cal-wrap::-webkit-scrollbar-thumb { background: var(--border-strong); }

/* v2 스킨 다크 보정: 라이트 하드코딩 값의 다크 대응 */
:root[data-theme="dark"] .topbar { border-bottom-color: rgba(255, 255, 255, 0.06); }
:root[data-theme="dark"] .login-box { border-color: rgba(255, 255, 255, 0.06); }
:root[data-theme="dark"] .empty-state .empty-icon {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, var(--bg) 100%);
}

/* =====================================================================
   22. 폼 안 접기 (프로젝트 폼 — 자주 안 쓰는 항목을 접어 길이를 줄인다)
   - 값이 이미 있거나 입력 오류가 난 항목은 서버에서 open 을 붙여 펼친 채로 렌더한다.
     안 그러면 접힌 칸 안에 오류가 숨어 저장만 계속 실패한다.
   ===================================================================== */

.form-fold {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--field-bg);
}
.form-fold + .form-fold { margin-top: 10px; }

.form-fold-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 14px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-body);
    cursor: pointer;
    list-style: none;
    user-select: none;
    border-radius: var(--radius-sm);
    transition: background 0.14s ease;
}
.form-fold-toggle::-webkit-details-marker { display: none; }
.form-fold-toggle:hover { background: var(--hover-row); }
.form-fold-toggle::after {
    content: "▾";
    margin-left: auto;
    font-size: 11px;
    color: var(--text-faint);
    transition: transform 0.18s ease;
}
.form-fold[open] > .form-fold-toggle {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.form-fold[open] > .form-fold-toggle::after { transform: rotate(180deg); }

/* 접힌 상태에서도 안에 뭐가 들어있는지 알려 주는 꼬리표 */
.form-fold-count {
    font-weight: 500;
    font-size: 12.5px;
    color: var(--text-muted);
}
.form-fold-body {
    padding: 14px;
    background: var(--surface);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}
.form-fold-body > .form-group:last-child { margin-bottom: 0; }

/* 금액이 아직 0 이면 요약 4칸이 "0원 0원 0원 발행 안 함" 으로만 보여 허전하다 → 숨긴다 */
.settle-sum.is-idle { display: none; }

/* =====================================================================
   21. 금액 · 정산 (프로젝트 등록/수정 폼 · 프로젝트 상세)
   - 받는 돈(공급가+부가세)과 나가는 돈(외주비·도메인비)을 시각적으로 갈라 놓는다.
   ===================================================================== */

/* ---------- 입력 폼 ---------- */

.settle-block {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px 4px;
    margin-bottom: 14px;
    background: var(--field-bg);
}
.settle-block-head {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    margin-bottom: 10px;
}
.settle-in       { border-left: 3px solid var(--primary); }
.settle-in .settle-block-head  { color: var(--primary); }
.settle-out      { border-left: 3px solid var(--danger); }
.settle-out .settle-block-head { color: var(--danger); }

/* 부가세 보조 버튼 줄 */
.settle-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

/* 폼 하단 실시간 요약 */
.settle-sum {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    background: var(--primary-soft);
    border: 1px solid var(--border);
}
.settle-sum-item  { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.settle-sum-label { font-size: 12px; color: var(--text-muted); }
.settle-sum-val   { font-size: 16px; font-weight: 700; color: var(--text); white-space: nowrap; }
.settle-sum-sub   { font-size: 11px; color: var(--text-muted); }
.settle-sum-item .badge { align-self: flex-start; }

/* ---------- 상세 화면 ---------- */

.settle-view {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}
.settle-figure {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--field-bg);
    min-width: 0;
}
.settle-figure-key {
    background: var(--primary-soft);
    border-color: var(--border-strong);
}
.settle-figure-label { font-size: 12px; color: var(--text-muted); }
.settle-figure-val   { font-size: 17px; font-weight: 700; color: var(--text); white-space: nowrap; }

/* 수납 현황 */
.settle-pay {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: center;
    gap: 6px 18px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.settle-pay-row   { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.settle-pay-label { font-size: 13px; color: var(--text-muted); }
.settle-pay-bar   { grid-column: 1 / -1; margin-top: 4px; }
.settle-pay-pct   { grid-column: 1 / -1; font-size: 12px; color: var(--text-muted); }

/* 재무에 반영된 내역 */
.settle-link            { margin-top: 16px; }
.settle-link-list       { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.settle-link-title      { font-size: 12px; color: var(--text-muted); margin-right: 2px; }
.settle-link-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 13px;
    color: var(--text-body);
    text-decoration: none;
    background: var(--surface);
}
.settle-link-item:hover { border-color: var(--border-strong); background: var(--hover-row); }

/* ---------- 좁은 화면 ---------- */

@media (max-width: 900px) {
    .settle-sum  { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .settle-view { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
    .settle-sum   { grid-template-columns: minmax(0, 1fr); }
    .settle-view  { grid-template-columns: minmax(0, 1fr); }
    .settle-pay   { grid-template-columns: minmax(0, 1fr); }
    .settle-btns .btn { flex: 1 1 auto; }
}

/* =====================================================================
   20. 인쇄 (프로젝트 상세 등 - [data-print] 버튼 / Ctrl+P 공통)
   - 화면 전용 요소(사이드바·상단바·입력폼·버튼)는 빼고 내용만 남긴다.
   - 배지는 배경색 대신 테두리로 그려 흑백 인쇄에서도 읽힌다.
   ===================================================================== */
.print-only { display: none; }

@media print {
    @page { margin: 12mm 10mm; }

    /* 종이에서는 배경·그림자 제거 */
    html, body {
        background: #fff !important;
        background-image: none !important;
        color: #000;
        font-size: 10.5pt;
    }

    /* 화면 전용 요소 감추기 */
    .sidebar,
    .sidebar-backdrop,
    .topbar,
    .app-footer,
    .head-actions,
    .toast,
    .no-print,
    .status-quick,
    .deliv-add,
    .asset-add,
    .asset-bulkbar,
    .log-form,
    .budget-form,
    .memo-form,
    .rte-toolbar,
    .filter-bar,
    .pagination,
    .card-foot,
    .memo-x,
    .log-del,
    .cell-actions,
    .table th.pick-col,
    .table td.pick-cell,
    .table th:last-child.text-right,
    .table td:last-child.text-right { display: none !important; }

    .print-only { display: block; }

    /* 레이아웃: 사이드바 여백 제거하고 한 단으로 펼친다 */
    .main { padding-left: 0 !important; }
    .content {
        padding: 0 !important;
        max-width: none !important;
        animation: none !important;
    }
    .detail-cols,
    .dash-cols,
    .dash-grid { display: block !important; }
    .detail-main, .detail-side { display: block !important; }

    /* 인쇄용 머리글 */
    .print-head {
        margin-bottom: 10px;
        padding-bottom: 8px;
        border-bottom: 2px solid #000;
    }
    .print-head-title { font-size: 16pt; font-weight: 700; color: #000; }
    .print-head-meta { margin-top: 3px; font-size: 9pt; color: #444; }

    /* 화면용 제목은 인쇄 머리글과 겹치므로 숨긴다 */
    .page-head { display: none !important; }

    /* 카드: 테두리만.
       ⚠ break-inside: avoid 를 카드에 걸면 안 된다.
       실무 가이드라인처럼 한 쪽보다 긴 카드가 통째로 다음 장으로 밀리면서
       앞장이 텅 비고 넘치는 내용이 잘려 나간다(= 인쇄 시 내용 누락).
       카드는 자유롭게 쪼개지게 두고, 잘리면 곤란한 작은 단위(표의 행 등)만 묶는다. */
    .card {
        break-inside: auto;
        page-break-inside: auto;
        box-shadow: none !important;
        border: 1px solid #999 !important;
        border-radius: 0 !important;
        margin-bottom: 8px !important;
        background: #fff !important;
    }
    /* 제목만 페이지 끝에 홀로 남지 않게 */
    .card-head {
        padding: 6px 10px !important;
        background: #f2f2f2 !important;
        border-bottom: 1px solid #999 !important;
        break-after: avoid;
        page-break-after: avoid;
        break-inside: avoid;
    }
    .card-head h2 { font-size: 11pt; }
    .card-body { padding: 8px 10px !important; }

    /* 표 */
    .table-wrap { overflow: visible !important; }
    .table { min-width: 0 !important; font-size: 9.5pt; }
    .table th {
        background: #f2f2f2 !important;
        color: #000 !important;
        padding: 5px 8px !important;
        border-bottom: 1px solid #999 !important;
    }
    .table td {
        padding: 5px 8px !important;
        border-bottom: 1px solid #ddd !important;
        color: #000 !important;
    }
    .table tbody tr { break-inside: avoid; page-break-inside: avoid; }
    .def-table th { border-right: 1px solid #ddd !important; width: 96px !important; }

    /* 배지·상태칩: 흑백에서도 읽히게 테두리로 */
    .badge, .status-pill {
        background: transparent !important;
        color: #000 !important;
        border: 1px solid #666 !important;
        border-radius: 3px !important;
        padding: 1px 5px !important;
        font-weight: 600;
    }

    /* 입력칸은 값만 보이도록 납작하게 (목록의 날짜칸 등) */
    .form-control, .date-cell {
        border: 0 !important;
        background: transparent !important;
        padding: 0 !important;
        box-shadow: none !important;
        color: #000 !important;
        font-size: 9.5pt !important;
        width: auto !important;
        -webkit-appearance: none;
        appearance: none;
    }
    input[type="date"]::-webkit-calendar-picker-indicator { display: none; }

    /* 진행률 바 */
    .progress-track, .progress-mini-track {
        border: 1px solid #999 !important;
        background: #fff !important;
    }
    .progress-fill { background: #666 !important; }

    /* 링크는 검게, 밑줄 유지 */
    a { color: #000 !important; text-decoration: underline; }

    /* 알림 박스는 테두리만 */
    .alert {
        border: 1px solid #999 !important;
        background: #fff !important;
        color: #000 !important;
        animation: none !important;
    }

    /* 가이드라인 본문: 길어도 여러 장에 걸쳐 자연스럽게 이어지게.
       .rte-body(편집 화면 에디터)도 같이 풀어야 폼을 인쇄할 때 잘리지 않는다. */
    .card-body,
    .rte-body,
    .guideline-body {
        break-inside: auto;
        page-break-inside: auto;
        overflow: visible !important;
        max-height: none !important;
    }
    /* 문단이 한 줄만 남고 넘어가지 않도록 */
    .guideline-body p,
    .guideline-body li { orphans: 2; widows: 2; }
    /* 목록 항목 하나는 쪼개지지 않게 */
    .guideline-body li,
    .simple-list li,
    .log-item { break-inside: avoid; page-break-inside: avoid; }

    /* 빈 상태 안내는 인쇄에 불필요 */
    .empty-state { padding: 10px !important; }

    /* 정산 박스: 배경이 빠지므로 테두리로 칸을 구분한다 */
    .settle-figure,
    .settle-pay,
    .settle-link-item {
        background: none !important;
        border: 1px solid #999 !important;
    }
    .settle-figure { padding: 6px 8px !important; }
    .settle-figure-val { font-size: 11pt; }
    .settle-pay-bar { display: none !important; }   /* 막대는 흑백에서 의미가 없다 */
    .empty-state .empty-icon { display: none !important; }
}

/* 유지보수 작업 링크 목록 */
.work-links { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.work-links li { font-size: 13.5px; word-break: break-all; }

/* 고객사 상세 → 전체 자산 화면 안내 링크 */
.asset-hub-link {
    padding: 0 16px 12px;
    font-size: 13px;
}
.asset-hub-link a { color: var(--primary); text-decoration: none; font-weight: 600; }
.asset-hub-link a:hover { text-decoration: underline; }

/* 도메인·호스팅 목록: 업체·계정 칸이 길어져도 표가 밀리지 않게 */
.acct-cell { display: block; font-size: 12.5px; margin-top: 2px; }

/* =====================================================================
   23. 프로젝트 폼 전용 정리 (.form-lg)
   - 이 클래스가 붙은 폼에만 적용된다. 다른 화면은 그대로 둔다.
     (.form-narrow 로 범위를 잡으면 공지 읽기 화면까지 같이 바뀐다 — 8개 파일이 공유)
   - 글자를 세 단으로만 쓴다: 값 17px / 이름 15.5px / 부연 14.5px
     이전엔 한 화면에 10종(11.5~16px)이 섞여 있어 눈이 어디를 봐야 할지 몰랐다.
   ===================================================================== */

/* ---------- 글자 ---------- */
.form-lg .form-label            { font-size: 15.5px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.form-lg .form-control          { font-size: 17px; padding: 10px 13px; }
.form-lg .form-hint,
.form-lg .form-error            { font-size: 14.5px; margin-top: 6px; }
.form-lg .form-hint-inline      { font-size: 14.5px; }
.form-lg .form-check            { font-size: 15.5px; }
.form-lg .form-fold-toggle      { font-size: 15.5px; }
.form-lg .form-fold-count       { font-size: 14.5px; }
.form-lg .chip                  { font-size: 14.5px; }
.form-lg .btn                   { font-size: 15.5px; }
.form-lg .btn-sm                { font-size: 14.5px; }
.form-lg .card-head h2          { font-size: 19px; }
.form-lg .card-head .text-muted { font-size: 14.5px; }
.form-lg .rte-body              { font-size: 17px; line-height: 1.75; }
.form-lg .member-check-name     { font-size: 15.5px; }
.form-lg .member-check-meta     { font-size: 14.5px; }

/* 한글이 어절 가운데서 잘리지 않게 — 이 폼 안에서만 */
.form-lg .form-label,
.form-lg .form-hint,
.form-lg .card-head { word-break: keep-all; }

/* ---------- 여백 리듬 ----------
   이전: 라벨→칸 6 / 칸→안내 5 / 항목↔항목 16 / 카드↔카드 16
   → '한 덩어리'와 '다음 덩어리'의 거리가 같아 섹션 경계가 안 보였다.
   이제: 8 / 6 / 22 / 24 로 덩어리 안은 붙이고 사이는 벌린다. */
.form-lg .form-group            { margin-bottom: 22px; }
.form-lg .form-group.mb-0       { margin-bottom: 0; }
.form-lg .card                  { margin-bottom: 24px; }

/* ---------- 금액 · 정산 ----------
   색깔 띠(좌측 3px 인디고/빨강)를 뺀다. 값이 아니라 상자를 강조하고 있었다.
   대신 '총 청구액' 숫자 자체를 키워서 눈이 그리로 가게 한다. */
/* 상자를 아예 없앤다. 카드가 이미 테두리 역할을 하므로 그 안에 또 상자를 두면
   테두리가 겹쳐 보이고, 여백을 줄이면 글자가 테두리에 달라붙는다. */
.form-lg .settle-block {
    border: 0;
    border-radius: 0;
    background: transparent;
    padding: 0;
    margin-bottom: 20px;
}
/* '받는 돈' 은 상자 제목이 아니라 그냥 소제목으로 둔다 */
.form-lg .settle-block-head {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0;
    padding: 0 0 8px;
    margin: 0 0 16px;
    border-bottom: 1px solid var(--border);
}
.form-lg .settle-in .settle-block-head,
.form-lg .settle-out .settle-block-head { color: var(--text-muted); }

/* 접기 줄도 카드 안에서 튀지 않게 */
.form-lg .settle-block ~ .form-fold,
.form-lg .card-body > .form-fold { background: transparent; }

/* 요약: 연보라 상자 대신 위쪽 실선 하나로 구분하고 총 청구액만 키운다 */
.form-lg .settle-sum {
    background: transparent;
    border: 0;
    border-top: 2px solid var(--border-strong);
    border-radius: 0;
    padding: 16px 2px 0;
    gap: 16px;
}
.form-lg .settle-sum-label      { font-size: 14.5px; }
.form-lg .settle-sum-val        { font-size: 18px; }
.form-lg .settle-sum-item:first-child .settle-sum-val { font-size: 24px; letter-spacing: -0.01em; }
.form-lg .settle-sum-sub        { font-size: 13.5px; }

/* ---------- 그라데이션 제거 ----------
   폼 안에서는 배경 그라데이션을 쓰지 않는다. 입력 화면은 조용해야 한다. */
.form-lg .card                  { background-image: none; }

/* 남은 잔글씨 두 곳 — 세금계산서 배지와 서식 버튼 */
.form-lg .badge   { font-size: 14px; }
.form-lg .rte-btn { font-size: 15.5px; }

/* ---------------------------------------------------------------
   .form-lg 2단 — 넓은 화면에서 좌우로 편다
   기준 1200px: 사무실 모니터와 노트북(1366) 양쪽에서 켜지도록.
   .detail-cols 를 쓰지 않는 이유: 그건 우측이 340~400px 고정인 '본문+위젯 레일'용이라
   입력 폼에 씌우면 오른쪽 칸이 반토막 나 날짜칸과 안내문이 잘린다.
   --------------------------------------------------------------- */
.form-cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
.form-col  { min-width: 0; }

@media (min-width: 1200px) {
    /* 폼 래퍼 폭을 넓힌다. .form-narrow(760px)는 8개 화면이 공유하므로
       .form-lg 가 붙은 이 폼에서만 덮어쓴다. */
    .form-lg.form-narrow { max-width: 1360px; }

    .form-cols {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 0 24px;
        align-items: stretch;          /* 칸들의 아래끝을 맞추기 위해 */
    }

    /* 각 칸의 마지막 카드가 남는 높이를 흡수해 아래끝이 나란해진다.
       칸 사이 내용 차이가 30px 안쪽이라 흡수해도 카드가 비어 보이지 않는다. */
    .form-col { display: flex; flex-direction: column; }
    .form-col > .card:last-child { flex: 1 1 auto; }

    /* 2단일 때 셋째 칸(발행 실적·가이드라인)은 아래 전체폭으로 눕힌다.
       안 그러면 반쪽짜리 줄이 하나 더 생겨 오른쪽이 뻥 빈다. */
    .form-col-c { grid-column: 1 / -1; }

    /* 2단 안에서는 요약 4칸이 한 줄에 안 들어간다.
       화면폭 기준 미디어쿼리(max-width:900px)는 여기서 안 먹으므로 직접 내린다. */
    .form-lg .form-cols .settle-sum { grid-template-columns: repeat(2, minmax(0, 1fr)); }

    /* 칸이 좁아지면 사이트 링크·발행 실적 행의 삭제(×) 버튼만 아래로 떨어져
       한 줄을 통째로 차지했다. 좌우를 꽉 채우는 격자로 바꿔 두 줄에 나눠 담는다.

         [작업 사이트][https://    ][×]
         [설명(선택)                  ]

       키워드 행은 칸이 둘뿐이라 그대로 둔다. */
    .form-lg .form-cols [data-link-row],
    .form-lg .form-cols [data-deliv-row] {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
        grid-template-areas:
            "one two del"
            "wide wide wide";
        gap: 8px;
        align-items: center;
    }
    .form-lg .form-cols [data-link-row]  > *:nth-child(1),
    .form-lg .form-cols [data-deliv-row] > *:nth-child(1) { grid-area: one; }
    .form-lg .form-cols [data-link-row]  > *:nth-child(2),
    .form-lg .form-cols [data-deliv-row] > *:nth-child(2) { grid-area: two; }
    .form-lg .form-cols [data-link-row]  > *:nth-child(3),
    .form-lg .form-cols [data-deliv-row] > *:nth-child(3) { grid-area: wide; }
    .form-lg .form-cols [data-link-row]  > *:nth-child(4),
    .form-lg .form-cols [data-deliv-row] > *:nth-child(4) { grid-area: del; }
}

/* ---------------------------------------------------------------
   폰(≤639.98px) — 밖에서 접수할 때 필요한 것만 먼저 보이게 한다
   글자를 키운 만큼 세로가 길어지므로, 자주 안 쓰는 카드는 접어 둔다.
   --------------------------------------------------------------- */
@media (max-width: 639.98px) {
    .form-lg .card { margin-bottom: 16px; }
    .form-lg .form-group { margin-bottom: 18px; }
    /* 폰에서는 카드 제목을 조금 줄여 한 줄에 들어가게 */
    .form-lg .card-head h2 { font-size: 17.5px; }
}

/* 인쇄에서는 2단을 풀어 한 줄로 */
@media print {
    .form-cols { display: block !important; }
    .form-col  { display: block !important; }
}

/* ---------------------------------------------------------------
   3단 — 1600px 이상에서만
   1366 노트북에서 3단을 켜면 칸 하나가 약 350px 로 내려앉아
   날짜 입력칸과 '광고에 들어갈 주소' 같은 긴 칸이 눌린다.
   그래서 큰 모니터에서만 세 줄로 편다.
   --------------------------------------------------------------- */
@media (min-width: 1600px) {
    .form-lg.form-narrow { max-width: 1680px; }

    .form-cols {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        align-items: stretch;          /* 세 칸의 아래끝을 맞추기 위해 */
    }

    /* 3단에서는 셋째 칸이 제자리(오른쪽)에 선다 */
    .form-col-c { grid-column: auto; }

    /* 오른쪽 칸은 가이드라인 에디터가 남는 높이를 먹는다.
       빈 공간을 두느니 글 쓰는 칸을 넓히는 쪽이 낫다. */
    .form-col-c > .card:last-child,
    .form-col-c > .card:last-child > .card-body,
    .form-col-c > .card:last-child .form-group,
    .form-col-c > .card:last-child .rte {
        flex: 1 1 auto;
        display: flex;
        flex-direction: column;
        min-height: 0;
    }
    /* max-height 를 풀어 줘야 flex 가 실제로 늘어난다.
       안 풀면 상한에서 얼어붙어 카드만 길어지고 글 쓰는 칸 아래로 빈 여백이 남는다. */
    .form-col-c > .card:last-child .rte-body { flex: 1 1 auto; min-height: 260px; max-height: none; }

    /* 칸이 좁아졌으므로 요약은 2열 유지 */
    .form-lg .form-cols .settle-sum { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* 좁아진 칸에서는 카드 제목 옆 회색 설명이 반대쪽 끝으로 밀려 따로 떠 보인다.
   제목 아래 줄로 내려 부제처럼 읽히게 한다. */
.form-lg .form-cols .card-head {
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: baseline;
    gap: 3px 8px;
}
.form-lg .form-cols .card-head > h2 { flex: 0 0 auto; }
.form-lg .form-cols .card-head > .text-muted {
    flex: 1 0 100%;
    line-height: 1.45;
}

/* 영업 담당: 직원 계정이 없는 사람(프리랜서·퇴사자)을 이름으로 지정하는 칸.
   위 select 에서 직원을 고르면 이 칸은 서버가 무시하므로 흐리게 보여 준다. */
.sales-name-input { margin-top: 8px; }
.sales-name-input[data-muted="1"] {
    background: var(--bg-subtle, #f6f7f9);
    color: var(--text-muted, #6b7280);
}

/* 목록 위에 뜨는 필터 안내 띠 (예: 고객사 한 곳만 보고 있을 때) */
.filter-note {
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    background: var(--bg-subtle, #f1f5f9);
    color: var(--text-muted, #475569);
    font-size: 14.5px;
}
.filter-note strong { color: var(--text, #0f172a); }
.filter-note a { margin-left: 6px; }

/* 고객사 콤보의 「상호 바꾸기」 항목.
   바로 아래 「새 고객사로 등록」과 결과가 전혀 다르므로 눈에 띄게 구분한다. */
.combo-item.combo-rename {
    border-left: 3px solid var(--primary, #4f46e5);
    background: var(--bg-subtle, #f8fafc);
    font-weight: 600;
}
.combo-item.combo-rename .combo-item-sub,
.combo-item.combo-create .combo-item-sub {
    display: block;
    margin-top: 2px;
    font-weight: 400;
}
