/* ===== 照片排版打印系统 - 前台样式 (兼容 IE11/360兼容模式) ===== */
/* 说明: 不使用 grid/gap/inset 等 IE 不支持的特性, 统一用 flex + margin */
html { color-scheme: light; }
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
       background: #f3f5f9; color: #222; font-size: 14px; line-height: 1.6; }
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }
.container { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

/* ===== 顶栏 ===== */
.topbar { background: #fff; border-bottom: 1px solid #e5e7eb; position: sticky; top: 0; z-index: 50; }
.topbar-inner { display: flex; align-items: center; height: 56px; }
.topbar-inner > * { margin-right: 24px; }
.topbar-inner > *:last-child { margin-right: 0; }
.logo { font-size: 18px; font-weight: 700; color: #1f2937; }
.nav { display: flex; flex: 1; }
.nav a { color: #4b5563; font-size: 14px; margin-right: 18px; }
.nav a:last-child { margin-right: 0; }
.nav a:hover { color: #2563eb; text-decoration: none; }
.topbar-user { display: flex; align-items: center; font-size: 13px; }
.topbar-user > * { margin-right: 12px; }
.topbar-user > *:last-child { margin-right: 0; }
.uname { font-weight: 600; color: #111827; }
.badge-vip { background: #f97316; background: linear-gradient(135deg, #f59e0b, #f97316); color: #fff; font-size: 11px;
             padding: 1px 7px; border-radius: 10px; font-weight: 700; }
.topbar-user a { color: #4b5563; }
.topbar-user a:hover { color: #2563eb; }

/* ===== 主体 ===== */
main.container { padding-top: 20px; padding-bottom: 60px; min-height: calc(100vh - 120px); }
.page-head { margin-bottom: 16px; }
.page-head h1 { font-size: 22px; color: #111827; }
.page-head .sub { color: #6b7280; margin-top: 4px; }
.footer { background: #fff; border-top: 1px solid #e5e7eb; color: #9ca3af; font-size: 12px;
          padding: 16px 0; text-align: center; }

/* 双栏布局: flex 替代 grid (IE11 支持) */
.grid-main { display: flex; align-items: flex-start; }
.grid-main > .panel { flex: 1 1 auto; min-width: 0; margin-left: 16px; }
.grid-main > .panel:first-child { flex: 0 0 430px; margin-left: 0; }
@media (max-width: 980px) { .grid-main { display: block; } .grid-main > .panel { margin-left: 0; } }

/* ===== 面板 ===== */
.panel { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.panel h2 { font-size: 15px; color: #111827; margin: 4px 0 10px; padding-bottom: 8px; border-bottom: 1px solid #f0f0f0; }
.hint { color: #9ca3af; font-size: 12px; font-weight: 400; }
.empty-tip { color: #9ca3af; text-align: center; padding: 26px 0; font-size: 13px; }

/* ===== 纸张选择 ===== */
.paper-select { display: flex; flex-wrap: wrap; max-height: 320px; overflow: auto; padding-right: 4px; }
.paper-select .paper-card { flex: 0 0 calc(50% - 4px); margin: 0 8px 8px 0; }
.paper-select .paper-card:nth-child(2n) { margin-right: 0; }
.paper-card { border: 1px solid #e5e7eb; border-radius: 8px; padding: 8px 10px; cursor: pointer; display: flex;
              flex-direction: column; }
.paper-card:hover { border-color: #2563eb; }
.paper-card.active { border-color: #2563eb; background: #eff6ff; }
.paper-card input { display: none; }
.paper-card .pname { font-size: 13px; font-weight: 600; }
.paper-card .psize { font-size: 11px; color: #9ca3af; }
#btnCustomPaper { align-self: center; margin: 8px auto 0; }

/* ===== 上传区 ===== */
.dropzone { border: 2px dashed #cbd5e1; border-radius: 10px; padding: 28px 12px; text-align: center;
            cursor: pointer; background: #fafbfc; display: block; position: relative; overflow: hidden; }
.dropzone.dragover { border-color: #2563eb; background: #eff6ff; }
.dz-inner { display: flex; flex-direction: column; color: #374151; pointer-events: none; position: relative; z-index: 2; }
.dz-inner span { font-size: 12px; color: #9ca3af; }
.upload-status { margin-top: 8px; font-size: 12px; color: #059669; }
.upload-status .err { color: #dc2626; }
/* 透明文件选择框覆盖整个上传区: 点击直接落在原生 input 上, 由浏览器打开文件选择框(不依赖JS转发, 任何浏览器不拦截) */
.dropzone input[type=file] { position: absolute; left: 0; top: 0; width: 100%; height: 100%;
                             opacity: 0; cursor: pointer; z-index: 3; }

/* ===== 照片列表 ===== */
.photo-list { max-height: 460px; overflow: auto; }
.photo-item { display: flex; align-items: center; border: 1px solid #eef0f3; border-radius: 8px;
              padding: 8px; background: #fafbfc; margin-bottom: 8px; }
.photo-item:last-child { margin-bottom: 0; }
.photo-item > * { margin-right: 10px; }
.photo-item > *:last-child { margin-right: 0; }
.photo-item .ph-img { width: 52px; height: 52px; border-radius: 6px; flex-shrink: 0; background: #eee;
                      display: block; }
.photo-item .ph-info { flex: 1; min-width: 0; }
.photo-item .ph-name { font-size: 12px; color: #374151; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.photo-item .ph-size { font-size: 11px; color: #9ca3af; }
.photo-item .ph-ctrl { display: flex; align-items: center; font-size: 12px; color: #6b7280; }
.photo-item .ph-ctrl > * { margin-right: 6px; }
.photo-item .ph-ctrl > *:last-child { margin-right: 0; }
.photo-item .ph-ctrl input[type=number] { width: 62px; padding: 3px 6px; border: 1px solid #d1d5db;
        border-radius: 5px; font-size: 12px; }
.photo-item .ph-ctrl .w40 { width: 40px; }

/* ===== 排版设置 ===== */
.layout-opts { display: flex; flex-direction: column; }
.opt-row { display: flex; align-items: center; flex-wrap: wrap; font-size: 13px; color: #374151;
           margin-bottom: 10px; }
.opt-row > * { margin-right: 10px; }
.opt-row > *:last-child { margin-right: 0; }
.opt-label { min-width: 96px; color: #6b7280; font-weight: 600; }
.opt-row label { display: inline-flex; align-items: center; cursor: pointer; }
.opt-row input[type=radio], .opt-row input[type=checkbox] { accent-color: #2563eb; }
.inp-mm { width: 58px; padding: 4px 6px; border: 1px solid #d1d5db; border-radius: 5px; }
.inp-text { flex: 1; min-width: 120px; padding: 5px 8px; border: 1px solid #d1d5db; border-radius: 5px; }
.disabled-row { opacity: .55; }
.disabled-row input { background: #f3f4f6; }

/* ===== 按钮 ===== */
.btn { display: inline-block; padding: 7px 16px; border: 1px solid transparent; border-radius: 6px;
       background: #f3f4f6; color: #374151; font-size: 13px; cursor: pointer; }
.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-outline { border-color: #d1d5db; background: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-xs { padding: 2px 8px; font-size: 11px; }
.btn-block { display: block; width: 100%; text-align: center; }
.opt-actions { display: flex; flex-wrap: wrap; margin: 14px 0 4px; }
.opt-actions .btn { flex: 1; min-width: 110px; margin: 0 10px 10px 0; }
.opt-actions .btn:last-child { margin-right: 0; }
.opt-actions .btn:disabled { background: #e5e7eb; color: #9ca3af; cursor: not-allowed; }

/* ===== 预览 ===== */
.preview-area { background: #eef1f6; border-radius: 10px; padding: 14px; min-height: 220px;
                max-height: 640px; overflow: auto; display: flex; flex-direction: column; align-items: center; }
.preview-area .sheet { margin-bottom: 14px; }
.sheet { background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.18); position: relative; margin: 0 auto; }
.sheet .cell { position: absolute; background-repeat: no-repeat; background-size: cover;
               background-position: center center; }
.sheet .cell .cutline { position: absolute; left: 0; top: 0; display: block; pointer-events: none; z-index: 5; }
.sheet .cell img { width: 100%; height: 100%; display: block; }
.wm-mark { position: absolute; right: 8px; bottom: 6px; font-size: 12px; color: rgba(128,128,128,.45);
           white-space: nowrap; pointer-events: none; user-select: none; z-index: 5; }
.page-tag { font-size: 12px; color: #6b7280; text-align: center; margin-top: 4px; }

/* ===== 模态框 ===== */
.modal-mask { position: fixed; top: 0; right: 0; bottom: 0; left: 0; background: rgba(17,24,39,.55); z-index: 200;
              display: flex; align-items: center; justify-content: center; padding: 20px; }
/* 关键修复: hidden 属性必须优先于 display:flex, 否则弹窗默认全部显示且无法关闭 */
.modal-mask[hidden] { display: none !important; }
.modal { background: #fff; border-radius: 12px; width: 640px; max-width: 96vw; max-height: 92vh;
         overflow: auto; padding: 18px; }
.modal-sm { width: 420px; }
.modal-lg { width: 780px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-head h3 { font-size: 16px; }
.modal-close { border: 0; background: none; font-size: 20px; cursor: pointer; color: #6b7280; }

/* ===== 表单 ===== */
.form-row { display: flex; align-items: center; margin-bottom: 12px; }
.form-row > * { margin-right: 10px; }
.form-row > *:last-child { margin-right: 0; }
.form-row label { min-width: 90px; color: #4b5563; font-size: 13px; }
.form-row input[type=text], .form-row input[type=password], .form-row input[type=email], .form-row input[type=number],
.form-row textarea { flex: 1; padding: 7px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 13px; }
.auth-box { max-width: 380px; margin: 40px auto; background: #fff; border: 1px solid #e5e7eb;
            border-radius: 12px; padding: 28px; }
.auth-box h2 { text-align: center; margin-bottom: 18px; }
.center { text-align: center; }
.alert { padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 12px; }
.alert-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-success { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.alert-info { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }

/* ===== 会员套餐 ===== */
.plan-list { display: flex; flex-wrap: wrap; }
.plan-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 22px; text-align: center;
             position: relative; flex: 0 0 calc(33.333% - 16px); margin: 0 16px 16px 0; }
.plan-card:nth-child(3n) { margin-right: 0; }
@media (max-width: 980px) { .plan-card { flex: 0 0 calc(50% - 16px); } .plan-card:nth-child(2n) { margin-right: 0; } .plan-card:nth-child(3n) { margin-right: 16px; } }
.plan-hot { border-color: #f59e0b; }
.plan-price { font-size: 30px; font-weight: 800; color: #f97316; margin: 8px 0 2px; }
.plan-days { color: #6b7280; font-size: 13px; margin-bottom: 10px; }
.plan-desc { font-size: 12px; color: #9ca3af; min-height: 44px; margin-bottom: 12px; }
.pay-order { display: flex; justify-content: space-between; background: #f9fafb; border-radius: 8px;
             padding: 12px; margin-bottom: 12px; }
.pay-order strong { color: #f97316; font-size: 18px; }
.pay-methods { display: flex; justify-content: center; margin-bottom: 14px; }
.pay-methods label { margin: 0 20px; }
.qr-box { width: 220px; height: 220px; margin: 0 auto 10px; border: 1px solid #e5e7eb; border-radius: 8px;
          display: flex; align-items: center; justify-content: center; }

/* ===== 表格/我的 ===== */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { background: #f9fafb; text-align: left; padding: 9px 10px; color: #6b7280; font-weight: 600;
            border-bottom: 1px solid #e5e7eb; white-space: nowrap; }
.table td { padding: 9px 10px; border-bottom: 1px solid #f0f1f3; vertical-align: middle; }
.thumb { width: 40px; height: 40px; border-radius: 5px; display: block; }
.tabs { display: flex; margin-bottom: 14px; border-bottom: 2px solid #e5e7eb; }
.tabs a { padding: 8px 16px; color: #6b7280; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -2px;
          margin-right: 4px; }
.tabs a.active { color: #2563eb; border-color: #2563eb; font-weight: 600; }
.tabs a:hover { text-decoration: none; color: #2563eb; }
.layout-list { display: flex; flex-direction: column; }
.layout-item { display: flex; justify-content: space-between; align-items: center; border: 1px solid #eef0f3;
               border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.layout-item:last-child { margin-bottom: 0; }
.st-pending { color: #d97706; }
.st-paid { color: #059669; font-weight: 600; }
.st-closed { color: #9ca3af; }
.st-refunded { color: #dc2626; }

/* ===== 手动排版 ===== */
.manual-tips { font-size: 12px; color: #6b7280; background: #f0f7ff; border: 1px dashed #93c5fd;
               padding: 8px 12px; border-radius: 8px; margin-bottom: 12px; }
.manual-pager { display: flex; flex-wrap: wrap; margin-bottom: 10px; }
.manual-pager .mp { padding: 4px 12px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 12px;
                    cursor: pointer; background: #fff; margin: 0 6px 6px 0; }
.manual-pager .mp.on { background: #2563eb; color: #fff; border-color: #2563eb; }
.m-sheet { background: #fff; margin: 0 auto 10px; position: relative; box-shadow: 0 2px 12px rgba(0,0,0,.25); }
.m-cell { position: absolute; border: 2px solid #2563eb; cursor: move; background-size: cover;
          background-position: center; box-sizing: border-box; }
.m-cell .rs { position: absolute; right: -6px; bottom: -6px; width: 12px; height: 12px; background: #2563eb;
              border-radius: 50%; cursor: nwse-resize; }
.m-cell .tag { position: absolute; left: 0; top: -18px; background: rgba(37,99,235,.9); color: #fff;
               font-size: 10px; padding: 0 6px; border-radius: 4px; white-space: nowrap; }

/* ===== 裁剪 ===== */
.crop-wrap { position: relative; text-align: center; background: #111; border-radius: 8px; overflow: hidden; }
.crop-stage { position: relative; margin: 0 auto; display: inline-block; }
.crop-wrap img { max-width: 100%; max-height: 52vh; display: block; margin: 0 auto; }
.crop-box { position: absolute; border: 2px solid #fff; box-shadow: 0 0 0 9999px rgba(0,0,0,.5); cursor: move; }
.crop-box .cb { position: absolute; width: 10px; height: 10px; background: #fff; border: 1px solid #333; }
.crop-actions { display: flex; justify-content: center; margin-top: 12px; }
.crop-actions .btn { margin: 0 12px; }

/* ===== 其他 ===== */
.toolbar-form { display: flex; margin-bottom: 14px; align-items: center; }
.toolbar-form > * { margin-right: 8px; }
.toolbar-form > *:last-child { margin-right: 0; }
.toolbar-form input[type=text] { width: 240px; padding: 6px 10px; border: 1px solid #d1d5db; border-radius: 6px; }
.inline-form { display: inline-flex; }
.inline-form > * { margin-right: 4px; }
.inline-form > *:last-child { margin-right: 0; }
.op { display: flex; flex-wrap: wrap; }
.op > * { margin-right: 4px; }
.op > *:last-child { margin-right: 0; }
.inp-xs { width: 70px; padding: 3px 5px; border: 1px solid #d1d5db; border-radius: 4px; font-size: 12px; }
.green { color: #059669; }
.red { color: #dc2626; }
.small { font-size: 11px; color: #9ca3af; }

/* ===== v1.3 新增 ===== */
.topbar .logo img { height: 34px; width: auto; display: block; }
.ad-box { margin: 12px 0; text-align: center; overflow: hidden; }
.ad-box img { display: inline-block; }
.crop-presets { display: flex; align-items: center; flex-wrap: wrap; margin: -3px; padding: 10px 9px; }
.crop-presets label { margin: 3px; }
                border-bottom: 1px solid #eef0f3; background: #fafafa; font-size: 12px; }
.crop-presets .inp-mm { width: 90px; }
.crop-actions .hint { margin-right: 12px; }
