:root {
  --navy: #12304a;
  --teal: #167c70;
  --teal-soft: #eaf7f4;
  --line: #d7e1e6;
  --muted: #637985;
  --surface: #fff;
  --canvas: #f4f7f8;
}
* { box-sizing: border-box; }
body { margin: 0; color: #173343; background: var(--canvas); font-family: "Noto Sans KR", "Noto Sans CJK KR", sans-serif; }
button, input, select { font: inherit; }
.license-page { height: 100vh; min-height: 0; overflow: hidden; }
.inventory-page { display: flex; flex-direction: column; min-width: 0; height: 100vh; min-height: 0; padding: 12px 16px; overflow: hidden; }
.inventory-header { display: flex; flex: 0 0 auto; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.inventory-header h1 { margin: 0 0 3px; color: var(--navy); font-size: 22px; letter-spacing: -.03em; }
.inventory-header p { margin: 0; color: var(--muted); font-size: 11px; }
.header-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: 0 15px; border: 1px solid transparent; border-radius: 9px; font-size: 12px; font-weight: 750; cursor: pointer; text-decoration: none; }
.button.primary { color: #fff; background: var(--teal); }
.button.primary:hover:not(:disabled) { background: #116a60; }
.button.secondary { color: #35596c; border-color: #cbd9df; background: #fff; }
.button.edit-mode-active { color: #fff; border-color: var(--teal); background: var(--teal); }
.button:disabled { opacity: .45; cursor: not-allowed; }
.message { margin: 0 0 14px; padding: 11px 14px; border: 1px solid #b9ded7; border-radius: 9px; color: #17685e; background: var(--teal-soft); font-size: 12px; font-weight: 650; }
.message.error { color: #8a4038; border-color: #efc3be; background: #fff2f0; }
.summary-grid { display: grid; flex: 0 0 auto; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; margin-bottom: 8px; }
.summary-grid article { min-height: 64px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; box-shadow: 0 4px 12px rgba(22,48,65,.035); }
.summary-grid article span { display: block; color: var(--muted); font-size: 11px; font-weight: 700; }
.summary-grid article strong { display: inline-block; margin-top: 4px; color: var(--navy); font-size: 20px; line-height: 1; }
.summary-grid article small { margin-left: 5px; color: #83949c; font-size: 11px; }
.summary-grid article.attention strong { color: #c6613b; }
.box-location-status { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; min-height: 44px; margin-bottom: 8px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.box-location-heading { display: grid; flex: 0 0 auto; gap: 1px; }
.box-location-heading strong { color: var(--navy); font-size: 11px; }
.box-location-heading span { color: var(--muted); font-size: 9px; }
.box-location-list { display: flex; align-items: center; gap: 7px; min-width: 0; overflow-x: auto; color: var(--muted); font-size: 10px; }
.box-location-item { display: flex; align-items: center; gap: 5px; flex: 0 0 auto; padding: 3px 7px; border: 1px solid #d9e5e9; border-radius: 7px; background: #f7fafb; }
.box-location-item strong { color: #345466; white-space: nowrap; font-size: 10px; }
.box-location-item input { width: 130px; height: 24px; padding: 2px 5px; border: 1px solid #cbd9df; border-radius: 5px; color: #173343; background: #fff; font-size: 10px; }
.box-location-item input:disabled { border-color: transparent; background: transparent; opacity: 1; -webkit-text-fill-color: #315a6c; }
.box-location-item input:disabled::placeholder { color: #8aa0ab; -webkit-text-fill-color: #8aa0ab; }
.workbook-panel { display: flex; flex: 1 1 auto; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; border: 1px solid #cddbe1; border-radius: 10px; background: #fff; box-shadow: 0 6px 18px rgba(20,50,69,.05); }
.sheet-tabs { display: flex; gap: 10px; padding: 2px 3px 0; border-bottom: 1px solid var(--line); background: #f7fafb; }
.sheet-tab { position: relative; flex: 0 0 auto; width: max-content; padding: 7px 0 8px; border: 0; color: #617783; background: transparent; font-size: 11px; font-weight: 750; cursor: pointer; }
.sheet-tab.is-active { color: var(--teal); }
.sheet-tab.is-active::after { position: absolute; right: 0; bottom: -1px; left: 0; height: 2px; content: ""; background: var(--teal); }
.sheet-toolbar { display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.sheet-search { display: flex; align-items: center; width: min(360px, 42vw); height: 36px; padding: 0 10px; border: 1px solid #cedae0; border-radius: 8px; background: #fff; }
.sheet-search:focus-within { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(22,124,112,.1); }
.sheet-search svg { width: 16px; height: 16px; margin-right: 8px; fill: none; stroke: #77909b; stroke-width: 1.8; }
.sheet-search input { min-width: 0; width: 100%; border: 0; outline: 0; color: #173343; background: transparent; font-size: 12px; }
.empty-toggle { display: flex; align-items: center; gap: 6px; color: #536b77; font-size: 11px; white-space: nowrap; }
.sheet-toolbar > button { height: 34px; padding: 0 11px; border: 1px solid #cbd9df; border-radius: 8px; color: #3c6072; background: #fff; font-size: 11px; font-weight: 700; cursor: pointer; }
.sheet-toolbar > button:disabled { opacity: .45; cursor: not-allowed; }
#delete-row-button:not(:disabled) { color: #a64038; border-color: #e3b7b2; background: #fff8f7; }
#sheet-status { margin-left: auto; color: #748994; font-size: 11px; white-space: nowrap; }
.grid-wrap { flex: 1 1 auto; width: 100%; height: auto; min-height: 0; overflow-x: auto; overflow-y: auto; background: #fff; }
.sheet-grid { width: 100%; min-width: 100%; border-spacing: 0; border-collapse: separate; table-layout: fixed; font-size: 11px; }
.sheet-grid th { position: sticky; top: 0; z-index: 3; min-width: 0; height: 32px; padding: 0; border-right: 1px solid #c9d7dd; border-bottom: 1px solid #b8cbd3; color: #294b5c; background: #eaf0f3; font-weight: 800; text-align: left; white-space: nowrap; }
.sheet-grid th:first-child { left: 0; z-index: 5; }
.sheet-grid td { position: relative; height: 29px; padding: 0; border-right: 1px solid #dfe7ea; border-bottom: 1px solid #dfe7ea; background: #fff; }
.sheet-grid td:first-child { position: sticky; left: 0; z-index: 2; background: #f4f7f8; }
.sheet-grid tr:hover td { background: #fbfdfd; }
.sheet-grid tr:hover td:first-child { background: #eef3f5; }
.sheet-grid tbody tr { cursor: pointer; }
.sheet-grid tbody tr.is-selected td, .sheet-grid tbody tr.is-selected:hover td { background: #dff1ee; box-shadow: inset 0 1px #9dcec6, inset 0 -1px #9dcec6; }
.sheet-grid tbody tr.is-selected td:first-child, .sheet-grid tbody tr.is-selected:hover td:first-child { background: #cfe8e3; }
.sheet-grid .number-index-column, .sheet-grid .number-index-column .sort-button, .sheet-grid .number-index-cell, .sheet-grid .number-index-cell .cell-input { text-align: center; }
.sheet-grid .number-index-column .sort-button { justify-content: center; }
.sort-button { display: flex; align-items: center; justify-content: space-between; gap: 7px; width: 100%; height: 31px; padding: 0 7px; border: 0; color: inherit; background: transparent; font: inherit; text-align: left; cursor: pointer; }
.sort-button:hover { color: var(--teal); background: #e1ecef; }
.sort-button span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sort-indicator { flex: 0 0 auto; color: #9aabb2; font-size: 9px; }
.sort-indicator.is-active { color: var(--teal); }
.column-resizer { position: absolute; top: 0; right: -3px; z-index: 6; width: 7px; height: 100%; cursor: col-resize; touch-action: none; }
.column-resizer:hover, .column-resizer.is-dragging { background: rgba(22,124,112,.35); }
body.is-resizing-column { cursor: col-resize; user-select: none; }
.cell-input { display: block; min-width: 0; width: 100%; height: 28px; padding: 0 6px; border: 1px solid transparent; border-radius: 0; outline: 0; color: #173343; background: transparent; font-size: 10px; }
.cell-input:focus { position: relative; z-index: 1; border-color: var(--teal); box-shadow: inset 0 0 0 1px var(--teal); background: #fff; }
.cell-input.changed { background: #fff8db; }
.cell-input[readonly] { color: #607680; background: #f6f8f9; cursor: default; }
.inventory-viewer-mode .cell-input:disabled { opacity: 1; color: #173343; background: transparent; cursor: default; -webkit-text-fill-color: #173343; }
.inventory-viewer-mode select.cell-input:disabled { padding-right: 6px; appearance: none; }
select.cell-input { min-width: 0; padding-right: 18px; }
.number-cell { text-align: right; font-variant-numeric: tabular-nums; }
.status-value { display: inline-flex; align-items: center; margin: 3px 6px; padding: 2px 6px; border-radius: 999px; font-size: 9px; font-weight: 800; }
.status-normal { color: #167060; background: #e6f5f1; }
.status-shortage { color: #aa6814; background: #fff2d5; }
.status-order { color: #a64038; background: #fde9e7; }
.datasheet-control { display: grid; grid-template-columns: minmax(0, 1fr) 24px 24px; min-width: 0; height: 28px; }
.datasheet-control.is-viewer { grid-template-columns: minmax(0, 1fr) auto; }
.datasheet-control.changed { background: #fff8db; }
.datasheet-value { display: none; }
.datasheet-summary { overflow: hidden; min-width: 0; padding: 0 7px; border: 0; color: #315a6c; background: transparent; font-size: 10px; font-weight: 750; text-align: left; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.datasheet-summary:hover { color: var(--teal); text-decoration: underline; }
.cell-tool { display: grid; place-items: center; width: 24px; height: 28px; border: 0; border-left: 1px solid #dfe7ea; color: #446575; background: #f7fafb; cursor: pointer; text-decoration: none; }
.cell-tool:hover { color: #fff; background: var(--teal); }
.cell-tool[hidden] { display: none; }
.cell-tool svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.loading-cell { padding: 50px !important; color: var(--muted); text-align: center; }
.workbook-footer { display: flex; justify-content: space-between; gap: 16px; padding: 8px 13px; border-top: 1px solid var(--line); color: #7a8f99; background: #f7fafb; font-size: 10px; }
.type-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.type-table th, .type-table td { padding: 11px 13px; border-bottom: 1px solid var(--line); text-align: left; }
.type-table th { padding: 0; color: #4d6976; background: #eef3f5; }
.type-table td:not(:first-child), .type-table th:not(:first-child) { text-align: right; }
.modal[hidden] { display: none; }
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(9,29,41,.5); backdrop-filter: blur(2px); }
.modal-card { position: relative; display: flex; flex-direction: column; width: min(760px, 94vw); max-height: min(760px, 88vh); overflow: hidden; border-radius: 14px; background: #fff; box-shadow: 0 24px 70px rgba(0,0,0,.24); }
.modal-card > header { display: flex; justify-content: space-between; gap: 20px; padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.modal-card h2 { margin: 0 0 4px; color: var(--navy); font-size: 18px; }
.modal-card header p { margin: 0; color: var(--muted); font-size: 11px; }
.modal-close { width: 34px; height: 34px; border: 0; border-radius: 8px; color: #607883; background: #edf3f5; font-size: 22px; cursor: pointer; }
.nas-breadcrumbs { display: flex; align-items: center; gap: 4px; min-height: 44px; padding: 7px 18px; overflow-x: auto; border-bottom: 1px solid var(--line); white-space: nowrap; }
.nas-breadcrumbs button { border: 0; color: #3a6071; background: transparent; font-size: 11px; font-weight: 700; cursor: pointer; }
.nas-breadcrumbs span { color: #9badb4; }
.nas-filter { display: flex; align-items: center; gap: 10px; padding: 10px 18px; border-bottom: 1px solid var(--line); color: #5e747f; font-size: 11px; }
.nas-filter input { flex: 1; height: 34px; padding: 0 10px; border: 1px solid #cedbe0; border-radius: 8px; outline: 0; }
.nas-list { min-height: 280px; overflow: auto; padding: 8px 12px; }
.nas-item { display: grid; grid-template-columns: 28px minmax(0,1fr) auto; align-items: center; width: 100%; min-height: 42px; padding: 4px 8px; border: 0; border-bottom: 1px solid #edf2f4; color: #244657; background: #fff; text-align: left; cursor: pointer; }
.nas-item:hover { background: var(--teal-soft); }
.nas-item svg { width: 18px; height: 18px; fill: none; stroke: #4f7889; stroke-width: 1.7; }
.nas-item strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.nas-item small { color: #84969e; font-size: 10px; }
.modal-card > footer { display: flex; justify-content: flex-end; padding: 11px 16px; border-top: 1px solid var(--line); background: #f8fafb; }
.datasheet-modal-card { width: min(820px, 94vw); }
.datasheet-add-bar { display: grid; grid-template-columns: minmax(240px, 1fr) auto auto auto; align-items: end; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: #f8fafb; }
.datasheet-add-bar[hidden], .datasheet-footer .button[hidden] { display: none; }
.datasheet-add-bar label { display: grid; gap: 5px; color: #536e7a; font-size: 10px; font-weight: 700; }
.datasheet-add-bar input { height: 36px; padding: 0 10px; border: 1px solid #cbd9df; border-radius: 8px; outline: 0; color: #173343; background: #fff; font-size: 11px; }
.datasheet-add-bar input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(22,124,112,.1); }
.datasheet-list { min-height: 260px; max-height: 440px; overflow: auto; padding: 8px 14px; }
.datasheet-empty { display: grid; min-height: 220px; margin: 0; place-items: center; color: #7b9099; font-size: 12px; }
.datasheet-item { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 8px; min-height: 50px; padding: 7px 5px; border-bottom: 1px solid #e5ecef; }
.datasheet-item > svg { width: 18px; height: 18px; fill: none; stroke: #4e7787; stroke-width: 1.7; }
.datasheet-item > div:nth-child(2) { min-width: 0; }
.datasheet-item strong, .datasheet-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.datasheet-item strong { color: #234757; font-size: 11px; }
.datasheet-item small { margin-top: 3px; color: #82959d; font-size: 9px; }
.datasheet-item-actions { display: flex; gap: 5px; }
.datasheet-action { padding: 5px 8px; border: 1px solid #cbd9df; border-radius: 7px; color: #3c6072; background: #fff; font-size: 10px; font-weight: 700; text-decoration: none; cursor: pointer; }
.datasheet-action:hover { color: #fff; border-color: var(--teal); background: var(--teal); }
.datasheet-action.danger:hover { border-color: #b84f46; background: #b84f46; }
.datasheet-no-link { align-self: center; padding: 4px 6px; color: #81949c; font-size: 9px; font-weight: 700; white-space: nowrap; }
.datasheet-footer { align-items: center; justify-content: space-between !important; }
.datasheet-footer > span { color: #68808b; font-size: 10px; font-weight: 700; }
.datasheet-footer > div { display: flex; gap: 7px; }
#nas-modal { z-index: 110; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (max-width: 1000px) {
  .inventory-page { padding: 10px; }
  .inventory-header { flex-direction: column; }
  .header-actions { width: 100%; justify-content: flex-start; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .sheet-tabs { overflow-x: auto; }
  .sheet-tab { flex: 0 0 auto; }
  .sheet-toolbar { align-items: stretch; flex-wrap: wrap; }
  .sheet-search { width: 100%; }
  #sheet-status { width: 100%; margin-left: 0; }
  .datasheet-add-bar { grid-template-columns: 1fr 1fr; }
  .datasheet-add-bar label { grid-column: 1 / -1; }
}
