/* 화면 셸 (TASK-SYS-014). 밝은 테마 하나 — 그리드 패키지 색 토큰 기본값을 쓴다 (결정 T-178 ④). */
/* 제품 글꼴 Noto Sans KR (OFL) — PDF 와 같은 파일 (TASK-SYS-019, T-321). */
@font-face { font-family: "Noto Sans KR"; font-weight: 400; font-display: swap; src: url("fonts/NotoSansKR-Regular.ttf") format("truetype"); }
@font-face { font-family: "Noto Sans KR"; font-weight: 700; font-display: swap; src: url("fonts/NotoSansKR-Bold.ttf") format("truetype"); }

:root {
    --shell-bg: #f6f7f9;
    --shell-panel: #ffffff;
    --shell-line: #d7dbe2;
    --shell-text: #1f2430;
    --shell-muted: #5b6475;
    --shell-accent: #0049A8;
    --shell-top: #0049A8;
    --shell-brand-dark: #0049A8;
    --shell-brand-light: #2581CE;
    --shell-menu-bg: #f2f5fa;
    --shell-tabbar-bg: #e9edf3;
    --shell-selected: #dde7f6;
    --shell-error: #c62828;
    --shell-error-bg: #fdecea;
    font-family: "Noto Sans KR", system-ui, sans-serif;
    font-size: 14px;
    color: var(--shell-text);
    background: var(--shell-bg);
}

body { margin: 0; }

/* 바탕 화면 (TASK-SYS-018 · 019): 상단 = 메뉴 단추 · Q 마크 · 제품 이름 · 모듈 · 사용자 메뉴 (진한 파랑), 왼쪽 = 고른 모듈 메뉴, 가운데 = 탭 화면. */
.shell { display: grid; grid-template-columns: 240px 1fr; grid-template-rows: 48px 1fr; height: 100vh; }
.shell[data-menu-hidden="true"] { grid-template-columns: 0 1fr; }
.shell-top { grid-column: 1 / 3; display: flex; align-items: center; gap: 12px; padding: 0 16px 0 8px; background: var(--shell-top); color: #fff; }
.shell-top .shell-user { margin-left: auto; }
.shell-top .shell-user-name { color: #fff; }
.shell-home-link { display: inline-flex; color: inherit; text-decoration: none; margin-right: 16px; }
.shell-menu-toggle { display: inline-flex; padding: 2px; border: none; background: none; cursor: pointer; }
.shell-menu-toggle .shell-icon img { width: 30px; height: 30px; }
.shell-company { font-weight: 700; white-space: nowrap; }
.shell-modules { display: flex; align-self: stretch; }
.shell-module { padding: 0 16px; border: none; background: none; color: #fff; font: inherit; font-size: 15px; cursor: pointer; }
.shell-module[aria-current="true"] { background: rgb(255 255 255 / 18%); font-weight: 700; }
.shell-menu { background: var(--shell-menu-bg); border-right: 1px solid var(--shell-line); padding: 8px 4px; overflow: auto; }
.shell-menu[hidden] { display: none; }
.shell-menu-list { list-style: none; margin: 0; padding-left: 12px; }
.shell-menu > .shell-menu-list { padding-left: 4px; }
.shell-menu-item summary { display: flex; align-items: center; gap: 6px; padding: 4px 6px; cursor: pointer; }
.shell-menu-item a { display: block; padding: 4px 6px 4px 28px; color: var(--shell-text); text-decoration: none; border-radius: 4px; }
.shell-menu-item a.active { background: var(--shell-selected); color: var(--shell-accent); font-weight: 700; }
.shell-main { display: flex; flex-direction: column; min-width: 0; overflow: auto; }
.shell-main > .screen, .shell-main > .shell-notice, .shell-tab-page { padding: 8px 16px; }
.shell-tab-page[hidden] { display: none; }
/* 그리드 높이 (TASK-SYS-021): 화면이 창 높이를 채우고, 화면에 바로 놓인 그리드가 남은 높이를 나눠 가져 그 안에서 위아래로 스크롤한다 (머리 행 고정).
   창이 낮아 최소 높이를 못 채우면 화면 전체가 스크롤된다. 대화 상자 · 양식 안 그리드는 그대로. */
.shell-tab-page:not([hidden]) { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.shell-tab-page > .screen, .shell-main > .screen { flex: 1 1 auto; min-height: 0; }
.screen > .screen-grid { flex: 1 1 0; min-height: 240px; display: flex; flex-direction: column; align-items: flex-start; }
.screen > .screen-grid > .shell-grid-tools { align-self: stretch; }
.screen > .screen-grid > .quro-grid, .screen > .screen-grid > .quro-grid-frame > .quro-grid { flex: 1 1 0; min-height: 0; }
.screen > .screen-grid > .quro-grid-frame[data-scroll-buttons] { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; }

/* 탭 막대 (메모 §2) */
.shell-tabbar { display: flex; align-items: flex-end; gap: 2px; padding: 6px 8px 0; background: var(--shell-tabbar-bg); border-bottom: 1px solid var(--shell-line); }
.shell-tabbar-tab { display: inline-flex; align-items: center; border: 1px solid var(--shell-line); border-bottom: none; border-radius: 4px 4px 0 0; background: var(--shell-bg); }
.shell-tabbar-tab[aria-selected="true"] { background: var(--shell-panel); border-top: 3px solid var(--shell-top); font-weight: 700; }
.shell-tabbar-name { padding: 4px 4px 4px 10px; border: none; background: none; font: inherit; color: var(--shell-text); cursor: pointer; }
.shell-tabbar-dirty { margin-left: 2px; color: var(--shell-accent); }
.shell-tabbar-close { display: inline-flex; padding: 4px 6px; border: none; background: none; color: var(--shell-muted); cursor: pointer; }
.shell-tabbar-tools { margin-left: auto; display: inline-flex; gap: 2px; padding-bottom: 2px; }

/* 아이콘 (결정 T-324 · T-325): 직접 만든 아이콘 34 px 상태 그림, Tabler 는 글자색 그림 */
.shell-icon { display: inline-flex; flex: none; }
.shell-icon-command img { width: 34px; height: 34px; }
.shell-icon-command .shell-icon-hover, .shell-icon-command .shell-icon-disabled { display: none; }
button:hover:not(:disabled) > .shell-icon-command .shell-icon-normal { display: none; }
button:hover:not(:disabled) > .shell-icon-command .shell-icon-hover { display: inline; }
button:disabled > .shell-icon-command .shell-icon-normal { display: none; }
button:disabled > .shell-icon-command .shell-icon-disabled { display: inline; }
.shell-icon-tabler { width: 18px; height: 18px; background: currentColor; -webkit-mask: var(--shell-icon-url) center / contain no-repeat; mask: var(--shell-icon-url) center / contain no-repeat; }
.shell-tool { display: inline-flex; align-items: center; padding: 3px; border: 1px solid transparent; border-radius: 4px; background: none; color: var(--shell-muted); cursor: pointer; }
.shell-tool:hover:not(:disabled) { border-color: var(--shell-line); color: var(--shell-text); }
.shell-tool:disabled { opacity: 0.4; cursor: not-allowed; }
.shell-tool[aria-pressed="true"] { background: var(--shell-selected); color: var(--shell-accent); }
/* 사용자 메뉴 "이름 ▼" 펼침 (T-323). */
.shell-user { position: relative; }
.shell-user-name { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; cursor: pointer; list-style: none; font-size: 15px; }
.shell-user-name::-webkit-details-marker { display: none; }
.shell-user-name::after { content: ""; border: 5px solid transparent; border-top-color: currentColor; margin-top: 5px; }
.shell-user-panel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; display: flex; flex-direction: column; gap: 10px; min-width: 200px; padding: 12px; background: var(--shell-panel); color: var(--shell-text); border: 1px solid var(--shell-line); border-radius: 6px; box-shadow: 0 4px 16px rgb(0 0 0 / 15%); }
.shell-user-panel .shell-company { font-weight: 700; padding-bottom: 8px; border-bottom: 1px solid var(--shell-line); }
.shell-user-panel a { color: var(--shell-accent); }
.shell-user-language { display: flex; flex-direction: column; gap: 4px; color: var(--shell-muted); font-size: 12px; }
.shell-user form { margin: 0; }

.shell-button { padding: 4px 12px; border: 1px solid var(--shell-line); border-radius: 4px; background: var(--shell-panel); color: var(--shell-text); cursor: pointer; text-decoration: none; }
.shell-button:disabled { opacity: 0.45; cursor: not-allowed; }
/* 명령 막대 단추 = 아이콘 (34 px) + 아래 글자 (결정 T-317 · T-324) */
.screen-commands .shell-button { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; min-width: 56px; padding: 2px 6px; border: none; background: none; font-size: 12px; }
.screen-commands .shell-button:disabled { opacity: 1; color: var(--shell-muted); }
.screen-commands .shell-button .shell-icon-tabler { width: 34px; height: 34px; color: var(--shell-accent); }
.screen-commands .shell-button:disabled .shell-icon-tabler { color: #b8bec9; }
/* 표준 단추 순서 (T-326): 단추는 style order, 단추가 아닌 것 (예: 출력 언어) 은 출력 앞 */
.screen-commands > * { order: 115; }
.screen-commands > .shell-button { align-self: flex-start; }

.screen { display: flex; flex-direction: column; gap: 8px; }
.screen-title { display: flex; align-items: center; gap: 12px; }
.screen-title h1 { font-size: 18px; margin: 0; }
.screen-commands { display: flex; gap: 6px; flex-wrap: wrap; padding: 6px 0; border-bottom: 1px solid var(--shell-line); }
.screen-conditions, .screen-form, .screen-process { display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 8px; background: var(--shell-panel); border: 1px solid var(--shell-line); border-radius: 4px; }
.screen-totals { display: flex; gap: 16px; justify-content: flex-end; }
.screen-audit { display: flex; gap: 16px; color: var(--shell-muted); font-size: 12px; }
.screen-results { border-collapse: collapse; width: 100%; background: var(--shell-panel); }
.screen-results th, .screen-results td { border: 1px solid var(--shell-line); padding: 4px 8px; text-align: left; }

.shell-field { display: flex; flex-direction: column; gap: 2px; min-width: 180px; }
.shell-field-label { color: var(--shell-muted); font-size: 12px; }
.shell-field-error .quro-ui-input, .shell-field-error input { border-color: var(--shell-error); background: var(--shell-error-bg); }
.shell-field-message, .shell-error { color: var(--shell-error); }
.shell-notice, .shell-hint { color: var(--shell-muted); }

/* 브랜드 (T-321): Q 마크 + 제품 이름 (Noto Sans KR Bold). */
.shell-brand { display: inline-flex; align-items: center; gap: 8px; }
.shell-brand[data-stacked="true"] { flex-direction: column; gap: 20px; }
.shell-brand-mark { height: 32px; width: auto; }
.shell-brand[data-size="large"] .shell-brand-mark { height: 120px; }
.shell-brand-name { font-weight: 700; font-size: 20px; white-space: nowrap; }
.shell-brand[data-size="large"] .shell-brand-name { font-size: 44px; line-height: 1.1; }

/* 첫 화면 (T-323): 파랑 Q 마크 + 환영 문장. */
.shell-home { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; min-height: 60vh; text-align: center; }
.shell-welcome { margin: 8px 0 0; font-size: 24px; color: var(--shell-brand-dark); }

/* 로그인 전 화면 (SYS-UI-012 v0.2, T-322): 왼쪽 그라데이션 브랜드 · 오른쪽 양식 · 아래 권리 표시. 좁은 화면은 위쪽 띠. */
.public-main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 100vh; }
.public-brand { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 32px; color: #fff; background: linear-gradient(90deg, var(--shell-brand-light), var(--shell-brand-dark)); }
.public-tagline { margin: 0; font-size: 20px; opacity: 0.9; }
.public-side { display: flex; flex-direction: column; align-items: center; padding: 32px 24px 24px; background: var(--shell-bg); }
.public-body { flex: 1; display: flex; flex-direction: column; justify-content: center; width: 100%; max-width: 380px; }
.public-form-box h1 { margin: 0 0 24px; font-size: 32px; }
.public-form { display: flex; flex-direction: column; gap: 6px; }
.public-form label { margin-top: 12px; color: var(--shell-muted); }
.public-form input, .public-form select { box-sizing: border-box; width: 100%; height: 48px; padding: 0 12px; border: 1px solid #c3c9d4; border-radius: 4px; background: var(--shell-panel); font: inherit; font-size: 18px; }
.public-form button[type="submit"] { margin-top: 28px; height: 54px; border: none; border-radius: 4px; background: var(--shell-brand-dark); color: #fff; font: inherit; font-size: 18px; font-weight: 700; cursor: pointer; }
.public-form button[type="submit"]:hover { background: var(--shell-brand-light); }
.public-form-box > form:not(.public-form) { margin-top: 12px; }
.public-copyright { margin: 24px 0 0; color: var(--shell-muted); font-size: 13px; }
@media (max-width: 800px) {
    .public-main { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
    .public-brand { flex-wrap: wrap; }
    .public-brand { flex-direction: row; gap: 16px; padding: 16px; background: linear-gradient(90deg, var(--shell-brand-light), var(--shell-brand-dark)); }
    .public-brand .shell-brand[data-stacked="true"] { flex-direction: row; gap: 10px; }
    .public-brand .shell-brand[data-size="large"] .shell-brand-mark { height: 40px; }
    .public-brand .shell-brand[data-size="large"] .shell-brand-name { font-size: 22px; }
    .public-tagline { font-size: 14px; }
    .public-side { padding: 24px 16px 16px; }
}
/* 찾기 칸 · 찾기 팝업 (결정 T-188 · T-278) */
.shell-finder { display: inline-flex; align-items: center; gap: 4px; position: relative; }
.shell-finder-name { color: var(--shell-muted, inherit); }
.shell-finder-message { color: var(--shell-error, #b00020); font-size: 0.9em; }
.shell-finder-popup { position: absolute; z-index: 20; min-width: 360px; max-height: 320px; overflow: auto; padding: 8px; border: 1px solid var(--shell-line); border-radius: 4px; background: var(--shell-panel); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2); }
.shell-finder-search { display: flex; gap: 4px; margin-bottom: 4px; }
.shell-finder-list { border-collapse: collapse; width: 100%; }
.shell-finder-list td { padding: 2px 6px; border-bottom: 1px solid var(--shell-line); cursor: pointer; }
/* 확인 대화 상자 (결정 T-273) */
.shell-dialog { position: fixed; z-index: 30; top: 30%; left: 50%; transform: translateX(-50%); min-width: 320px; padding: 16px; border: 1px solid var(--shell-line); border-radius: 6px; background: var(--shell-panel); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25); }
.shell-dialog-commands { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.shell-link { border: none; background: none; padding: 0; color: inherit; text-decoration: underline; cursor: pointer; }
.shell-hint { margin: 4px 0; color: var(--shell-muted, inherit); }
.screen-notices { margin: 4px 0; }
.shell-notice { margin: 2px 0; padding: 4px 8px; border-left: 3px solid var(--shell-accent); background: var(--shell-panel); }
.shell-notice[data-code] { border-left-color: #b26a00; }
.shell-picker { position: fixed; z-index: 25; top: 15%; left: 50%; transform: translateX(-50%); width: min(960px, calc(100vw - 32px)); padding: 16px; border: 1px solid var(--shell-line); border-radius: 6px; background: var(--shell-panel); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25); }
.shell-picker-title { margin: 0 0 8px; font-weight: 600; }
/* 탭 · 트리 위치 고르기 · 여러 줄 칸 · 파일 선택 · 설정 항목 (TASK-SYS-015 T-302) */
.shell-tabs { display: flex; gap: 2px; margin-top: 8px; border-bottom: 1px solid var(--shell-line); }
.shell-tab { padding: 4px 12px; border: 1px solid var(--shell-line); border-bottom: none; border-radius: 4px 4px 0 0; background: var(--shell-bg); color: var(--shell-text); cursor: pointer; }
.shell-tab[aria-selected="true"] { background: var(--shell-panel); border-color: var(--shell-accent); font-weight: 600; }
.shell-tab-count { margin-left: 4px; color: var(--shell-muted); font-size: 12px; }
.shell-tree-picker { position: fixed; top: 20%; left: 50%; transform: translateX(-50%); }
.shell-tree-root td { font-style: italic; }
.shell-multiline-input { width: 100%; min-width: 360px; font: inherit; resize: vertical; }
.shell-file { display: inline-flex; align-items: center; gap: 4px; }
.shell-file-name { color: var(--shell-muted); }
.shell-setting { display: flex; align-items: flex-end; gap: 12px; width: 100%; padding: 4px; border-radius: 4px; cursor: pointer; }
.shell-setting[aria-selected="true"] { outline: 1px solid var(--shell-accent); }
.shell-setting-range, .shell-setting-default, .shell-setting-updated { color: var(--shell-muted); font-size: 12px; }
.shell-import-preview { display: flex; gap: 12px; align-items: center; margin: 4px 0; }

/* 번역 영역 (TASK-BC-009 T-423) · 회사 달력 보기 (T-430). */
.shell-names { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; max-width: 480px; }
.bc-calendar { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-top: 8px; }
.bc-calendar-month { background: var(--shell-panel); border: 1px solid var(--shell-line); padding: 8px; }
.bc-calendar-month h3 { margin: 0 0 6px; font-size: 0.95rem; }
.bc-calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.bc-calendar-weekday { text-align: center; font-size: 0.75rem; color: var(--shell-muted); }
.bc-calendar-day { border: 1px solid var(--shell-line); background: var(--shell-panel); color: var(--shell-text); padding: 4px 0; cursor: pointer; }
.bc-calendar-day:disabled { cursor: default; }
.bc-calendar-holiday { background: var(--shell-error-bg); color: var(--shell-error); }

/* 트리 찾기 — 고를 수 없는 줄 (최하위가 아닌 품목 그룹, TASK-BC-010). */
.shell-finder-list tr.shell-finder-disabled { color: #8a8a8a; cursor: default; }
.shell-tabbar-dirty::after { content: "\25CF"; margin-left: 2px; font-size: 10px; color: var(--shell-accent); }

/* 그리드 (TASK-SYS-018 T-309): 셸 색 체계 · 도구 · 열 고르기 */
.screen-grid { --quro-bg: var(--shell-panel); --quro-text: var(--shell-text); --quro-border: var(--shell-line); --quro-head-bg: var(--shell-menu-bg); --quro-active: var(--shell-accent); --quro-selected: var(--shell-selected); --quro-error-line: var(--shell-error); --quro-error: var(--shell-error-bg); --quro-label: var(--shell-muted); position: relative; }
.shell-grid-tools { display: flex; gap: 2px; justify-content: flex-end; padding: 2px 0; }
.shell-grid-panel { position: absolute; right: 0; top: 30px; z-index: 20; display: flex; flex-direction: column; gap: 4px; max-height: 320px; overflow: auto; padding: 8px 12px; background: var(--shell-panel); border: 1px solid var(--shell-line); border-radius: 4px; box-shadow: 0 4px 12px rgb(0 0 0 / 12%); }
.shell-grid-choice { display: flex; gap: 6px; align-items: center; white-space: nowrap; }
