/* SYSTEMCARE — 관리자 UI (PIMS 스타일 디자인 시스템, 프레임워크 미사용) */

/* ==========================================================================
   1. 디자인 토큰
   ========================================================================== */
:root {
    --bg: #f6f8fb;
    --surface: #ffffff;
    --surface-alt: #f1f5fa;      /* 테이블 헤더, bar track 등 */
    --border: #dfe5ee;
    --border-strong: #cdd6e3;

    --primary: #2478ee;
    --primary-dark: #1a62cf;
    --primary-soft: #eaf2fd;     /* active nav, focus ring, link hover */

    --text: #26334d;
    --text-strong: #17233c;
    --muted: #738099;

    --danger: #d64545;
    --danger-dark: #b83b3b;
    --danger-soft: #fdecec;
    --danger-border: #f3cccc;

    --warning: #b9761b;
    --warning-soft: #fdf4e5;
    --warning-border: #f0dcb8;

    --success: #1f9d6b;
    --success-soft: #e7f6ef;

    --radius: 12px;
    --radius-sm: 8px;
    --radius-pill: 999px;

    --shadow-sm: 0 1px 2px rgba(20, 35, 60, .06);
    --shadow: 0 1px 2px rgba(20, 35, 60, .04), 0 6px 20px rgba(20, 35, 60, .06);

    --sidebar-w: 232px;
    --header-h: 72px;

    --font: "Pretendard Variable", "Pretendard", "Noto Sans KR",
        "Apple SD Gothic Neo", "Malgun Gothic", "Segoe UI", system-ui,
        -apple-system, BlinkMacSystemFont, sans-serif;
    --mono: "SFMono-Regular", "Consolas", "D2Coding", "Courier New", monospace;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary);
}

h1,
h2,
h3 {
    color: var(--text-strong);
    letter-spacing: -0.01em;
}

/* ==========================================================================
   2. App shell (Header + Sidebar + Main)
   ========================================================================== */
.app {
    min-height: 100%;
    display: flex;
    flex-direction: column;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 20;
    min-height: var(--header-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 24px;
}

.app-header__brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
    min-width: 0;
}

.brand-icon {
    width: 40px;
    height: 40px;
    flex: none;
    border-radius: 11px;
    background: linear-gradient(160deg, #efeafe, #e2ddfb);
    color: #6d5bd0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-icon svg {
    width: 22px;
    height: 22px;
}

.app-header__titles {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.app-header__title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-strong);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-header__subtitle {
    font-size: 11.5px;
    color: var(--muted);
    letter-spacing: .01em;
}

.app-header__user {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 0;
}

.app-header__user-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.35;
    min-width: 0;
}

.app-header__user-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-strong);
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-header__user-role {
    font-size: 11.5px;
    color: var(--primary);
    font-weight: 600;
}

.app-body {
    flex: 1;
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    align-items: start;
}

.app-sidebar {
    position: sticky;
    top: var(--header-h);
    align-self: start;
    height: calc(100vh - var(--header-h));
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 16px 12px;
    overflow-y: auto;
}

.side-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.side-nav__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text);
    font-size: 13.5px;
    font-weight: 600;
    white-space: nowrap;
}

.side-nav__item:hover {
    background: var(--surface-alt);
}

.side-nav__item.is-active {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.side-nav__icon {
    width: 18px;
    height: 18px;
    flex: none;
    color: var(--muted);
}

.side-nav__item.is-active .side-nav__icon {
    color: var(--primary);
}

.side-nav__group-label {
    margin: 12px 12px 2px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

.app-main {
    min-width: 0;
    padding: 28px 32px 56px;
}

/* ==========================================================================
   3. 로그인 (사이드바 없는 중앙 카드)
   ========================================================================== */
.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 32px 28px;
    text-align: center;
}

.auth-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.auth-brand .brand-icon {
    width: 48px;
    height: 48px;
}

.auth-brand__title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-strong);
}

.auth-brand__subtitle {
    font-size: 11.5px;
    color: var(--muted);
}

.auth-card h1 {
    margin: 0 0 18px;
    font-size: 17px;
}

.auth-card__hint {
    margin: 14px 0 0;
    color: var(--muted);
    font-size: 12px;
}

/* ==========================================================================
   4. 페이지 헤더 / 카드
   ========================================================================== */
.page-head {
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.page-head__main {
    min-width: 0;
}

.page-head h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
}

.page-head__desc {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.page-head__sub {
    margin-left: 10px;
    font-size: 15px;
    font-weight: 400;
    color: var(--muted);
}

.page-head__actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 14px;
    font-size: 13px;
    color: var(--muted);
    text-decoration: none;
}

.back-link:hover {
    color: var(--text-strong);
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card + .card {
    margin-top: 16px;
}

.card__title {
    margin: 0;
    padding: 14px 18px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-strong);
    border-bottom: 1px solid var(--border);
}

.card__title--bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card__title--bar h2 {
    margin: 0;
    font: inherit;
    color: inherit;
}

/* ==========================================================================
   5. 테이블
   ========================================================================== */
.table-wrap {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    white-space: nowrap;
}

.data-table thead th {
    background: var(--surface-alt);
    color: var(--muted);
    font-weight: 600;
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.data-table tbody td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr:hover {
    background: #f8fafd;
}

.data-table .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.data-table td a,
.link-action {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.data-table td a:hover,
.link-action:hover {
    text-decoration: underline;
}

.link-action + .link-action {
    margin-left: 12px;
}

.data-table td a.link-action--danger,
.link-action--danger {
    color: var(--danger);
}

/* 표 안의 POST 액션(실제값 보기 등): 링크처럼 보이는 button */
.inline-form {
    display: inline;
    margin: 0;
}

button.link-action {
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.inline-form + .link-action {
    margin-left: 12px;
}

/* ==========================================================================
   6. 빈 상태
   ========================================================================== */
.empty-state {
    padding: 44px 20px;
    text-align: center;
    color: var(--muted);
    font-size: 13.5px;
}

.empty-state p {
    margin: 0;
}

.empty-state__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    margin: 0 auto 12px;
    border-radius: var(--radius-pill);
    background: var(--surface-alt);
    color: var(--muted);
}

.empty-state__icon svg {
    width: 22px;
    height: 22px;
}

/* ==========================================================================
   7. 버튼
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}

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

.btn--primary:hover {
    background: var(--primary-dark);
}

.btn--secondary {
    background: var(--surface);
    color: var(--primary-dark);
    border-color: var(--primary);
}

.btn--secondary:hover {
    background: var(--primary-soft);
}

.btn--ghost {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border-strong);
}

.btn--ghost:hover {
    background: var(--surface-alt);
}

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

.btn--danger:hover {
    background: var(--danger-dark);
}

.btn--sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn.is-disabled {
    opacity: 0.45;
    pointer-events: none;
}

.action-bar {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
}

/* ==========================================================================
   8. 알림
   ========================================================================== */
.alert {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 16px;
    border: 1px solid transparent;
}

.alert--error {
    background: var(--danger-soft);
    color: var(--danger-dark);
    border-color: var(--danger-border);
}

.alert--warning {
    background: var(--warning-soft);
    color: var(--warning);
    border-color: var(--warning-border);
}

.alert--info {
    background: var(--primary-soft);
    color: var(--primary-dark);
    border-color: #cfe0f5;
}

/* ==========================================================================
   9. 폼
   ========================================================================== */
.form {
    padding: 20px;
    max-width: 920px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form__section {
    margin: 0;
    padding: 16px 16px 4px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.form__section legend {
    padding: 0 6px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-strong);
}

.form__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 20px;
    row-gap: 12px;
}

.field {
    margin-bottom: 12px;
}

.form__grid .field {
    margin-bottom: 0;
}

.field--full {
    grid-column: 1 / -1;
}

.field--inline {
    display: flex;
    gap: 14px;
}

.field--inline > div {
    flex: 1;
}

.field label {
    display: block;
    margin-bottom: 5px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-strong);
}

.field .req {
    color: var(--danger);
    margin-left: 2px;
}

.field input,
.field textarea,
.field select {
    width: 100%;
    min-height: 44px;
    padding: 9px 12px;
    font: inherit;
    font-size: 13.5px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    appearance: none;
}

.field select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%23738099' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5 6 6.5 11 1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 34px;
}

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

.field input::placeholder,
.field textarea::placeholder {
    color: #9aa6ba;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.field input:disabled,
.field textarea:disabled,
.field select:disabled {
    background: var(--surface-alt);
    color: var(--muted);
    cursor: not-allowed;
}

.field__error {
    margin: 6px 0 0;
    color: var(--danger);
    font-size: 12px;
}

.field__hint {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.form__actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

/* --- 넓은 폼 페이지 (신규 등록 / 제품·라이선스·Credential 수정) --------------
   대시보드/상세 화면과 콘텐츠 폭이 어긋나 보이지 않도록 폼 카드를 넓게 사용하고
   타이포를 한 단계 키워 가독성을 높인다. 데스크톱 2열 / 960px 이하 1열. */
.software-form-page {
    width: 100%;
}

.page-head--form {
    margin-bottom: 18px;
}

.software-form {
    width: 100%;
    max-width: 1480px;
    padding: 24px;
    gap: 18px;
}

.software-form .form__section {
    padding: 18px 20px 6px;
}

.software-form .form__section legend {
    font-size: 13px;
}

.software-form .form__grid {
    column-gap: 28px;
    row-gap: 16px;
}

.software-form .field label {
    font-size: 13px;
}

.software-form .field input,
.software-form .field textarea,
.software-form .field select {
    min-height: 46px;
    font-size: 14px;
}

.software-form .field textarea {
    min-height: 76px;
    line-height: 1.6;
}

.software-form .form__actions .btn {
    padding: 10px 20px;
    font-size: 13.5px;
}

/* ==========================================================================
   10. 상세 (정의 목록)
   ========================================================================== */
.detail-list {
    margin: 0;
    padding: 16px 18px;
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 10px 18px;
    font-size: 13px;
}

.detail-list dt {
    color: var(--muted);
    font-weight: 600;
}

.detail-list dd {
    margin: 0;
    color: var(--text);
    word-break: break-word;
}

/* 복호화된 실제값: 공백/개행 보존 + 시각적으로 뚜렷하게 구분 */
.cred-plaintext {
    margin: 0;
    padding: 12px 14px;
    background: #0f1a30;
    color: #eaf1ff;
    border: 1px solid #0f1a30;
    border-radius: var(--radius-sm);
    font-family: var(--mono);
    font-size: 13px;
    white-space: pre-wrap;
    word-break: break-all;
    overflow-wrap: anywhere;
}

/* ==========================================================================
   11. 감사로그 (필터 + 배지 + 페이저)
   ========================================================================== */
.filter-bar {
    padding: 16px 18px;
    margin-bottom: 16px;
}

.filter-bar__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px 16px;
}

.filter-bar__actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 14px;
}

.badge {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 8px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.7;
    background: var(--surface-alt);
    color: var(--muted);
    vertical-align: middle;
}

.badge--reveal {
    background: var(--warning-soft);
    color: var(--warning);
    border: 1px solid var(--warning-border);
}

.badge--success {
    background: var(--success-soft);
    color: var(--success);
    border: 1px solid var(--success);
}

.badge--muted {
    background: var(--surface-alt);
    color: var(--muted);
    border: 1px solid var(--border-strong);
}

.badge--warning {
    background: var(--warning-soft);
    color: var(--warning);
    border: 1px solid var(--warning-border);
}

.badge--danger {
    background: var(--danger-soft);
    color: var(--danger);
    border: 1px solid var(--danger-border);
}

.pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin: 18px 0 4px;
}

.pager__status {
    font-size: 13px;
    color: var(--muted);
}

/* ==========================================================================
   12. 대시보드
   ========================================================================== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 18px;
}

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

.kpi-card__icon {
    width: 44px;
    height: 44px;
    flex: none;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kpi-card__icon svg {
    width: 22px;
    height: 22px;
}

.kpi-card__body {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.kpi-card__label {
    font-size: 12.5px;
    color: var(--muted);
    font-weight: 600;
}

.kpi-card__value {
    font-size: 26px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text-strong);
}

.kpi-card--blue .kpi-card__icon {
    background: #eaf2fd;
    color: var(--primary);
}

.kpi-card--mint .kpi-card__icon {
    background: var(--success-soft);
    color: var(--success);
}

.kpi-card--orange .kpi-card__icon {
    background: var(--warning-soft);
    color: var(--warning);
}

.kpi-card--red .kpi-card__icon {
    background: var(--danger-soft);
    color: var(--danger);
}

.kpi-card--warn {
    border-color: var(--danger-border);
    background: #fef6f6;
}

.kpi-card--warn .kpi-card__value {
    color: var(--danger-dark);
}

.dash-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
}

.dash-grid > .card {
    margin: 0;
}

.cat-list {
    list-style: none;
    margin: 0;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cat-row {
    display: grid;
    grid-template-columns: 96px 1fr 52px;
    align-items: center;
    gap: 12px;
    font-size: 13px;
}

.cat-row__name {
    font-weight: 600;
    color: var(--text-strong);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cat-row__bar {
    display: block;
    height: 14px;
    background: var(--surface-alt);
    border-radius: var(--radius-pill);
    overflow: hidden;
}

.cat-row__fill {
    display: block;
    height: 100%;
    min-width: 3px;
    background: var(--primary);
    border-radius: var(--radius-pill);
}

.cat-row__qty {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: var(--muted);
}

/* ==========================================================================
   12-1. 소프트웨어 목록 (그룹형: 카테고리 > 브랜드 > 제품명 > 버전 행)
   <details>/<summary> 로 접기/펼치기를 처리하므로 JS 가 필요 없다.
   행은 5열 그리드(.sw-row)를 모든 레벨이 공유해 열이 세로로 정렬된다.
   폭이 좁으면 컨테이너 쿼리로 행을 2줄 스택으로 바꾼다.
   ========================================================================== */
.sw-list {
    container: sw-list / inline-size;
}

/* 컨테이너 자신은 컨테이너 쿼리로 스타일할 수 없으므로 변수는 안쪽 body 에 둔다.
   margin-bottom -1px: 마지막 행의 하단선이 카드 테두리와 겹쳐 이중선이 되는 것을 잘라낸다. */
.sw-list__body {
    --sw-step: 16px;      /* 레벨 하나당 들여쓰기 */
    --sw-chev: 20px;      /* chevron(12px) + 간격(8px) */
    --sw-pad: 16px;       /* 좌우 기본 여백 */
    --sw-head-border: #cfe0f5;
    margin-bottom: -1px;
}

/* 열 정의는 여기 한 곳. 버전 | 라이선스 형태 | 이용기간 | 보유수량 | 상세
   (목록에는 비고를 표시하지 않는다. 상세/등록/수정 화면의 비고 데이터·UI 는 그대로다)
   비율 목표: 42% / 14% / 22% / 10% / 12% (min 폭은 내용이 깨지지 않는 최소값) */
.sw-row {
    display: grid;
    grid-template-columns:
        minmax(280px, 42fr)
        minmax(90px, 14fr)
        minmax(180px, 22fr)
        minmax(60px, 10fr)
        minmax(50px, 12fr);
    grid-template-areas: "ver type period qty act";
    column-gap: 16px;
    align-items: center;
    padding: 7px var(--sw-pad) 7px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: var(--text);
    /* 행 내용의 왼쪽 시작 위치 = 버전 행(제품명보다 한 단계 안쪽). 좁은 폭의 2·3번째 줄도 이 값에 맞춘다 */
    --sw-ind: calc(var(--sw-pad) + 2 * var(--sw-step) + var(--sw-chev) + var(--sw-step));
}

.sw-row:not(.sw-row--colhead):not(.sw-row--subhead):hover {
    background: #f8fafd;
}

.sw-cell {
    min-width: 0;
    overflow-wrap: anywhere;
}

.sw-cell--ver    { grid-area: ver; padding-left: var(--sw-ind); }
.sw-cell--type   { grid-area: type; white-space: nowrap; text-align: center; }
.sw-cell--period { grid-area: period; white-space: nowrap; font-variant-numeric: tabular-nums; text-align: center; }
.sw-cell--qty    { grid-area: qty; text-align: center; font-variant-numeric: tabular-nums; }
.sw-cell--act    { grid-area: act; text-align: right; white-space: nowrap; }

/* 전체 컬럼 헤더 / 펼친 제품 안의 버전 헤더 */
.sw-row--colhead {
    background: var(--surface-alt);
    color: var(--muted);
    font-weight: 600;
    padding-top: 10px;
    padding-bottom: 10px;
}

.sw-row--colhead {
    --sw-ind: var(--sw-pad);
}

.sw-row--subhead {
    padding-top: 4px;
    padding-bottom: 4px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--muted);
}

/* 공통 summary 초기화 (기본 삼각형 제거, 한 줄 flex) */
.sw-list summary {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.sw-list summary::-webkit-details-marker {
    display: none;
}

.sw-list summary:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

/* ▼(펼침) / ▶(접힘). select 화살표와 같은 chevron 을 회전해서 사용 */
.sw-chevron {
    flex: none;
    width: 12px;
    height: 12px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%23738099' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5 6 6.5 11 1.5'/%3E%3C/svg%3E") center / 12px 8px no-repeat;
    transform: rotate(-90deg);
    transition: transform .12s ease;
}

.sw-list details[open] > summary > .sw-chevron {
    transform: none;
}

/* 카테고리: 가장 강한 구분. 연한 파랑 배경 */
.sw-cat__head {
    padding: 9px var(--sw-pad);
    background: var(--primary-soft);
    border-bottom: 1px solid var(--sw-head-border);
    font-size: 14px;
    font-weight: 700;
    color: var(--text-strong);
}

.sw-cat__head:hover {
    background: #e2edfc;
}

/* 브랜드: 카테고리보다 한 단계 약함. 회청색 배경 + 한 단계 들여쓰기 */
.sw-brand__head {
    padding: 7px var(--sw-pad) 7px calc(var(--sw-pad) + var(--sw-step));
    background: var(--surface-alt);
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}

.sw-brand__head:hover {
    background: #e9eff7;
}

/* 제품: 흰 배경 + 굵은 제품명 + 총 수량 badge */
.sw-product__head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px var(--sw-pad) 7px calc(var(--sw-pad) + 2 * var(--sw-step));
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-strong);
}

/* 접히지 않는 제품 헤더: chevron 자리를 비워 제품명 위치를 맞춘다 */
.sw-product__head--static {
    padding-left: calc(var(--sw-pad) + 2 * var(--sw-step) + var(--sw-chev));
}

summary.sw-product__head:hover {
    background: #f8fafd;
}

/* 열린 제품의 버전 영역은 살짝 구분 */
.sw-versions {
    background: #fbfcfe;
}

/* 버전 1개짜리 제품 한 줄: 제품명 위치를 접히는 제품과 맞춘다 */
.sw-row--product {
    --sw-ind: calc(var(--sw-pad) + 2 * var(--sw-step) + var(--sw-chev));
}

.sw-row--product .sw-cell--ver {
    font-weight: 600;
    color: var(--text-strong);
}

.sw-list a.sw-name {
    color: inherit;
    text-decoration: none;
}

.sw-list a.sw-name:hover {
    color: var(--primary);
    text-decoration: underline;
}

.sw-vtag {
    display: inline-block;
    margin-left: 4px;
    padding: 0 8px;
    border-radius: var(--radius-pill);
    background: var(--surface-alt);
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.7;
    vertical-align: middle;
}

/* 라이선스 형태 셀의 "구독형" 글자 강조 */
.sw-license--sub {
    color: #7C3AED;
    font-weight: 600;
}

/* 구독형 행/그룹 제목: 제품명·버전·기간·수량 글자색만 보라색. 굵기·배경·상세 링크(.link-action)·
   "총 N" 배지는 기존 스타일 유지. 제품명(.sw-row--product .sw-cell--ver)과 버전 태그(.sw-vtag)의
   기존 색상보다 우선하도록 .sw-list 로 한정한다. 기간/수량 셀은 좁은 폭(@container)에서
   --muted 로 바뀌므로 명시한다 (모바일 "수량 " 라벨(::before)은 회색 유지). */
.sw-list .sw-subscribed,
.sw-list .sw-subscribed .sw-cell--ver,
.sw-list .sw-subscribed .sw-cell--period,
.sw-list .sw-subscribed .sw-cell--qty,
.sw-list .sw-subscribed .sw-vtag {
    color: #7C3AED;
}

.sw-list .badge--total {
    margin-left: 0;
    background: var(--primary-soft);
    color: var(--primary-dark);
    border: 1px solid var(--sw-head-border);
}

.sw-cat__head .badge--total {
    background: var(--surface);
}

/* 좁은 폭(모바일/작은 창): 열 헤더를 숨기고 행을 스택으로 */
@container sw-list (max-width: 760px) {
    .sw-list__body {
        --sw-step: 10px;
        --sw-pad: 12px;
    }

    .sw-row {
        grid-template-columns: auto minmax(0, 1fr) auto auto;
        grid-template-areas:
            "ver    ver    qty  act"
            "type   period period period";
        row-gap: 2px;
    }

    .sw-row--colhead,
    .sw-row--subhead {
        display: none;
    }

    .sw-cell--type,
    .sw-cell--period {
        font-size: 12px;
        color: var(--muted);
    }

    /* 2번째 줄을 첫 줄(버전/제품명) 시작 위치에 맞춘다 */
    .sw-cell--type {
        padding-left: var(--sw-ind);
    }

    /* 데스크톱 전용 가운데 정렬(비율 조정)을 스택 레이아웃에서는 되돌린다 */
    .sw-cell--type,
    .sw-cell--period {
        text-align: left;
    }

    .sw-cell--qty {
        text-align: right;
        font-weight: 600;
    }

    .sw-cell--qty::before {
        content: "수량 ";
        font-weight: 400;
        color: var(--muted);
    }

}

/* ==========================================================================
   12-2. 소프트웨어 목록 검색/필터 (한 줄 GET 폼, 좁으면 줄바꿈)
   .filter-bar / .field / .btn 을 그대로 쓰고 배치만 잡는다.
   ========================================================================== */
.sw-filter__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.sw-filter .field {
    margin: 0;
}

.sw-filter__q {
    flex: 1 1 200px;
    min-width: 0;
}

.sw-filter__select {
    flex: 0 1 150px;
    min-width: 0;
}

.sw-filter .btn {
    min-height: 44px;
    padding-left: 20px;
    padding-right: 20px;
}

.sw-result-info {
    margin: 0 2px 12px;
    font-size: 13px;
    color: var(--muted);
}

.sw-result-info strong {
    color: var(--text-strong);
}

/* 구독 사용자 현황: 카드 제목 아래 "총수량/적용수량 X/Y" 요약 */
.card__summary {
    margin: 0;
    padding: 12px 18px;
    font-size: 13px;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
}

.card__summary strong {
    color: var(--text-strong);
}

.card__summary-note {
    margin-left: 8px;
}

/* 전직원 사용 중 보존된 개별 배정 안내 */
.card__summary--sub {
    font-size: 12px;
    background: var(--surface-alt);
}

/* 표/목록 헤더의 보조 설명 ("구독형: 총수량/적용수량") */
.th-note,
.sw-colhead__note {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: var(--muted);
    white-space: nowrap;
}

/* 전직원 사용 표시 (구독형 보라색 계열) */
.badge--all-staff {
    background: #f3e8ff;
    color: #7C3AED;
    border: 1px solid #ddd6fe;
}

/* 좁은 폭 목록: 구독형 수량 앞 라벨을 "총/적용" 으로 (기본은 "수량 ") */
@container sw-list (max-width: 760px) {
    .sw-list .sw-subscribed .sw-cell--qty::before {
        content: "총/적용 ";
    }
}

/* 사용자 추가: "전직원 사용" 체크박스 옵션. 전역 input 스타일(appearance:none 등)을
   체크박스에서만 되돌린다. */
.check-option {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.check-option:hover,
.check-option:has(input[type="checkbox"]:checked) {
    border-color: #7C3AED;
}

.check-option:has(input[type="checkbox"]:checked) {
    background: #faf5ff;
}

.check-option input[type="checkbox"] {
    appearance: auto;
    -webkit-appearance: checkbox;
    flex: none;
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
    accent-color: #7C3AED;
    cursor: pointer;
}

.check-option input[type="checkbox"]:focus {
    box-shadow: none;
}

.check-option input[type="checkbox"]:focus-visible {
    outline: 2px solid #7C3AED;
    outline-offset: 2px;
}

.check-option__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.check-option__title {
    font-weight: 600;
    color: var(--text-strong);
}

.check-option__desc {
    font-size: 12px;
    color: var(--muted);
}

/* 비활성화된 사용자 정보 입력(전직원 사용 체크 시) */
fieldset:disabled .field input {
    background: var(--surface-alt);
    color: var(--muted);
    cursor: not-allowed;
}

.form__actions--card {
    padding: 12px 18px;
    align-items: center;
}

.form__actions--card form {
    margin: 0;
}

.empty-state__action {
    margin-top: 12px;
}

/* 검색 결과 0건: 기본 empty-state(세로 44px)보다 여백을 줄인 변형 */
.empty-state--compact {
    padding: 28px 20px;
}

@media (max-width: 560px) {
    .sw-filter__q {
        flex-basis: 100%;
    }

    .sw-filter__select {
        flex: 1 1 calc(50% - 5px);
    }

    .sw-filter .btn {
        flex: 1 1 calc(50% - 5px);
    }
}

/* ==========================================================================
   12-3. 관리자 계정 목록 (표가 넓어지지 않도록 긴 값은 말줄임)
   ========================================================================== */
/* 열 너비는 colgroup 비율로 고정하고(fixed), 넘치는 값은 셀 폭에 맞춰 말줄임한다.
   최소 폭 아래에서는 .table-wrap 이 가로 스크롤을 처리한다. */
.acct-table {
    table-layout: fixed;
    min-width: 1040px;
}

.acct-table thead th,
.acct-table tbody td {
    padding-left: 12px;
    padding-right: 12px;
    overflow: hidden;
}

.acct-ellipsis {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}

/* 관리자 ID 옆 "복사" 버튼 자리를 남긴다 */
.acct-ellipsis--id {
    max-width: calc(100% - 44px);
}

.acct-name {
    font-weight: 600;
    color: var(--text-strong);
}

/* 조회된 비밀번호가 길면 셀 안에서 줄바꿈되도록 이 셀만 wrap 허용 */
.acct-table td.acct-pw-cell {
    white-space: normal;
}

.acct-pw {
    display: inline-block;
    min-width: 76px;
    margin-right: 4px;
    font-family: var(--mono);
    letter-spacing: .04em;
    color: var(--muted);
}

/* 조회된 비밀번호: 길면 줄바꿈해서 표를 넓히지 않는다 */
.acct-pw.is-revealed {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    letter-spacing: 0;
    color: var(--text-strong);
    user-select: all;
}

.acct-table .link-action:disabled {
    opacity: .5;
    cursor: default;
}

/* ==========================================================================
   12-4. GWS 구독 (메인 화면 전용). 색상/폰트/버튼/카드/배지는 기존 토큰만 재사용하고,
   이 파일의 다른 화면 스타일은 건드리지 않는다. 사이드바 유무에 따라 실제 카드 폭이
   달라지므로(뷰포트 폭만으로는 부정확) .sw-list 와 동일하게 컨테이너 쿼리로 반응한다.
   ========================================================================== */
.gws-dashboard {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

/* .gws-dashboard 는 flex gap 으로 섹션 간격을 이미 확보하므로, 기존 컴포넌트의
   기본 margin 은 이중으로 더해지지 않도록 무력화한다. */
.gws-dashboard > .page-head {
    margin-bottom: 0;
}

.gws-dashboard > .card + .card {
    margin-top: 0;
}

.gws-basis-note {
    margin-left: 8px;
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
}

.gws-card__title-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ── 현재 계약: 라벨/값 정보 그리드 (세로 목록 대신 여러 열로 배치) ───────── */
.gws-card {
    container: gws-card / inline-size;
}

.gws-contract-grid {
    margin: 0;
    padding: 20px 22px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px 24px;
}

.gws-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.gws-field__label {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--muted);
}

.gws-field__value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-strong);
    line-height: 1.4;
    overflow-wrap: break-word;
}

/* ── 예산 현황: 주요 지표(3) + 진행률 + 보조 지표(2) 를 한 카드 안에 ───────── */
.gws-budget-body {
    padding: 20px 22px 22px;
}

.gws-budget-primary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0 24px;
}

.gws-stat {
    min-width: 0;
    padding: 2px 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.gws-budget-primary .gws-stat + .gws-stat {
    padding-left: 24px;
    border-left: 1px solid var(--border);
}

.gws-stat__label {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
}

.gws-stat__value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-strong);
    font-variant-numeric: tabular-nums;
    overflow-wrap: break-word;
}

.gws-stat__value--danger {
    color: var(--danger-dark);
}

.gws-stat__unit {
    margin-left: 3px;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
}

.gws-stat--sub .gws-stat__value {
    font-size: 16px;
}

.gws-stat--sub .gws-stat__label {
    font-size: 11.5px;
}

/* 진행률: 금액 문구는 절대 말줄임하지 않는다(자연 줄바꿈만 허용) — 기존 .cat-row__name
   의 nowrap+ellipsis 조합을 여기서는 의도적으로 쓰지 않는다. */
.gws-progress {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

.gws-progress__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin-bottom: 10px;
}

.gws-progress__caption {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    overflow-wrap: break-word;
}

.gws-progress__pct {
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    white-space: nowrap;
}

.gws-progress__pct-value {
    margin-left: 6px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-strong);
    font-variant-numeric: tabular-nums;
}

.gws-progress__bar {
    height: 16px;
    background: var(--surface-alt);
    border-radius: var(--radius-pill);
    overflow: hidden;
}

.gws-progress__fill {
    display: block;
    height: 100%;
    min-width: 3px;
    max-width: 100%;
    background: var(--primary);
    border-radius: var(--radius-pill);
}

.gws-progress__fill--over {
    background: var(--danger);
}

.gws-progress-empty {
    margin: 18px 0 0;
    padding-top: 18px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 13px;
}

.gws-budget-secondary {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px 24px;
}

/* ── 월별 사용 내역 표: 정렬/강조/관리 영역만 보강(열·데이터는 그대로) ───── */
.gws-usage-table thead th {
    border-bottom: 2px solid var(--border-strong);
}

.gws-usage-table th,
.gws-usage-table td {
    padding-left: 12px;
    padding-right: 12px;
}

.gws-col-center {
    text-align: center;
}

.gws-billing-month {
    font-weight: 700;
    color: var(--text-strong);
    white-space: nowrap;
}

.gws-row-actions {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

/* 카드 폭(사이드바 유무와 무관하게 실측)이 좁아지면 열 수를 단계적으로 줄인다. */
@container gws-card (max-width: 760px) {
    .gws-contract-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .gws-budget-primary {
        grid-template-columns: 1fr;
        gap: 14px 0;
    }

    .gws-budget-primary .gws-stat + .gws-stat {
        padding-left: 0;
        padding-top: 14px;
        border-left: 0;
        border-top: 1px solid var(--border);
    }

    .gws-budget-secondary {
        grid-template-columns: 1fr;
        gap: 14px 0;
    }
}

@container gws-card (max-width: 420px) {
    .gws-contract-grid {
        grid-template-columns: 1fr;
    }
}

/* GWS 월별 사용 내역 폼의 처리 상태 체크박스. `.field input`/`.software-form .field input`
   의 appearance:none·min-height·padding 이 체크박스를 세로로 늘이고 체크 표시를 지우므로
   `.field` 밖에 두고 네이티브 체크박스로 명시적으로 되돌린다. */
.gws-status-options {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.gws-status-option {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.gws-status-option:hover {
    border-color: var(--primary);
}

.gws-status-option:has(input[type="checkbox"]:checked) {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.gws-status-option input[type="checkbox"] {
    appearance: auto;
    -webkit-appearance: checkbox;
    flex: none;
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
    accent-color: var(--primary);
    cursor: pointer;
}

.gws-status-option input[type="checkbox"]:focus {
    box-shadow: none;
}

.gws-status-option input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.gws-status-option__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.gws-status-option__title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-strong);
}

.gws-status-option__desc {
    font-size: 12px;
    color: var(--muted);
}

/* GWS 월별 사용 내역 폼의 계산서 첨부 영역 + 목록의 첨부 열 */
.gws-invoice {
    display: grid;
    gap: 12px;
}

.gws-invoice__current {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
    padding: 12px 14px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.gws-invoice__file {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.gws-invoice__label {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
}

.gws-invoice__name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-strong);
    overflow-wrap: anywhere;
}

.gws-invoice__meta {
    font-size: 12px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.gws-invoice__actions {
    display: inline-flex;
    flex: none;
    gap: 14px;
}

.gws-invoice__upload {
    margin-bottom: 0;
}

.gws-invoice__upload input[type="file"] {
    cursor: pointer;
}

.gws-invoice-none {
    font-size: 12.5px;
    color: var(--muted);
}

/* 청구서 금액 자동 대조: 목록 셀(<details>)과 수정 화면 패널 */
.gws-check {
    margin-top: 4px;
    text-align: left;
}

.gws-check > summary {
    list-style: none;
    cursor: pointer;
    text-align: center;
}

.gws-check > summary::-webkit-details-marker {
    display: none;
}

.gws-check > summary:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: var(--radius-pill);
}

.gws-check .gws-check__badge {
    margin-left: 0;
    white-space: nowrap;
}

.gws-check__detail {
    margin-top: 8px;
}

.gws-check__table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.gws-check__table th,
.gws-check__table td {
    padding: 4px 8px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    text-align: left;
}

.gws-check__table .num {
    text-align: right;
}

.gws-check__row--mismatch td {
    color: var(--danger);
    font-weight: 600;
}

.gws-check__row--missing td,
.gws-check__row--multiple td,
.gws-check__row--unregistered td {
    color: var(--warning);
}

.gws-check__note {
    margin: 6px 0 0;
    font-size: 12px;
    color: var(--muted);
    white-space: normal;
}

.gws-check--panel {
    margin-top: 0;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    overflow-x: auto;
}

.gws-check__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

/* 추가 청구(정정 추가금 등) */
.gws-stat__sub {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    color: var(--muted);
}

.gws-budget-note {
    grid-column: 1 / -1;
    margin: 4px 0 0;
    font-size: 12px;
    color: var(--muted);
}

.gws-paygroups {
    display: grid;
    gap: 12px;
    margin-bottom: 16px;
}

.gws-paygroup {
    padding: 12px 14px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.gws-paygroup__title {
    margin: 0 0 8px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-strong);
}

.gws-paygroup__list {
    display: grid;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.gws-payitem {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 6px 12px;
    padding: 8px 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.gws-payitem .gws-payitem__kind {
    margin-left: 0;
    white-space: nowrap;
}

.gws-payitem__desc {
    font-size: 13px;
    color: var(--text);
    overflow-wrap: anywhere;
}

.gws-payitem__amount {
    font-weight: 700;
    color: var(--text-strong);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.gws-payitem--empty .gws-payitem__desc {
    color: var(--muted);
}

.gws-paygroup__sum {
    margin: 8px 0 0;
    font-size: 12px;
    color: var(--muted);
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.gws-extra-targets {
    white-space: normal;
    min-width: 140px;
}

.gws-target-chip {
    display: inline-block;
    margin: 1px 4px 1px 0;
    padding: 1px 8px;
    font-size: 12px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    white-space: nowrap;
}

.gws-target-chip__amount {
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.gws-unconfirmed {
    font-size: 12px;
    color: var(--muted);
}

.gws-extra-hint {
    margin: 0 0 12px;
}

.gws-target-rows {
    display: grid;
    gap: 10px;
}

.gws-target-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 28px;
}

.gws-target-row .field {
    margin-bottom: 0;
}

.gws-target-row__error {
    grid-column: 1 / -1;
}

@media (max-width: 640px) {
    .gws-payitem {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .gws-payitem__desc {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    .gws-target-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}

@media (max-width: 640px) {
    .gws-status-options {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   13. 반응형
   ========================================================================== */
@media (max-width: 960px) {
    .app-body {
        display: block;
    }

    .app-sidebar {
        position: static;
        height: auto;
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 8px 12px;
        overflow-x: auto;
    }

    .side-nav {
        flex-direction: row;
        gap: 6px;
    }

    .side-nav__item {
        padding: 8px 12px;
    }

    .app-main {
        padding: 22px 20px 44px;
    }

    /* 960px 이하: 폼은 항상 1열 */
    .form__grid {
        grid-template-columns: 1fr;
        row-gap: 4px;
    }

    .form__grid .field {
        margin-bottom: 14px;
    }

    .software-form {
        padding: 18px;
    }
}

@media (max-width: 720px) {
    .app-header {
        flex-wrap: wrap;
        padding: 10px 16px;
        gap: 10px;
    }

    .app-header__subtitle {
        display: none;
    }

    .kpi-grid {
        grid-template-columns: 1fr 1fr;
    }

    .dash-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .app-main {
        padding: 18px 14px 40px;
    }

    .form {
        padding: 16px;
    }

    .form__grid {
        grid-template-columns: 1fr;
        row-gap: 4px;
    }

    .form__grid .field {
        margin-bottom: 12px;
    }

    .field--inline {
        flex-direction: column;
        gap: 0;
    }

    .form__actions {
        flex-direction: column-reverse;
    }

    .form__actions .btn {
        width: 100%;
    }

    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .detail-list {
        grid-template-columns: 108px 1fr;
    }

    .side-nav__item span {
        display: none;
    }

    .side-nav__item {
        padding: 8px 10px;
    }

    /* GWS 구독: 페이지 헤더 버튼을 2열로(요청 시 세로 전체폭도 자연스럽게 이어짐) */
    .gws-dashboard .page-head__actions {
        width: 100%;
    }

    .gws-dashboard .page-head__actions .btn {
        flex: 1 1 calc(50% - 4px);
    }
}

/* ==========================================================================
   PWA 설치 안내 버튼 — beforeinstallprompt 가 발생했을 때만 JS 가 [hidden] 을 해제한다.
   ========================================================================== */
.pwa-install-btn {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 18px;
    border: none;
    border-radius: var(--radius-pill);
    background: var(--primary);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font);
    box-shadow: var(--shadow);
    cursor: pointer;
}

.pwa-install-btn:hover {
    background: var(--primary-dark);
}

.pwa-install-btn svg {
    width: 16px;
    height: 16px;
    flex: none;
}

/* ---------------------------------------------------------------------------
   SW 검증: CSV 내보내기 · AI 조사 초안 미리보기 (긴 문자열은 줄바꿈하고, 원본 게시자는 접어서 표시)
   표시만 접는다. 저장·내보내기·매칭에 쓰는 값은 템플릿의 원문 그대로다.
   --------------------------------------------------------------------------- */
.sw-counts { padding: 14px 18px; }
.sw-counts p + p { margin-top: 6px; }
.sw-toolbar {
    display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center;
    padding: 12px 18px; border-bottom: 1px solid var(--border);
}
.sw-toolbar__count { color: var(--text); font-weight: 600; }
.sw-toolbar__hint { color: var(--muted); font-size: 13px; }
.sw-prewrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.sw-compact-list { margin: 6px 0 0; padding-left: 18px; }
.sw-compact-list li + li { margin-top: 6px; }
.sw-url, .sw-long__text { overflow-wrap: anywhere; word-break: break-word; }
.sw-url { display: block; color: var(--muted); font-size: 12px; }
.sw-cell-wide { max-width: 320px; min-width: 180px; }
.sw-long { margin-top: 4px; }
.sw-long > summary {
    cursor: pointer; color: var(--primary-dark); font-size: 13px; list-style: none;
}
.sw-long > summary::-webkit-details-marker { display: none; }
.sw-long > summary::before { content: "▸ "; }
.sw-long[open] > summary::before { content: "▾ "; }
.sw-long__text {
    margin-top: 4px; padding: 8px 10px; border-radius: var(--radius-sm);
    background: var(--surface-alt); color: var(--text); white-space: pre-wrap;
}
.sw-export { padding: 14px 18px; display: grid; gap: 8px; }
.sw-export__actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sw-export__message { margin: 0; color: var(--danger-dark); min-height: 1em; font-size: 13px; }
.sw-draft { padding-bottom: 6px; }
.sw-draft .detail-list dd { overflow-wrap: anywhere; }
.sw-draft__owner { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.sw-research-table { table-layout: fixed; width: 100%; white-space: normal; }
.sw-research-table td { vertical-align: top; white-space: normal; overflow-wrap: anywhere; word-break: break-word; }
.sw-research-table th:nth-child(1) { width: 64px; }
.sw-research-table th:nth-child(2) { width: 22%; }
.sw-research-table th:nth-child(3) { width: 17%; }
.sw-research-table th:nth-child(4) { width: 14%; }
.sw-research-table th:nth-child(5) { width: 28%; }
.sw-research-table th:nth-child(6) { width: 12%; }

/* GWS 추가 청구 ↔ 정기 청구서 합산 표시: 연결 배지, 공유 첨부 안내, 합산 대조 범위 */
.badge--info {
    background: var(--primary-soft);
    color: var(--primary);
    border: 1px solid var(--primary-soft);
}

.gws-invoice[hidden] {
    display: none;
}

.gws-invoice-shared {
    margin-top: 4px;
    font-size: 12px;
    color: var(--primary);
}

.gws-check__scope {
    margin-bottom: 8px;
}

.gws-check__scope-line {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
}
