/* ==========================================================================
   中创云服数据业务系统 —— 权限管理系统 主题样式
   基于 Bootstrap 4.6 + AdminLTE 3.2，适配桌面 / 平板 / 手机多端
   ========================================================================== */

:root {
    /* 主色调：中创云服数据业务系统品牌色 #2692be */
    --brand: #2692be;
    --brand-dark: #1d7ba1;
    --brand-deep: #14526b;
    --brand-light: #45c2e0;
    --brand-soft: #e8f5fa;
    --brand-line: #bfe2f0;
    --sidebar-bg: #0d2a38;
    --sidebar-hover: #16404f;
    --sidebar-active: #2692be;
    --ink: #1f2937;
    --muted: #6b7280;
    --line: #e5e7eb;
    --page-bg: #f2f8fb;
    --radius: 12px;
}

html, body { height: 100%; }
body {
    background: var(--page-bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
                 "Helvetica Neue", Arial, "Noto Sans CJK SC", sans-serif;
}

a { color: var(--brand); }
a:hover { color: var(--brand-dark); }

/* ------------------------------ 顶部栏 ------------------------------ */
.main-header.navbar {
    border-bottom: 1px solid var(--line);
    box-shadow: 0 1px 6px rgba(17, 28, 51, .06);
    min-height: 56px;
}
.main-header .navbar-nav .nav-link { color: #374151; }
.main-header .nav-link:hover { color: var(--brand); }
.app-topbar-title { font-size: 15px; color: var(--ink); }

/* 顶栏版本徽标（取「系统管理 → 系统配置」里的版本号） */
.app-ver {
    display: inline-block;
    padding: 1px 8px;
    font-size: 11px;
    line-height: 1.6;
    color: var(--brand);
    background: rgba(38, 146, 190, .1);
    border: 1px solid rgba(38, 146, 190, .22);
    border-radius: 10px;
    white-space: nowrap;
}

.user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px; height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand), #45c2e0);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    vertical-align: middle;
    margin-right: 4px;
}
.user-avatar-lg {
    width: 42px; height: 42px;
    font-size: 17px;
    margin-right: 0;
}

/* ------------------------------ 侧边栏 ------------------------------ */
.main-sidebar {
    background: linear-gradient(180deg, #0f3242 0%, var(--sidebar-bg) 100%);
}
.main-sidebar .brand-link {
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    display: flex;
    align-items: center;
    padding: .8rem 1rem;
}
.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px; height: 34px;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--brand), #45c2e0);
    color: #fff;
    font-size: 16px;
    margin-right: 10px;
    flex: 0 0 auto;
}
/* 图片版 LOGO：去底色，图片自适应 */
.brand-mark.brand-mark-img {
    background: transparent;
    border-radius: 0;
}
.brand-mark.brand-mark-img img {
    width: 100%; height: 100%;
    object-fit: contain;
    display: block;
}
.login-aside .brand-mark.brand-mark-img {
    width: 64px; height: 64px;
}
.brand-text {
    font-weight: 700;
    font-size: 15px;
    color: #fff;
    line-height: 1.15;
    white-space: nowrap;
}
.brand-text small {
    display: block;
    font-size: 11px;
    font-weight: 400;
    color: rgba(255, 255, 255, .55);
    letter-spacing: 1px;
}
.main-sidebar .user-panel .info a { color: #e5e7eb; }
.main-sidebar .user-panel { border-bottom: 1px solid rgba(255, 255, 255, .08); }

.nav-sidebar .nav-link { border-radius: 8px; margin: 2px 8px; color: #c2d8e2; }
.nav-sidebar .nav-link:hover { background: var(--sidebar-hover); color: #fff; }
.nav-sidebar .nav-link.active,
.nav-sidebar .nav-link.active:hover {
    background: var(--sidebar-active);
    color: #fff;
    box-shadow: 0 4px 12px rgba(38, 146, 190, .45);
}
.nav-sidebar .nav-link > p { font-size: 13.5px; }
.nav-sidebar .nav-icon { font-size: 14px; }

/* 二级菜单层级缩进（一级 1rem → 二级 2.5rem → 三级 3.6rem） */
.nav-sidebar .nav-treeview > .nav-item > .nav-link { padding-left: 2.5rem; }
.nav-sidebar .nav-treeview .nav-treeview > .nav-item > .nav-link { padding-left: 3.6rem; }
.nav-sidebar .nav-treeview > .nav-item > .nav-link > p { font-size: 13px; }
.nav-sidebar .nav-treeview > .nav-item > .nav-link .nav-icon { font-size: 11px; width: 1.2rem; }
.nav-sidebar .nav-treeview > .nav-item > .nav-link { color: #8fb8cb; }
.nav-sidebar .nav-treeview > .nav-item > .nav-link.active { background: rgba(38, 146, 190, .9); color: #fff; }

/* ------------------------------ 内容区 ------------------------------ */
.content-wrapper { background: var(--page-bg); }
.content-header { padding: 16px 0 6px; }
.page-title { font-size: 19px; font-weight: 700; color: var(--ink); }
.breadcrumb-item + .breadcrumb-item::before { content: "/"; }
.breadcrumb { font-size: 12.5px; }

.card {
    border: none;
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(17, 28, 51, .07), 0 8px 24px -16px rgba(17, 28, 51, .25);
}
.card-header {
    background: #fff;
    border-bottom: 1px solid var(--line);
    border-radius: var(--radius) var(--radius) 0 0 !important;
    padding: .9rem 1.15rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .5rem;
}
.card-title { font-size: 15px; font-weight: 600; margin: 0; }

.table thead th {
    background: #f8fafc;
    border-top: none;
    border-bottom: 1px solid var(--line);
    color: #475569;
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
}
.table td { vertical-align: middle; font-size: 13px; }
.table-hover tbody tr:hover { background: #f8fbff; }

/* ------------------------------ 统计卡片 ------------------------------ */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
}
.stat-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #fff;
    border-radius: var(--radius);
    padding: 16px 18px;
    color: inherit;
    text-decoration: none;
    box-shadow: 0 1px 3px rgba(17, 28, 51, .07), 0 8px 24px -18px rgba(17, 28, 51, .3);
    transition: transform .15s ease, box-shadow .15s ease;
}
a.stat-card:hover { transform: translateY(-2px); text-decoration: none; color: inherit;
    box-shadow: 0 6px 20px -8px rgba(38, 146, 190, .35); }
.stat-icon {
    width: 46px; height: 46px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 19px; color: #fff; flex: 0 0 auto;
}
.stat-value { font-size: 22px; font-weight: 700; line-height: 1.15; }
.stat-label { font-size: 12.5px; color: var(--muted); }
.stat-primary .stat-icon { background: linear-gradient(135deg, #2692be, #4db4d6); }
.stat-success .stat-icon { background: linear-gradient(135deg, #059669, #10b981); }
.stat-danger  .stat-icon { background: linear-gradient(135deg, #dc2626, #f87171); }
.stat-info    .stat-icon { background: linear-gradient(135deg, #1d7ba1, #67d4ec); }
.stat-warning .stat-icon { background: linear-gradient(135deg, #d97706, #fbbf24); }
.stat-purple  .stat-icon { background: linear-gradient(135deg, #7c3aed, #a78bfa); }

/* ------------------------------ 徽标（柔和色） ------------------------------ */
.badge { font-weight: 500; padding: .32em .6em; border-radius: 6px; font-size: 11.5px; }
.badge-primary-soft { background: #dcf0f8; color: #1a6d90; }
.badge-success-soft { background: #dcfce7; color: #15803d; }
.badge-danger-soft  { background: #fee2e2; color: #b91c1c; }
.badge-warning-soft { background: #fef3c7; color: #b45309; }
.badge-info-soft    { background: #e0f2fe; color: #0369a1; }
.badge-secondary-soft { background: #e5e7eb; color: #4b5563; }
.badge-purple-soft  { background: #ede9fe; color: #6d28d9; }

/* ------------------------------ 表单 ------------------------------ */
.form-control:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 .2rem rgba(38, 146, 190, .12);
}
.form-control-sm { font-size: 13px; }
.btn { border-radius: 2px; }
.btn-primary { background: var(--brand); border-color: var(--brand); }
.btn-primary:hover, .btn-primary:focus { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-sm { font-size: 12.5px; }
.btn-icon { padding: .2rem .5rem; font-size: 12.5px; }
.required::after { content: " *"; color: #dc2626; }

/* 权限树 */
.perm-tree { max-height: 460px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.perm-tree ul { list-style: none; padding-left: 22px; margin: 0; }
.perm-tree > ul { padding-left: 0; }
.perm-tree li { padding: 3px 0; }
.perm-tree .form-check { margin-bottom: 0; }
.perm-tree .node-dir > .form-check > label { font-weight: 600; }

/* ------------------------------ 登录页 ------------------------------ */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    /* 背景图：宽度 100%、高度按比例自适应，铺满顶部；底色与图底融合 */
    background: #fbfcfd url('../img/login-bg.jpg') no-repeat center top;
    background-size: 100% auto;
}
.login-wrap { width: 100%; max-width: 920px; }
.login-card {
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    border-radius: 5px;
    overflow: hidden;
}
.login-aside {
    padding: 40px 36px;
    color: #333333;
    position: relative;
}
.login-aside h3 { font-weight: 700; font-size: 22px; line-height: 1.4; color: #333333; }
.login-aside p { color: rgba(51, 51, 51, .75); font-size: 13.5px; }
.login-aside .feature { display: flex; align-items: center; gap: 10px; margin-top: 14px; font-size: 13.5px; color: #333333; }
.login-aside .feature i { width: 26px; height: 26px; border-radius: 8px; background: rgba(51, 51, 51, .08);
    display: inline-flex; align-items: center; justify-content: center; font-size: 12px; }
.login-main { padding: 38px 36px; background: #fff; }
.login-main h4 { font-weight: 700; color: var(--ink); }
.login-main .sub { color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.captcha-img {
    height: 38px; width: 118px; border-radius: 8px; cursor: pointer;
    border: 1px solid var(--line); background: #f8fafc; object-fit: cover;
}
.login-tip {
    background: #f1f5f9; border: 1px dashed #c2d8e2; border-radius: 10px;
    padding: 9px 12px; font-size: 12.5px; color: #475569;
}
.login-footer { text-align: center; color: #8a929c; font-size: 12px; margin-top: 18px; }

/* ------------------------------ 登录趋势图 ------------------------------ */
.trend-chart {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    height: 180px;
    padding: 6px 4px 0;
}
.trend-col { flex: 1 1 0; display: flex; flex-direction: column; height: 100%; }
.trend-bars { display: flex; align-items: flex-end; justify-content: center; gap: 4px; flex: 1 1 auto; }
.bar { width: 40%; max-width: 20px; border-radius: 4px 4px 0 0; min-height: 2px; transition: height .3s ease; }
.bar-ok { background: linear-gradient(180deg, #34d399, #059669); }
.bar-fail { background: linear-gradient(180deg, #fca5a5, #dc2626); }
.trend-label { text-align: center; font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.trend-dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; vertical-align: middle; }
.trend-ok { background: #059669; }
.trend-fail { background: #dc2626; }

/* ------------------------------ 403 / 空态 ------------------------------ */
.forbidden-body {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: var(--page-bg); padding: 20px;
}
.forbidden-card { background: #fff; border-radius: 16px; padding: 44px 40px; text-align: center;
    box-shadow: 0 20px 50px -30px rgba(15, 23, 42, .5); max-width: 460px; }
.forbidden-code { font-size: 64px; font-weight: 800; line-height: 1;
    background: linear-gradient(135deg, #2692be, #45c2e0); -webkit-background-clip: text;
    background-clip: text; color: transparent; margin-bottom: 8px; }
.empty-state { text-align: center; padding: 54px 16px; color: var(--muted); }
.empty-state i { font-size: 40px; color: #c2d8e2; margin-bottom: 12px; display: block; }

/* ------------------------------ 个人中心 ------------------------------ */
.profile-hero {
    background: linear-gradient(135deg, #14526b, #2692be 60%, #45c2e0 130%);
    color: #fff; border-radius: var(--radius) var(--radius) 0 0; padding: 26px 24px;
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.profile-hero .avatar-xl {
    width: 64px; height: 64px; border-radius: 18px; background: rgba(255, 255, 255, .18);
    display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 700;
}
.info-list { list-style: none; padding: 0; margin: 0; }
.info-list li { display: flex; padding: 11px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.info-list li:last-child { border-bottom: none; }
.info-list .k { width: 110px; color: var(--muted); flex: 0 0 auto; }

/* ------------------------------ 响应式适配 ------------------------------ */
@media (max-width: 991.98px) {
    .login-card { grid-template-columns: 1fr; }
    .login-aside { display: none; }
    .login-main { padding: 30px 24px; }
}
@media (max-width: 767.98px) {
    .content-header { padding: 12px 0 4px; }
    .page-title { font-size: 17px; }
    .stat-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
    .stat-card { padding: 13px 14px; gap: 10px; }
    .stat-icon { width: 40px; height: 40px; font-size: 16px; }
    .stat-value { font-size: 19px; }
    .card-body { padding: 1rem; }
    .filter-bar .form-group { margin-bottom: .5rem; }
}
@media (max-width: 575.98px) {
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stat-label { font-size: 11.5px; }
    .login-body { padding: 10px; }
    .table td, .table th { font-size: 12.5px; }
    .btn { padding: .3rem .6rem; }
}

/* ------------------------------ 品牌色补充 ------------------------------ */
.text-brand { color: var(--brand) !important; }
.btn-outline-primary { color: var(--brand); border-color: var(--brand); }
.btn-outline-primary:hover, .btn-outline-primary:focus {
    background: var(--brand); border-color: var(--brand); color: #fff;
}
.page-item.active .page-link { background: var(--brand); border-color: var(--brand); }
.page-link { color: var(--brand); }
.page-link:hover { color: var(--brand-dark); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.custom-control-input:checked ~ .custom-control-label::before { border-color: var(--brand); background-color: var(--brand); }
.bg-brand-soft { background: var(--brand-soft) !important; }
.border-brand { border-color: var(--brand) !important; }
a.brand-link:hover { text-decoration: none; }
.main-header .nav-link:hover { color: var(--brand); }
.dropdown-item.active, .dropdown-item:active { background: var(--brand); }

/* ==========================================================================
   按钮圆角统一为 2px（覆盖 Bootstrap 默认值与各设计器内的自定义控件）
   ========================================================================== */
.btn,
.btn-sm, .btn-lg,
.btn-group > .btn,
.page-link,
.page-item:first-child .page-link,
.page-item:last-child .page-link,
.seg,
.seg > button,
.flow-zoombar,
.flow-zoombar button,
.fd-actions,
.fd-actions button,
.wizard-chip-lg button,
.task-tab,
.dropdown-menu,
.input-group > .form-control,
.input-group-prepend > .input-group-text,
.input-group-append > .input-group-text {
    border-radius: 2px;
}

/* ==========================================================================
   多标签工作区
   ========================================================================== */
.content-wrapper.has-tabs {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 3.5rem);
    min-height: 320px;
    overflow: hidden;
}
.content-tabs {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 1px 4px rgba(17, 28, 51, .04);
}
.tabs-strip {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.tabs-strip::-webkit-scrollbar { display: none; }
.tabs-arrow {
    flex: 0 0 auto;
    width: 24px; height: 26px;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 2px;
    color: #94a3b8;
    font-size: 11px;
    cursor: pointer;
    line-height: 1;
}
.tabs-arrow:hover { color: var(--brand); border-color: var(--brand); }

.tab-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    max-width: 200px;
    padding: 5px 9px;
    border: 1px solid var(--line);
    border-radius: 2px;
    background: #f8fafc;
    color: #475569;
    font-size: 12.5px;
    line-height: 1.4;
    white-space: nowrap;
    cursor: pointer;
    text-decoration: none;
}
.tab-item:hover { background: #fff; border-color: var(--brand-line); color: var(--brand-dark); text-decoration: none; }
.tab-item > i:first-child { font-size: 11px; opacity: .85; }
.tab-item .tab-text { overflow: hidden; text-overflow: ellipsis; }
.tab-item .tab-close {
    font-size: 10px;
    opacity: .45;
    padding: 2px;
    margin-right: -3px;
    border-radius: 2px;
}
.tab-item .tab-close:hover { opacity: 1; background: rgba(0, 0, 0, .08); }
.tab-item.active {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    box-shadow: 0 3px 10px -4px rgba(38, 146, 190, .75);
}
.tab-item.active .tab-close:hover { background: rgba(255, 255, 255, .25); }

.tabs-tools { flex: 0 0 auto; display: flex; align-items: center; gap: 4px; padding-left: 6px; border-left: 1px solid var(--line); }
.tabs-tool {
    width: 26px; height: 26px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--line);
    border-radius: 2px;
    background: #fff;
    color: #64748b;
    font-size: 11.5px;
    cursor: pointer;
}
.tabs-tool:hover { color: var(--brand); border-color: var(--brand); background: var(--brand-soft); }

.content-frames { position: relative; flex: 1 1 auto; overflow: hidden; background: var(--page-bg); }
.content-frame {
    position: absolute;
    inset: 0;
    width: 100%; height: 100%;
    border: 0;
    display: none;
    background: var(--page-bg);
}
.content-frame.active { display: block; }

/* 全屏工作区：隐藏侧边菜单与顶栏，标签页独占整屏 */
body.tabs-fullscreen .main-sidebar { display: none !important; }
body.tabs-fullscreen .content-wrapper.has-tabs { margin-left: 0 !important; height: 100vh; }
body.tabs-fullscreen .main-header { display: none !important; }
body.tabs-fullscreen .main-footer { display: none !important; }
@media (min-width: 992px) {
    body.sidebar-collapse .content-tabs { padding-left: 8px; }
}

/* ==========================================================================
   嵌入模式（页面片段被标签页 iframe 加载）
   ========================================================================== */
.embed-body { background: var(--page-bg); }
.embed-page { display: flex; flex-direction: column; height: 100vh; }
.embed-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px;
    padding: 13px 16px 9px;
    background: var(--page-bg);
}
.embed-title { font-size: 17px; font-weight: 700; color: var(--ink); margin: 0; }
.embed-head .breadcrumb { font-size: 12.5px; }
.embed-main {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: auto;
    padding: 0 16px 18px;
}
/* 设计器：嵌入模式下无需顶栏与页脚，直接撑满剩余高度（不写死抵消值） */
.embed-body .designer-wrap,
.embed-body .flow-wrap { flex: 1 1 auto; height: auto; min-height: 320px; }

@media (max-width: 767.98px) {
    .embed-head { padding: 10px 12px 6px; }
    .embed-title { font-size: 15.5px; }
    .embed-main { padding: 0 12px 14px; }
    .tab-item { max-width: 150px; }
}
