@import url('../../theme/UXC_Flarumix/css/ui.css');
@import url('../../theme/UXC_Flarumix/css/layout.css');

/* 프리미엄 계산기 위젯 (고정 레이어) */
#pos-calculator {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 320px;
    background: var(--ui-color-gray-800) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: var(--ui-radius-l);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7);
    z-index: 9999 !important;
    overflow: hidden;
    color: white;
    user-select: none;
}

.calc-header {
    background: var(--ui-color-gray-900);
    padding: 15px 20px;
    font-size: 0.9rem;
    font-weight: 700;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sale-item {
    background: #1e293b !important;
    padding: 10px 16px !important;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-bottom: 4px;
}

.calc-close {
    cursor: pointer;
    color: var(--ui-color-gray-500);
    font-size: 1.2rem;
}

.calc-close:hover {
    color: white;
}

.calc-display {
    background: var(--ui-color-black);
    padding: 25px 20px;
    font-size: 2.2rem;
    font-weight: 800;
    text-align: right;
    color: var(--primary-color);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Custom Touch Stepper (Vertical) */
.touch-stepper-v {
    display: inline-flex;
    align-items: center;
    background: var(--ui-color-black);
    border-radius: var(--ui-radius-m);
    border: 2px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    height: 90px;
}

.touch-stepper-v input {
    width: 120px;
    height: 100%;
    background: transparent;
    border: none;
    color: var(--primary-color);
    text-align: center;
    font-size: 2.5rem;
    font-weight: 800;
    pointer-events: none;
}

.stepper-ctrls {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 70px;
    border-left: 2px solid rgba(255, 255, 255, 0.1);
}

.stepper-ctrls button {
    flex: 1;
    border: none;
    color: white;
    font-size: 1.4rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.stepper-ctrls button:active {
    opacity: 0.7;
}

.btn-step-plus {
    background: #28a745 !important;
}

.btn-step-minus {
    background: #dc3545 !important;
}

.btn {
    min-height: 70px;
    /* 높이 확장 */
    padding: 0 35px;
    font-size: 1.4rem;
    /* 확대 */
}

.calc-keys {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: rgba(255, 255, 255, 0.05);
}

.calc-keys button {
    height: 70px;
    background: var(--ui-color-gray-800);
    border: none;
    color: white;
    font-size: 1.3rem;
    font-weight: 600;
    cursor: pointer;
}

.calc-keys button:active {
    background: var(--ui-color-gray-700);
}

.calc-keys button.op {
    background: var(--ui-color-gray-900);
    color: var(--primary-color);
}

.calc-keys button.clr {
    color: var(--ui-color-danger);
}

.calc-keys button.equal {
    background: var(--primary-color);
    grid-column: span 2;
}

:root {
    --primary-color: var(--ui-color-success);
    --secondary-color: #558c3a;
    --dark-bg: var(--ui-color-gray-900);
    --card-bg: var(--ui-color-gray-800);
    --text-color: var(--ui-color-white);
    --border-radius: var(--ui-radius-l);

    /* 기본값 */
    --font-base: 1rem;
    --spacing-main: 15px;
    --header-padding: 4px 20px;
    --header-margin: 15px;
    --nav-gap: 8px;
}



/* [1680x1050] 고해상도 웹 버전 - 넓은 공간을 텍스트와 버튼으로 가득 채움 */
body.ui-mode-1680 {
    --font-base: 1.15rem;
    --spacing-main: 12px;
    --header-padding: 4px 25px;
    --header-margin: 10px;
    --nav-gap: 10px;
    --border-radius: var(--ui-radius-l);
}

/* [1280x1024] 표준 모니터 버전 - 최적의 밀도 유지 */
body.ui-mode-1280 {
    --font-base: 1.05rem;
    --spacing-main: 10px;
    --header-padding: 2px 15px;
    --header-margin: 8px;
    --nav-gap: 8px;
    --border-radius: var(--ui-radius-m);
}

/* [1024x768] 포스 전용 버전 - 극한의 고밀도 압축 (스크롤 제로) */
body.ui-mode-1024,
body.ui-res-compact {
    --font-base: 0.95rem;
    --spacing-main: 7px;
    --header-padding: 2px 10px;
    --header-margin: 4px;
    --nav-gap: 4px;
    --border-radius: var(--ui-radius-s);
}

/* 텍스트 줄바꿈 제어 (공통) */
.nowrap-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media (max-width: 1050px) {
    body:not([class*="ui-mode-"]) {
        --font-base: 0.95rem;
        --spacing-main: 7px;
        --header-padding: 8px 15px;
        --header-margin: 5px;
        --card: #e8f3e8;
        --border-radius: var(--ui-radius-s);
    }
}

body {
    margin: 0;
    padding: 0;
    background: var(--dark-bg);
    color: var(--text-color);
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    min-height: 100vh;
    font-size: var(--font-base);
    line-height: 1.6;
}

/* POS 전용 레이아웃 (스크롤 금지) */
body.is-pos {
    height: 100vh;
    overflow: hidden;
}

.main-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: var(--spacing-main);
    box-sizing: border-box;
    background: radial-gradient(circle at top right, rgba(22, 163, 74, 0.05), transparent);
}

body.is-pos .main-container {
    height: 100vh;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: var(--header-margin);
    padding: var(--header-padding);
    background: var(--card-bg);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
}

.farm-name {
    font-size: calc(var(--font-base) * 1.35);
    font-weight: 800;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.header-tools {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.logout-btn {
    background: rgba(255, 255, 255, 0.05);
    color: var(--ui-color-gray-300);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 15px 30px;
    /* 터치 최적화 */
    border-radius: var(--ui-radius-m);
    text-decoration: none;
    font-size: 1.1rem;
    /* 확대 */
    font-weight: 700;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: var(--ui-color-danger);
    border-color: var(--ui-color-danger);
    color: white;
}

/* Login Page */
.login-container {
    background: var(--card-bg);
    padding: 3rem 2.5rem;
    border-radius: 32px;
    border: 1px solid var(--border-color);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.08);
    text-align: center;
    width: 420px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

#password-display {
    width: 100%;
    height: 70px;
    background: var(--ui-color-black);
    border: 2px solid var(--primary-color);
    border-radius: var(--ui-radius-m);
    margin-bottom: 2rem;
    font-size: 2.2rem;
    letter-spacing: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--primary-color);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5);
}

.keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.key {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: white;
    padding: 22px;
    font-size: 1.6rem;
    border-radius: var(--ui-radius-m);
    cursor: pointer;
    transition: all 0.1s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
}

.key:active {
    background: var(--primary-color);
    color: white;
    transform: scale(0.92);
}

.key.special {
    background: rgba(255, 255, 255, 0.03);
    font-size: 0.9rem;
    color: var(--ui-color-gray-400);
}

.key.submit {
    background: var(--primary-color);
    color: white;
    grid-column: span 3;
    margin-top: 15px;
    font-size: 1.2rem;
    font-weight: 700;
    padding: 18px;
}

/* Dashboard Items - High Density Grid Management */
.item-grid {
    display: grid;
    gap: var(--spacing-main);
    overflow: hidden;
    /* Prevent extra scroll in dashboard */
    padding: 5px;
}

/* 1680: 4-Column wide and rich */
body.ui-mode-1680 .item-grid {
    grid-template-columns: repeat(4, 1fr);
}

/* 1280 & 1024: 3-Column standard/compact */
body.ui-mode-1280 .item-grid {
    grid-template-columns: repeat(3, 1fr);
}

body.ui-mode-1024 .item-grid,
body.ui-res-compact .item-grid {
    grid-template-columns: repeat(4, 1fr);
    /* 1024에서도 가로로 더 많이 배치하여 높이 절약 */
    gap: 8px;
}

.item-btn {
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 30px 20px;
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 180px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    position: relative;
}

body.ui-mode-1680 .item-btn {
    padding: 40px 25px;
    min-height: 200px;
}

body.ui-mode-1280 .item-btn {
    padding: 30px 20px;
    min-height: 170px;
}

body.ui-mode-1024 .item-btn,
body.ui-res-compact .item-btn {
    padding: 12px 10px;
    min-height: 110px;
}

.item-btn i {
    font-size: 3.5rem;
    margin-bottom: 15px;
    transition: transform 0.2s;
}

body.ui-mode-1680 .item-btn i {
    font-size: 4rem;
}

body.ui-mode-1280 .item-btn i {
    font-size: 3.2rem;
}

body.ui-mode-1024 .item-btn i,
body.ui-res-compact .item-btn i {
    font-size: 2rem;
    margin-bottom: 6px;
}

.item-btn:hover {
    border-color: var(--primary-color);
    background: rgba(100, 166, 68, 0.08);
    transform: translateY(-5px);
}

.item-btn:hover i {
    transform: scale(1.1);
}

.item-btn:active {
    background: var(--primary-color);
    transform: scale(0.95);
}

.item-btn .it-name {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 8px;
    color: white;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.prod-card .p-name {
    font-size: 1.1rem;
    font-weight: 800;
    margin-bottom: 8px;
    color: #1e293b !important;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.badge-overdue {
    display: inline-block;
    width: fit-content;
    background-color: #ef4444 !important;
    color: #ffffff !important;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 900;
}

.prod-card .p-price {
    font-size: 1.3rem;
    color: #059669 !important;
    font-weight: 900;
}

.prod-card .p-code {
    font-size: 0.95rem;
    color: #64748b !important;
    margin-top: 10px;
    font-weight: 600;
}

body.ui-mode-1680 .item-btn .it-name {
    font-size: 1.6rem;
}

body.ui-mode-1280 .item-btn .it-name {
    font-size: 1.3rem;
}

body.ui-mode-1024 .item-btn .it-name,
body.ui-res-compact .item-btn .it-name {
    font-size: 1rem;
    margin-bottom: 4px;
}

.item-btn .it-price {
    font-size: 0.95rem;
    color: var(--ui-color-gray-500);
    width: 100%;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.2;
}

body.ui-mode-1680 .item-btn .it-price {
    font-size: 1.05rem;
}

body.ui-mode-1024 .item-btn .it-price,
body.ui-res-compact .item-btn .it-price {
    font-size: 0.8rem;
    -webkit-line-clamp: 1;
}


/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(15px);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--ui-color-gray-800);
    padding: 40px;
    border-radius: var(--ui-radius-l);
    width: 380px;
    text-align: center;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-title {
    font-size: 1.6rem;
    margin-bottom: 25px;
    font-weight: 700;
}

.weight-input {
    font-size: 3.5rem !important;
    width: 100%;
    background: var(--ui-color-black);
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    text-align: right;
    padding: 15px;
    margin: 0 0 25px 0;
    border-radius: var(--ui-radius-m);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5);
}

.modal-btns {
    display: flex;
    gap: 12px;
}

.btn {
    flex: 1;
    min-height: 45px;
    padding: 0 20px;
    border-radius: var(--ui-radius-m);
    border: none;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

body.ui-res-compact .btn {
    min-height: 34px;
    font-size: 0.9rem;
    padding: 0 12px;
}

.btn i {
    font-size: 1.4rem;
}

.btn-cancel {
    background: var(--ui-color-gray-700);
    color: white;
}

.btn-print {
    background: var(--primary-color);
    color: white;
}

.btn:active {
    transform: scale(0.96);
}

/* Virtual Keyboard */
.v-keyboard {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(30, 30, 30, 0.95);
    backdrop-filter: blur(20px);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    padding: 20px;
    box-sizing: border-box;
    z-index: 2000;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.k-btn {
    height: 70px;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: white;
    font-size: 1.4rem;
    font-weight: 600;
    border-radius: var(--ui-radius-m);
    cursor: pointer;
    transition: all 0.1s;
}

.k-btn:active {
    background: var(--primary-color);
    transform: scale(0.95);
}

.k-btn.special {
    background: rgba(255, 255, 255, 0.08);
    color: var(--ui-color-gray-400);
}

/* Admin Navigation */
.admin-nav {
    display: flex;
    gap: var(--nav-gap);
    margin-bottom: 8px;
    overflow-x: auto;
    padding-bottom: 0px;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) transparent;
}

.nav-link {
    background: rgba(255, 255, 255, 0.05);
    color: var(--ui-color-gray-200);
    padding: 2px 12px;
    border-radius: var(--ui-radius-m);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

body.ui-res-compact .nav-link {
    padding: 1px 8px;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-link.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 10px rgba(100, 166, 68, 0.3);
}

/* Management Cards */
.content-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: var(--spacing-main);
    min-height: 400px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* POS Tables in Management */
.tbl-container {
    overflow-x: auto;
    margin-top: 15px;
}

/* List Page Layout (Scroll Zero) */
body.is-list-page {
    height: 100vh;
    overflow: hidden;
}

body.is-list-page .main-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    padding-bottom: 0;
}

body.is-list-page .content-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    padding-bottom: 0;
}

body.is-list-page .tbl-container {
    flex: 1;
    overflow-y: auto;
    margin-top: 10px;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) transparent;
}

body.is-list-page .tbl-container::-webkit-scrollbar {
    width: 6px;
}

body.is-list-page .tbl-container::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

table.pos-table {
    width: 100%;
    border-collapse: collapse;
    color: white;
    min-width: 600px;
    /* 테이블 최소 너비 보장 */
}

table.pos-table th {
    padding: var(--spacing-main) 15px;
    text-align: center;
    border-bottom: 2px solid var(--primary-color);
    color: var(--ui-color-gray-400);
    font-size: calc(var(--font-base) * 0.95);
    font-weight: 800;
    text-transform: uppercase;
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--card-bg);
}

.pos-table.premium tfoot td {
    position: sticky;
    bottom: 0;
    z-index: 10;
    background: var(--ui-color-gray-900);
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.3);
}

.pos-table th,
.pos-table td {
    padding: 8px 15px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

body.ui-res-compact .pos-table th,
body.ui-res-compact .pos-table td {
    padding: 6px 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

table.pos-table td {
    padding: 8px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    font-size: var(--font-base);
}

body.ui-mode-1680 table.pos-table td {
    padding: 9px 15px;
}

body.ui-mode-1280 table.pos-table td {
    padding: 7px 12px;
}

body.ui-mode-1024 table.pos-table td {
    padding: 5px 8px;
    font-size: 0.9rem;
}

/* Form Groups */
.form-group {
    margin-bottom: var(--spacing-main);
}

.form-label {
    display: block;
    margin-bottom: 8px;
    color: var(--ui-color-gray-400);
    font-size: calc(var(--font-base) * 0.95);
    font-weight: 700;
}

.pos-input {
    width: 100%;
    height: 50px;
    background: var(--ui-color-black);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--ui-radius-m);
    color: white;
    padding: 0 15px;
    font-size: calc(var(--font-base) * 1.15);
    font-weight: 600;
    box-sizing: border-box;
    transition: all 0.2s;
}

body.ui-res-compact .pos-input {
    height: 36px;
    padding: 0 10px;
    font-size: var(--font-base);
}

/* Chrome, Safari, Edge, Opera */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Firefox */
input[type=number] {
    -moz-appearance: textfield;
}

/* Date Input Picker Icon for Dark Theme */
input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1) opacity(0.6);
    cursor: pointer;
    width: 25px;
    height: 25px;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover {
    filter: invert(1) opacity(1);
}

.pos-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(100, 166, 68, 0.2);
    outline: none;
}

/* Responsive Breakpoints */
@media (max-width: 768px) {
    .main-container {
        padding: 10px;
    }

    header {
        padding: 15px;
    }

    .content-card {
        padding: 20px;
    }

    .modal-content {
        width: 90%;
        padding: 25px;
    }

    .key {
        padding: 15px;
        font-size: 1.2rem;
    }
}

/* Quick Stats & Dashboard Elements */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-bottom: 10px;
}

body.ui-res-compact .stats-grid {
    grid-template-columns: repeat(4, 1fr);
}

.stat-card {
    background: var(--card-bg);
    padding: 10px 15px;
    border-radius: var(--border-radius);
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: var(--spacing-main);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.stat-icon {
    width: 50px;
    height: 50px;
    background: rgba(100, 166, 68, 0.1);
    color: var(--primary-color);
    border-radius: var(--ui-radius-m);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--ui-color-gray-500);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 1.3rem;
    font-weight: 800;
    color: white;
}

/* Status Pills & Badges */
.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: 25px;
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.05);
    color: var(--ui-color-gray-400);
}

.status-pill.active {
    background: rgba(100, 166, 68, 0.15);
    color: var(--primary-color);
}

.status-pill.warning {
    background: rgba(255, 206, 86, 0.1);
    color: var(--ui-color-warning);
}

.status-pill.danger {
    background: rgba(237, 85, 101, 0.1);
    color: var(--ui-color-danger);
}

/* 바코드 가독성 강화 (스캐너 최적화) */
code.barcode-field {
    background: rgba(255, 255, 255, 0.08);
    padding: 8px 15px;
    border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    color: var(--ui-color-success);
    border: 1px solid rgba(100, 166, 68, 0.2);
    letter-spacing: 1px;
}

/* Premium Table Enhancements */
table.pos-table tr {
    transition: background 0.2s;
}

table.pos-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

table.pos-table.premium {
    border-radius: var(--ui-radius-l);
    overflow: hidden;
}

/* Glassmorphism search box */
.search-box-container {
    background: rgba(255, 255, 255, 0.02);
    padding: 10px 15px;
    border-radius: var(--ui-radius-l);
    border: 1px solid rgba(255, 255, 255, 0.03);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.page-header .btn {
    flex: none;
}

.page-title {
    font-size: 1.4rem;
    font-weight: 800;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Responsive */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .search-box-container {
        flex-direction: column;
        align-items: stretch;
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
}

/* Custom Touch DatePicker Modal */
#v-datepicker-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 440px;
    background: var(--ui-color-gray-800);
    border-radius: var(--ui-radius-l);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 99999;
    overflow: hidden;
    color: white;
}

.cal-header {
    background: var(--ui-color-gray-900);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.cal-month-nav {
    display: flex;
    align-items: center;
    gap: 15px;
}

.cal-btn {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: white;
    width: 45px;
    height: 45px;
    border-radius: var(--ui-radius-m);
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.1s;
}

.cal-btn:active {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(0.95);
}

.cal-title {
    font-size: 1.4rem;
    font-weight: 800;
}

.cal-body {
    padding: 20px;
    background: var(--ui-color-black);
}

.cal-week {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-weight: 700;
    color: var(--ui-color-gray-400);
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

.cal-day {
    aspect-ratio: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: var(--ui-radius-m);
    font-size: 1.3rem;
    font-weight: 700;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.03);
    color: white;
    user-select: none;
    transition: all 0.1s;
    border: 1px solid transparent;
}

.cal-day:active {
    transform: scale(0.92);
}

.cal-day.other-month {
    opacity: 0.3;
}

.cal-day.today {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.cal-day.selected {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.cal-day.sun {
    color: var(--ui-color-danger);
}

.cal-day.sat {
    color: #5dade2;
}

.cal-footer {
    padding: 15px 20px;
    background: var(--ui-color-gray-900);
    display: flex;
    justify-content: space-between;
    gap: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.cal-footer .btn {
    min-height: 55px;
    font-size: 1.2rem;
}

/* === 농가 전용 테마 (High Contrast Compact) - 최종 실무 개편 === */
.farmer-theme {
    --primary-color: #10b981;
    --secondary-color: #064e3b;
    --primary-light: #f1f5f9;
    --dark-bg: #0f172a;
    /* 관리자 대시보드 배경색 (Slate 900) */
    --card-bg: #1e293b;
    /* 관리자 카드 배경색 (Slate 800) */
    --text-color: #f8fafc;
    --text-sub: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.05);
    --border-radius: 16px;

    /* 상위 테마(ui.css) 변수 강제 오버라이드 - 시인성 중심 */
    --ui-color-white: #ffffff !important;
    --ui-color-black: #000000 !important;
    --ui-color-gray-900: #000000 !important;
    --ui-color-gray-800: #0f172a !important;
    --ui-color-gray-700: #1e293b !important;
    --ui-color-gray-600: #334155 !important;
    --ui-color-gray-500: #064e3b !important;
    --ui-color-gray-400: #164e33 !important;
    --ui-color-gray-300: #cbd5e1 !important;
    --ui-color-gray-200: #ccd3de !important;
    --ui-color-gray-100: #e2e8f0 !important;
    --ui-color-gray-50: #f1f5f9 !important;
}

/* 농가 테마 적용 시 배경 및 군더더기 제거 */
body.farmer-theme,
html.darkMode body.farmer-theme,
body.darkMode.farmer-theme {
    background-color: var(--dark-bg) !important;
    color: var(--text-color) !important;
    -webkit-font-smoothing: antialiased;
}

.farmer-theme input,
.farmer-theme select,
.farmer-theme textarea,
.farmer-theme button {
    color: #000000 !important;
    background-color: #ffffff !important;
    font-family: inherit;
    border: 1px solid var(--border-color) !important;
}

/* 카드 공통 스타일 (그림자 완전 배제, 실선 구분) */
.farmer-theme .card-premium {
    background: #86f586 !important;
    padding: 20px;
    border-radius: 24px;
    border: 1px solid #72d072 !important;
    box-shadow: none !important;
    transition: all 0.2s;
}

.farmer-theme .card-premium:hover {
    transform: none !important;
}

/* ══════════════════════════════════════════════════════════════
   MOBILE ADMIN UI — Complete Overhaul  (max-width: 768px)
   ────────────────────────────────────────────────────────────
   원칙: 44px+ 터치 타겟 / 단일 컬럼 폼 / sticky 헤더+내비
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

    /* ── 1. 헤더 (sticky + 단순화) ── */
    header.admin-header {
        position: sticky !important;
        top: 0 !important;
        z-index: 300 !important;
        padding: 0 12px !important;
        height: 54px !important;
        min-height: 54px !important;
        flex-wrap: nowrap !important;
        gap: 0 !important;
        align-items: center !important;
        box-sizing: border-box !important;
        margin-bottom: 0 !important;
    }
    .farm-name {
        font-size: 0.95rem !important;
        gap: 5px !important;
        flex: 1 1 auto !important;
        min-width: 0 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
    .farm-name i { font-size: 1.1rem !important; flex-shrink: 0 !important; }

    /* 헤더 우측 도구들 */
    .header-tools {
        flex-shrink: 0 !important;
        flex-wrap: nowrap !important;
        gap: 5px !important;
        align-items: center !important;
    }
    /* 숨김: 해상도 토글, 사용자 이름 텍스트, 가상 키보드 토글 */
    .res-toggle-group,
    .header-tools > span,
    #vk-toggle-btn { display: none !important; }

    /* 계산기 버튼 — 아이콘만 */
    .btn-header-calc {
        width: 38px !important;
        min-height: 38px !important;
        padding: 0 !important;
        font-size: 0 !important;
        border-radius: 9px !important;
        flex-shrink: 0 !important;
    }
    .btn-header-calc i { font-size: 1.2rem !important; margin: 0 !important; }

    /* POS 실행 버튼 */
    .btn-header-pos {
        padding: 0 10px !important;
        min-height: 38px !important;
        font-size: 0.78rem !important;
        white-space: nowrap !important;
        flex-shrink: 0 !important;
    }
    .btn-header-pos i { font-size: 1rem !important; }

    /* 로그아웃 버튼 */
    .logout-btn {
        padding: 0 10px !important;
        min-height: 38px !important;
        font-size: 0.8rem !important;
        border-radius: 9px !important;
        flex-shrink: 0 !important;
    }

    /* ── 2. 내비게이션 (sticky, 수평 스크롤 pill) ── */
    nav.admin-nav {
        position: sticky !important;
        top: 54px !important;
        z-index: 200 !important;
        background: var(--dark-bg) !important;
        margin-bottom: 10px !important;
        padding: 8px 0 6px !important;
        gap: 6px !important;
        scroll-snap-type: x mandatory !important;
        -webkit-overflow-scrolling: touch !important;
        flex-wrap: nowrap !important;
        border-bottom: 1px solid rgba(255,255,255,0.05);
    }
    .nav-link {
        scroll-snap-align: start !important;
        flex: 0 0 auto !important;
        padding: 8px 14px !important;
        font-size: 0.88rem !important;
        font-weight: 700 !important;
        border-radius: 20px !important;
        min-height: 36px !important;
        display: inline-flex !important;
        align-items: center !important;
        white-space: nowrap !important;
    }

    /* ── 3. 레이아웃 (100vh 잠금 해제) ── */
    body.is-list-page { height: auto !important; overflow: auto !important; }
    body.is-list-page .main-container {
        height: auto !important;
        display: block !important;
        padding: 8px 10px !important;
    }
    body.is-list-page .content-card {
        flex: none !important;
        display: block !important;
        min-height: 0 !important;
        padding-bottom: 15px !important;
    }
    body.is-list-page .tbl-container {
        overflow-y: visible !important;
        max-height: none !important;
        margin-top: 12px !important;
        margin-bottom: 15px !important;
    }

    /* 메인 컨테이너 패딩 */
    .main-container { padding: 8px 10px !important; }

    /* ── 4. 콘텐츠 카드 ── */
    .content-card {
        min-height: 0 !important;
        padding: 14px 12px !important;
        border-radius: 12px !important;
        margin-bottom: 10px !important;
    }
    .content-card > h3 {
        font-size: 1rem !important;
        margin-bottom: 12px !important;
    }

    /* ── 5. 버튼 (44px 터치 타겟) ── */
    .btn {
        min-height: 44px !important;
        padding: 0 14px !important;
        font-size: 0.9rem !important;
        border-radius: 10px !important;
        white-space: nowrap !important;
    }
    .btn i { font-size: 1.05rem !important; }
    /* 테이블 내부 인라인 버튼은 컴팩트 유지 */
    table.pos-table .btn {
        min-height: 34px !important;
        padding: 0 8px !important;
        font-size: 0.76rem !important;
        border-radius: 6px !important;
        white-space: nowrap !important;
    }

    /* ── 6. 폼 그룹 & 인풋 ── */
    .form-group { margin-bottom: 10px !important; }
    .form-label {
        font-size: 0.85rem !important;
        margin-bottom: 5px !important;
    }
    .pos-input {
        height: 44px !important;
        font-size: 0.95rem !important;
        padding: 0 12px !important;
    }
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 0.95rem !important;
        height: 44px !important;
        padding: 0 12px !important;
        box-sizing: border-box !important;
    }
    .form-group textarea { height: auto !important; padding: 10px 12px !important; min-height: 80px !important; }

    /* ── 7. 통계 카드 그리드 ── */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
        margin-bottom: 12px !important;
    }
    .stat-card {
        padding: 10px 10px !important;
        gap: 8px !important;
        flex-direction: row !important;
        align-items: center !important;
    }
    .stat-icon {
        width: 36px !important;
        height: 36px !important;
        font-size: 1.1rem !important;
        flex-shrink: 0 !important;
        border-radius: 8px !important;
    }
    .stat-info { min-width: 0 !important; flex: 1; }
    .stat-label {
        font-size: 0.72rem !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
    .stat-value {
        font-size: 1rem !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    /* ── 8. 대시보드 아이템 그리드 ── */
    .item-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }
    .item-btn {
        padding: 16px 10px !important;
        min-height: 90px !important;
        border-radius: 12px !important;
    }
    .item-btn i { font-size: 2rem !important; margin-bottom: 6px !important; }
    .item-btn .it-name { font-size: 0.88rem !important; }
    .item-btn .it-price { font-size: 0.75rem !important; }

    /* ── 9. 페이지 헤더 & 검색박스 ── */
    .page-header {
        flex-wrap: wrap !important;
        gap: 8px !important;
        margin-bottom: 12px !important;
        align-items: stretch !important;
    }
    .page-title {
        font-size: 1rem !important;
        width: 100% !important;
        margin-bottom: 0 !important;
        white-space: normal !important;
        word-break: keep-all !important;
    }
    .page-header .btn { width: 100% !important; }
    .search-box-container {
        padding: 10px !important;
        gap: 8px !important;
        flex-direction: column !important;
        align-items: stretch !important;
        border-radius: 10px !important;
    }
    .search-box-container > *,
    .search-box-container input,
    .search-box-container select,
    .search-box-container form,
    .search-box-container .btn {
        width: 100% !important;
        box-sizing: border-box !important;
    }
    .search-box-container form {
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
    }
    .search-box-container label {
        font-size: 0.82rem !important;
    }

    /* ── 10. 테이블 ── */
    .tbl-container {
        -webkit-overflow-scrolling: touch !important;
        border-radius: 8px !important;
        border: 1px solid rgba(255,255,255,0.06) !important;
        overflow-x: auto !important;
    }
    table.pos-table { min-width: 500px !important; }
    table.pos-table th {
        padding: 8px 6px !important;
        font-size: 0.76rem !important;
        white-space: nowrap !important;
    }
    table.pos-table td {
        padding: 8px 6px !important;
        font-size: 0.82rem !important;
    }
    table.pos-table tfoot td {
        padding: 8px 6px !important;
        font-size: 0.82rem !important;
        font-weight: 800 !important;
    }

    /* ── 11. 모달 ── */
    .modal-content {
        width: calc(100vw - 40px) !important;
        max-width: 400px !important;
        padding: 20px !important;
    }
    .modal-title { font-size: 1.2rem !important; margin-bottom: 16px !important; }
    #v-datepicker-modal {
        width: calc(100vw - 24px) !important;
        max-width: 420px !important;
        left: 12px !important;
        transform: translateY(-50%) !important;
    }

    /* ── 12. 상태 Pills & 배지 ── */
    .status-pill {
        font-size: 0.75rem !important;
        padding: 4px 10px !important;
    }

    /* ── 13. 인라인 그리드 오버라이드 (JS와 협력) ── */
    /* stats-grid 4컬럼 강제 → 2컬럼 */
    .stats-grid[style*="repeat(4"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    /* sync-dashboard 4컬럼 → 2컬럼 */
    .sync-dashboard {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

    /* ── 14. 로그아웃 텍스트 숨김 ── */
    .logout-text { display: none !important; }
    .logout-btn { gap: 0 !important; }

/* ── 초소형 폰 (400px 이하) ── */
@media (max-width: 400px) {
    .stats-grid { grid-template-columns: 1fr !important; }
    .item-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .farm-name i { font-size: 1rem !important; }
    .btn { font-size: 0.85rem !important; padding: 0 10px !important; }
    nav.admin-nav { top: 54px !important; }
}