:root{
  --ikuai-blue:#1e6bd6;
  --ikuai-blue2:#2f8ef4;
  --ikuai-bg:#eef3f9;
  --ikuai-line:#e3eaf3;
  --ikuai-text:#33465c;
  --ikuai-active:#e8f3ff;
}
*{box-sizing:border-box}
html,body{margin:0;height:100%}
body{font-family:"Microsoft YaHei","PingFang SC","Helvetica Neue",sans-serif;color:var(--ikuai-text);background:var(--ikuai-bg)}
#app{height:100vh}

/* ---------- 登录 ---------- */
.login-wrap{height:100vh;display:flex;align-items:center;justify-content:center;
  background:linear-gradient(135deg,#1e6bd6 0%,#2f8ef4 55%,#5fb0ff 100%);position:relative;overflow:hidden}
.login-wrap::after{content:"";position:absolute;inset:0;
  background:radial-gradient(circle at 80% 20%,rgba(255,255,255,.18),transparent 45%),
             radial-gradient(circle at 10% 90%,rgba(255,255,255,.12),transparent 40%)}
.login-card{position:relative;z-index:1;width:380px;background:#fff;border-radius:12px;
  padding:34px 34px 26px;box-shadow:0 18px 60px rgba(9,42,90,.35)}
.login-card h1{font-size:20px;margin:0 0 4px;text-align:center;color:#12324f}
.login-card .sub{text-align:center;color:#8a9bb0;font-size:12px;margin-bottom:22px}
.login-logo{width:54px;height:54px;border-radius:14px;margin:0 auto 14px;display:flex;align-items:center;justify-content:center;
  background:linear-gradient(135deg,#1e6bd6,#4aa3ff);color:#fff;font-size:26px}

/* ---------- 框架 ---------- */
.layout{height:100vh;display:flex;flex-direction:column}
.topbar{height:56px;flex:0 0 56px;display:flex;align-items:center;padding:0 18px;gap:14px;
  background:linear-gradient(90deg,#1a5fc4,#2f8ef4);color:#fff;box-shadow:0 2px 8px rgba(20,70,140,.25);z-index:5}
.topbar .brand{font-size:16px;font-weight:600;letter-spacing:.5px}
.topbar .brand .dot{opacity:.75;font-weight:400}
.topbar .spacer{flex:1}
.topbar .user{display:flex;align-items:center;gap:8px;font-size:13px;cursor:pointer}
.topbar .user .avatar{width:28px;height:28px;border-radius:50%;background:rgba(255,255,255,.25);display:flex;align-items:center;justify-content:center}
.main{flex:1;display:flex;min-height:0}

.sidebar{width:208px;flex:0 0 208px;background:#fff;border-right:1px solid var(--ikuai-line);
  padding:10px 0;overflow-y:auto}
.menu-group{color:#9aabbd;font-size:11px;padding:12px 18px 6px;letter-spacing:1px}
.menu-item{display:flex;align-items:center;gap:10px;padding:11px 18px;font-size:14px;color:var(--ikuai-text);
  cursor:pointer;border-left:3px solid transparent;transition:.15s;user-select:none}
.menu-item:hover{background:#f4f8fd;color:var(--ikuai-blue)}
.menu-item.active{background:var(--ikuai-active);color:var(--ikuai-blue);border-left-color:var(--ikuai-blue);font-weight:600}
.menu-item .el-icon{font-size:17px}
.menu-item .arrow{margin-left:auto;font-size:12px;opacity:.55;transition:transform .2s}
.menu-item .arrow.open{transform:rotate(90deg)}
.menu-item.sub{padding-left:47px;font-size:13px;color:#5a6b7f}
.menu-item.sub:hover{background:#f4f8fd;color:var(--ikuai-blue)}
.menu-item.sub.active{background:var(--ikuai-active);color:var(--ikuai-blue);font-weight:600;border-left-color:var(--ikuai-blue)}

.content{flex:1;min-width:0;overflow-y:auto;padding:16px 18px 26px}
.page-title{font-size:16px;font-weight:600;margin:0 0 14px;color:#12324f;display:flex;align-items:center;gap:8px}
.page-title .bar{width:4px;height:16px;border-radius:2px;background:var(--ikuai-blue)}

/* ---------- 卡片 ---------- */
.panel{background:#fff;border:1px solid var(--ikuai-line);border-radius:8px;padding:14px 16px;margin-bottom:14px}
.panel h3{margin:0 0 12px;font-size:14px;color:#12324f}
.stat-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:14px;margin-bottom:16px}
.stat{background:#fff;border:1px solid var(--ikuai-line);border-radius:8px;padding:16px 18px;position:relative;overflow:hidden}
.stat .label{font-size:12px;color:#8a9bb0}
.stat .val{font-size:26px;font-weight:700;margin-top:6px;color:#12324f;font-variant-numeric:tabular-nums}
.stat .unit{font-size:13px;font-weight:400;color:#8a9bb0;margin-left:3px}
.stat .icon{position:absolute;right:14px;top:14px;font-size:26px;opacity:.16}
.stat.blue .val{color:#1e6bd6}.stat.green .val{color:#12a05c}.stat.orange .val{color:#e6841a}.stat.red .val{color:#d64545}

.toolbar{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin-bottom:12px}
.muted{color:#8a9bb0;font-size:12px}
.mono{font-family:ui-monospace,Consolas,monospace}
.tag-in{color:#12a05c}.tag-out{color:#d64545}
.pairbox{border:1px dashed #c6d7ea;border-radius:8px;padding:10px 12px;background:#f8fbff}
.trade-block{border:1px solid var(--ikuai-line);border-radius:8px;padding:10px 12px 12px;margin-bottom:12px;background:#fff}
.el-table .row-selected > td{background:#e8f3ff !important}
html.dark .el-table .row-selected > td{background:#1b2942 !important}
.trade-block .block-head{display:flex;align-items:center;gap:10px;margin-bottom:10px}
.trade-block .block-head b{color:#12324f;font-size:14px}
html.dark .trade-block{background:#16223a;border-color:#25324a}
html.dark .trade-block .block-head b{color:#e2e8f0}
.pair-row{display:flex;align-items:center;gap:8px;margin-bottom:8px}
.total-bar{display:flex;justify-content:flex-end;gap:26px;align-items:baseline;padding:12px 4px 0;font-size:14px}
.total-bar .big{font-size:22px;font-weight:700;color:#1e6bd6}
.empty{padding:30px;text-align:center;color:#9aabbd}

/* ---------- 设置页 ---------- */
.theme-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:12px}
.theme-card{display:flex;align-items:center;gap:8px;border:1px solid var(--ikuai-line);border-radius:8px;padding:12px 14px;cursor:pointer;transition:.15s;background:#fff;font-size:14px}
.theme-card:hover{border-color:var(--ikuai-blue)}
.theme-card.active{border-color:var(--ikuai-blue);box-shadow:0 0 0 2px rgba(30,107,214,.15)}
.theme-card .dot{width:16px;height:16px;border-radius:50%;display:inline-block}
.tag-list{min-height:38px;padding-top:4px}

/* ---------- 主题：绿色 / 紫色 ---------- */
[data-theme="green"]{ --ikuai-blue:#12a05c; --ikuai-blue2:#1fbf74; --ikuai-active:#e3f7ec; }
[data-theme="green"] .topbar{ background:linear-gradient(90deg,#0e8a4e,#1fbf74); }
[data-theme="purple"]{ --ikuai-blue:#7c4dff; --ikuai-blue2:#9a6bff; --ikuai-active:#efe8ff; }
[data-theme="purple"] .topbar{ background:linear-gradient(90deg,#6a3fe0,#9a6bff); }

/* ---------- 主题：暗色 ---------- */
html.dark{ --ikuai-bg:#0f172a; --ikuai-line:#25324a; --ikuai-text:#c7d2e0; --ikuai-active:#16233b; }
html.dark body{ background:#0f172a; }
html.dark .topbar{ background:linear-gradient(90deg,#1b3a6b,#25518f); }
html.dark .sidebar{ background:#131d31; border-right-color:#25324a; }
html.dark .panel, html.dark .stat{ background:#16223a; border-color:#25324a; }
html.dark .menu-item{ color:#c7d2e0; }
html.dark .menu-item:hover{ background:#1b2942; color:#7fb2ff; }
html.dark .menu-item.active{ background:var(--ikuai-active); color:#7fb2ff; }
html.dark .menu-item.sub{ color:#93a5bd; }
html.dark .page-title, html.dark .panel h3, html.dark .stat .val{ color:#e2e8f0; }
html.dark .muted, html.dark .stat .label{ color:#7f90a8; }
html.dark .theme-card{ background:#16223a; }
html.dark .login-card{ background:#16223a; }
html.dark .login-card h1{ color:#e2e8f0; }

/* ================= 移动端适配 (≤768px) ================= */
.hamburger{display:none;width:34px;height:34px;align-items:center;justify-content:center;border-radius:8px;
  background:rgba(255,255,255,.18);color:#fff;cursor:pointer;flex:0 0 auto;font-size:19px}
.hamburger:active{background:rgba(255,255,255,.32)}
.side-mask{display:none}

@media (max-width:768px){
  /* ---- 顶栏 ---- */
  .topbar{height:52px;flex-basis:52px;padding:0 12px;gap:10px}
  .hamburger{display:flex}
  .topbar .brand{font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
  .topbar .brand .dot{display:none}
  .topbar .user{font-size:12px;gap:6px}
  .topbar .user .avatar{width:24px;height:24px}

  /* ---- 侧栏 → 抽屉 ---- */
  .sidebar{position:fixed;top:52px;bottom:0;left:0;width:248px;flex:0 0 248px;z-index:60;
    transform:translateX(-104%);transition:transform .25s ease;box-shadow:8px 0 28px rgba(9,42,90,.22)}
  .sidebar.open{transform:none}
  .side-mask{display:block;position:fixed;top:52px;left:0;right:0;bottom:0;background:rgba(6,20,40,.44);z-index:55}
  .menu-item{padding:13px 18px;font-size:15px}
  .menu-item.sub{padding-left:44px;font-size:14px}

  /* ---- 内容区 ---- */
  .content{padding:12px 12px 30px}
  .page-title{font-size:15px;margin-bottom:10px}
  .panel{padding:12px;border-radius:10px;margin-bottom:12px}

  /* ---- 工具栏：堆叠 + 铺满 ---- */
  .toolbar{gap:8px}
  .toolbar .el-input,.toolbar .el-select,.toolbar .el-date-editor,.toolbar .el-input-number{width:100%!important}
  .toolbar>.el-button{flex:1 1 auto}
  .toolbar>.muted{flex:1 1 100%}
  .toolbar>span[style*="flex:1"]{display:none}

  /* ---- 统计卡 ---- */
  .stat-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:10px}
  .stat{padding:12px 14px}
  .stat .val{font-size:22px}
  .stat .icon{font-size:22px;right:10px;top:10px}

  /* ---- 合计条 ---- */
  .total-bar{flex-wrap:wrap;gap:8px 18px;justify-content:flex-start;font-size:13px;padding-top:8px}
  .total-bar .big{font-size:20px}

  /* ---- 登录卡 ---- */
  .login-card{width:92vw;max-width:380px;padding:26px 22px 20px}

  /* ---- 弹窗 / 抽屉 铺满 ---- */
  .el-message{top:58px!important;width:calc(100vw - 24px)!important;min-width:0!important}
  .el-dialog{width:92vw!important;max-width:92vw;margin-top:5vh!important}
  .el-dialog__body{padding:14px 16px}
  .el-drawer{width:92vw!important;max-width:92vw}
  .el-drawer__body{padding:12px!important}
  .el-drawer__header{padding:14px 16px 0!important;margin-bottom:10px!important}
  .el-message-box{width:90vw!important;max-width:90vw}
  .el-form-item__label{font-size:13px}

  /* 手机端不需要“扫码拍照”（本机可直接拍照/选图） */
  .scan-btn{display:none!important}

  /* ---- 表格 → 卡片 ---- */
  .el-table .el-table__inner-wrapper::before{display:none}
  .m-cards .el-table__header-wrapper{display:none!important}
  .m-cards .el-table__body-wrapper .el-scrollbar__bar{display:none!important}
  .m-cards .el-table__body-wrapper{overflow:visible!important}
  .m-cards .el-table__body,
  .m-cards table.el-table__body{display:block;width:100%!important}
  .m-cards colgroup{display:none}
  .m-cards tbody{display:block}
  .m-cards tbody tr{display:block;background:#fff;border:1px solid var(--ikuai-line);border-radius:10px;
    margin:0 0 10px;padding:5px 12px;box-shadow:0 1px 2px rgba(9,42,90,.04)}
  .m-cards tbody tr:hover>td>.cell{background:transparent!important}
  .m-cards tbody tr.row-selected{border-color:var(--ikuai-blue);box-shadow:0 0 0 1px var(--ikuai-blue)}
  .m-cards tbody td{display:flex;align-items:flex-start;gap:10px;border:none!important;
    padding:7px 0!important;white-space:normal!important;word-break:break-word;overflow:visible}
  .m-cards tbody td::before{content:attr(data-label);flex:0 0 80px;color:#8a9bb0;font-size:12px;line-height:20px;padding-top:1px}
  .m-cards tbody td .cell{overflow:visible;text-overflow:clip;white-space:normal;width:100%;min-width:0;line-height:20px;padding:0!important}
  .m-cards tbody td.is-right .cell{text-align:right}
  .m-cards tbody td[data-label=""]{justify-content:flex-end;padding-top:2px!important;padding-bottom:2px!important}
  .m-cards tbody td[data-label=""]::before{display:none}
  .m-cards tbody td .el-input,.m-cards tbody td .el-select,.m-cards tbody td .el-input-number,
  .m-cards tbody td .el-date-editor{width:100%!important}
  .m-cards tbody td .el-image{width:40px!important;height:40px!important}

  /* 暗色卡片 */
  html.dark .m-cards tbody tr{background:#16223a;border-color:#25324a}
  html.dark .m-cards tbody td::before{color:#7f90a8}
}

@media (max-width:400px){
  .stat-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .stat .val{font-size:20px}
  .m-cards tbody td::before{flex-basis:70px}
}

/* 实拍图删除角标 */
.photo-del{position:absolute;top:-6px;right:-6px;width:18px;height:18px;border-radius:50%;
  background:#d64545;color:#fff;font-size:13px;line-height:18px;text-align:center;cursor:pointer;
  box-shadow:0 1px 3px rgba(0,0,0,.25);z-index:3;user-select:none;font-weight:600}
.photo-del:hover{background:#b83232}

/* 小缩略图上的删除角标更小一点 */
.el-table .photo-del{width:14px;height:14px;line-height:14px;font-size:11px;top:-4px;right:-4px}
.el-dialog .photo-del{width:18px;height:18px;line-height:18px;font-size:13px}

/* 列表分页 */
.el-pagination{flex-wrap:wrap;row-gap:8px;margin-top:12px}
@media (max-width:768px){
  .el-pagination{justify-content:center!important;font-size:12px}
  .el-pagination__sizes{display:none!important}
}

/* 列表分页条 */
.pager-bar{display:flex;align-items:center;justify-content:flex-end;gap:10px;flex-wrap:wrap;margin-top:12px}
@media (max-width:768px){
  .pager-bar{justify-content:center}
  .pager-bar .el-select{width:104px!important}
}

/* 标签版式编辑器 */
.label-canvas{position:relative;background:#fff;border:1px dashed #b9c4d2;overflow:hidden}
.label-field{position:absolute;line-height:1.15;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
  cursor:grab;user-select:none;-webkit-user-select:none;border:1px dashed #d5dde8;padding:1px 2px;
  box-sizing:border-box;touch-action:none}
.label-field::after{content:"";position:absolute;inset:-4px}
.label-field > span:not(.resize-handle),.label-field img{pointer-events:none;-webkit-user-drag:none}
.resize-handle{position:absolute;right:0;bottom:0;width:11px;height:11px;background:#fff;border:1px solid #1e6bd6;
  border-radius:2px;cursor:nwse-resize;pointer-events:auto;z-index:3;box-sizing:border-box;opacity:.75;touch-action:none}
.label-field:hover .resize-handle{opacity:1;background:#1e6bd6}
.label-field{-webkit-touch-callout:none}
.label-field:hover{border-color:#1e6bd6;background:rgba(30,107,214,.05)}
.label-field:active{cursor:grabbing;border-color:#1e6bd6;background:rgba(30,107,214,.09)}
.label-field span{display:block}
.barcode-placeholder{width:100%;height:100%;background:repeating-linear-gradient(90deg,#000 0 2px,#fff 2px 4px)}

/* 出库单右侧小预览 */
.print-preview-frame{width:480px;height:340px;overflow:hidden;border:1px solid #e3eaf3;background:#fff}
.print-preview-frame iframe{width:1123px;height:794px;border:0;transform:scale(.42);transform-origin:top left;background:#fff}
.print-preview-frame.receipt{width:290px;height:600px}
.print-preview-frame.receipt iframe{width:340px;height:700px;transform:scale(.85)}
@media (max-width:768px){
  .print-preview-frame{margin:0 auto}
  .print-preview-frame.receipt{height:560px}
}

/* 设置页右侧预览列 */
.preview-col{margin-left:auto;margin-right:-5px}
@media (max-width:768px){.preview-col{margin-left:0;margin-right:0}.print-preview-frame{width:340px;height:240px}.print-preview-frame iframe{width:1123px;height:794px;transform:scale(.303)}}
