.fragment-popup {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fragment-popup-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
}

.fragment-popup-window {
    position: relative;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    min-width: 600px;
    max-width: 95vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.fragment-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: linear-gradient(135deg, #2c7be5, #1e6fd9);
    color: #fff;
}

.fragment-popup-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

.fragment-popup-close {
    background: transparent;
    border: 0;
    color: #fff;
    cursor: pointer;
    font-size: 20px;
    padding: 0 4px;
    line-height: 1;
}

.fragment-popup-close:hover {
    opacity: 0.8;
}

.fragment-popup-body {
    flex: 1;
    overflow: auto;
    padding: 12px 14px 14px;
}

.fragment-popup-loading,
.fragment-popup-error {
    padding: 40px;
    text-align: center;
    color: #666;
}

.fragment-popup-error {
    color: #c62828;
}

/* 단일 컬럼 frag (그룹/제조회사) 상단 툴바 */
.single-frag {
    min-width: 560px;
}

.mfr-frag {
    min-width: 820px;
}

.mfr-frag a.mfr-home-link {
    color: #2c7be5;
    text-decoration: none;
}

.mfr-frag a.mfr-home-link:hover {
    text-decoration: underline;
}

.single-frag .single-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding: 6px 10px;
    background: #fff;
    border: 1px solid #d0d7de;
    border-radius: 4px;
}

.single-frag .single-toolbar .filter-box {
    display: flex;
    align-items: center;
    gap: 6px;
}

.single-frag .single-toolbar label {
    font-size: 12px;
    color: #555;
}

.single-frag .single-toolbar input[type=text] {
    padding: 4px 8px;
    border: 1px solid #d0d7de;
    border-radius: 3px;
    font-size: 13px;
    width: 180px;
}

.single-frag .single-toolbar .filter-count {
    font-size: 12px;
    color: #555;
}

/* 분류/그룹/제조회사 공용 3컬럼 표 */
.classify-frag .grid-wrap {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}

.classify-frag .grid-item {
    border: 1px solid #d0d7de;
    border-radius: 4px;
    background: #fff;
    display: flex;
    flex-direction: column;
    min-width: 220px;
}

.classify-frag .grid-item.focus {
    border-color: #2c7be5;
    box-shadow: 0 0 0 2px rgba(44, 123, 229, 0.15);
}

.classify-frag .grid-item-head {
    background: #f0f4f8;
    padding: 6px 10px;
    font-weight: 600;
    font-size: 13px;
    border-bottom: 1px solid #d0d7de;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.classify-frag .grid-item-head small {
    font-weight: 400;
    color: #666;
}

.classify-frag .grid-item-body {
    max-height: 420px;
    overflow-y: auto;
}

.classify-frag table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.classify-frag table th,
.classify-frag table td {
    padding: 5px 8px;
    border-bottom: 1px solid #eee;
    text-align: left;
}

.classify-frag table th {
    background: #fafbfc;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 1;
}

.classify-frag table tbody tr {
    cursor: pointer;
}

.classify-frag table tbody tr:hover {
    background: #f5f9ff;
}

.classify-frag table tbody tr.selected {
    background: #fff8dc;
}

/* 색상표시 슬롯 - 고정폭, 내부에 색상바가 width만큼 채워짐 */
.classify-frag .color-slot {
    display: inline-block;
    width: 40px;
    height: 12px;
    vertical-align: middle;
    position: relative;
    margin-left: 6px;
    flex-shrink: 0;
}

.classify-frag .color-slot .color-bar {
    position: absolute;
    top: 0;
    height: 100%;
    border-radius: 1px;
    min-width: 2px;
}

.classify-frag .name-cell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
}

.classify-frag .name-cell .name-text {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.classify-frag .col-code {
    width: 50px;
    text-align: center;
}

.classify-frag .col-count {
    width: 60px;
    text-align: right;
}

.classify-frag .action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding: 8px 10px;
    background: #f4f6f8;
    border-radius: 4px;
}

.classify-frag .action-bar .target {
    font-size: 12px;
    color: #555;
}

.classify-frag .action-bar .target strong {
    color: #2c7be5;
    font-weight: 700;
}

.classify-frag .action-bar .btn-group button {
    padding: 6px 14px;
    margin-left: 6px;
    font-size: 13px;
    border: 1px solid #d0d7de;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
}

.classify-frag .action-bar .btn-group button:hover {
    background: #f0f4f8;
    border-color: #2c7be5;
}

.classify-frag .action-bar .btn-group .btn-primary {
    background: #2c7be5;
    color: #fff;
    border-color: #2c7be5;
}

.classify-frag .action-bar .btn-group .btn-primary:hover {
    background: #1e6fd9;
}

.classify-frag .action-bar .btn-group .btn-danger {
    background: #fff;
    color: #c62828;
    border-color: #f5c2c7;
}

.classify-frag .action-bar .btn-group .btn-danger:hover {
    background: #fff5f5;
}

/* 등록/수정 미니모달 */
.classify-frag .edit-modal {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.classify-frag .edit-modal-window {
    background: #fff;
    border-radius: 4px;
    width: 320px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
}

.classify-frag .edit-modal-header {
    background: linear-gradient(135deg, #2c7be5, #1e6fd9);
    color: #fff;
    padding: 8px 12px;
    font-size: 13px;
    display: flex;
    justify-content: space-between;
}

.classify-frag .edit-modal-body {
    padding: 12px;
    font-size: 13px;
}

.classify-frag .edit-modal-body .form-row {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.classify-frag .edit-modal-body .form-row label {
    width: 80px;
    color: #555;
}

.classify-frag .edit-modal-body .form-row input[type=text],
.classify-frag .edit-modal-body .form-row input[type=number],
.classify-frag .edit-modal-body .form-row select {
    flex: 1;
    padding: 4px 6px;
    border: 1px solid #d0d7de;
    border-radius: 3px;
    font-size: 13px;
}

.classify-frag .edit-modal-footer {
    padding: 8px 12px;
    text-align: right;
    border-top: 1px solid #eee;
}

.classify-frag .edit-modal-footer button {
    padding: 5px 14px;
    margin-left: 6px;
    font-size: 13px;
    border: 1px solid #d0d7de;
    border-radius: 3px;
    background: #fff;
    cursor: pointer;
}

.classify-frag .edit-modal-footer .btn-primary {
    background: #2c7be5;
    color: #fff;
    border-color: #2c7be5;
}

/* 색상 팔레트 */
.color-picker-wrap {
    position: relative;
    flex: 1;
}

.color-picker-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 4px 8px;
    background: #fff;
    border: 1px solid #d0d7de;
    border-radius: 3px;
    cursor: pointer;
    font-size: 13px;
}

.color-picker-btn:hover {
    border-color: #2c7be5;
}

.color-picker-preview {
    display: inline-block;
    width: 60px;
    height: 16px;
    border: 1px solid #aaa;
    border-radius: 2px;
    background: #000;
}

.color-picker-arrow {
    color: #666;
    font-size: 10px;
}

.color-picker-dropdown {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    z-index: 100;
    background: #fff;
    border: 1px solid #999;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    padding: 6px;
    width: 200px;
}

.color-picker-auto {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 4px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    margin-bottom: 4px;
    font-size: 12px;
}

.color-picker-auto:hover {
    background: #f0f4f8;
}

.color-picker-auto .color-swatch {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 1px solid #aaa;
}

.color-picker-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
}

.color-picker-grid .swatch {
    width: 100%;
    height: 18px;
    border: 1px solid #ccc;
    cursor: pointer;
    box-sizing: border-box;
}

.color-picker-grid .swatch:hover,
.color-picker-grid .swatch.selected {
    outline: 2px solid #2c7be5;
    outline-offset: 1px;
}

.color-picker-more {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid #eee;
}

.color-picker-more input[type="color"] {
    height: 28px;
    border: 1px solid #d0d7de;
    border-radius: 3px;
    cursor: pointer;
}

/* ============================================ */
/* 알림장 메모 관리 (bojo_alrimmemo)              */
/* ============================================ */
.alrim-memo-frag {
    min-width: 640px;
}

.alrim-memo-frag .alrim-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding: 6px 10px;
    background: #fff;
    border: 1px solid #d0d7de;
    border-radius: 4px;
}

.alrim-memo-frag .alrim-toolbar .filter-box {
    display: flex;
    align-items: center;
    gap: 6px;
}

.alrim-memo-frag .alrim-toolbar label {
    font-size: 12px;
    color: #555;
}

.alrim-memo-frag .alrim-toolbar select {
    padding: 4px 8px;
    border: 1px solid #d0d7de;
    border-radius: 3px;
    font-size: 13px;
    min-width: 140px;
}

.alrim-memo-frag .alrim-toolbar .filter-count {
    font-size: 12px;
    color: #555;
}

.alrim-memo-frag .alrim-grid {
    border: 1px solid #d0d7de;
    border-radius: 4px;
    background: #fff;
    max-height: 420px;
    overflow-y: auto;
}

.alrim-memo-frag .alrim-grid table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.alrim-memo-frag .alrim-grid th,
.alrim-memo-frag .alrim-grid td {
    padding: 6px 10px;
    border-bottom: 1px solid #eee;
    text-align: left;
    vertical-align: top;
}

.alrim-memo-frag .alrim-grid th {
    background: #fafbfc;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 1;
}

.alrim-memo-frag .alrim-grid .col-bunru { width: 120px; }
.alrim-memo-frag .alrim-grid .alrim-empty {
    text-align: center;
    color: #999;
    padding: 24px 0;
}

.alrim-memo-frag .alrim-grid tbody tr { cursor: pointer; }
.alrim-memo-frag .alrim-grid tbody tr:hover { background: #f5f9ff; }
.alrim-memo-frag .alrim-grid tbody tr.selected { background: #fff8dc; }

.alrim-memo-frag .alrim-actionbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-top: 12px;
    padding: 8px 10px;
    background: #f4f6f8;
    border-radius: 4px;
}

.alrim-memo-frag .alrim-actionbar .btn-group button {
    padding: 6px 14px;
    margin-left: 6px;
    font-size: 13px;
    border: 1px solid #d0d7de;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
}

.alrim-memo-frag .alrim-actionbar .btn-group button:hover {
    background: #f0f4f8;
    border-color: #2c7be5;
}

.alrim-memo-frag .alrim-actionbar .btn-group .btn-primary {
    background: #2c7be5;
    color: #fff;
    border-color: #2c7be5;
}

.alrim-memo-frag .alrim-actionbar .btn-group .btn-primary:hover {
    background: #1e6fd9;
}

.alrim-memo-frag .alrim-actionbar .btn-group .btn-danger {
    background: #fff;
    color: #c62828;
    border-color: #f5c2c7;
}

.alrim-memo-frag .alrim-actionbar .btn-group .btn-danger:hover {
    background: #fff5f5;
}

/* 등록/수정 내부 모달 */
.alrim-memo-frag .alrim-edit-modal {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.alrim-memo-frag .alrim-edit-window {
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
    min-width: 400px;
    max-width: 90%;
}

.alrim-memo-frag .alrim-edit-header {
    padding: 10px 14px;
    background: #2c7be5;
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    border-radius: 6px 6px 0 0;
}

.alrim-memo-frag .alrim-edit-body {
    padding: 16px;
}

.alrim-memo-frag .alrim-edit-body .form-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
}

.alrim-memo-frag .alrim-edit-body .form-row label {
    width: 60px;
    padding-top: 6px;
    font-size: 12px;
    color: #333;
    font-weight: 600;
}

.alrim-memo-frag .alrim-edit-body input[type=text],
.alrim-memo-frag .alrim-edit-body textarea {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid #d0d7de;
    border-radius: 3px;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
}

.alrim-memo-frag .alrim-edit-footer {
    padding: 10px 14px;
    text-align: right;
    border-top: 1px solid #eee;
}

.alrim-memo-frag .alrim-edit-footer button {
    padding: 6px 14px;
    margin-left: 6px;
    font-size: 13px;
    border: 1px solid #d0d7de;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
}

.alrim-memo-frag .alrim-edit-footer .btn-primary {
    background: #2c7be5;
    color: #fff;
    border-color: #2c7be5;
}

.alrim-memo-frag .alrim-edit-footer .btn-primary:hover {
    background: #1e6fd9;
}