/* ==========================================================================
   Selleck_auto 管理后台公共样式
   bootstrap3 负责栅格与面板，layui 负责表单/表格/弹层，这里只处理两者的视觉冲突
   与后台特有的布局细节。
   ========================================================================== */

:root {
    --brand: #1e6fb8;
    --brand-dark: #16548c;
    --ok: #16b777;
    --warn: #ffb800;
    --danger: #ff5722;
    --muted: #8a94a6;
    --border: #e6e9ef;
    --bg: #f2f4f8;
}

html, body {
    height: 100%;
    margin: 0;
    background: var(--bg);
    font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 14px;
    color: #333;
}

/* ---------- 页面容器 ---------- */
.page-wrap {
    padding: 14px;
}

.page-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(31, 45, 61, .06);
    margin-bottom: 14px;
}

.page-card > .card-head {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    color: #2c3e50;
    background: #fbfcfe;
    border-radius: 4px 4px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.page-card > .card-head .head-tip {
    font-weight: 400;
    font-size: 12px;
    color: var(--muted);
}

.page-card > .card-body {
    padding: 14px;
}

/* ---------- 查询条：bootstrap 3 十二栅格 ----------
   历史问题：查询条曾用 layui 的 .layui-inline + 每个字段写死的像素宽度，
   字段一多就在窄屏（右侧内容区 = 窗口宽 - 230px 菜单）下参差不齐地折行，
   「开始日」「关键字」之类会孤零零吊在第二行。
   现在统一走 bootstrap 栅格：每个筛选项占 col-md-3 / col-sm-6 / col-xs-12 一列，
   列内是「标签固定宽 + 控件自适应」的 flex，折行时整列一起换行，
   各列的左右边界永远对齐 —— 与两侧卡片、统计卡片的栅格是同一套。

   用法（给 form 加 filter-grid，再按栅格排列 filter-col）：
   <form class="layui-form filter-grid">
     <div class="row">
       <div class="col-md-3 col-sm-6 filter-col">
         <div class="filter-field">
           <label class="filter-label">任务</label>
           <div class="filter-control">…输入 / 下拉…</div>
         </div>
       </div>
     </div>
     <div class="row"><div class="col-md-6 filter-col"><div class="filter-actions">…按钮…</div></div></div>
   </form> */
.filter-grid .row {
    margin-left: -6px;
    margin-right: -6px;
}

.filter-grid .filter-col {
    padding-left: 6px;
    padding-right: 6px;
    margin-bottom: 10px;
}

.filter-grid .filter-field {
    display: flex;
    align-items: center;
}

.filter-grid .filter-label {
    flex: 0 0 66px;
    width: 66px;
    margin: 0;
    padding-right: 8px;
    text-align: right;
    font-weight: 400;
    font-size: 13px;
    color: #5a6577;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.filter-grid .filter-control {
    flex: 1 1 auto;
    min-width: 0;
}

.filter-grid .filter-control .layui-input,
.filter-grid .filter-control .layui-textarea,
.filter-grid .filter-control .layui-form-select {
    width: 100%;
}

.filter-grid .filter-actions {
    padding-left: 6px;
    padding-right: 6px;
    margin-bottom: 12px;
}

.filter-grid .filter-actions .layui-btn {
    margin-right: 8px;
}

/* ---------- 统计卡片 ---------- */
.stat-grid {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -6px;
}

.stat-box {
    flex: 1 1 200px;
    margin: 0 6px 12px;
    background: #fff;
    border: 1px solid var(--border);
    border-left: 4px solid var(--brand);
    border-radius: 4px;
    padding: 14px 16px;
    box-shadow: 0 1px 3px rgba(31, 45, 61, .05);
}

.stat-box.ok { border-left-color: var(--ok); }
.stat-box.warn { border-left-color: var(--warn); }
.stat-box.danger { border-left-color: var(--danger); }
.stat-box.muted { border-left-color: var(--muted); }

.stat-box .stat-label {
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 6px;
}

.stat-box .stat-value {
    font-size: 26px;
    font-weight: 700;
    line-height: 1.1;
    color: #2c3e50;
}

.stat-box .stat-extra {
    margin-top: 6px;
    font-size: 12px;
    color: var(--muted);
}

/* ---------- 状态徽标 ---------- */
.tag {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 12px;
    line-height: 18px;
    border: 1px solid transparent;
    white-space: nowrap;
}

.tag-ok      { background: #e8f8f1; color: #0f9d63; border-color: #b7ebd6; }
.tag-fail    { background: #ffefe9; color: #e0431a; border-color: #ffd3c4; }
.tag-warn    { background: #fff8e1; color: #b78103; border-color: #ffe6a3; }
.tag-info    { background: #eaf3fd; color: #1e6fb8; border-color: #c5ddf5; }
.tag-muted   { background: #f2f3f5; color: #7a8290; border-color: #e2e4e9; }
.tag-purple  { background: #f3edff; color: #6b3fd4; border-color: #ddd0fb; }

/* ---------- 表格微调 ---------- */
.layui-table td, .layui-table th {
    word-break: break-all;
}

.layui-table .row-actions .layui-btn {
    margin: 1px 2px;
}

.mono {
    font-family: Consolas, Monaco, "Courier New", monospace;
}

.text-muted { color: var(--muted) !important; }
.text-danger { color: var(--danger) !important; }
.text-ok { color: var(--ok) !important; }
.nowrap { white-space: nowrap; }

/* ---------- 发票查询结果 ---------- */
.conclusion-bar {
    background: #eaf3fd;
    border: 1px solid #c5ddf5;
    border-radius: 4px;
    padding: 12px 14px;
    margin-bottom: 12px;
}

.conclusion-bar .conclusion-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--brand-dark);
    margin-bottom: 6px;
}

.conclusion-bar dl {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
}

.conclusion-bar dl > div {
    margin-right: 24px;
    margin-bottom: 4px;
    font-size: 13px;
}

.conclusion-bar dt {
    display: inline;
    color: var(--muted);
}

.conclusion-bar dd {
    display: inline;
    margin: 0;
    font-weight: 700;
}

.warning-list {
    margin: 0 0 12px;
    padding: 0;
    list-style: none;
}

.warning-list li {
    background: #fff8e1;
    border: 1px solid #ffe6a3;
    color: #8a6100;
    border-radius: 3px;
    padding: 6px 10px;
    margin-bottom: 6px;
    font-size: 13px;
}

.warning-list li::before {
    content: "\26A0";
    margin-right: 6px;
}

/* ---------- 命名规则选择 ---------- */
.naming-panel .layui-form-item {
    margin-bottom: 10px;
}

.naming-preview {
    background: #f7f8fa;
    border: 1px dashed #cfd6e0;
    border-radius: 3px;
    padding: 8px 10px;
    font-family: Consolas, Monaco, monospace;
    font-size: 12px;
    color: #445;
    word-break: break-all;
}

.invoice-help {
    display: inline-flex;
    position: relative;
    vertical-align: middle;
    margin-left: 5px;
}

.invoice-help-trigger {
    border: 1px solid #8fa8c6;
    border-radius: 50%;
    background: transparent;
    color: #5b78a0;
    cursor: help;
    padding: 0;
    width: 16px;
    height: 16px;
    line-height: 14px;
    font-size: 11px;
    font-weight: 700;
}

.invoice-help-tip {
    display: none;
    position: absolute;
    z-index: 30;
    top: 22px;
    left: 0;
    width: 270px;
    padding: 8px 10px;
    border: 1px solid #cfd6e0;
    border-radius: 3px;
    background: #fff;
    box-shadow: 0 4px 12px rgba(20, 35, 55, .15);
    color: #445;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.6;
    white-space: normal;
}

.invoice-help:hover .invoice-help-tip,
.invoice-help:focus-within .invoice-help-tip {
    display: block;
}

.invoice-action .invoice-help-tip { left: auto; right: 0; }

.filter-grid .filter-label.invoice-naming-label {
    flex-basis: 100px;
    width: 100px;
    overflow: visible;
}

.invoice-action {
    display: inline-flex;
    align-items: center;
    margin: 0 8px 8px 0;
}

.invoice-action .layui-btn { margin: 0; }

.placeholder-chips span {
    display: inline-block;
    background: #eef2f8;
    border: 1px solid #d6e0ee;
    color: #3a5b83;
    border-radius: 3px;
    padding: 1px 7px;
    margin: 0 5px 5px 0;
    font-size: 12px;
    cursor: pointer;
    font-family: Consolas, Monaco, monospace;
}

.placeholder-chips span:hover {
    background: #dfe9f7;
    border-color: #b9cde6;
}

/* ---------- 日志详情 ---------- */
.log-detail pre {
    background: #1e2530;
    color: #d7e0ea;
    padding: 12px;
    border-radius: 4px;
    max-height: 320px;
    overflow: auto;
    font-size: 12px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
}

/* ---------- 登录页 ---------- */
.login-body {
    height: 100%;
    margin: 0;
    background: linear-gradient(135deg, #1e6fb8 0%, #16548c 55%, #0e3d68 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-box {
    width: 380px;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .25);
    padding: 30px 34px 24px;
}

.login-box .login-title {
    text-align: center;
    margin-bottom: 6px;
    font-size: 20px;
    font-weight: 700;
    color: #22374d;
}

.login-box .login-sub {
    text-align: center;
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 22px;
}

.login-box .login-foot {
    margin-top: 14px;
    text-align: center;
    color: #a3adbb;
    font-size: 12px;
}

/* ---------- 后台外壳 ----------
   刻意不复用 layui 的 .layui-layout-admin / .layui-body：
   layui 2.9.18 里 .layui-layout-admin .layui-body 只有 `position:absolute;top:60px;
   padding-bottom:44px`，既没有 left/right/width 也没有 bottom，高度与宽度全靠内容撞出来。
   叠加 height:100% 百分比链后，iframe 很容易算出 0 高度，表现就是「右侧一片空白」。
   所以下面完全自己接管几何：固定定位 + flex + 绝对铺满，不依赖任何百分比高度链。 */
.shell-body {
    height: 100%;
    margin: 0;
    overflow: hidden;
}

.shell-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    z-index: 1000;
    background: #23292e;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px 0 0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
}

.shell-logo {
    width: 230px;
    flex: 0 0 230px;
    padding-left: 18px;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: .5px;
    line-height: 60px;
    white-space: nowrap;
    overflow: hidden;
}

.shell-logo small {
    font-size: 11px;
    font-weight: 400;
    opacity: .65;
    margin-left: 6px;
}

.shell-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sched-pill {
    display: inline-block;
    padding: 0 10px;
    line-height: 26px;
    border-radius: 13px;
    font-size: 12px;
    background: rgba(255, 255, 255, .14);
    color: #e8eef6;
    white-space: nowrap;
}

/* 头部下拉菜单（自己实现，不依赖 bootstrap/layui 的 JS） */
.shell-menu { position: relative; }

.shell-menu-btn {
    background: transparent;
    border: 0;
    color: #e8eef6;
    height: 60px;
    padding: 0 14px;
    font-size: 14px;
    cursor: pointer;
}

.shell-menu-btn:hover { background: rgba(255, 255, 255, .08); }

.shell-menu-drop {
    display: none;
    position: absolute;
    right: 0;
    top: 60px;
    min-width: 168px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 3px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .16);
    padding: 5px 0;
    z-index: 1200;
}

.shell-menu.open .shell-menu-drop { display: block; }

.shell-menu-drop a {
    display: block;
    padding: 8px 16px;
    color: #333;
    font-size: 13px;
    text-decoration: none;
}

.shell-menu-drop a:hover { background: #f2f6fb; color: var(--brand); }

/* 左侧导航 */
.shell-side {
    position: fixed;
    top: 60px;
    left: 0;
    bottom: 0;
    width: 230px;
    z-index: 999;
    background: #20222a;
    overflow-x: hidden;
    overflow-y: auto;
}

.shell-side .layui-nav-tree { width: 230px; background: transparent; }

/* 主区：tab 条 + 内容面板，用 flex 分配，面板永远拿到真实高度 */
.shell-main {
    position: fixed;
    top: 60px;
    left: 230px;
    right: 0;
    bottom: 0;
    z-index: 998;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg);
}

.shell-tabs {
    flex: 0 0 auto;
    display: flex;
    align-items: stretch;
    background: #fff;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    min-height: 40px;
}

.shell-tabs::-webkit-scrollbar { height: 3px; }
.shell-tabs::-webkit-scrollbar-thumb { background: #cfd6e0; border-radius: 2px; }

.shell-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 12px;
    line-height: 39px;
    font-size: 13px;
    color: #5a6577;
    border-right: 1px solid var(--border);
    cursor: pointer;
    user-select: none;
    flex: 0 0 auto;
}

.shell-tab:hover { color: var(--brand); background: #f7fafd; }

.shell-tab.active {
    color: var(--brand);
    font-weight: 700;
    box-shadow: inset 0 -2px 0 var(--brand);
}

.shell-tab .tab-close {
    font-style: normal;
    font-size: 14px;
    line-height: 1;
    color: #a3adbb;
    padding: 2px 3px;
    border-radius: 50%;
}

.shell-tab .tab-close:hover { background: #ff5722; color: #fff; }

.shell-tab .tab-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--warn);
    display: none;
}

.shell-tab.loading .tab-dot { display: inline-block; background: var(--brand); }
.shell-tab.error .tab-dot { display: inline-block; background: var(--danger); }

/* 内容区：面板用绝对定位铺满，iframe 再铺满面板，全程不用百分比高度 */
.shell-panes {
    flex: 1 1 auto;
    position: relative;
    min-height: 0;
    overflow: hidden;
}

.shell-pane {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
}

.shell-pane.active { display: block; }

.shell-pane iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
    background: var(--bg);
}

.pane-mask {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--bg);
    z-index: 5;
    text-align: center;
    padding: 24px;
}

.pane-mask[hidden] { display: none; }

.pane-mask .mask-icon { font-size: 34px; color: #b6bfcd; }
.pane-mask .mask-text { color: var(--muted); font-size: 13px; line-height: 1.8; max-width: 640px; }
.pane-mask.error { background: #fff6f4; }
.pane-mask.error .mask-icon { color: var(--danger); }
.pane-mask.error .mask-text { color: #8a3a26; word-break: break-all; }

.shell-empty {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 13px;
}

/* ---------- 空状态 ---------- */
.empty-tip {
    text-align: center;
    color: var(--muted);
    padding: 40px 0;
    font-size: 13px;
}

.empty-tip i {
    display: block;
    font-size: 40px;
    margin-bottom: 10px;
    opacity: .35;
}

/* ---------- 表单帮助文字 ---------- */
.field-help {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
    margin-top: 4px;
}

.cron-next-list {
    margin: 6px 0 0;
    padding-left: 18px;
    color: #4a5568;
    font-size: 12px;
    line-height: 1.8;
}

/* ---------- 树形表格（菜单管理） ----------
   不用 layui 的 tree 模块（项目的约定是只借 layui 的 CSS、不依赖它的 JS 行为），
   展开/收起就是给行加一个 hidden，缩进靠 data-depth 算出的占位 span。 */
.tree-toggle {
    display: inline-block;
    width: 16px;
    height: 16px;
    line-height: 14px;
    text-align: center;
    cursor: pointer;
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: 2px;
    background: #fff;
    font-size: 11px;
    user-select: none;
    vertical-align: middle;
}

.tree-toggle:hover { border-color: var(--brand); color: var(--brand); }

.tree-toggle.leaf {
    border-color: transparent;
    background: transparent;
    cursor: default;
    color: #d3d9e3;
}

.tree-indent {
    display: inline-block;
    width: 18px;
}

.tree-name {
    margin-left: 6px;
    vertical-align: middle;
}

.tree-row[data-hidden="1"] { display: none; }

/* ---------- 权限树（角色管理授权） ---------- */
.perm-tree {
    border: 1px solid var(--border);
    border-radius: 3px;
    background: #fcfdff;
    padding: 8px 10px;
    max-height: 460px;
    overflow: auto;
}

.perm-row {
    display: flex;
    align-items: center;
    padding: 3px 0;
    line-height: 22px;
}

.perm-row label {
    margin: 0;
    font-weight: 400;
    cursor: pointer;
}

.perm-row input[type="checkbox"] {
    margin: 0 6px 0 0;
    vertical-align: middle;
    cursor: pointer;
}

/* 半选态：父节点下只勾了一部分子项时，用横线提示「不是全选」，
   原生 checkbox 没有 indeterminate 样式，这里叠一个伪元素 */
.perm-row > label > input[data-half="1"] {
    opacity: .45;
}

.perm-children {
    margin-left: 9px;
    padding-left: 14px;
    border-left: 1px dashed #dfe4ec;
}

/* 折叠态用 class 而不是内联 display：弹层动画中、祖先被隐藏时量可见性会给出错答案 */
.perm-node.collapsed > .perm-children { display: none; }

.perm-caret {
    display: inline-block;
    width: 14px;
    text-align: center;
    cursor: pointer;
    color: var(--muted);
    font-size: 10px;
    user-select: none;
}

.perm-caret.leaf { cursor: default; color: transparent; }

.perm-perms {
    margin-left: 8px;
    color: var(--muted);
    font-size: 12px;
    font-family: Consolas, Monaco, monospace;
}

.perm-tools {
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 12px;
}

.perm-tools .layui-btn { margin-right: 6px; }

/* ---------- 图标选择器（菜单管理） ---------- */
.icon-picker {
    border: 1px solid var(--border);
    border-radius: 3px;
    background: #fff;
    max-height: 200px;
    overflow: auto;
    padding: 6px;
}

.icon-picker span {
    display: inline-block;
    width: 34px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    cursor: pointer;
    border: 1px solid transparent;
    border-radius: 3px;
    color: #5a6577;
    font-size: 16px;
}

.icon-picker span:hover { border-color: var(--brand); color: var(--brand); background: #f2f8ff; }
.icon-picker span.picked { border-color: var(--brand); color: #fff; background: var(--brand); }

.icon-preview {
    display: inline-block;
    min-width: 30px;
    text-align: center;
    margin-right: 8px;
    font-size: 18px;
    color: var(--brand);
    vertical-align: middle;
}

/* 打印时只保留内容 */
@media print {
    .no-print { display: none !important; }
}
