*{box-sizing:border-box}body{margin:0;font:15px/1.5 system-ui,-apple-system,"Segoe UI","PingFang SC","Microsoft Yahei",sans-serif;background:#f6f7f9;color:#222}header{background:#111827;color:#fff;display:flex;align-items:center;gap:22px;padding:12px 18px;position:sticky;top:0;z-index:5}.brand{font-weight:800}nav{display:flex;gap:8px;flex:1;overflow:auto}nav a{color:#fff;text-decoration:none;padding:7px 9px;border-radius:7px;white-space:nowrap}nav a:hover{background:#374151}.user{white-space:nowrap}main{max-width:1200px;margin:auto;padding:20px}h1{font-size:24px;margin:0 0 18px}h2{font-size:18px;margin-top:25px}.cards{display:grid;grid-template-columns:repeat(4,1fr);gap:12px}.card{background:#fff;border-radius:12px;padding:18px;text-decoration:none;color:#111;box-shadow:0 1px 4px #0001}.card b{font-size:30px;display:block}.card span{color:#666}.warn b,.badge{color:#b45309}.grid{display:grid;grid-template-columns:repeat(4,1fr);gap:12px}.product{background:#fff;border-radius:12px;padding:10px;color:#222;text-decoration:none;position:relative}.product img{width:100%;height:150px;object-fit:contain;background:#fafafa;border-radius:8px}.product small{display:block;color:#666;margin-top:5px}.badge{display:inline-block;background:#fef3c7;padding:2px 6px;border-radius:8px;margin-top:5px}.list{display:grid;gap:8px}.list>a{display:grid;grid-template-columns:1fr auto;gap:4px 14px;background:#fff;padding:12px;border-radius:10px;text-decoration:none;color:#222}.list>a span,.list>a small{grid-column:1}.list em{grid-column:2;grid-row:1/4;font-style:normal;align-self:center}.row{display:flex;justify-content:space-between;gap:15px;align-items:center;flex-wrap:wrap}input,select,textarea,button{font:inherit;border:1px solid #d1d5db;border-radius:8px;padding:9px 10px}button{background:#111827;color:#fff;border:0;cursor:pointer}.danger{background:#b91c1c}.linkbtn{background:none;padding:0;margin-left:8px}.form{max-width:620px;display:grid;gap:12px}.form label{display:grid;gap:5px}.compact{grid-template-columns:repeat(5,1fr);max-width:none;align-items:end}.auth{max-width:420px;margin:8vh auto;background:#fff;padding:24px;border-radius:14px}.auth form,.auth label{display:grid;gap:10px}.flash{padding:10px 13px;border-radius:8px;margin-bottom:12px}.flash.ok{background:#dcfce7}.flash.error{background:#fee2e2}.producthead{display:flex;gap:20px;align-items:flex-start}.hero{width:260px;max-height:260px;object-fit:contain;background:#fff;border-radius:12px}.share{background:#fff;padding:14px;border-radius:10px;margin-bottom:10px;word-break:break-all}table{width:100%;border-collapse:collapse;background:#fff}th,td{text-align:left;padding:10px;border-bottom:1px solid #eee}.inline{display:inline}.mini{width:70px}.reason{width:140px}.tabs{display:flex;gap:8px}.tabs a{background:#fff;padding:7px 9px;border-radius:8px;text-decoration:none;color:#222}.status.pending{color:#b45309}.status.shipped{color:#047857}.status.cancelled{color:#6b7280}@media(max-width:700px){header{flex-wrap:wrap}.brand{width:100%}nav{order:3;width:100%}main{padding:12px}.cards{grid-template-columns:repeat(2,1fr)}.grid{grid-template-columns:repeat(2,1fr)}.product img{height:120px}.producthead{display:block}.hero{width:100%;height:240px}.compact{grid-template-columns:1fr}table{display:block;overflow:auto;white-space:nowrap}.row form{width:100%;display:flex}.row form input{flex:1}.list>a{grid-template-columns:1fr}.list em{grid-column:1;grid-row:auto}.reason{width:110px}}
.btn{display:inline-block;background:#111827;color:#fff;text-decoration:none;border-radius:8px;padding:9px 12px}.filtertabs{margin:0 0 14px;flex-wrap:wrap}.filtertabs a.active{background:#111827;color:#fff}.badge.new{background:#dbeafe;color:#1d4ed8}.badge.out{background:#f3f4f6;color:#6b7280}.badge.disabled{background:#e5e7eb;color:#374151}.flash.info{background:#dbeafe}.panel{margin:14px 0;background:#fff;border-radius:10px;padding:12px}.panel summary{cursor:pointer;font-weight:700}.compact3{grid-template-columns:2fr 1fr auto;max-width:700px;margin-top:10px}.productform fieldset{border:1px solid #d1d5db;border-radius:10px;padding:12px}.check{display:flex!important;grid-template-columns:auto 1fr!important;align-items:center;gap:8px!important}.check input{width:auto}.productform textarea{min-height:82px}@media(max-width:700px){.compact3{grid-template-columns:1fr}.filtertabs{display:flex;overflow:auto}.btn{white-space:nowrap}}


/* ===== ONEPEA_HEADER_LAYOUT_V2 ===== */

.site-header {
    display: block;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    width: 100%;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    white-space: nowrap;
}

.mainnav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    width: 100%;
    margin-top: 10px;
}

.mainnav a {
    white-space: nowrap;
}

.dashboard-product-search {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 12px 0 16px 0;
    width: 100%;
}

.dashboard-product-search input[type="search"] {
    flex: 1;
    min-width: 260px;
    height: 54px;
    min-height: 54px;
    padding: 0 16px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-size: 17px;
    background: #fff;
    box-sizing: border-box;
}

.dashboard-product-search input[type="search"]:focus {
    outline: none;
    border-color: #2563eb;
}

.dashboard-product-search button {
    height: 42px;
    padding: 0 20px;
    white-space: nowrap;
}

@media (max-width: 700px) {
    .header-top {
        align-items: flex-start;
    }

    .mainnav {
        gap: 6px;
    }

    .dashboard-product-search {
        flex-direction: column;
        align-items: stretch;
    }

    .dashboard-product-search input[type="search"] {
        width: 100%;
        min-width: 0;
    }

    .dashboard-product-search button {
        width: 100%;
    }
}


/* ONEPEA_MOBILE_NAV_FIX_V3 */

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    overflow: visible;
}

.header-top {
    position: relative;
    z-index: 1;
    min-width: 0;
}

.mainnav {
    position: relative;
    z-index: 10;
    pointer-events: auto;
}

.mainnav a {
    position: relative;
    z-index: 11;
    pointer-events: auto;
    touch-action: manipulation;
}

@media (max-width: 700px) {

    .site-header {
        display: block !important;
        padding: 10px 12px;
    }

    .header-top {
        display: flex !important;
        align-items: center;
        width: 100%;
        gap: 8px;
    }

    .header-top .brand {
        width: auto !important;
        flex: 1 1 auto;
        min-width: 0;
        white-space: nowrap;
        font-size: 15px;
    }

    .header-user {
        flex: 0 0 auto;
        margin-left: auto;
        gap: 6px;
        font-size: 14px;
    }

    .mainnav {
        display: flex !important;
        order: initial !important;
        width: 100% !important;
        margin-top: 8px;
        gap: 2px;
        flex-wrap: nowrap !important;

        overflow-x: auto !important;
        overflow-y: hidden !important;

        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;

        position: relative;
        z-index: 20;
        pointer-events: auto;
    }

    .mainnav::-webkit-scrollbar {
        display: none;
    }

    .mainnav a {
        flex: 0 0 auto;
        display: block;
        padding: 7px 8px;
        font-size: 14px;

        position: relative;
        z-index: 21;
        pointer-events: auto;
        touch-action: manipulation;
    }
}

/* ONEPEA_DIRECT_STOCK_V1 */

.stock-direct-form {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}

.stock-direct-input {
    width: 72px;
    height: 36px;
    padding: 5px 8px;
    text-align: center;
    font-weight: 700;
}

.stock-save-btn {
    height: 36px;
    padding: 5px 10px;
    white-space: nowrap;
}

@media (max-width:700px) {
    .stock-direct-form {
        min-width: 128px;
    }

    .stock-direct-input {
        width: 64px;
    }

    .stock-table th,
    .stock-table td {
        padding: 8px;
    }
}

/* ===== ONEPEA_PRODUCTS_MOBILE_4COL_V1 ===== */

@media (max-width: 700px) {

    html,
    body {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    main {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        padding-left: 8px;
        padding-right: 8px;
        overflow-x: hidden;
    }

    .products-grid {
        width: 100%;
        max-width: 100%;
        display: grid !important;
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        gap: 6px !important;
        box-sizing: border-box;
    }

    .product-card {
        width: 100%;
        min-width: 0;
        padding: 5px !important;
        border-radius: 8px !important;
        box-sizing: border-box;
        overflow: hidden;
    }

    .product-card img {
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 1 / 1;
        object-fit: contain !important;
        object-position: center;
        background: #f5f5f5;
        border-radius: 6px !important;
        display: block;
    }

    .product-card h3 {
        margin: 5px 0 3px !important;
        font-size: 11px !important;
        line-height: 1.2 !important;
        overflow: hidden;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        word-break: break-all;
    }

    .product-card p {
        margin: 2px 0 !important;
        font-size: 10px !important;
        line-height: 1.25 !important;
        white-space: normal;
    }

    .product-card .badge {
        margin-top: 3px !important;
        padding: 2px 4px !important;
        font-size: 9px !important;
        line-height: 1.2;
    }
}

