/* =============================================================
   外贸单据制作系统 · 橙色主题
   基于 Bootstrap 5.3 覆盖定制
   ============================================================= */
:root {
    --inv-orange:        #fd7e14;
    --inv-orange-dark:   #e8590c;
    --inv-orange-darker: #d9480f;
    --inv-orange-light:  #fff4e6;
    --inv-orange-lighter:#fffaf3;
    --inv-gradient:      linear-gradient(135deg, #ffa94d 0%, #fd7e14 55%, #e8590c 100%);
    --inv-gradient-soft: linear-gradient(135deg, #fff4e6 0%, #ffe8cc 100%);
    --inv-text:          #212529;
    --inv-muted:         #6c757d;
    --inv-border:        #e9ecef;
    --inv-body-bg:       #f5f6f8;
    --inv-radius:        12px;
}

body {
    font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
    background: var(--inv-body-bg);
    color: var(--inv-text);
}

/* ---------- 布局骨架 ---------- */
.app-shell { display: flex; min-height: 100vh; }

.app-sidebar {
    width: 236px;
    position: fixed;
    inset: 0 auto 0 0;
    height: 100vh;
    overflow-y: auto;
    background: #fff;
    border-right: 1px solid var(--inv-border);
    display: flex;
    flex-direction: column;
    z-index: 1040;
}

.sidebar-brand {
    background: var(--inv-gradient);
    color: #fff;
    padding: 1rem 1.1rem;
    display: flex;
    align-items: center;
    gap: .65rem;
    font-weight: 700;
    letter-spacing: .5px;
}
.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: rgba(255, 255, 255, .22);
    border: 1px solid rgba(255, 255, 255, .35);
    font-weight: 800;
    font-size: .8rem;
}
.sidebar-brand .brand-text { font-size: .95rem; line-height: 1.2; }

.sidebar-nav { padding: .75rem; display: flex; flex-direction: column; gap: .15rem; flex: 1; }
.nav-item {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .55rem .8rem;
    border-radius: 9px;
    color: #495057;
    text-decoration: none;
    font-size: .9rem;
    transition: background .15s, color .15s;
}
.nav-item .bi { font-size: 1.05rem; }
.nav-item:hover { background: var(--inv-orange-light); color: var(--inv-orange-darker); }
.nav-item.active {
    background: var(--inv-gradient);
    color: #fff;
    box-shadow: 0 4px 12px rgba(253, 126, 20, .35);
}
.nav-item.active .nav-badge { background: rgba(255,255,255,.25); color: #fff; }
.nav-badge {
    margin-left: auto;
    font-size: 10px;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--inv-orange-light);
    color: var(--inv-orange-darker);
    font-weight: 600;
}
.sidebar-footer {
    padding: .8rem 1.1rem;
    font-size: 11px;
    color: var(--inv-muted);
    border-top: 1px solid var(--inv-border);
    display: flex;
    align-items: center;
    gap: .4rem;
}
.sidebar-footer .dot { background: #40c057; }

.app-main {
    flex: 1;
    margin-left: 236px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--inv-border);
    padding: .6rem 1.4rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.topbar-title { font-size: 1.05rem; font-weight: 700; margin: 0; }
.topbar-user { margin-left: auto; display: flex; align-items: center; gap: .6rem; }
.user-name { font-weight: 600; font-size: .9rem; }
.role-badge {
    background: var(--inv-orange-light);
    color: var(--inv-orange-darker);
    border-radius: 999px;
    padding: 2px 10px;
    font-size: 12px;
    font-weight: 600;
}

.app-content { padding: 1.4rem; flex: 1; }

/* ---------- 组件 ---------- */
.card {
    border: 1px solid var(--inv-border);
    border-radius: var(--inv-radius);
    box-shadow: 0 1px 3px rgba(16, 24, 40, .04);
}
.card-header {
    background: #fff;
    border-bottom: 1px solid var(--inv-border);
    font-weight: 600;
    padding: .75rem 1.15rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    border-radius: var(--inv-radius) var(--inv-radius) 0 0;
}

.btn-primary {
    background: var(--inv-gradient);
    border: none;
    font-weight: 600;
}
.btn-primary:hover, .btn-primary:focus {
    background: linear-gradient(135deg, #fd7e14 0%, #e8590c 100%);
    box-shadow: 0 4px 14px rgba(253, 126, 20, .4);
}
.btn-outline-primary {
    color: var(--inv-orange-dark);
    border-color: var(--inv-orange);
}
.btn-outline-primary:hover, .btn-outline-primary:active {
    background: var(--inv-orange);
    border-color: var(--inv-orange);
}

.form-control:focus, .form-select:focus {
    border-color: #ffc078;
    box-shadow: 0 0 0 .2rem rgba(253, 126, 20, .18);
}
.input-group-text { background: var(--inv-orange-lighter); border-color: var(--inv-border); color: var(--inv-orange-dark); }

.table { margin: 0; }
.table thead th {
    background: var(--inv-orange-light);
    color: var(--inv-orange-darker);
    font-weight: 600;
    font-size: .82rem;
    white-space: nowrap;
    border-bottom: 1px solid #ffd8a8;
    padding: .6rem 1rem;
}
.table td { padding: .65rem 1rem; vertical-align: middle; }
.table-hover tbody tr:hover { background: var(--inv-orange-lighter); }

code { color: var(--inv-orange-darker); background: var(--inv-orange-light); padding: .1rem .35rem; border-radius: 5px; }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 4px; }
.dot-success { background: #40c057; }
.dot-danger  { background: #fa5252; }

.badge.bg-success-soft { background: #ebfbee; color: #2b8a3e; }
.badge.bg-danger-soft  { background: #fff5f5; color: #c92a2a; }
.bg-primary-soft { background: var(--inv-orange-light); color: var(--inv-orange-darker); }
.bg-success-soft { background: #ebfbee; color: #2b8a3e; }
.bg-info-soft    { background: #e7f5ff; color: #1864ab; }
.bg-warning-soft { background: #fff9db; color: #e67700; }

/* 动作徽标 */
.badge-action { font-weight: 500; font-size: 11px; padding: .28em .6em; }
.action-login       { background: #ebfbee; color: #2b8a3e; }
.action-logout      { background: #f1f3f5; color: #495057; }
.action-login_failed{ background: #fff5f5; color: #c92a2a; }
.action-login_locked{ background: #ffe3e3; color: #a61e1e; }
.action-create      { background: #e7f5ff; color: #1864ab; }
.action-update      { background: var(--inv-orange-light); color: var(--inv-orange-darker); }
.action-delete      { background: #fff5f5; color: #c92a2a; }
.action-generate_pdf{ background: #e6fcf5; color: #0b7285; }
.action-download    { background: #e6fcf5; color: #0b7285; }

/* 统计卡 */
.stat-card {
    background: #fff;
    border: 1px solid var(--inv-border);
    border-radius: var(--inv-radius);
    padding: 1.1rem 1.2rem;
    display: flex;
    align-items: center;
    gap: .9rem;
    box-shadow: 0 1px 3px rgba(16, 24, 40, .04);
    height: 100%;
}
.stat-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}
.stat-value { font-size: 1.45rem; font-weight: 800; line-height: 1.2; }
.stat-label { font-size: .8rem; color: var(--inv-muted); }

/* 欢迎卡 */
.welcome-card {
    background: var(--inv-gradient);
    color: #fff;
    border-radius: var(--inv-radius);
    padding: 1.4rem 1.6rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    box-shadow: 0 8px 24px rgba(253, 126, 20, .28);
    flex-wrap: wrap;
}
.welcome-card .btn-primary {
    background: #fff;
    color: var(--inv-orange-dark);
}
.welcome-card .btn-primary:hover { background: #fff; color: var(--inv-orange-darker); box-shadow: 0 4px 14px rgba(0,0,0,.15); }
.welcome-card .text-muted { color: rgba(255,255,255,.85) !important; }

/* 功能导览 */
.feature-item {
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: .7rem .25rem;
    border-bottom: 1px dashed var(--inv-border);
}
.feature-item:last-child { border-bottom: none; }
.feature-item > .bi {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--inv-gradient-soft);
    color: var(--inv-orange-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.feature-item > div { flex: 1; min-width: 0; }
.feature-item small { font-size: .78rem; }

/* 分页 */
.page-item.active .page-link {
    background: var(--inv-orange);
    border-color: var(--inv-orange);
    color: #fff;
}
.page-link { color: var(--inv-orange-dark); }
.page-link:hover { color: var(--inv-orange-darker); background: var(--inv-orange-light); }

/* 弹窗 */
.modal-header { background: var(--inv-orange-lighter); border-bottom: 1px solid var(--inv-border); }
.modal-title { font-size: 1rem; font-weight: 700; color: var(--inv-orange-darker); }
.kv-row { display: flex; gap: .75rem; padding: .45rem 0; border-bottom: 1px dashed var(--inv-border); }
.kv-row:last-child { border-bottom: none; }
.kv-key { flex: 0 0 88px; color: var(--inv-muted); font-size: .85rem; }
.kv-val { flex: 1; word-break: break-all; font-size: .88rem; }
.kv-diff-old { color: #c92a2a; text-decoration: line-through; }
.kv-diff-new { color: #2b8a3e; font-weight: 600; }

/* ---------- 登录页 ---------- */
.auth-body { background: var(--inv-body-bg); }
.login-wrap { display: flex; min-height: 100vh; }
.login-panel {
    flex: 0 0 46%;
    background: var(--inv-gradient);
    color: #fff;
    display: flex;
    align-items: center;
    padding: 3.5rem;
    position: relative;
    overflow: hidden;
}
.login-panel::after {
    content: "";
    position: absolute;
    right: -90px;
    bottom: -90px;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .08);
}
.login-panel::before {
    content: "";
    position: absolute;
    right: 40px;
    top: -60px;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .06);
}
.login-panel-inner { position: relative; z-index: 1; max-width: 420px; }
.login-panel h2 { font-weight: 800; margin: 1.2rem 0 .5rem; }
.login-logo .brand-mark { width: 52px; height: 52px; font-size: 1.1rem; border-radius: 14px; }
.login-sub { opacity: .92; line-height: 1.8; }
.login-features { list-style: none; padding: 0; margin-top: 2rem; }
.login-features li { padding: .45rem 0; display: flex; align-items: center; gap: .6rem; opacity: .95; }
.login-form-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
}
.login-card {
    width: 100%;
    max-width: 410px;
    background: #fff;
    border-radius: 18px;
    padding: 2.4rem;
    box-shadow: 0 16px 48px rgba(16, 24, 40, .10);
}
.login-card-header { text-align: center; margin-bottom: 1.2rem; }
.login-card-header h2 { font-size: 1.15rem; font-weight: 800; margin-top: .5rem; }
.login-title { font-weight: 800; margin-bottom: .2rem; }
.login-tip { color: var(--inv-muted); font-size: .88rem; margin-bottom: 1.4rem; }
.btn-login { padding: .6rem; font-size: 1rem; letter-spacing: 2px; }
.login-footer { text-align: center; color: var(--inv-muted); font-size: 12px; margin: 1.2rem 0 0; }

/* ---------- 占位 / 错误页 ---------- */
.coming-soon, .error-page {
    background: #fff;
    border: 1px solid var(--inv-border);
    border-radius: var(--inv-radius);
    text-align: center;
    padding: 4rem 2rem;
    max-width: 560px;
    margin: 2rem auto;
    box-shadow: 0 1px 3px rgba(16, 24, 40, .04);
}
.coming-soon-icon {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: var(--inv-gradient-soft);
    color: var(--inv-orange-dark);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin-bottom: 1.2rem;
}
.error-code {
    font-size: 4.5rem;
    font-weight: 900;
    line-height: 1;
    background: var(--inv-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: .5rem;
}

/* ---------- 响应式 ---------- */
@media (max-width: 767.98px) {
    .app-sidebar { transform: translateX(-100%); transition: transform .25s; box-shadow: none; }
    .app-sidebar.open { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,.15); }
    .app-main { margin-left: 0; }
    .app-content { padding: 1rem; }
    .topbar-title { font-size: .95rem; }
    .user-name { display: none; }
    .login-panel { display: none !important; }
    .sidebar-backdrop {
        position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 1035; display: none;
    }
    .sidebar-backdrop.show { display: block; }
}
