* { box-sizing: border-box; }

body {
    font-family: Verdana, Geneva, sans-serif;
    font-size: 12px;
    color: #222;
    margin: 0;
    padding: 0;
    background: #f0f0f0;
}

a { color: #1a5f9e; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 顶栏 ---------- */
.topbar {
    background: linear-gradient(to bottom, #4a4a4a, #2c2c2c);
    color: #fff;
    padding: 10px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 4px rgba(0,0,0,.3);
}
.topbar h1 {
    font-size: 18px;
    margin: 0;
    letter-spacing: .5px;
}
.topbar .nav a {
    color: #ddd;
    margin-left: 16px;
    font-size: 12px;
}
.topbar .nav a:hover { color: #fff; }
.topbar .nav a.active { color: #fff; border-bottom: 2px solid #e8730a; padding-bottom: 2px; }
.badge-new {
    background: #e8730a;
    color: #fff;
    border-radius: 10px;
    padding: 1px 7px;
    font-weight: bold;
    font-size: 11px;
    margin-left: 4px;
}

.wrap { padding: 14px 18px 120px; }

/* ---------- 筛选栏 ---------- */
.filters {
    background: #fff;
    border: 1px solid #ccc;
    padding: 10px 12px;
    margin-bottom: 12px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}
.filters input[type=text], .filters select {
    font-family: Verdana, sans-serif;
    font-size: 12px;
    padding: 4px 6px;
    border: 1px solid #aaa;
}
.filters input[type=text] { min-width: 220px; }
.filters button {
    font-size: 12px;
    padding: 4px 12px;
    background: #4a4a4a;
    color: #fff;
    border: none;
    cursor: pointer;
}
.filters button:hover { background: #333; }
.filters a.reset { font-size: 11px; color: #777; }
.filters a.btn-tous {
    font-size: 12px;
    padding: 4px 12px;
    background: #fff;
    border: 1px solid #4a4a4a;
    color: #4a4a4a;
    border-radius: 3px;
    margin-left: auto;
    white-space: nowrap;
}
.filters a.btn-tous:hover { background: #4a4a4a; color: #fff; text-decoration: none; }
.filters a.btn-tous.active { background: #e8730a; border-color: #e8730a; color: #fff; }
.filters a.btn-tous.active:hover { background: #cf6205; }

/* ---------- 产品表格 ---------- */
.table-scroll { overflow-x: auto; background: #fff; border: 1px solid #ccc; }

table.catalogue {
    border-collapse: collapse;
    width: 100%;
    min-width: 900px;
}
table.catalogue th {
    background: linear-gradient(to bottom, #6d6d6d, #4a4a4a);
    color: #fff;
    font-size: 11px;
    text-align: left;
    padding: 6px 8px;
    border: 1px solid #3c3c3c;
    white-space: nowrap;
}
table.catalogue td {
    padding: 4px 8px;
    border: 1px solid #ddd;
    vertical-align: middle;
}
table.catalogue tbody tr:nth-child(odd)  { background: #ebebeb; }
table.catalogue tbody tr:nth-child(even) { background: #f8f8f8; }
table.catalogue tbody tr:hover { background: #dcecff; }

td.num { text-align: right; white-space: nowrap; }
td.center { text-align: center; }

.stock-high { color: #1a8a1a; font-weight: bold; }
.stock-low  { color: #e8730a; font-weight: bold; }
.stock-rupture { color: #cc0000; font-weight: bold; }

/* 季节小图标 */
/* 季节/车型图标 */
.ico { height: 20px; width: auto; vertical-align: middle; display: inline-block; }

.etiq { text-decoration: none; font-size: 13px; margin-left: 3px; }
.etiq:hover { opacity: .7; }

.saison-ico {
    display: inline-block;
    border: 1px solid #999;
    border-radius: 3px;
    padding: 1px 5px;
    background: #fff;
    font-size: 12px;
    white-space: nowrap;
}

input.qty {
    width: 52px;
    font-family: Verdana, sans-serif;
    font-size: 12px;
    padding: 3px 4px;
    border: 1px solid #999;
    text-align: center;
    -moz-appearance: textfield;   /* Firefox：去掉上下微调箭头 */
}
/* Chrome/Safari/Edge：去掉上下微调箭头 */
input.qty::-webkit-outer-spin-button,
input.qty::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* ---------- 底部固定下单栏 ---------- */
.orderbar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    background: #2c2c2c;
    color: #eee;
    padding: 10px 18px;
    box-shadow: 0 -2px 6px rgba(0,0,0,.35);
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.orderbar .summary {
    font-weight: bold;
    font-size: 13px;
    color: #ffcf9e;
    min-width: 220px;
}
.orderbar input {
    font-family: Verdana, sans-serif;
    font-size: 12px;
    padding: 4px 6px;
    border: 1px solid #666;
    background: #fff;
}
.orderbar input.req { border-color: #e8730a; }
.btn-orange {
    background: #e8730a;
    color: #fff;
    border: none;
    padding: 7px 18px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 3px;
}
.btn-orange:hover { background: #cf6205; }

/* ---------- 确认页 ---------- */
.card {
    background: #fff;
    border: 1px solid #ccc;
    padding: 18px 22px;
    margin: 18px auto;
    max-width: 820px;
}
.card h2 { margin-top: 0; }
table.recap { border-collapse: collapse; width: 100%; margin: 12px 0; }
table.recap th, table.recap td { border: 1px solid #ccc; padding: 6px 8px; text-align: left; }
table.recap th { background: #eee; }
table.recap td.num { text-align: right; }
.total-line { font-size: 15px; font-weight: bold; text-align: right; margin-top: 8px; }
.ok-msg { color: #1a8a1a; font-weight: bold; font-size: 14px; }
.err-msg { color: #cc0000; font-weight: bold; }

/* ---------- 登录页 ---------- */
.login-box {
    background: #fff;
    border: 1px solid #ccc;
    max-width: 320px;
    margin: 80px auto;
    padding: 26px;
}
.login-box h2 { margin-top: 0; text-align: center; }
.login-box input[type=password] {
    width: 100%;
    padding: 8px;
    font-size: 13px;
    border: 1px solid #999;
    margin-bottom: 12px;
}

/* ---------- 后台 ---------- */
.admin-section { background: #fff; border: 1px solid #ccc; padding: 14px; margin-bottom: 16px; }

/* 库存统计条 */
.stock-stats { display: flex; gap: 18px; flex-wrap: wrap; align-items: center;
    background: #f4f4f4; border: 1px solid #ddd; padding: 8px 12px; margin-bottom: 10px; font-size: 13px; }
.stock-stats strong { font-size: 15px; }

/* 折叠式"添加产品"面板：summary 呈现为按钮 */
.add-panel summary {
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #e8730a;
    color: #fff;
    font-size: 13px;
    font-weight: bold;
    padding: 7px 16px;
    border-radius: 3px;
    cursor: pointer;
    user-select: none;
}
.add-panel summary:hover { background: #cf6205; }
.add-panel summary::-webkit-details-marker { display: none; }  /* 隐藏默认三角(Safari/Chrome) */
.add-panel[open] summary { background: #4a4a4a; }
.add-panel[open] summary::before { content: "▾ "; }
.add-panel:not([open]) summary::before { content: "▸ "; }
.admin-section h2 { margin-top: 0; font-size: 15px; }
table.admin { border-collapse: collapse; width: 100%; }
table.admin th {
    background: linear-gradient(to bottom, #6d6d6d, #4a4a4a);
    color: #fff; padding: 6px 8px; text-align: left; font-size: 11px; border: 1px solid #3c3c3c;
}
table.admin td { border: 1px solid #ddd; padding: 4px 6px; }
table.admin tbody tr:nth-child(odd) { background: #ebebeb; }
table.admin tbody tr:nth-child(even) { background: #f8f8f8; }
table.admin input[type=text], table.admin input[type=number] {
    font-family: Verdana, sans-serif; font-size: 12px; padding: 3px 4px; border: 1px solid #999;
}
table.admin input.small { width: 64px; text-align: right; }
tr.inactive { opacity: .45; }

.form-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 10px; }
.form-row label { display: flex; flex-direction: column; font-size: 11px; color: #555; }
.form-row input, .form-row select {
    font-family: Verdana, sans-serif; font-size: 12px; padding: 4px 6px; border: 1px solid #999; margin-top: 2px;
}
.btn-dark {
    background: #4a4a4a; color: #fff; border: none; padding: 5px 12px; font-size: 12px; cursor: pointer; border-radius: 3px;
}
.btn-dark:hover { background: #333; }
.btn-mini { padding: 3px 8px; font-size: 11px; }

/* 状态徽章 */
.statut { display: inline-block; padding: 2px 9px; border-radius: 10px; color: #fff; font-size: 11px; font-weight: bold; }
.statut-nouveau  { background: #e8730a; }
.statut-confirme { background: #1a5f9e; }
.statut-livre    { background: #1a8a1a; }
.statut-annule   { background: #888; }

/* 批量保存栏：随页面滚动吸附在视口底部，产品多时无需滚到最底 */
.savebar {
    position: sticky;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: #2c2c2c;
    color: #eee;
    padding: 10px 14px;
    margin-top: 8px;
    box-shadow: 0 -2px 6px rgba(0,0,0,.3);
    border-radius: 3px;
}
.savebar .muted { color: #bbb; }

/* 危险操作按钮（删除行 / 删除订单） */
.btn-del {
    background: #b32020; color: #fff; border: none;
    padding: 5px 12px; font-size: 12px; cursor: pointer; border-radius: 3px;
}
.btn-del:hover { background: #8f1919; }
.btn-del.btn-mini { padding: 2px 7px; font-size: 11px; line-height: 1; }

/* 订单明细的行内输入 */
table.recap input.small {
    width: 66px; font-family: Verdana, sans-serif; font-size: 12px;
    padding: 3px 4px; border: 1px solid #999; text-align: right;
}

.addline {
    display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
    background: #f4f4f4; border: 1px dashed #bbb; padding: 8px; margin: 8px 0;
}
.addline select {
    font-family: Verdana, sans-serif; font-size: 12px; padding: 4px 6px;
    border: 1px solid #999; max-width: 420px;
}

.order-actions {
    display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
    margin: 10px 0; padding-top: 8px; border-top: 1px solid #eee;
}
.order-actions select {
    font-family: Verdana, sans-serif; font-size: 12px; padding: 4px 6px; border: 1px solid #999;
}

.order-card { border: 1px solid #ccc; margin-bottom: 14px; }
.order-head { background: #eee; padding: 8px 12px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; align-items: center; }
.order-body { padding: 8px 12px; }
.muted { color: #777; }

/* ---------- 移动端自适应 ---------- */
@media (max-width: 640px) {
    .wrap { padding: 10px 8px 20px; }
    .topbar { padding: 8px 10px; }
    .topbar h1 { font-size: 15px; }
    .topbar .nav a { margin-left: 10px; font-size: 11px; }

    /* 前台目录：手机隐藏 IC/IV 和 EAN 列 */
    .col-hide-m { display: none; }

    /* 筛选栏：搜索框占满、其余控件自适应换行 */
    .filters { padding: 8px; gap: 6px; }
    .filters input[type=text] { min-width: 0; flex: 1 1 100%; }
    .filters select { flex: 1 1 45%; }
    .filters button, .filters a.btn-tous, .filters a.reset { flex: 1 1 auto; }
    .filters a.btn-tous { margin-left: 0; }

    /* 目录表格：更紧凑、随屏收缩 */
    table.catalogue { min-width: 0; width: 100%; font-size: 11px; }
    table.catalogue th { padding: 4px 3px; font-size: 10px; }
    table.catalogue td { padding: 3px 3px; }
    .ico { height: 18px; }
    input.qty { width: 40px; padding: 3px 2px; }

    /* 下单栏：随页面流动、每个输入占满一行 */
    .orderbar {
        position: static; box-shadow: none; border-radius: 4px;
        margin-top: 12px; padding: 10px; gap: 6px;
    }
    .orderbar .summary { min-width: 0; flex: 1 1 100%; text-align: center; }
    .orderbar input { flex: 1 1 100%; min-width: 0; }
    .orderbar .btn-orange { flex: 1 1 100%; }

    /* 后台：保存栏 / 统计条适配窄屏 */
    .savebar { flex-direction: column; gap: 8px; align-items: stretch; text-align: center; }
    .stock-stats { gap: 10px; font-size: 12px; }
    table.admin { font-size: 11px; }
    table.admin th, table.admin td { padding: 3px 4px; }
}
