/* --------------------------------------------------------------------------
 * 자료실 — 목록 한 줄(확장자 꼬리표 + 제목 · 파일 이름), 보기 창의 판 이력.
 * -------------------------------------------------------------------------- */
.library-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}
a.mf-attach-type {
    text-decoration: none;
}
.library-versions {
    margin-top: 1rem;
    padding-top: 0.875rem;
    border-top: 1px solid var(--ln);
}
.library-version {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.375rem 0;
}
.library-version + .library-version {
    border-top: 1px dashed var(--ln-soft);
}

/* --------------------------------------------------------------------------
 * 장비 점검 — 장비 창의 요약 줄 · 점검 기록 줄 · 이력 · 접힌 정보 수정.
 * -------------------------------------------------------------------------- */
/* 장비 정보 여덟 칸 — 한 줄에 네 칸씩 두 줄(좁으면 두 칸씩) */
.equipment-facts {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.5rem;
    margin: 0 0 1.25rem;
}
@media (max-width: 575.98px) {
    .equipment-facts {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
.equipment-facts > div {
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--ln);
    border-radius: 0.625rem;
    background: var(--sf-inset);
    min-width: 0;
}
.equipment-facts dt {
    margin-bottom: 0.125rem;
    color: var(--tx-muted);
    font-size: 0.75rem;
    font-weight: 500;
}
.equipment-facts dd {
    margin: 0;
    color: var(--tx-strong);
    font-weight: 600;
    overflow-wrap: anywhere;
}
.equipment-facts-sub {
    display: block;
    color: var(--tx-muted);
    font-size: 0.75rem;
    font-weight: 500;
}
.equipment-facts .is-overdue {
    border-color: var(--theme-danger-border-subtle);
    background: var(--theme-danger-bg-subtle);
}
.equipment-facts .is-overdue .equipment-facts-sub {
    color: var(--theme-danger);
    font-weight: 600;
}
.equipment-facts .is-soon {
    border-color: var(--theme-warning-border-subtle);
    background: var(--theme-warning-bg-subtle);
}
.equipment-facts .is-soon .equipment-facts-sub {
    color: var(--theme-warning-text-emphasis);
    font-weight: 600;
}
.equipment-section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
}
.equipment-inspect {
    margin-bottom: 1.25rem;
    padding: 0.875rem;
    border-radius: 0.625rem;
    background: var(--sf-inset);
}
.equipment-history {
    max-height: 16rem;
    overflow-y: auto;
}
/* 이력 한 줄: 날짜 · 결과 · 내용 · 점검한 사람(오른쪽) */
.equipment-history-item {
    display: flex;
    align-items: baseline;
    gap: 0.625rem;
}
.equipment-history-date {
    flex-shrink: 0;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.equipment-history-item .badge {
    flex-shrink: 0;
}
.equipment-history-note {
    flex: 1;
    min-width: 0;
    font-size: 0.8125rem;
    white-space: pre-line;
}
.equipment-history-who {
    flex-shrink: 0;
    color: var(--tx-muted);
    font-size: 0.8125rem;
}
@media (max-width: 575.98px) {
    /* 좁으면 내용은 아랫줄 전체로 */
    .equipment-history-item {
        flex-wrap: wrap;
    }
    .equipment-history-who {
        margin-left: auto;
    }
    .equipment-history-note {
        order: 1;
        flex-basis: 100%;
    }
    .equipment-history-note:empty {
        display: none;
    }
}
.equipment-edit {
    margin-top: 1rem;
    padding-top: 0.875rem;
    border-top: 1px solid var(--ln);
}
.equipment-edit > summary {
    color: var(--brand-emph);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
}

/*
 * 날짜 입력칸(datepicker.js — flatpickr). 글자 칸으로 바뀌어 브라우저 달력 아이콘이 없어지므로 오른쪽에 달력 아이콘을 그린다.
 * 달력 상자 모양은 템플릿(app.css)의 .flatpickr-* 를 쓴다.
 */
.mf-date-input.form-control {
    padding-inline-end: 2rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238391a2' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cpath d='M16 2v4M8 2v4M3 10h18'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
    background-size: 1rem;
}
.mf-date-input.form-control-sm {
    background-position: right 0.5rem center;
    background-size: 0.875rem;
}
.mf-date-input.is-time.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238391a2' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E");
}

/* 탭 전환(결재 의견 · 이력 등) — 부트스트랩 기본은 사라지기 .15s + 나타나기 .15s 라 느리게 느껴진다. 반으로. */
.tab-content > .tab-pane.fade {
    transition-duration: 0.07s;
}

/*
 * 목록 줄 누르기(mediflow.js — [data-row-link]). 줄 어디를 눌러도 대표 링크가 열린다 — 열 링크가 있는 줄만 손가락 모양 · 옅은 강조.
 */
[data-row-link]:has(a[href]:not([href^="tel:"]):not([href^="mailto:"]):not([data-soft="off"]), [data-row-primary]) {
    cursor: pointer;
}
/* 마우스 화면에서만 칸을 칠한다 — 손가락 화면은 누른 뒤 hover 가 남아, 카드(mf-card-table)에서는 글자 뒤에 회색 조각이 생겼다. */
@media (hover: hover) {
    tr[data-row-link]:has(a[href]:not([href^="tel:"]):not([href^="mailto:"]):not([data-soft="off"]), [data-row-primary]):hover > td {
        background-color: var(--theme-tertiary-bg);
    }
}
/* 손가락으로 누를 때: 브라우저의 링크 회색 상자(tap highlight)는 끄고, 누르는 동안 줄(카드) 전체를 옅게. */
[data-row-link] {
    -webkit-tap-highlight-color: transparent;
}
@media (hover: none) {
    tr[data-row-link]:active,
    li[data-row-link]:active {
        background-color: var(--sf-hover);
    }
    tr[data-row-link]:active > td {
        background-color: transparent;
    }
}

/*
 * 앱(PWA) 스플래시(pwa/splash) — 흰 바탕 가운데 로고, 살짝 떠오르며 나타난다. 로그인 화면 아래 '앱 설치' 줄.
 */
.pwa-splash {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
}
.pwa-splash-inner {
    text-align: center;
    animation: pwa-splash-in 0.6s ease-out both;
}
.pwa-splash-brand .mf-brand-name {
    color: var(--brand-accent);
}
.pwa-splash-tagline {
    margin: 0.75rem 0 0;
    color: var(--theme-secondary-color);
    font-size: 0.875rem;
}
@keyframes pwa-splash-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    .pwa-splash-inner { animation: none; }
}
.pwa-install {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding: 0.75rem;
    border: 1px solid var(--theme-border-color);
    border-radius: 12px;
    background: var(--theme-tertiary-bg);
}
.pwa-install-icon {
    flex-shrink: 0;
    border-radius: 10px;
}
.pwa-install-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}
.pwa-install-text strong {
    font-size: 0.875rem;
}
.pwa-install-text span {
    font-size: 0.75rem;
    color: var(--theme-secondary-color);
}
/* 아이폰 — 둘째 줄 대신 누를 곳을 차례로 보여 주는 칩(아이콘 + 이름 › 아이콘 + 이름). */
.pwa-ios-steps {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.3rem;
}
.pwa-ios-steps[hidden],
.pwa-ios-steps [hidden] {
    display: none;
}
.pwa-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.5rem;
    border: 1px solid var(--theme-border-color);
    border-radius: 999px;
    background: var(--theme-secondary-bg);
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}
.pwa-chip svg {
    width: 0.9rem;
    height: 0.9rem;
    color: var(--brand-accent);
}
.pwa-chip.is-action {
    font-family: inherit;
    line-height: inherit;
    color: inherit;
    cursor: pointer;
    border-color: var(--brand-accent);
}
.pwa-chip.is-action:active {
    background: var(--theme-primary-bg-subtle);
}
.pwa-chip .pwa-chip-sub {
    width: 0.75rem;
    height: 0.75rem;
    color: var(--theme-secondary-color);
}
.pwa-chip-arrow {
    display: inline-flex;
    color: var(--theme-secondary-color);
}
.pwa-chip-arrow svg {
    width: 0.85rem;
    height: 0.85rem;
}
.pwa-guide + .pwa-guide {
    margin-top: 1.25rem;
}
.pwa-guide-title {
    margin-bottom: 0.75rem;
    font-size: 0.8125rem;
    color: var(--theme-secondary-color);
}
.pwa-steps {
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: pwa-step;
}
.pwa-steps li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
}
.pwa-steps li + li {
    margin-top: 0.75rem;
}
.pwa-step-icon {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--theme-primary-bg-subtle);
    color: var(--brand-accent);
}

/* 로그인 카드 — 휴대폰은 폭 가득, 태블릿 세로(768~991px)에서도 좁지 않게 30rem 까지. */
.auth-card {
    max-width: 30rem;
    margin: 0 auto;
}

/*
 * 창(모달) 열림 효과 — 템플릿은 '살짝 커지며 나타나기'(zoomInModal, 0.1초)만 쓰려 했는데,
 * 부트스트랩의 '.modal.fade .modal-dialog { 위 50px 에서 0.3초 내려오기 }' 가 선택자가 더 강해 함께 걸려 있었다.
 * 크롬은 확대 효과가 가려 주지만 아이폰(WebKit)은 확대가 끝난 뒤 남은 내려오기를 보여 줘
 * '위로 튀었다가 내려오는' 것처럼 보였다(홈 화면 앱에서 창만 움직임). 부트스트랩의 내려오기를 끈다.
 */
.modal.fade .modal-dialog {
    transform: none;
    transition: none;
}

/*
 * 템플릿은 사이드바를 아이콘만 남기는 폭(condensed, 약 768~1399px — 태블릿 · 작은 노트북)이 되면
 * 본문 최소 높이를 1900px 로 박는다(아이콘에 마우스를 올려 펼치는 하위 메뉴 자리). MediFlow 는 그 메뉴를 쓰지 않아
 * 내용이 짧은 화면(대시보드 등)이 빈 곳까지 한참 스크롤됐다. 다른 폭과 같이 '화면 한 장'으로 되돌린다.
 */
html[data-sidenav-size=condensed] .content-page {
    min-height: calc(100vh - calc(var(--theme-topbar-height) + 1px));
}

/* 장비 창 요약 — 왼쪽 사진(없으면 빈 이미지) | 오른쪽 정보 목록(라벨 | 값 한 줄씩, 2열 × 4줄, 가는 구분선).
   정보는 카드 칸 대신 줄 목록으로 — 세로 자리를 덜 쓴다. 점검 지남 · 임박은 글자 색으로. 좁은 화면은 위아래로. */
.equipment-summary {
    display: grid;
    grid-template-columns: 10rem minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
    margin-bottom: 1.25rem;
}
.equipment-summary .equipment-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 1.5rem;
    row-gap: 0;
    margin: 0;
}
.equipment-summary .equipment-facts > div {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border: 0;
    border-bottom: 1px solid var(--ln-soft);
    border-radius: 0;
    background: none;
}
.equipment-summary .equipment-facts dt {
    flex: 0 0 4.5rem;
    margin: 0;
    font-size: 0.8125rem;
}
.equipment-summary .equipment-facts dd {
    font-weight: 500;
}
.equipment-summary .equipment-facts-sub {
    display: inline;
    margin-left: 0.375rem;
}
.equipment-summary .equipment-facts .is-overdue,
.equipment-summary .equipment-facts .is-soon {
    background: none;
}
.equipment-summary .equipment-facts .is-overdue dd {
    color: var(--theme-danger);
}
.equipment-summary .equipment-facts .is-soon dd {
    color: var(--theme-warning-text-emphasis);
}
.equipment-photo {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    padding: 0.25rem;
    border: 1px solid var(--ln);
    border-radius: 0.625rem;
    background: var(--sf-inset);
    overflow: hidden;
}
.equipment-photo img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    border-radius: 0.4375rem;
    object-fit: contain;
}
.equipment-photo.is-empty {
    color: var(--tx-muted);
    opacity: 0.6;
}
.equipment-photo.is-empty svg {
    width: 2.5rem;
    height: 2.5rem;
    stroke-width: 1.25;
}
@media (max-width: 575.98px) {
    .equipment-summary {
        grid-template-columns: minmax(0, 1fr);
    }
    .equipment-photo {
        width: 8rem;
    }
    .equipment-summary .equipment-facts {
        grid-template-columns: minmax(0, 1fr);
    }
}
