/* ZSM Admin Taste UI V2 - visual/interaction layer only */
:root{--zsm-blue:#2f6fed;--zsm-blue-50:#eef5ff;--zsm-bg:#f5f7fb;--zsm-card:#fff;--zsm-line:#e3e9f2;--zsm-text:#14213d;--zsm-muted:#718096;--zsm-danger:#e05252;--zsm-green:#159a63;--zsm-radius:14px}
.admin-layout{grid-template-columns:244px minmax(0,1fr)!important;background:var(--zsm-bg);min-height:100vh}
.admin-side{background:#fff!important;color:var(--zsm-text)!important;padding:20px 16px!important;border-right:1px solid var(--zsm-line)!important;position:sticky;top:0;height:100vh;overflow-y:auto;box-shadow:none!important}
.admin-side h2{height:72px;margin:0 2px 18px!important;padding:0 8px 18px!important;border-bottom:1px solid #edf1f6;display:flex;align-items:center;font-size:0!important;color:transparent!important}
.admin-side h2:before{content:"";display:block;width:46px;height:46px;background:url('/static/img/zsm_admin_logo.png') center/contain no-repeat;margin-right:11px;flex:0 0 46px}
.admin-side h2:after{content:"ZSM 管理后台";font-size:18px;line-height:1.2;font-weight:750;color:#15223d;white-space:nowrap}
.admin-side a{position:relative;color:#4e5d75!important;padding:11px 13px!important;margin:4px 0!important;border-radius:9px!important;font-size:14px;font-weight:600;transition:.16s;background:transparent!important;box-shadow:none!important}
.admin-side a:hover{background:#f5f8fc!important;color:#245fcf!important}.admin-side a.active{background:var(--zsm-blue-50)!important;color:var(--zsm-blue)!important;box-shadow:inset 3px 0 0 var(--zsm-blue)!important}
.admin-main{background:var(--zsm-bg)!important;min-width:0}.topbar{height:66px!important;padding:0 28px!important;background:rgba(255,255,255,.97)!important;border-bottom:1px solid var(--zsm-line)!important;position:sticky;top:0;z-index:20}.topbar>b{font-size:17px!important;color:#182640}.topbar>span{display:flex;align-items:center;gap:10px;color:#748198;font-size:13px}.topbar button{padding:7px 12px!important;background:#fff!important;border:1px solid #dbe3ee!important}
.admin-main>.panel{margin:22px 26px!important;padding:22px 24px!important;border:1px solid var(--zsm-line)!important;border-radius:var(--zsm-radius)!important;box-shadow:0 4px 16px rgba(25,50,85,.045)!important;background:#fff!important}.panel-head{gap:16px;margin-bottom:16px}.panel-head h2,.panel>h2{margin:0;color:#16243e;font-size:21px!important}.panel-tools{flex-wrap:wrap;gap:8px!important}
.stats{gap:14px!important;margin:22px 26px!important}.stats div{border:1px solid var(--zsm-line)!important;border-radius:var(--zsm-radius)!important;padding:19px 21px!important;box-shadow:0 4px 16px rgba(25,50,85,.04)!important;background:#fff}.stats b{font-size:28px!important;color:#17233d}.stats span{font-size:13px!important;color:var(--zsm-muted)}
button,.btn{border-color:#d8e1ed!important;border-radius:8px!important;padding:8px 13px!important;font-weight:650;transition:.15s;background:#fff}button:hover,.btn:hover{border-color:#b9c9df!important;background:#f8fafc!important}.primary{background:var(--zsm-blue)!important;border-color:var(--zsm-blue)!important;color:#fff!important;box-shadow:0 2px 6px rgba(47,111,237,.16)}.primary:hover{background:#265fce!important}.danger{color:var(--zsm-danger)!important;border-color:#f0caca!important;background:#fff!important}
input,select,textarea{border-color:#d8e1ed!important;border-radius:8px!important;background:#fff;color:#27344a;outline:none;font-size:13px}input:focus,select:focus,textarea:focus{border-color:#8eb4ff!important;box-shadow:0 0 0 3px rgba(47,111,237,.08)}
table{font-size:13px!important}th{background:#f8fafc!important;color:#65738a!important;font-size:12px!important;font-weight:700!important;border-bottom:1px solid #e4eaf2!important}th,td{padding:12px 11px!important}td{border-bottom:1px solid #edf1f5!important;color:#344158}tr:hover td{background:#fbfcfe}.badge{font-weight:700;font-size:12px;padding:4px 9px}.badge.on{background:#e8f8ef;color:#178454}.badge.off{background:#f1f3f6;color:#727d8d}.ops{flex-wrap:wrap;gap:6px!important}.ops a{color:#2563eb;text-decoration:none;font-weight:650}
/* dashboard */
.zsm-dashboard{margin:22px 26px 28px}.zsm-dashboard .dash-head{display:flex;justify-content:space-between;align-items:flex-end;gap:20px;margin-bottom:16px}.zsm-dashboard h1{margin:0;font-size:26px;color:#14213d}.zsm-dashboard .dash-sub{margin-top:5px;color:var(--zsm-muted);font-size:13px}.zsm-dashboard .stats{margin:0 0 16px!important}.dash-grid{display:grid;grid-template-columns:1.35fr .65fr;gap:16px}.dash-card{background:#fff;border:1px solid var(--zsm-line);border-radius:14px;padding:20px;box-shadow:0 4px 16px rgba(25,50,85,.04)}.dash-card h2{font-size:17px;margin:0 0 5px;color:#182640}.dash-card p{margin:0;color:var(--zsm-muted);font-size:13px}.dash-actions{display:grid;grid-template-columns:repeat(2,1fr);gap:10px;margin-top:16px}.dash-action{display:block;padding:14px;border:1px solid #e3e9f2;border-radius:10px;text-decoration:none;color:#233654;background:#fbfcfe;font-weight:650}.dash-action:hover{border-color:#b9d0ff;background:#f4f8ff;color:#245fcf}.dash-status{display:grid;gap:10px;margin-top:15px}.dash-status div{display:flex;justify-content:space-between;padding:11px 0;border-bottom:1px solid #edf1f5}.dash-status div:last-child{border:0}.dash-status span{color:var(--zsm-muted)}.dash-status b{color:#263750}
/* software management */
.admin-main>.panel table{border-collapse:separate;border-spacing:0;width:100%}.admin-main>.panel table td:first-child{font-weight:650;color:#22334f}.admin-main>.panel input[type=number]{min-height:34px}.admin-main>.panel .ops button{padding:6px 9px!important;font-size:12px}
/* portal: override legacy embedded styles */
.pa-wrap{padding:22px 26px 30px!important}.pa-title{margin-bottom:18px!important}.pa-title h1{font-size:26px!important;color:#14213d!important}.pa-title p{font-size:13px!important;color:var(--zsm-muted)!important}.pa-tip{border-color:#d8e6ff!important;background:#f4f8ff!important;border-radius:10px!important}.pa-card{border-color:var(--zsm-line)!important;border-radius:14px!important;box-shadow:0 4px 16px rgba(25,50,85,.035);margin-bottom:16px!important}.pa-card-head{padding:16px 18px!important;background:#fbfcfe!important}.pa-card-head h2{font-size:17px!important}.pa-card-body{padding:18px!important}.pa-table th{background:#f8fafc!important}.pa-table td{padding:11px 9px!important}.pa-btn{border-color:#d8e1ed!important}.pa-btn.primary{background:var(--zsm-blue)!important;border-color:var(--zsm-blue)!important}
/* analytics already good: harmonize only */
.an-wrap,.analytics-wrap{padding-left:26px!important;padding-right:26px!important}
/* licenses */
.lic-wrap{padding:22px 26px 30px!important}.lic-head h1{font-size:26px!important}.lic-kpi,.lic-card{border-color:var(--zsm-line)!important;border-radius:14px!important;box-shadow:0 4px 16px rgba(25,50,85,.04)!important}.lic-card-h{padding:15px 18px!important}.lic-card-b{padding:16px 18px!important}.lic-table td{padding:13px 10px!important}.lic-actions{min-width:280px!important}.lic-actions-row{gap:6px!important}.lic-actions-row>form,.lic-actions-row>details{margin-bottom:2px}.lic-actions button,.lic-actions .btn,.manage-products summary{padding:6px 9px!important;font-size:12px!important}
/* login */
body:has(.login-card) .login-wrap{background:#f4f7fb;position:relative;overflow:hidden}body:has(.login-card) .login-wrap:before{content:"";position:absolute;width:520px;height:520px;border-radius:50%;background:#e8f1ff;left:-230px;top:-240px;opacity:.8}body:has(.login-card) .login-card{position:relative;width:400px;padding:38px;border:1px solid #e4eaf2;border-radius:16px;box-shadow:0 20px 55px rgba(35,65,105,.12)}body:has(.login-card) .login-logo{width:76px;height:76px;margin-bottom:14px}
@media(max-width:1050px){.admin-layout{grid-template-columns:210px minmax(0,1fr)!important}.dash-grid{grid-template-columns:1fr}.lic-stats{grid-template-columns:repeat(2,1fr)!important}}
@media(max-width:760px){.admin-layout{grid-template-columns:1fr!important}.admin-side{position:static;height:auto;display:flex;gap:4px;overflow-x:auto;padding:10px!important}.admin-side h2{display:none}.admin-side a{white-space:nowrap}.topbar{position:static}.zsm-dashboard,.admin-main>.panel,.stats{margin:14px!important}.dash-actions{grid-template-columns:1fr}.stats{grid-template-columns:1fr 1fr!important}}

/* ===== V2.1 UI refinement: visual only ===== */
.page-intro{margin-bottom:18px}.page-intro h2{margin:0 0 6px!important}.page-intro p{margin:0;color:var(--zsm-muted);font-size:13px}
.section-card{border:1px solid var(--zsm-line);border-radius:12px;background:#fff;margin-top:16px;overflow:hidden}.section-card-head{padding:16px 18px;border-bottom:1px solid #edf1f5;background:#fbfcfe}.section-card-head h3{margin:0 0 4px;font-size:16px;color:#182640}.section-card-head p{margin:0;color:var(--zsm-muted);font-size:12px}.section-card-body{padding:18px}
.v21-add-row{display:flex;align-items:center;gap:10px;flex-wrap:wrap;padding:14px 16px;background:#f8fafc;border:1px solid #e6ebf2;border-radius:10px;margin:0}.v21-add-row input,.v21-add-row select{height:38px;box-sizing:border-box}.v21-add-row button,.v21-add-row .btn{height:38px;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box}
.file-field{position:relative;display:inline-flex;align-items:center;min-width:210px;height:38px;padding:0 12px;border:1px solid #d8e1ed;border-radius:8px;background:#fff;color:#65738a;font-size:12px;overflow:hidden}.file-field input[type=file]{position:absolute;inset:0;opacity:0;cursor:pointer}.file-field:before{content:'选择文件';display:inline-flex;align-items:center;height:26px;padding:0 9px;margin-right:9px;border-radius:6px;background:#f3f6fa;color:#344158;font-weight:650}.category-icon-editor{display:flex;align-items:center;gap:12px}.category-icon-preview{width:42px;height:42px;border:1px solid #e3e9f2;border-radius:9px;background:#f8fafc;display:flex;align-items:center;justify-content:center;flex:0 0 42px}.category-icon-preview img{max-width:30px;max-height:30px;object-fit:contain}.category-icon-placeholder{color:#9aa6b8;font-size:20px}.category-icon-controls{display:flex;align-items:center;gap:10px}.category-remove-icon{white-space:nowrap;color:#718096;font-size:12px}.category-remove-icon input{vertical-align:middle;margin-right:4px}.category-table .small{width:78px}
.panel-tools>form.inline:first-child select{height:38px!important;min-width:118px;padding:0 34px 0 12px!important}.panel-tools>form button,.panel-tools>.btn{height:38px!important;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box}.panel-tools{align-items:center!important}
.user-create{max-width:760px}.user-table .ops{display:flex;align-items:center;gap:7px}.user-table .password-action{display:flex;align-items:center;gap:6px}.user-table .password-action input{height:34px;width:150px}.status-pill{display:inline-flex;align-items:center;gap:6px;padding:4px 9px;border-radius:999px;font-size:12px;font-weight:700}.status-pill.on{background:#e8f8ef;color:#178454}.status-pill.off{background:#f1f3f6;color:#727d8d}
.empty-state{padding:54px 20px;text-align:center;border-top:1px solid #edf1f5;color:#718096}.empty-state-icon{width:48px;height:48px;margin:0 auto 12px;border-radius:50%;background:#f1f5fb;display:flex;align-items:center;justify-content:center;font-size:22px;color:#7b8ba5}.empty-state b{display:block;color:#344158;font-size:14px;margin-bottom:5px}.empty-state span{font-size:12px}
.config-card{max-width:820px}.config-note{margin:5px 0 18px!important;color:var(--zsm-muted);font-size:13px}.config-field{display:block;font-weight:650;color:#3d4b61}.config-field input{display:block;width:100%;height:42px;margin-top:7px;padding:0 12px;box-sizing:border-box}.config-hint{display:flex;gap:9px;align-items:flex-start;padding:11px 13px;margin:14px 0;background:#f4f8ff;border:1px solid #dce8ff;border-radius:9px;color:#5c6f8e;font-size:12px;line-height:1.6}.config-actions{padding-top:2px}
.product-create{max-width:780px}.product-create .product-name{min-width:330px;flex:1}.product-create .hours{width:140px}.product-table code{padding:4px 7px;border-radius:6px;background:#f5f7fa;color:#44536b;font-size:12px}.table-wrap{overflow-x:auto}.table-empty{text-align:center!important;padding:38px!important;color:#7b8799!important;font-weight:400!important}
@media(max-width:900px){.v21-add-row{align-items:stretch}.v21-add-row>*{max-width:100%}.file-field{width:100%}.user-table .ops{align-items:flex-start}.product-create .product-name{min-width:220px}}

/* ===== V2.1 FINAL polish: visual only, no business logic changes ===== */
/* Unified control sizing */
.panel-tools select,.panel-tools button,.panel-tools .btn,
.v21-add-row input,.v21-add-row select,.v21-add-row button,.v21-add-row .btn,
.file-field{height:38px!important;box-sizing:border-box!important}
.panel-tools select{line-height:36px!important;border:1px solid #d8e1ed!important;border-radius:8px!important;background-color:#fff!important;color:#344158!important}
.panel-tools>form.inline{display:inline-flex!important;align-items:center!important;margin:0!important}
.panel-tools>form.inline:first-child select{min-width:126px!important;margin:0!important}

/* Category management: denser, cleaner editing controls */
.category-table td{vertical-align:middle!important}.category-table input[name=name]{height:34px;min-width:170px;padding:0 10px}.category-table input.small{height:34px!important;padding:0 9px}.category-table .file-field{min-width:190px;height:34px!important}.category-table .file-field:before{height:24px}.category-icon-controls{min-width:280px}.category-remove-icon{display:inline-flex;align-items:center;gap:4px}

/* User management */
.user-create{width:min(100%,720px)!important}.user-create input[name=username]{width:190px}.user-create input[name=password]{width:210px}.user-table td{vertical-align:middle}.user-table .ops button{min-height:34px}.user-table .password-action input{min-height:34px}

/* Trash empty state */
.empty-state{min-height:150px;box-sizing:border-box;display:flex;flex-direction:column;align-items:center;justify-content:center}

/* Feishu configuration */
.config-card{width:min(820px,calc(100% - 52px))!important;margin-right:auto!important}.config-actions .primary{min-width:92px}

/* License product creation: compact form, full-width list remains unchanged */
.product-create{width:min(100%,760px)!important}.product-create .product-name{min-width:360px!important}.product-create .hours{width:130px!important}.product-table td,.product-table th{vertical-align:middle}.product-table form{margin:0}

/* Consistent section spacing */
.section-card+.section-card{margin-top:16px}.section-card-body>.muted:last-child{margin-bottom:0}.page-intro+ .section-card{margin-top:0}

@media(max-width:900px){
 .config-card{width:auto!important;margin-left:14px!important;margin-right:14px!important}
 .category-icon-controls{min-width:0;flex-wrap:wrap}
 .user-create input[name=username],.user-create input[name=password],.product-create .product-name,.product-create .hours{width:100%!important;min-width:0!important}
}

/* ===== V2.2.5 sidebar collapse ===== */
.admin-layout{transition:grid-template-columns .22s ease}
.admin-side{transition:transform .22s ease,opacity .18s ease}
.zsm-sidebar-toggle{position:fixed;left:226px;top:50%;transform:translateY(-50%);z-index:80;width:34px;height:46px;padding:0!important;border:1px solid #dce5f2!important;border-radius:0 10px 10px 0!important;background:#fff!important;box-shadow:0 3px 12px rgba(25,50,85,.10)!important;display:flex;align-items:center;justify-content:center;cursor:pointer;transition:left .22s ease,background .15s ease}
.zsm-sidebar-toggle:hover{background:#f5f8ff!important;border-color:#bcd0f4!important}
.zsm-sidebar-toggle img{display:block;width:23px;height:21px;object-fit:contain;transform:rotate(-90deg);transition:transform .22s ease;pointer-events:none}
.admin-layout.zsm-sidebar-collapsed{grid-template-columns:0 minmax(0,1fr)!important}
.admin-layout.zsm-sidebar-collapsed>.admin-side{transform:translateX(-100%);opacity:0;pointer-events:none}
.admin-layout.zsm-sidebar-collapsed+.zsm-sidebar-toggle{left:0}
.admin-layout.zsm-sidebar-collapsed+.zsm-sidebar-toggle img{transform:rotate(90deg)}
@media(max-width:1050px) and (min-width:761px){.zsm-sidebar-toggle{left:192px}}
@media(max-width:760px){.zsm-sidebar-toggle{display:none!important}.admin-layout.zsm-sidebar-collapsed{grid-template-columns:1fr!important}.admin-layout.zsm-sidebar-collapsed>.admin-side{transform:none;opacity:1;pointer-events:auto}}

/* ===== V2.2.5.1 sidebar handle + portal category horizontal scroll ===== */
.zsm-sidebar-toggle{left:232px;width:28px;height:38px;border-radius:0 8px 8px 0!important;box-shadow:0 2px 8px rgba(25,50,85,.09)!important}
.zsm-sidebar-toggle img{width:20px;height:18px;object-fit:contain;transform:none;transition:transform .22s ease}
.admin-layout.zsm-sidebar-collapsed+.zsm-sidebar-toggle{left:0}
.admin-layout.zsm-sidebar-collapsed+.zsm-sidebar-toggle img{transform:rotate(180deg)}
/* Keep the category editor comfortably sized and let its own bottom scrollbar handle narrow cards. */
.pa-two>section:first-child .pa-table-wrap{overflow-x:auto!important;overflow-y:hidden!important;padding-bottom:2px;scrollbar-gutter:stable}
.pa-two>section:first-child .pa-table{min-width:520px!important}
.pa-two>section:first-child .pa-category-row{grid-template-columns:minmax(120px,1fr) 75px 82px 85px 150px!important;gap:8px!important;padding:9px 8px!important}
.pa-two>section:first-child .pa-category-row input[name=sort_order]{width:75px!important}
.pa-two>section:first-child .pa-category-row .pa-inline-actions{gap:7px!important}
.pa-two>section:first-child .pa-category-row .pa-btn{padding:8px 14px!important}
@media(max-width:1050px) and (min-width:761px){.zsm-sidebar-toggle{left:198px}}
