/*
 * 할일 — 위 입력 줄에서 바로 추가, 한 줄에 체크 · 제목 · 마감 · 별.
 * 완료한 줄은 흐리게 긋는다. 마감이 지난 것은 빨강, 오늘은 파랑.
 */
.todo-card {
    max-width: 52rem;
}
.todo-add {
    display: flex;
    align-items: center;
    gap: .5rem;
}
.todo-add-title {
    flex: 1 1 auto;
    min-width: 0;
}
.todo-add-date {
    flex: 0 0 9.5rem;
}
.todo-add .btn-check:checked + .todo-add-star {
    color: var(--theme-warning);
}
.todo-add .btn-check:checked + .todo-add-star svg {
    fill: currentColor;
}
.todo-row {
    display: flex;
    align-items: center;
    gap: .75rem;
}
.todo-check {
    display: inline-flex;
    padding: 0;
    border: 0;
    background: none;
    color: var(--tx-faint);
}
.todo-check svg {
    width: 20px;
    height: 20px;
}
.todo-check:hover,
.todo-row.is-done .todo-check {
    color: var(--brand-accent);
}
.todo-title {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
}
.todo-row.is-done .todo-title {
    color: var(--tx-muted);
    text-decoration: line-through;
}
.todo-due {
    flex-shrink: 0;
    font-size: .8125rem;
    color: var(--tx-muted);
    white-space: nowrap;
}
.todo-due.is-today {
    color: var(--brand-emph);
    font-weight: 600;
}
.todo-due.is-overdue {
    color: var(--theme-danger);
    font-weight: 600;
}
/* 휴대폰: [할일 추가……] [추가] / [날짜] [☆] 두 줄 — 네 줄(+ / 입력 / 날짜 / ☆ 추가)로 흩어졌다. */
@media (max-width: 575.98px) {
    /* 템플릿의 .card-header { gap: 1.25rem !important } 를 덮는다. 세로 간격은 줄 나눔 칸(::after) 앞뒤로 두 번 들어가 0.5rem. */
    .todo-add.card-header {
        flex-wrap: wrap;
        column-gap: 0.5rem !important;
        row-gap: 0.25rem !important;
    }
    .todo-add > svg {
        display: none;
    }
    .todo-add-title {
        order: 1;
        flex: 1 1 0;
    }
    .todo-add > .btn-primary {
        order: 2;
    }
    .todo-add::after {
        content: "";
        order: 3;
        flex-basis: 100%;
        height: 0;
    }
    .todo-add-date {
        order: 4;
    }
    .todo-add-star {
        order: 5;
    }
}

/*
 * 게시판 — 목록은 표, 글은 읽기 좋은 폭(52rem)으로 묶는다.
 * 공지 줄은 옅은 파랑 바탕 + 제목 앞 파란 [공지], 새 글(사흘 안)은 작은 N.
 */
.board-search {
    width: 16rem;
    max-width: 100%;
}
.board-table tr.is-notice > td {
    background: var(--st-primary-row);
}
.post-notice-tag {
    color: var(--theme-primary);
    font-weight: 600;
    margin-right: .25rem;
}
/* 글 설문 — 글 아래 상자, 결과는 항목마다 가는 막대. */
.post-poll {
    margin-top: 1.5rem;
    padding: 1rem 1.25rem;
    border: 1px solid var(--theme-border-color);
    border-radius: 10px;
    max-width: 36rem;
}
.post-poll-head {
    display: flex;
    align-items: center;
    gap: .5rem;
}
.post-poll-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem .75rem;
    margin: .25rem 0 .75rem;
    font-size: .8125rem;
    color: var(--theme-secondary-color);
}
.post-poll-options {
    list-style: none;
    margin: 0 0 .75rem;
    padding: 0;
    display: grid;
    gap: .5rem;
}
.post-poll-label {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin: 0;
    cursor: pointer;
}
.post-poll-count {
    font-size: .8125rem;
    color: var(--theme-secondary-color);
    white-space: nowrap;
}
.post-poll-bar {
    height: 6px;
    margin-top: .25rem;
    border-radius: 3px;
    background: var(--theme-tertiary-bg);
    overflow: hidden;
}
.post-poll-bar > span {
    display: block;
    height: 100%;
    background: var(--theme-primary);
}
/* 글쓰기 — 설문 항목 줄, 임시저장 상태 */
.post-poll-editor {
    padding: 1rem;
    border: 1px solid var(--theme-border-color);
    border-radius: 10px;
}
.post-poll-editor-option {
    display: flex;
    gap: .5rem;
    margin-bottom: .5rem;
}
.post-draft-status {
    font-size: .8125rem;
    color: var(--theme-secondary-color);
}
.board-title {
    font-weight: 500;
}
.board-new {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    margin-left: .25rem;
    border-radius: 50%;
    /* 템플릿의 --bs-danger 는 옅어서 흰 바탕 · 공지 줄(옅은 파랑)에 묻힌다 — 짙은 빨강으로. */
    background: var(--st-danger);
    color: #fff;
    font-size: .625rem;
    font-weight: 700;
    vertical-align: .1em;
}
[data-bs-theme="dark"] .board-new {
    color: #2a0a0a;
}
.post-card {
    max-width: 52rem;
}
.board-post-prefix {
    color: var(--brand-emph);
    font-weight: 600;
}
.post-prefix-select {
    flex: 0 0 9rem;
}

/* 말머리 탭 — 목록 위에서 말머리로 거른다. */
.board-prefixes {
    display: flex;
    flex-wrap: wrap;
    gap: .375rem;
}
.board-prefix {
    padding: .25rem .75rem;
    border: 1px solid var(--ln);
    border-radius: 999px;
    color: var(--tx-muted);
    font-size: .8125rem;
    text-decoration: none;
}
.board-prefix:hover {
    border-color: var(--brand-accent);
    color: var(--brand-emph);
}
.board-prefix.active {
    border-color: var(--brand-accent);
    background: var(--theme-primary-bg-subtle);
    color: var(--brand-emph);
    font-weight: 600;
}

/* 게시판 만들기 · 설정 — 왼쪽 이름표 | 오른쪽 칸 두 줄 격자. */
.board-form {
    max-width: 52rem;
}
.board-form-grid {
    display: grid;
    grid-template-columns: 7.5rem 1fr;
    align-items: center;
    gap: .875rem 1rem;
}
.board-form-grid > .form-label {
    margin-bottom: 0;
}
.board-form .card-body.board-form-grid {
    padding-top: 1.25rem;
    padding-bottom: 1.25rem;
}

/* 선택 막대 — 어느 칸이든 같은 폭, 칸은 똑같이 나눈다. 숫자 칸도 같은 폭. */
.board-segment,
.board-segment-input {
    width: 18rem;
    max-width: 100%;
}
.board-segment {
    display: inline-flex;
}
.board-segment > .btn {
    flex: 1 1 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .375rem;
    white-space: nowrap;
}
.board-segment .btn-check:disabled + .btn {
    opacity: .45;
}
/* 품목 창의 LOT · 유통기한 관리 — 반 칸씩 두 막대, 같은 폭 */
.item-track-segment {
    width: 100%;
}
/* 잠긴 막대(만든 뒤의 게시판 유형) — 고른 칸은 또렷하게, 안 고른 칸만 흐리게. */
.board-segment.is-locked .btn-check:checked:disabled + .btn {
    opacity: 1;
}
@media (max-width: 575.98px) {
    .board-form-grid {
        grid-template-columns: 1fr;
        gap: .375rem;
    }
    .board-form-grid > .form-label:not(:first-child) {
        margin-top: .5rem;
    }
    .board-segment,
    .board-segment-input {
        width: 100%;
    }
}
.post-title {
    margin: .25rem 0 .5rem;
    font-weight: 600;
    line-height: 1.4;
}
/* 제목 맨 앞 별(중요) — 폼에 제목과 같은 클래스(h4 post-title)를 붙여 글자 크기 · 줄 높이 · 위 여백을 같게 하고,
   별 버튼을 그 한 줄 높이(1.4em) 가운데에 둔다 — 제목이 여러 줄이어도 첫 줄에 맞는다. */
.post-title-star {
    flex-shrink: 0;
}
.post-title-star .contact-star {
    display: flex;
    align-items: center;
    height: 1.4em;
    font-size: inherit;
    line-height: inherit;
}
/* 제목 줄 오른쪽 끝 날짜 · (수정됨) — 별과 같이 제목 클래스로 줄 높이를 맞추고 첫 줄 가운데에 작은 흐린 글자 */
.post-title-date {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    height: 1.4em;
}
.post-title-date-text {
    color: var(--tx-muted);
    font-size: 0.8125rem;
    font-weight: 400;
    white-space: nowrap;
}
.post-title-star svg {
    width: 1.15em;
    height: 1.15em;
}
.post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem .75rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--ln);
    color: var(--tx-muted);
    font-size: .8125rem;
}
.post-body {
    min-height: 8rem;
    padding: 1.25rem 0;
    line-height: 1.8;
    overflow-wrap: anywhere;
}
.post-body-input {
    line-height: 1.7;
}
/*
 * 게시글 보기 — 1400px 이상은 왼쪽 글 · 오른쪽 댓글(화면에 붙어 따라오고 안에서만 스크롤, 새 댓글 칸은 아래 고정).
 * 그보다 좁으면 글 아래 댓글. 댓글은 원댓글 아래 답글 한 단계, 좋아요는 엄지 + 숫자.
 */
.post-layout .post-comments {
    margin-top: 1rem;
}
/* 글 보기는 글쓰기 폼(52rem)보다 넓게 — 표 · 사진이 있는 글도 답답하지 않게. */
.post-layout .post-card {
    max-width: 64rem;
}
/* 글 카드는 한 화면에 맞게 서 있게(짧은 글도 아래가 비어 보이지 않게) — [목록 · 수정 · 삭제]는 카드 바닥.
   높이 = 화면 − 상단바 − 제목 줄 − 푸터(약 9.5rem) — 스크롤하지 않아도 아래 푸터가 보인다. */
.post-layout {
    --post-fit-height: calc(100vh - var(--theme-topbar-height) - 9.5rem);
}
.post-layout .post-main {
    display: flex;
    flex-direction: column;
    min-height: var(--post-fit-height);
}
.post-layout .post-main > .card-body {
    flex: 1 1 auto;
}
@media (min-width: 1400px) {
    .post-layout.has-comments {
        display: grid;
        grid-template-columns: minmax(0, 64rem) minmax(26rem, 38rem);
        gap: 1rem;
        align-items: start;
    }
    .post-layout.has-comments .post-card {
        max-width: none;
    }
    /* 댓글 칸은 화면의 60% 정도(24rem 이상, 글 카드보다 높지 않게) — 안에서만 스크롤, 따라 내려온다. */
    .post-layout .post-comments {
        position: sticky;
        top: calc(var(--theme-topbar-height) + 1rem);
        display: flex;
        flex-direction: column;
        height: clamp(24rem, 60vh, var(--post-fit-height));
        margin-top: 0;
    }
    .post-layout .post-comments-scroll {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
    }
}
.post-comment-list,
.post-comment-replies {
    list-style: none;
    margin: 0;
    padding: 0;
}
.post-comment {
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--ln-soft);
}
.post-comment-list > .post-comment:last-child {
    border-bottom: 0;
}
.post-comment-head {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .25rem;
}
.post-comment-deleted {
    color: var(--tx-faint);
    font-size: .875rem;
}
.post-comment-tools {
    display: inline-flex;
    align-items: center;
    gap: .625rem;
    margin-left: auto;
}
.post-comment-like,
.post-comment-reply-toggle {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: 0;
    border: 0;
    background: none;
    font-size: .8125rem;
    color: var(--tx-muted);
}
.post-comment-like:hover,
.post-comment-reply-toggle:hover {
    color: var(--brand-emph);
}
.post-comment-like.is-on {
    color: var(--brand-emph);
    font-weight: 600;
}
.post-comment-like.is-on svg {
    fill: currentColor;
    fill-opacity: .15;
}
/* 글 좋아요 — 글 아래 [목록] 옆, 켜면 파랑 */
.post-like {
    display: inline-flex;
    align-items: center;
    gap: .375rem;
}
.post-like [data-like-count]:empty {
    display: none;
}
.post-like.is-on,
.post-like.is-on:hover {
    color: var(--brand-emph);
    background-color: color-mix(in srgb, var(--brand-emph) 12%, transparent);
    font-weight: 600;
}
.post-like.is-on svg {
    fill: currentColor;
    fill-opacity: .15;
}
/* 답글 — 한 단계 들여쓰고 옅은 면 */
.post-comment-replies {
    margin-top: .5rem;
    border-radius: 8px;
    background: var(--sf-inset);
}
.post-comment.is-reply {
    padding: .5rem .75rem;
    border-bottom: 1px solid var(--ln-soft);
}
.post-comment-replies > .post-comment.is-reply:last-child {
    border-bottom: 0;
}
.post-comment-reply-form {
    margin-top: .5rem;
}

/* 메모처럼 사람이 친 줄바꿈을 그대로 보여 줄 칸 */
.text-pre-line {
    white-space: pre-line;
}


/* 게시판 휴대폰 · 태블릿 — 목록 카드(mf-card-table)의 공지 줄은 카드 전체를 칠한다(칸마다 칠하면 조각나 보였다). */
@media screen and (max-width: 1199.98px) {
    .mf-card-table.board-table tr.is-notice {
        background: var(--st-primary-row);
    }
    .mf-card-table.board-table tr.is-notice > td {
        background: transparent;
    }
}
/* 휴대폰: 검색칸은 카드 폭 그대로, 글쓰기 말머리는 제목 칸 위 한 줄, 글 보기는 화면 높이 채우기를 하지 않는다
   (댓글이 글 아래로 오는데 빈칸이 끼어 있었다). */
@media screen and (max-width: 767.98px) {
    .board-search-form {
        flex: 1 1 100%;
        margin-left: 0 !important;
    }
    /* 탭 머리(아래 여백 0 — 탭이 밑줄에 붙는다)에서 검색칸이 따로 한 줄이 되면 점선과 띄운다(업무요청). */
    .leave-tabs-head .board-search-form {
        margin-bottom: 0.75rem;
    }
    .board-search-form .board-search,
    .board-search-form > input[type="search"] {
        flex: 1 1 auto;
        width: auto;
        min-width: 0;
    }
    .post-title-row {
        flex-wrap: wrap;
    }
    .post-title-row .post-prefix-select {
        flex: 1 1 100%;
    }
    .post-layout .post-main {
        min-height: 0;
    }
}
