:root {
    /* 추천 1: 블루 계열 (신뢰감, 데이터 중심) */
    --primary: #2563EB;
    --primary-dark: #1E40AF;
    --bg: #F8FAFC;
    --surface: #FFFFFF;
    --border: #E2E8F0;
    --text: #1E293B;
    --text-secondary: #64748B;
    --muted: #64748B;

    /* 상태 표시 */
    --status-ok: #16A34A;
    --status-warning: #F59E0B;
    --status-danger: #DC2626;
    --status-info: #0EA5E9;

    --warning-bg: #FEF3C7;
    --danger-bg: #FEE2E2;
    --expired-bg: #FECACA;
    --primary-soft: #EFF6FF;
    --primary-border: #BFDBFE;
    --topbar-bg: linear-gradient(135deg, #1E40AF 0%, #2563EB 100%);
    --topbar-border: rgba(255, 255, 255, 0.14);

    --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    --radius: 12px;
    --field-radius: 8px;
    --control-height: 40px;
    --control-padding-x: 12px;
    --field-padding: 0 var(--control-padding-x);
    --field-border: 1px solid var(--border);
    --field-bg: var(--surface);
    --field-focus-border: var(--primary);
    --field-focus-ring: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: "Pretendard", "Noto Sans KR", sans-serif; color: var(--text); background: var(--bg); }
button { font: inherit; }
a { color: var(--primary); }

input.date-input { cursor: pointer; }

/* ── 통합 입력 필드 (검색, 로그인, 폼, 인라인, 설정 테이블, 상세 모달) ── */
.field-input,
input.field-input,
select.field-input,
textarea.field-input,
.search-box input,
.login-form input,
.form-grid input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.form-grid select,
.form-grid textarea,
.inline-input,
.settings-pane input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.settings-pane select,
.settings-pane textarea,
#detailStockLocation,
#detailDescription {
    width: 100%;
    padding: var(--field-padding);
    border: var(--field-border);
    border-radius: var(--field-radius);
    background: var(--field-bg);
    color: var(--text);
    font: inherit;
    font-size: 0.875rem;
    line-height: 1.4;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    box-sizing: border-box;
}

.field-input:not(textarea),
input.field-input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
select.field-input,
.search-box input,
.login-form input,
.form-grid input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.form-grid select,
.inline-input,
.settings-pane input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.settings-pane select {
    height: var(--control-height);
    min-height: var(--control-height);
}

textarea.field-input,
.form-grid textarea,
.settings-pane textarea,
#detailDescription {
    height: auto;
    min-height: calc(var(--control-height) * 2.5);
    padding: 10px var(--control-padding-x);
}

.field-input:focus,
.search-box input:focus,
.login-form input:focus,
.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus,
.inline-input:focus,
.settings-pane input:focus,
.settings-pane select:focus,
.settings-pane textarea:focus,
#detailStockLocation:focus,
#detailDescription:focus {
    outline: none;
    border-color: var(--field-focus-border);
    box-shadow: var(--field-focus-ring);
}

.field-input:disabled,
.inline-input:disabled,
.inline-input[readonly] {
    background: var(--bg);
    color: var(--text-secondary);
    cursor: default;
}

.inline-input.editable {
    border-color: var(--primary-border);
    background: var(--surface);
    cursor: text;
}

.field-label,
.form-grid label > span,
.login-form label span {
    display: block;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 500;
}

.field-hint {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin: 0 0 16px;
    line-height: 1.5;
}

.field-check {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text);
    white-space: nowrap;
}

.field-check span {
    white-space: nowrap;
}

.field-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    min-width: 16px;
    flex-shrink: 0;
    accent-color: var(--primary);
}

/* ── 로그인 ── */
.login-page {
    position: relative;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    overflow: hidden;
    background: var(--primary-dark);
}
.login-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    background: url('/assets/img/login-bg.jpg') center center / cover no-repeat;
    transform: scale(1.03);
}
.login-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(135deg, rgba(15, 23, 42, 0.72) 0%, rgba(30, 64, 175, 0.58) 45%, rgba(37, 99, 235, 0.52) 100%),
        radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.08), transparent 42%),
        radial-gradient(circle at 80% 80%, rgba(15, 23, 42, 0.35), transparent 48%);
}
.login-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(15, 23, 42, 0.15), rgba(15, 23, 42, 0.45));
    backdrop-filter: blur(1px);
}
.login-card {
    position: relative;
    z-index: 1;
    width: min(420px, 100%);
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.65);
    border-radius: var(--radius);
    box-shadow: 0 24px 64px rgba(15, 23, 42, 0.28);
    padding: 32px;
    backdrop-filter: blur(12px);
}
.login-brand-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}
.login-brand-head .app-logo {
    width: 40px;
    height: 40px;
}
.login-brand h1 { margin: 0; font-size: 1.5rem; color: var(--text); }
.login-brand-head h1 { line-height: 1.25; }
.login-brand p { margin: 0 0 24px; color: var(--text-secondary); }
.login-form label { display: block; margin-bottom: 16px; }
.form-error { color: var(--status-danger); font-size: 0.875rem; margin-top: 12px; }

/* ── 레이아웃 ── */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--topbar-border);
    box-shadow: 0 2px 12px rgba(30, 64, 175, 0.22);
    position: sticky;
    top: 0;
    z-index: 20;
}
.app-title { margin: 0; font-size: 1.125rem; color: var(--text); }
.topbar .app-title { color: #fff; font-weight: 600; }
.topbar-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.topbar-brand { display: flex; align-items: center; gap: 10px; }
.app-logo { width: 32px; height: 32px; border-radius: 7px; flex-shrink: 0; display: block; }
.topbar .app-logo {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2);
}
.user-badge { font-size: 0.8125rem; color: var(--primary-dark); background: var(--primary-soft); padding: 4px 10px; border-radius: 999px; }
.topbar .user-badge {
    color: #fff;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.22);
}
.topbar-right { display: flex; gap: 8px; }

.topbar .btn-ghost.btn-with-icon {
    color: rgba(255, 255, 255, 0.94);
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.28);
}
.topbar .btn-ghost.btn-with-icon:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.38);
}
.topbar .btn-ghost.btn-with-icon .btn-icon {
    opacity: 0.95;
}

.btn-with-icon {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}
.btn-ghost.btn-with-icon {
    color: var(--text-secondary);
    border-color: transparent;
}
.btn-ghost.btn-with-icon:hover {
    color: var(--primary);
    background: var(--primary-soft);
    border-color: var(--primary-border);
}

.toolbar { padding: 16px 20px; background: var(--surface); border-bottom: 1px solid var(--border); }
.toolbar-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.toolbar-main {
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 16px;
}
.toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    flex: 1;
    min-width: 0;
}
.search-box {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
    margin-left: auto;
}
.search-box input {
    width: 350px;
    min-width: 350px;
    max-width: 350px;
    flex: 0 0 350px;
}

.btn {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    height: var(--control-height);
    min-height: var(--control-height);
    padding: 0 14px;
    border-radius: var(--field-radius);
    cursor: pointer;
    transition: 0.15s ease;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    line-height: 1;
    box-sizing: border-box;
}
.btn:hover { background: var(--bg); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-danger { background: var(--status-danger); border-color: var(--status-danger); color: #fff; }
.btn-danger:hover { background: #B91C1C; border-color: #B91C1C; }
.btn-detail { background: var(--status-info); border-color: var(--status-info); color: #fff; font-weight: 600; }
.btn-detail:hover { background: #0284C7; border-color: #0284C7; }
.btn-edit { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.btn-edit:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-ghost { background: transparent; }
.btn-block { width: 100%; }
.btn-sm {
    height: var(--control-height);
    min-height: var(--control-height);
    padding: 0 10px;
    font-size: 0.875rem;
}
.btn-filter.active { background: var(--primary-soft); border-color: var(--primary-border); color: var(--primary-dark); }
.btn-filter-danger.active { background: var(--danger-bg); border-color: #FCA5A5; color: #991B1B; }
.btn-filter-warning {
    background: var(--warning-bg);
    border-color: #FCD34D;
    color: #92400E;
}
.btn-filter-warning:hover {
    background: #FDE68A;
    border-color: #FBBF24;
    color: #78350F;
}
.btn-filter-warning.active {
    background: #F59E0B;
    border-color: #D97706;
    color: #fff;
}

.cell-category-fix {
    background: var(--warning-bg) !important;
}
.cell-category-fix .inline-select-category {
    width: 100%;
    min-width: 120px;
    font-size: 0.8125rem;
}
.category-fix-hint {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #92400E;
}
.product-card-category-fix {
    background: var(--warning-bg);
    border: 1px solid #FCD34D;
    color: #92400E;
    padding: 6px 10px;
    border-radius: var(--field-radius);
}
.product-card-category-fix .inline-select-category {
    width: 100%;
    font-size: 0.8125rem;
}

.category-add-form {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}
.category-add-title {
    margin: 0 0 12px;
    font-size: 1rem;
    color: var(--text);
}
.category-add-grid {
    grid-template-columns: 1fr 1fr;
}
.category-add-actions {
    margin-top: 12px;
    display: flex;
    justify-content: flex-end;
}
.category-modal-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.category-modal-table th,
.category-modal-table td {
    padding: 10px 8px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    text-align: left;
}
.category-modal-table th { background: var(--bg); color: var(--text); white-space: nowrap; }
.category-modal-table .col-actions { white-space: nowrap; width: 1%; text-align: right; }
.category-modal-empty {
    padding: 24px 12px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.main-content { padding: 16px 20px 32px; flex: 1; }
.site-footer {
    flex-shrink: 0;
    padding: 14px 20px;
    text-align: center;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    background: var(--surface);
    border-top: 1px solid var(--border);
}
.site-footer p { margin: 0; }
.site-footer--login {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    border-top: 0;
    background: transparent;
    color: rgba(255, 255, 255, 0.78);
}
.table-wrap { overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.product-table { width: 100%; border-collapse: collapse; min-width: 1180px; font-size: 0.875rem; }
.product-table th, .product-table td { padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; text-align: left; }
.product-table th { background: var(--bg); position: sticky; top: 0; z-index: 2; white-space: nowrap; color: var(--text); }
.product-table tr.row-warning { background: var(--warning-bg); }
.product-table tr.row-danger { background: var(--danger-bg); }
.product-table tr.row-expired { background: var(--expired-bg); }
.col-check { width: 36px; text-align: center; }
.product-name-cell { min-width: 140px; max-width: 240px; }
.product-code-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-family: ui-monospace, "Consolas", monospace;
    line-height: 1.3;
    margin-bottom: 2px;
}
.product-name-label {
    font-weight: 500;
    line-height: 1.35;
    word-break: keep-all;
}
.product-table .inline-input-date {
    width: 112px;
    min-width: 112px;
    max-width: 112px;
    padding-left: 8px;
    padding-right: 8px;
}
.product-table .inline-input-num {
    width: 92px;
    min-width: 92px;
    max-width: 92px;
    padding-left: 8px;
    padding-right: 8px;
    text-align: right;
}
.product-table th.col-date,
.product-table th.col-num { text-align: center; }
.product-table td:has(.inline-input-date),
.product-table td:has(.inline-input-num) { text-align: center; }
.thumb-cell img { width: 48px; height: 48px; object-fit: cover; border-radius: var(--field-radius); border: 1px solid var(--border); background: var(--bg); }
.thumb-placeholder { width: 48px; height: 48px; border-radius: var(--field-radius); background: var(--border); display: grid; place-items: center; color: var(--text-secondary); font-size: 0.75rem; }
.readonly-cell { color: var(--text); }
.action-cell { white-space: nowrap; }
.action-cell .btn + .btn { margin-left: 4px; }

.empty-state { text-align: center; padding: 48px 16px; color: var(--text-secondary); }
.pagination { display: flex; justify-content: center; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.pagination button.active { background: var(--primary-soft); border-color: var(--primary-border); color: var(--primary-dark); }

/* ── 모달 ── */
.modal[hidden] { display: none !important; }
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.5); pointer-events: none; }
body.modal-open { overflow: hidden; touch-action: none; }
.modal-panel { position: relative; background: var(--surface); width: min(960px, 100%); max-height: 90vh; border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; }
.modal-lg { width: min(1100px, 100%); }
.modal-xl { width: min(1200px, 100%); }
.modal-sm { width: min(420px, 100%); }
.modal-md { width: min(640px, 100%); }
.modal.app-dialog { z-index: 3000; }
.modal.app-dialog .modal-backdrop { pointer-events: auto; cursor: pointer; }
.app-dialog-panel { text-align: center; }
.app-dialog-body { padding: 28px 24px 8px; }
.app-dialog-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.app-dialog-icon svg { width: 28px; height: 28px; }
.app-dialog-icon-info { background: var(--primary-soft); color: var(--status-info); }
.app-dialog-icon-confirm { background: var(--warning-bg); color: var(--status-warning); }
.app-dialog-icon-danger { background: var(--danger-bg); color: var(--status-danger); }
.app-dialog-title { margin: 0 0 10px; font-size: 1.125rem; color: var(--text); }
.app-dialog-message {
    margin: 0;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: keep-all;
}
.app-dialog .modal-footer { justify-content: center; gap: 10px; padding: 16px 24px 24px; border-top: 0; }
.app-dialog .modal-footer[hidden] { display: none !important; }
.password-form-grid { grid-template-columns: 1fr; gap: 16px; }
.import-actions-top { margin: 0 0 14px; }

/* 설정 모달: 화면 90% × 90% */
.modal-panel.modal-settings {
    width: 90vw;
    height: 90vh;
    max-width: 90vw;
    max-height: 90vh;
}

.modal-header, .modal-footer { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; }
.modal-header h2 { margin: 0; font-size: 1.25rem; color: var(--text); }
.modal-footer { border-bottom: 0; border-top: 1px solid var(--border); justify-content: flex-end; gap: 8px; }
.modal-body { padding: 20px; overflow: auto; flex: 1; min-height: 0; }
.btn-close { border: 0; background: transparent; font-size: 1.5rem; cursor: pointer; line-height: 1; color: var(--text-secondary); }
.btn-close:hover { color: var(--text); }

.detail-grid { display: grid; grid-template-columns: 280px 1fr; gap: 24px; }
.detail-view-head {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}
.detail-view-head-text-only {
    display: block;
}
.detail-view-thumb {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    flex-shrink: 0;
}
.detail-view-thumb-empty {
    display: grid;
    place-items: center;
    background: var(--bg);
    color: var(--text-secondary);
    font-size: 0.875rem;
}
.detail-view-code {
    font-family: ui-monospace, "Consolas", monospace;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.detail-view-name {
    margin: 0 0 8px;
    font-size: 1.375rem;
    color: var(--text);
    line-height: 1.35;
}
.detail-view-category {
    font-size: 0.875rem;
    color: var(--primary-dark);
    background: var(--primary-soft);
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
}
.detail-text-block { margin-bottom: 14px; }
.detail-text-block:last-child { margin-bottom: 0; }
.detail-text-label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 500;
}
.detail-empty-images {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
}
.detail-section-images { margin-bottom: 28px; }
.detail-image-gallery {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--field-radius);
    overflow: hidden;
}
.detail-image-group + .detail-image-group {
    border-top: 1px solid var(--border);
}
.detail-image-group-title {
    padding: 10px 12px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.detail-image-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px;
}
.detail-image-full {
    margin: 0;
    padding: 0;
    line-height: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--field-radius);
    overflow: hidden;
}
.detail-image-full + .detail-image-full {
    border-top: none;
}
.detail-image-full img {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
    background: var(--surface);
}
.image-grid-thumb { max-width: 140px; }
.detail-section h3 { margin: 0 0 10px; font-size: 1rem; color: var(--text); }
.detail-section-hint {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
}
.lightbox-trigger,
.lightbox-trigger-img { cursor: zoom-in; }
.image-item-zoom img { cursor: zoom-in; transition: transform 0.2s ease, box-shadow 0.2s ease; }
.image-item-zoom img:hover { transform: scale(1.03); box-shadow: 0 8px 20px rgba(37, 99, 235, 0.18); }

.image-lightbox {
    position: fixed;
    inset: 0;
    z-index: 300;
    background: rgba(15, 23, 42, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.image-lightbox[hidden] { display: none !important; }
.image-lightbox img {
    max-width: min(96vw, 1200px);
    max-height: 90vh;
    object-fit: contain;
    border-radius: var(--radius);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
}
.image-lightbox-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
}
.image-lightbox-close:hover { background: rgba(255, 255, 255, 0.28); }

.mobile-only { display: none; }
.desktop-only { display: block; }

.mobile-product-list {
    display: grid;
    gap: 14px;
}
.product-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.product-card:active { transform: scale(0.995); }
.product-card.row-warning { border-color: #FCD34D; background: linear-gradient(180deg, #FFFBEB 0%, var(--surface) 100%); }
.product-card.row-danger { border-color: #FCA5A5; background: linear-gradient(180deg, #FEF2F2 0%, var(--surface) 100%); }
.product-card.row-expired { border-color: #F87171; background: linear-gradient(180deg, #FEE2E2 0%, var(--surface) 100%); }
.product-card-head {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 14px;
}
.product-card-check {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    flex-shrink: 0;
}
.product-card-check input { accent-color: var(--primary); }
.product-card-thumb {
    width: 72px;
    height: 72px;
    flex-shrink: 0;
    border-radius: 14px;
    overflow: hidden;
    background: var(--bg);
    border: 1px solid var(--border);
}
.product-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.product-card-thumb .thumb-placeholder {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    font-size: 0.7rem;
    color: var(--text-secondary);
}
.product-card-main { flex: 1; min-width: 0; }
.product-card-category {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--primary-dark);
    background: var(--primary-soft);
    padding: 3px 8px;
    border-radius: 999px;
    margin-bottom: 6px;
}
.product-card-code {
    font-family: ui-monospace, "Consolas", monospace;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.product-card-name {
    margin: 0;
    font-size: 1rem;
    line-height: 1.4;
    color: var(--text);
    word-break: keep-all;
}
.product-card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
    padding: 12px;
    background: var(--bg);
    border-radius: 12px;
}
.product-card-stat span {
    display: block;
    font-size: 0.6875rem;
    color: var(--text-secondary);
    margin-bottom: 2px;
}
.product-card-stat strong {
    font-size: 0.875rem;
    color: var(--text);
    font-weight: 600;
}
.product-card-actions {
    display: flex;
    gap: 8px;
}
.product-card-actions .btn { flex: 1; }

@media (max-width: 767px) {
    .mobile-only { display: block; }
    .desktop-only { display: none !important; }
    .mobile-product-list { display: grid; }
    .table-wrap.desktop-only { display: none !important; }
    .topbar { padding: 12px 14px; }
    .app-title { font-size: 1rem; }
    .app-title-suffix { display: none; }
    .login-brand-head h1 { font-size: 1.25rem; white-space: nowrap; }
    .toolbar { padding: 0 14px 12px; }
    .main-content { padding: 12px 14px 24px; }
    .toolbar-actions { gap: 6px; }
    .toolbar-actions .btn { font-size: 0.8125rem; padding: 0 10px; }
    .search-box { width: 100%; }
    .search-box input { min-width: 0; max-width: none; flex: 1; }
    .modal { padding: 0; align-items: stretch; }
    .modal-panel {
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }
    .modal-panel.modal-settings {
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
    }
    .modal-header, .modal-footer { padding: 14px 16px; }
    .modal-body { padding: 16px; }
    .detail-view-head { flex-direction: column; }
    .detail-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .image-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .pagination { gap: 6px; }
    .pagination .btn { min-width: 36px; padding: 0 8px; }
}

.detail-section { margin-bottom: 20px; }
.detail-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 20px; }
.meta-item { background: var(--bg); border: 1px solid var(--border); border-radius: var(--field-radius); padding: 10px 12px; }
.meta-item span { display: block; font-size: 0.75rem; color: var(--text-secondary); margin-bottom: 4px; }
.meta-item strong { font-weight: 600; color: var(--text); }
.detail-text { white-space: pre-wrap; line-height: 1.6; background: var(--bg); border: 1px solid var(--border); padding: 12px; border-radius: var(--field-radius); min-height: 48px; }

.edit-upload-section { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--border); }
.edit-upload-title { margin: 0 0 16px; font-size: 1.0625rem; color: var(--text); }
.edit-upload-grid { display: flex; flex-direction: column; gap: 24px; }
.edit-upload-block { width: 100%; }
.edit-upload-block h4 { margin: 0 0 10px; font-size: 0.9375rem; color: var(--text); }

.upload-actions { display: flex; gap: 8px; justify-content: center; margin-top: 10px; flex-wrap: wrap; }
.upload-mobile-only { display: flex; }
.upload-desktop-only { display: none; }
@media (min-width: 768px) {
    .upload-mobile-only { display: none !important; }
    .upload-desktop-only { display: block; }
    .upload-actions.upload-desktop-only { display: flex; }
}
@media (max-width: 767px) {
    .detail-view-head { flex-direction: column; }
    .detail-grid { grid-template-columns: 1fr; }
}

.upload-zone {
    border: 2px dashed var(--border);
    border-radius: 10px;
    padding: 24px 20px;
    text-align: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: 0.15s;
    background: var(--bg);
}
.upload-zone:hover { border-color: var(--primary-border); background: var(--primary-soft); }
.upload-zone.dragover { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); }
.upload-zone p { margin: 0 0 6px; }
.upload-zone .upload-zone-hint { font-size: 0.8rem; color: var(--text-secondary); }
.upload-zone input[type=file] { display: none; }
.upload-zone.has-file { border-color: var(--status-ok); background: #F0FDF4; color: #166534; }

.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; margin-top: 12px; }
.image-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--field-radius); border: 1px solid var(--border); }
.image-item { position: relative; }
.image-item button { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border: 0; border-radius: 999px; background: rgba(0,0,0,0.6); color: #fff; cursor: pointer; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    align-items: end;
}
.form-grid label { display: block; }
.form-grid label.field-check {
    display: inline-flex;
    flex-wrap: nowrap;
    align-items: center;
    width: auto;
}
.form-grid .full { grid-column: 1 / -1; }
.form-grid .form-action {
    display: flex;
    align-items: flex-end;
}
.form-grid .form-action .btn {
    width: 100%;
}
.settings-pane td .btn + .btn { margin-left: 4px; }

.settings-tabs { display: flex; gap: 4px; padding: 0 20px; border-bottom: 1px solid var(--border); background: var(--bg); flex-wrap: wrap; flex-shrink: 0; }
.settings-tab { border: 0; background: transparent; padding: 12px 16px; cursor: pointer; border-bottom: 2px solid transparent; color: var(--text-secondary); font: inherit; }
.settings-tab:hover { color: var(--text); }
.settings-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.settings-body { min-height: 0; }
.settings-pane table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.settings-pane th, .settings-pane td { padding: 10px 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.settings-pane th { background: var(--bg); color: var(--text); }
.log-changes { font-size: 0.8125rem; color: var(--text-secondary); }

.import-panel { max-width: 640px; }
.import-result { margin-top: 16px; }

/* ── 카테고리 테이블 ── */
.category-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.category-table th,
.category-table td { padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; text-align: left; }
.category-table th { background: var(--bg); color: var(--text); white-space: nowrap; }
.category-table tbody.is-sorting { user-select: none; cursor: grabbing; }
.category-table tbody.is-sorting td { will-change: transform; }
.category-table tbody.is-sorting tr.dragging td {
    position: relative;
    z-index: 2;
    background: var(--surface);
    box-shadow: 0 10px 28px rgba(37, 99, 235, 0.16);
    transition: box-shadow 0.2s ease, background 0.2s ease;
}
.category-table tbody.is-sorting tr.dragging td:first-child { border-radius: 10px 0 0 10px; }
.category-table tbody.is-sorting tr.dragging td:last-child { border-radius: 0 10px 10px 0; }
.category-table tbody.is-sorting tr:not(.dragging) td {
    transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.category-table .col-drag { width: 44px; text-align: center; padding-left: 4px; padding-right: 4px; }
.category-table .col-actions { white-space: nowrap; width: 1%; }
.category-table .col-name .field-input { min-width: 180px; }
@media (prefers-reduced-motion: reduce) {
    .category-table tbody.is-sorting td,
    .category-table tbody.is-sorting tr.dragging td {
        transition: none !important;
        will-change: auto;
    }
}
.rate-cell {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.rate-cell .field-input {
    width: 96px;
    min-width: 96px;
    max-width: 96px;
    flex: 0 0 96px;
}
.rate-suffix {
    flex-shrink: 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
    user-select: none;
}
.drag-handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--control-height);
    height: var(--control-height);
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--field-radius);
    background: var(--surface);
    color: var(--text-secondary);
    cursor: grab;
    touch-action: none;
    user-select: none;
    transition: 0.15s ease;
}
.drag-handle:hover {
    color: var(--primary);
    border-color: var(--primary-border);
    background: var(--primary-soft);
}
.drag-handle:active { cursor: grabbing; }
.drag-icon { width: 18px; height: 18px; pointer-events: none; }

.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--text);
    color: #fff;
    padding: 12px 18px;
    border-radius: 999px;
    z-index: 2000;
    box-shadow: var(--shadow);
    max-width: min(90vw, 420px);
    text-align: center;
}
.toast.error { background: var(--status-danger); }

@media (max-width: 900px) {
    .detail-grid { grid-template-columns: 1fr; }
    .topbar, .toolbar, .main-content { padding-left: 12px; padding-right: 12px; }
    .product-table { min-width: 980px; }
    .modal-panel.modal-settings {
        width: 96vw;
        height: 96vh;
        max-width: 96vw;
        max-height: 96vh;
    }
    .toolbar-main { flex-wrap: wrap; }
    .search-box { margin-left: 0; width: 100%; justify-content: flex-end; }
}

@media (max-width: 640px) {
    .toolbar-main { flex-direction: column; align-items: stretch; }
    .toolbar-actions .btn { flex: 1 1 calc(50% - 5px); }
    .search-box { flex-direction: row; justify-content: stretch; }
    .search-box input {
        width: 100%;
        min-width: 0;
        max-width: none;
        flex: 1;
    }
}
