:root{
  --bg:#f5f5f7;
  --card:#ffffff;
  --card-soft:#fbfbfd;
  --line:#e6e8ee;
  --line-strong:#d7dce5;
  --text:#1d1d1f;
  --muted:#6e6e73;
  --blue:#007aff;
  --blue-dark:#0063d1;
  --danger:#d84f5f;
  --shadow:0 12px 36px rgba(17,24,39,.06);
  --shadow-soft:0 6px 18px rgba(17,24,39,.04);
  --radius-xl:32px;
  --radius-lg:24px;
  --radius-md:18px;
  --radius-sm:14px;
}
*{box-sizing:border-box}
html,body{margin:0;min-height:100%}
body{
  font-family:Inter,"PingFang SC","Microsoft YaHei",system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  color:var(--text);
  background:
    radial-gradient(circle at 0% 0%, rgba(0,122,255,.06), transparent 26%),
    linear-gradient(180deg,#fafafc 0%, #f3f4f7 100%);
}
button,input,textarea{font:inherit}
button{appearance:none;border:none;background:none}
input,textarea{outline:none}
textarea{resize:vertical;min-height:108px}
input[type="range"]{accent-color:var(--blue)}

.app-shell{max-width:1520px;margin:0 auto;padding:28px 24px 34px}
.header-shell{
  display:flex;align-items:center;justify-content:space-between;gap:18px;
  background:rgba(255,255,255,.78);backdrop-filter:blur(18px);
  border:1px solid rgba(255,255,255,.76);box-shadow:var(--shadow);
  border-radius:28px;padding:20px 24px;margin-bottom:18px;
}
.brand-wrap{display:flex;align-items:center;gap:16px;min-width:0}
.brand-mark{
  width:56px;height:56px;border-radius:18px;background:linear-gradient(145deg,#23a0ff,#007aff);
  color:#fff;display:grid;place-items:center;font-size:24px;font-weight:900;box-shadow:0 12px 28px rgba(0,122,255,.22);
}
.brand-copy h1{margin:0;font-size:28px;line-height:1.06;font-weight:860;letter-spacing:-.02em}
.brand-copy p{margin:6px 0 0;color:var(--muted);font-size:14px}
.header-pill{
  flex:0 0 auto;background:#eef6ff;color:#0a64d8;border:1px solid #d8e8ff;border-radius:999px;padding:10px 14px;font-size:13px;font-weight:760;
}

.main-grid{display:grid;grid-template-columns:430px minmax(0,1fr);gap:18px;align-items:start}
.control-panel,.preview-panel{
  background:rgba(255,255,255,.82);backdrop-filter:blur(18px);border:1px solid rgba(255,255,255,.74);box-shadow:var(--shadow);border-radius:var(--radius-xl);
}
.control-panel{padding:24px}
.preview-panel{padding:24px;position:sticky;top:18px}
.panel-header,.preview-head{display:flex;align-items:flex-start;justify-content:space-between;gap:14px}
.panel-header h2,.preview-head h2{margin:0;font-size:22px;line-height:1.08;font-weight:850;letter-spacing:-.02em}
.panel-header p,.preview-head p{margin:8px 0 0;color:var(--muted);font-size:14px;line-height:1.5}
.ghost-btn{
  cursor:pointer;border:1px solid var(--line);background:#fff;color:#4b5563;border-radius:16px;padding:10px 14px;font-size:13px;font-weight:760;box-shadow:var(--shadow-soft);
}
.ghost-btn:hover{background:#f9fafe}
.small-btn{padding:8px 12px}

.group-block{padding:20px 0;border-top:1px solid #eef1f5}
.group-block:first-of-type{border-top:none;padding-top:18px}
.compact-block{padding-top:18px;padding-bottom:0}
.group-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:14px}
.group-head h3,.section-row span{margin:0;font-size:16px;font-weight:820;letter-spacing:-.01em}
.section-row{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:16px 0 10px}
.section-row small{font-size:12px;color:var(--muted);font-weight:760}
.tight-row{margin:12px 0 10px}
.no-margin{margin:0}
.top-gap{margin-top:18px}
.top-gap-sm{margin-top:12px}

.upload-box{
  min-height:218px;border:1.5px dashed #d8e0ec;border-radius:24px;background:linear-gradient(180deg,#fdfdff,#f8faff);
  display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:24px;cursor:pointer;transition:.18s ease;
}
.upload-box:hover,.upload-box.drag{border-color:#bcd4ff;background:linear-gradient(180deg,#ffffff,#f4f8ff)}
.upload-icon{
  width:78px;height:78px;border-radius:24px;background:#fff;border:1px solid #e8edf5;color:var(--blue);display:grid;place-items:center;box-shadow:0 10px 24px rgba(0,122,255,.08);
}
.upload-icon svg{width:36px;height:36px}
.upload-title{margin-top:16px;font-size:19px;font-weight:840;letter-spacing:-.01em}
.upload-sub{margin-top:8px;color:#7c8591;font-size:14px;line-height:1.6}

.file-list,.result-list{display:flex;flex-direction:column;gap:10px}
.empty-state{min-height:112px;border:1px dashed #dde3eb;border-radius:18px;display:grid;place-items:center;background:#fafbfc}
.empty-copy{color:#97a0ab;font-size:14px}
.file-item,.result-item{
  display:flex;align-items:center;gap:14px;background:#fff;border:1px solid var(--line);border-radius:18px;padding:13px 14px;box-shadow:var(--shadow-soft);
}
.file-type{width:56px;height:42px;border-radius:14px;background:#f3f6fb;color:#355784;display:grid;place-items:center;font-size:13px;font-weight:900}
.file-meta{min-width:0;flex:1}
.file-name{font-size:14px;font-weight:770;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.file-size{margin-top:4px;font-size:12px;color:var(--muted)}
.file-remove{
  cursor:pointer;width:34px;height:34px;border-radius:12px;border:1px solid var(--line);background:#fafbfd;color:#7d8796;font-size:20px;line-height:1;display:grid;place-items:center;
}
.file-remove:hover{background:#fff4f5;color:var(--danger)}

.field-stack{display:flex;flex-direction:column;gap:14px}
.field{display:flex;flex-direction:column;gap:8px}
.field>span{font-size:13px;font-weight:800;color:#344054}
.field textarea,.field input[type="number"],.field input[type="text"]{
  width:100%;border:1px solid var(--line);background:#fbfbfd;color:var(--text);border-radius:18px;padding:14px 15px;font-size:14px;transition:.18s ease;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.85);
}
.field textarea::placeholder,.field input::placeholder{color:#a0a7b3}
.field textarea:focus,.field input:focus{border-color:#c9ddff;box-shadow:0 0 0 4px rgba(0,122,255,.08)}
.hidden{display:none!important}

.preset-list{display:flex;flex-wrap:wrap;gap:10px}
.preset-btn{
  cursor:pointer;border:1px solid var(--line);background:#fff;color:#4b5563;border-radius:999px;padding:10px 14px;font-size:13px;font-weight:800;box-shadow:var(--shadow-soft);transition:.18s ease;
}
.preset-btn:hover{transform:translateY(-1px);background:#f9fbff}
.preset-btn.active{background:linear-gradient(135deg,#2f89ff,#007aff);border-color:transparent;color:#fff;box-shadow:0 14px 26px rgba(0,122,255,.20)}

.segmented{display:flex;flex-wrap:wrap;gap:10px}
.segmented button{
  cursor:pointer;border:1px solid var(--line);background:#fff;color:#4b5563;border-radius:16px;padding:10px 14px;font-size:13px;font-weight:820;box-shadow:var(--shadow-soft);transition:.18s ease;
}
.segmented button.active{background:linear-gradient(135deg,#2f89ff,#007aff);border-color:transparent;color:#fff;box-shadow:0 14px 26px rgba(0,122,255,.20)}

.expiry-card{margin-top:14px;border:1px solid #e4ebf5;background:#f8fbff;border-radius:22px;padding:15px 16px;display:flex;align-items:center;justify-content:space-between;gap:14px}
.expiry-left small{display:block;color:#7d8898;font-size:12px;font-weight:760;margin-bottom:6px}
.expiry-left strong{font-size:15px;line-height:1.4}
.serial-chip{flex:0 0 auto;background:#fff;border:1px solid #dbe4f1;border-radius:999px;padding:10px 14px;color:#4f6484;font-size:12px;font-weight:850;letter-spacing:.04em}

.toggle-grid{display:flex;flex-direction:column;gap:12px;margin-top:14px}
.toggle-row{display:grid;grid-template-columns:minmax(0,1fr) auto auto;align-items:center;gap:14px;padding:14px 16px;border:1px solid var(--line);background:#fff;border-radius:18px}
.toggle-row strong{display:block;font-size:14px}
.toggle-row small{display:block;margin-top:4px;font-size:12px;color:var(--muted)}
.toggle-row input{display:none}
.toggle-row i{width:52px;height:31px;border-radius:999px;background:#d8dee8;position:relative;display:block;transition:.18s ease}
.toggle-row i::before{content:"";position:absolute;top:4px;left:4px;width:23px;height:23px;border-radius:50%;background:#fff;box-shadow:0 4px 10px rgba(17,24,39,.12);transition:.18s ease}
.toggle-row input:checked + i{background:linear-gradient(135deg,#2f89ff,#007aff)}
.toggle-row input:checked + i::before{left:25px}

.color-box{border:1px solid var(--line);background:#fbfbfd;border-radius:20px;padding:16px}
.color-value-wrap{display:flex;align-items:center;gap:10px}
.color-value-wrap input[type="color"]{width:42px;height:42px;border:none;padding:0;background:none;cursor:pointer}
.color-value-wrap input[type="color"]::-webkit-color-swatch-wrapper{padding:0}
.color-value-wrap input[type="color"]::-webkit-color-swatch{border:none;border-radius:12px;box-shadow:0 0 0 1px #e1e6ef}
#colorValue{font-size:13px;font-weight:820;color:#566171}
.swatches{display:flex;flex-wrap:wrap;gap:10px;margin-top:14px}
.swatch{cursor:pointer;width:32px;height:32px;border-radius:50%;background:var(--sw);position:relative;box-shadow:0 0 0 1px rgba(17,24,39,.08), inset 0 1px 0 rgba(255,255,255,.3)}
.swatch.active::after{content:"";position:absolute;inset:-4px;border-radius:50%;border:2px solid var(--blue)}

.range-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:14px}
.range-field{border:1px solid var(--line);background:#fff;border-radius:18px;padding:14px 15px}
.range-field span{display:flex;align-items:center;justify-content:space-between;font-size:13px;font-weight:800;color:#344054;margin-bottom:12px}
.range-field b{color:#111827}
.range-field input[type="range"]{width:100%}

.preview-stage{margin-top:14px;background:#f7f8fb;border:1px solid var(--line);border-radius:24px;padding:18px}
#previewCanvas{display:block;width:100%;height:auto;background:#fff;border-radius:18px;border:1px solid #e7ebf2;box-shadow:0 8px 18px rgba(17,24,39,.04)}
.generate-btn{
  width:100%;cursor:pointer;border-radius:22px;padding:18px 20px;margin-top:16px;background:linear-gradient(135deg,#2f89ff,#007aff);color:#fff;display:flex;align-items:center;gap:16px;box-shadow:0 18px 34px rgba(0,122,255,.24);transition:.18s ease;
}
.generate-btn:hover:not(:disabled){transform:translateY(-1px)}
.generate-btn:disabled{opacity:.56;cursor:not-allowed;box-shadow:none}
.btn-icon{width:46px;height:46px;border-radius:16px;background:rgba(255,255,255,.18);display:grid;place-items:center;font-size:22px;font-weight:900}
.generate-btn strong{display:block;font-size:17px}
.generate-btn small{display:block;margin-top:4px;font-size:12px;color:rgba(255,255,255,.9);font-weight:700}
.progress-wrap{margin-top:14px}
.progress-line{height:10px;border-radius:999px;background:#e4ebf4;overflow:hidden}
.progress-line i{display:block;height:100%;width:0;background:linear-gradient(90deg,#2f89ff,#007aff);border-radius:999px;transition:width .18s ease}
.progress-copy{display:flex;justify-content:space-between;gap:12px;margin-top:8px;font-size:13px;color:#556274;font-weight:760}
.result-item{justify-content:space-between}
.result-item>div{min-width:0;flex:1}
.result-item strong{display:block;font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.result-item small{display:block;margin-top:5px;font-size:12px;color:var(--muted)}
.download-btn{flex:0 0 auto;cursor:pointer;border-radius:13px;padding:10px 14px;background:#111827;color:#fff;font-size:13px;font-weight:820;box-shadow:0 10px 18px rgba(17,24,39,.14)}
.download-btn:hover{background:#0b1220}
.danger-soft{width:100%;margin-top:12px;cursor:pointer;border-radius:16px;padding:13px 16px;border:1px solid #f0d5d9;background:#fff6f7;color:var(--danger);font-weight:820}

.site-footer{display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:10px;color:#8a94a3;font-size:12px;font-weight:760;margin-top:16px}
.toast{position:fixed;left:50%;bottom:28px;transform:translateX(-50%) translateY(24px);background:rgba(29,29,31,.92);color:#fff;padding:12px 18px;border-radius:18px;font-size:13px;font-weight:760;box-shadow:0 16px 32px rgba(17,24,39,.18);opacity:0;pointer-events:none;transition:.22s ease;z-index:999}
.toast.show{opacity:1;transform:translateX(-50%) translateY(0)}

@media (max-width: 1180px){
  .main-grid{grid-template-columns:1fr}
  .preview-panel{position:static}
}
@media (max-width: 860px){
  .app-shell{padding:18px 14px 28px}
  .header-shell{padding:18px;border-radius:24px;flex-direction:column;align-items:flex-start}
  .brand-copy h1{font-size:24px}
  .panel-header h2,.preview-head h2{font-size:20px}
  .range-grid{grid-template-columns:1fr}
}
@media (max-width: 560px){
  .control-panel,.preview-panel{padding:18px;border-radius:24px}
  .brand-wrap{align-items:flex-start}
  .brand-mark{width:50px;height:50px;border-radius:16px}
  .upload-box{min-height:206px;padding:20px}
  .upload-title{font-size:17px}
  .toggle-row{grid-template-columns:minmax(0,1fr) auto}
  .toggle-row i{justify-self:end}
}

.group-tip{font-size:12px;color:var(--muted);font-weight:700}
