/*
 * Summary Pills
 * 화면 상단이나 섹션 시작 지점에서 핵심 수치를 짧게 요약하는 pill형 컴포넌트.
 * 예: 진행중인 사건 2건, 보완 요청 1건, 읽지 않은 알림 3건.
 */
.summary-pills {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: -8px 0 18px;
}

.summary-pills__item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 32px;
    padding: 7px 11px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--muted);
    font-size: var(--font-size-body-sm);
    font-weight: 700;
}

.summary-pills__item b {
    color: var(--ink);
    font-weight: 900;
}

/*
 * Page Head
 * 각 화면 상단에서 페이지 제목, 설명, 보조 액션을 표시하는 헤더 컴포넌트.
 */
.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 20px;
}

.eyebrow {
    margin: 0 0 6px;
    color: #7c8798;
    font-weight: 800;
    font-size: var(--font-size-meta);
    letter-spacing: .06em;
}

.page-head h2,
.detail-title h2 {
    margin: 0;
    font-size: var(--font-size-display);
}

.page-head p,
.detail-title p {
    margin: 8px 0 0;
    color: var(--muted);
    line-height: 1.55;
}

/*
 * Pills And Status Badges
 * 필터, 사건 유형, 서류/사건 상태처럼 짧은 상태값을 표시하는 pill형 컴포넌트.
 */
.pill,
.type-badge,
.status,
.small-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    font-weight: 800;
}

.pill {
    border: 1px solid transparent;
    background: #eef2f7;
    color: var(--muted);
    padding: 8px 12px;
    font-size: var(--font-size-body-sm);
}

.pill.active {
    background: #182230;
    border-color: #182230;
    color: #fff;
}

.type-badge {
    padding: 6px 10px;
    background: #edf2fb;
    color: #244f9e;
    font-size: var(--font-size-caption);
}

.status {
    padding: 6px 9px;
    font-size: var(--font-size-meta);
}

.status.progress {
    background: #ecfdf5;
    color: var(--mint);
}

.status.need {
    background: #fff7ed;
    color: var(--amber);
}

.status.done {
    background: #f5f3ff;
    color: var(--violet);
}

.status.waiting {
    background: #f1f5f9;
    color: #475569;
}

.status.reviewing {
    background: #eff6ff;
    color: var(--brand);
}

.status.reject {
    background: #fff1f2;
    color: var(--rose);
}

/*
 * Form Controls And Buttons
 * 로그인, 댓글, 파일 제출 등 의뢰인 화면 전반에서 쓰는 기본 입력/버튼 컴포넌트.
 */
.field {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
}

.field label {
    font-size: var(--font-size-body-sm);
    font-weight: 700;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    border: 1px solid #d8dee8;
    border-radius: 8px;
    background: #fbfcfe;
    padding: 14px;
    color: var(--ink);
    outline: none;
}

.field textarea {
    min-height: 138px;
    resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(29, 78, 216, .12);
}

.row-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin: 4px 0 20px;
    color: var(--muted);
    font-size: var(--font-size-body-sm);
}

.checkline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 8px;
    font-weight: 800;
    min-height: 42px;
    white-space: nowrap;
}

.primary-btn {
    width: 100%;
    border: 1px solid var(--brand);
    background: #182230;
    color: #fff;
    padding: 12px 16px;
}

.primary-btn.compact {
    width: auto;
}

.secondary-btn {
    border: 1px solid #d8dee8;
    background: #fff;
    color: var(--ink);
    padding: 10px 14px;
}

.ghost-btn {
    border: 1px solid transparent;
    background: transparent;
    color: var(--muted);
    padding: 10px 12px;
}

.link-btn {
    border: 0;
    background: transparent;
    color: var(--brand);
    font-weight: 900;
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/*
 * Content Grids
 * 카드 목록과 주요 콘텐츠 레이아웃에 쓰는 1열 grid 컴포넌트.
 */
.case-grid,
.dashboard-grid,
.document-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.case-grid {
    gap: 12px;
}

/*
 * Panels And Cards
 * 사건 카드, 빈 상태 패널, 서류 카드, 알림 카드의 공통 표면 스타일.
 */
.case-card,
.panel,
.document-card,
.alert-card {
    background: var(--panel);
    border: 1px solid rgba(231, 234, 240, .88);
    border-radius: 8px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, .035);
}

.case-card {
    display: grid;
    gap: 15px;
    padding: 18px;
    text-align: left;
    color: inherit;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}
/* 
.case-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    height: 4px;
    background: #244f9e;
} */

.case-card:hover {
    border-color: #cbd7ee;
    box-shadow: var(--shadow);
}

.case-card h3 {
    margin: 0 0 7px;
    font-size: var(--font-size-card-title-lg);
    line-height: 1.25;
}

.case-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

.case-subtitle {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: var(--font-size-body-sm);
    font-weight: 700;
    line-height: 1.45;
}

.card-top,
.panel-head,
.detail-toolbar,
.app-footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-top {
    align-items: flex-start;
}

.panel {
    padding: 18px;
}

.panel-head {
    margin-bottom: 16px;
}

.panel-head h3 {
    margin: 0;
    font-size: var(--font-size-section-title-sm);
}

.panel-desc {
    margin: -8px 0 14px;
    color: var(--muted);
    font-size: var(--font-size-body-sm);
    line-height: 1.5;
}

/*
 * Case Metrics
 * 사건 카드 내부의 요청/제출/보완 수치와 최근 진행사항을 표시한다.
 */
.collect-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border: 1px solid #edf0f5;
    border-radius: 8px;
    background: #fbfcfe;
    overflow: hidden;
    margin-bottom: 1rem;
}

.collect-item {
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.collect-item + .collect-item {
    border-left: 1px solid #edf0f5;
}

.collect-item span,
.latest-note span,
.stat span {
    display: block;
    color: var(--muted);
    font-size: var(--font-size-meta);
    font-weight: 800;
    margin-bottom: 5px;
}

.collect-item b {
    font-size: var(--font-size-section-title);
}

.latest-note {
    display: grid;
    gap: 5px;
    padding: 13px 14px;
    border-radius: 8px;
    background: #f6f8fb;
}

.latest-note b {
    font-size: var(--font-size-body-sm);
    line-height: 1.45;
}

.meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding-top: 4px;
}

.meta-item {
    padding: 11px 0 0;
    border-top: 1px solid #eef1f5;
}

.meta-item span {
    display: block;
    color: var(--muted);
    font-size: var(--font-size-meta);
    margin-bottom: 4px;
}

.meta-item b {
    font-size: var(--font-size-body-sm);
}

@media (max-width: 720px) {
    .page-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .page-head h2,
    .detail-title h2 {
        font-size: var(--font-size-title-lg);
    }
}

@media (max-width: 520px) {
    .page-head h2,
    .detail-title h2 {
        font-size: var(--font-size-page-title);
    }
}

/*
 * Remaining Shared Components
 * 사건 상세, 서류, 알림, 마이페이지에서 공통으로 쓰는 잔여 컴포넌트 스타일.
 */
.filter-row {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.document-panel,
.reply-field {
    margin-top: 16px;
}

.stat-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.stat {
    padding: 14px;
    border-radius: 8px;
    background: #fbfcfe;
    border: 1px solid #edf0f5;
}

.stat b {
    font-size: var(--font-size-title-lg);
}

.timeline {
    display: grid;
}

.step {
    position: relative;
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) auto;
    gap: 12px;
    padding: 0 0 18px;
}

.step:not(:last-child)::before {
    content: "";
    position: absolute;
    left: 13px;
    top: 28px;
    bottom: 0;
    width: 2px;
    background: #dbe3ef;
}

.dot {
    position: relative;
    z-index: 1;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #dbeafe;
    border: 6px solid #fff;
    box-shadow: 0 0 0 1px #bfdbfe;
}

.step.done .dot {
    background: var(--mint);
    box-shadow: 0 0 0 1px rgba(15, 118, 110, .3);
}

.step.current .dot {
    background: var(--brand);
    box-shadow: 0 0 0 4px rgba(29, 78, 216, .14);
}

.step h4 {
    margin: 2px 0 5px;
    font-size: var(--font-size-body);
}

.step p {
    margin: 0;
    color: var(--muted);
    font-size: var(--font-size-body-sm);
    line-height: 1.5;
}

.step-date {
    color: var(--muted);
    font-size: var(--font-size-caption);
    font-weight: 700;
    padding-top: 5px;
}

.alert-list,
.document-list,
.chat-thread {
    gap: 10px;
}

.document-list {
    gap: 8px;
}

.alert-card {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 10px;
    padding: 13px;
    color: inherit;
    text-align: left;
    box-shadow: none;
}

.alert-icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: #fff7ed;
    color: var(--amber);
    font-weight: 900;
}

.alert-card.urgent .alert-icon {
    background: #fff1f2;
    color: var(--rose);
}

.alert-card b {
    display: block;
    margin-bottom: 5px;
    font-size: var(--font-size-body-sm);
}

.alert-card p {
    margin: 0;
    color: var(--muted);
    font-size: var(--font-size-caption);
    line-height: 1.5;
}

.document-card {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 14px;
    text-align: left;
    color: inherit;
    text-decoration: none;
    box-shadow: none;
}

.document-card:hover {
    border-color: var(--brand);
}

.file-icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: #f1f4f9;
    color: #475467;
    font-weight: 900;
    font-size: var(--font-size-meta-sm);
}

.doc-check {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #eef2f7;
    color: #94a3b8;
    font-size: var(--font-size-section-title-sm);
    font-weight: 900;
}

.doc-check.is-checked {
    background: #dcfce7;
    color: #16a34a;
}

.document-card h4 {
    margin: 0 0 4px;
    font-size: var(--font-size-body);
}

.document-card p {
    margin: 0;
    color: var(--muted);
    font-size: var(--font-size-caption);
}

.doc-action {
    display: grid;
    gap: 6px;
    justify-items: stretch;
    min-width: 132px;
}

.doc-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 26px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: var(--font-size-meta);
    font-weight: 900;
    line-height: 1;
    white-space: nowrap;
}

.doc-badge.submit.submitted {
    background: #ecfdf5;
    color: #059669;
}

.doc-badge.submit.missing {
    background: #f1f5f9;
    color: #64748b;
}

.doc-badge.review.before {
    background: #f8fafc;
    color: #64748b;
}

.doc-badge.review.reviewing {
    background: #eff6ff;
    color: #2563eb;
}

.doc-badge.review.complete {
    background: #dcfce7;
    color: #16a34a;
}

.doc-action small {
    color: var(--muted);
    font-size: var(--font-size-meta);
    font-weight: 700;
    text-align: right;
}

.signal-board {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}

.signal {
    display: grid;
    justify-items: center;
    gap: 4px;
    min-width: 48px;
    padding: 7px 6px;
    background: #fbfcfe;
    color: var(--muted);
    font-size: var(--font-size-meta-xs);
    font-weight: 900;
    line-height: 1.1;
}

.signal + .signal {
    border-left: 1px solid #edf0f5;
}

.signal::before {
    content: "";
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #cbd5e1;
}

.signal.off::before {
    background: #f59e0b;
}

.signal.wait::before {
    background: #3b82f6;
}

.signal.ok::before {
    background: #10b981;
}

.signal.fix::before {
    background: #ef4444;
}

.toolbar-actions {
    display: flex;
    gap: 8px;
}

.preview {
    min-height: 420px;
    display: grid;
    place-items: center;
    background: #eef2f7;
    border-radius: 8px;
    padding: 18px;
}

.paper {
    width: min(440px, 100%);
    min-height: 600px;
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, .13);
    padding: 34px;
}

.paper-line {
    height: 10px;
    background: #e5e7eb;
    border-radius: 999px;
    margin-bottom: 14px;
}

.paper-line.short {
    width: 56%;
}

.paper-line.mid {
    width: 76%;
}

.paper-gap {
    height: 42px;
}

.info-row,
.menu-item {
    display: flex;
    justify-content: space-between;
    gap: 14px;
}

.info-row {
    padding-bottom: 12px;
    border-bottom: 1px solid #edf0f5;
}

.info-row span,
.menu-item span span {
    color: var(--muted);
    font-size: var(--font-size-caption);
}

.info-row b {
    text-align: right;
    font-size: var(--font-size-body-sm);
}

.comment-box {
    margin-top: 16px;
    padding: 14px;
    border-radius: 8px;
    background: #fff8eb;
    border: 1px solid #f5dfb8;
}

.comment-box b {
    display: block;
    margin-bottom: 7px;
}

.comment-box p {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
    font-size: var(--font-size-body-sm);
}

.chat-message {
    display: grid;
    gap: 6px;
    max-width: 88%;
    padding: 12px;
    border-radius: 8px;
    background: #fbfcfe;
    border: 1px solid #edf0f5;
}

.chat-message.admin {
    justify-self: start;
    border-left: 3px solid #244f9e;
}

.chat-message.user {
    justify-self: end;
    background: #eef4ff;
    border-color: #d4e2ff;
}

.chat-message b {
    font-size: var(--font-size-caption);
}

.chat-message p {
    margin: 0;
    color: #344054;
    font-size: var(--font-size-body-sm);
    line-height: 1.5;
}

.chat-message time {
    color: var(--muted);
    font-size: var(--font-size-meta);
    font-weight: 700;
}

.profile-summary {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr);
    gap: 14px;
    align-items: center;
    padding: 18px;
    margin-bottom: 14px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.profile-avatar {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    border-radius: 18px;
    background: #e0ecff;
    color: var(--brand);
    font-size: var(--font-size-page-title);
    font-weight: 900;
}

.profile-summary h3 {
    margin: 0 0 5px;
    font-size: var(--font-size-section-title);
}

.profile-summary p {
    margin: 0;
    color: var(--muted);
    font-size: var(--font-size-body-sm);
    line-height: 1.45;
}

.menu-list {
    gap: 10px;
}

.menu-item {
    align-items: center;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 15px;
    color: inherit;
    text-align: left;
}

.menu-item b {
    display: block;
    margin-bottom: 4px;
    font-size: var(--font-size-body);
}

@media (max-width: 720px) {
    .stat-row {
        grid-template-columns: 1fr 1fr;
    }

    .document-card {
        grid-template-columns: 40px minmax(0, 1fr);
    }

    .doc-action {
        grid-column: 2;
        justify-items: start;
    }

    .step {
        grid-template-columns: 28px minmax(0, 1fr);
    }

    .step-date {
        grid-column: 2;
        padding-top: 0;
    }

    .paper {
        min-height: 460px;
        padding: 24px;
    }
}

@media (max-width: 520px) {
    .detail-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .toolbar-actions {
        width: 100%;
    }

    .toolbar-actions button {
        flex: 1;
    }
}
