/* =============================================================
   客户数字化包装管理门户 —— 样式
   与前台同一套色板，纯 CSS，无第三方框架 / 无 CDN
   ============================================================= */

:root {
    --c-primary: #1D5BFF;
    --c-teal:    #00C2A8;
    --c-purple:  #7C4DFF;
    --c-orange:  #FF6B35;
    --c-rose:    #FF4D8D;
    --c-amber:   #F7A800;
    --c-ink:     #0A1633;

    --c-bg:      #F4F6FB;
    --c-card:    #FFFFFF;
    --c-line:    #E6EAF3;
    --c-text:    #0A1633;
    --c-muted:   #6B7793;

    --grad-dark: linear-gradient(120deg, #0A1633 0%, #143A96 55%, #1D5BFF 100%);
    --radius:    14px;
    --shadow:    0 6px 24px rgba(10, 22, 51, .08);
    --shadow-lg: 0 16px 42px rgba(10, 22, 51, .16);
    --font:      -apple-system, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

body.portal {
    margin: 0;
    font-family: var(--font);
    background: var(--c-bg);
    color: var(--c-text);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 700; }
ul, ol { margin: 0; padding: 0; list-style: none; }

/* ---------------- 顶部导航 ---------------- */
.pt-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--grad-dark);
    color: #fff;
    box-shadow: 0 8px 30px rgba(10, 22, 51, .22);
}
.pt-header__inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 12px 22px;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}
.pt-brand { display: flex; align-items: center; gap: 12px; color: #fff; }
.pt-brand__logo {
    width: 42px; height: 42px; border-radius: 12px;
    display: grid; place-items: center;
    font-size: 20px; font-weight: 800;
    background: linear-gradient(135deg, var(--c-teal), var(--c-primary));
    box-shadow: 0 6px 18px rgba(0, 194, 168, .4);
}
.pt-brand__text { display: flex; flex-direction: column; line-height: 1.25; }
.pt-brand__title { font-size: 17px; letter-spacing: .5px; }
.pt-brand__sub { font-size: 12px; color: rgba(255, 255, 255, .68); }

.pt-nav { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.pt-nav__link {
    padding: 8px 14px;
    border-radius: 999px;
    color: rgba(255, 255, 255, .82);
    font-size: 14px;
    transition: .2s;
    white-space: nowrap;
}
.pt-nav__link:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.pt-nav__link.is-active {
    background: rgba(255, 255, 255, .18);
    color: #fff;
    font-weight: 700;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .28);
}

.pt-user { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pt-user__info { display: flex; flex-direction: column; line-height: 1.3; text-align: right; }
.pt-user__name { font-size: 14px; font-weight: 700; }
.pt-user__meta { font-size: 12px; color: rgba(255, 255, 255, .66); }

.pt-btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 8px 15px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid transparent;
    transition: .2s;
    white-space: nowrap;
}
.pt-btn--ghost { color: #fff; border-color: rgba(255, 255, 255, .45); background: rgba(255, 255, 255, .08); }
.pt-btn--ghost:hover { background: rgba(255, 255, 255, .2); }
.pt-btn--light { color: var(--c-primary); background: #fff; }
.pt-btn--light:hover { background: #EAF1FF; }
.pt-logout { margin: 0; display: inline-flex; }

/* ---------------- 主体 ---------------- */
.pt-main { padding: 26px 0 44px; }
.pt-wrap { max-width: 1240px; margin: 0 auto; padding: 0 22px; }

.pt-flash {
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 18px;
    font-size: 14px;
    border: 1px solid transparent;
}
.pt-flash--success { background: #E7FBF5; color: #067F6E; border-color: #B4EFE4; }
.pt-flash--error   { background: #FFEDF2; color: #C81E56; border-color: #FFCAD9; }

.pt-page-head {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 16px; margin-bottom: 18px; flex-wrap: wrap;
}
.pt-page-head__title { font-size: 24px; letter-spacing: .3px; }
.pt-page-head__sub { margin: 4px 0 0; color: var(--c-muted); font-size: 13px; }

/* ---------------- 卡片 / 网格 ---------------- */
.card {
    background: var(--c-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 18px;
    border: 1px solid rgba(230, 234, 243, .9);
}
.card__head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.card__title { font-size: 16px; }
.card__title::before {
    content: ""; display: inline-block; width: 4px; height: 15px;
    border-radius: 3px; margin-right: 9px; vertical-align: -2px;
    background: linear-gradient(180deg, var(--c-primary), var(--c-teal));
}
.card__more { font-size: 13px; color: var(--c-primary); font-weight: 600; }
.card__hint { font-size: 12px; color: var(--c-muted); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 0; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 18px; }

/* ---------------- KPI ---------------- */
.kpi {
    position: relative;
    display: flex; align-items: center; gap: 14px;
    background: var(--c-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    overflow: hidden;
    border: 1px solid rgba(230, 234, 243, .9);
}
.kpi::after {
    content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
    background: var(--kpi-accent, var(--c-primary));
}
.kpi__icon {
    width: 48px; height: 48px; border-radius: 13px; flex: 0 0 48px;
    display: grid; place-items: center; font-size: 22px;
    background: var(--kpi-bg, linear-gradient(135deg, #EAF1FF, #D7E3FF));
}
.kpi__body { min-width: 0; }
.kpi__label { font-size: 12.5px; color: var(--c-muted); }
.kpi__value {
    font-size: 24px; font-weight: 800; line-height: 1.25;
    color: var(--kpi-accent, var(--c-ink));
    white-space: nowrap;
}
.kpi__value small { font-size: 13px; font-weight: 600; margin-left: 3px; color: var(--c-muted); }
.kpi__value--sm { font-size: 19px; }
.kpi__sub { font-size: 12px; color: var(--c-muted); margin-top: 2px; }
.kpi__sub .badge { margin-left: 4px; }

.kpi--a { --kpi-accent: #1D5BFF; --kpi-bg: linear-gradient(135deg, #EAF1FF, #C9DCFF); }
.kpi--b { --kpi-accent: #00A38C; --kpi-bg: linear-gradient(135deg, #DFFAF5, #B7F0E6); }
.kpi--c { --kpi-accent: #FF6B35; --kpi-bg: linear-gradient(135deg, #FFEDE3, #FFD3BE); }
.kpi--d { --kpi-accent: #C21E68; --kpi-bg: linear-gradient(135deg, #FFE7F0, #FFC9DE); }

/* ---------------- 欢迎区 ---------------- */
.welcome {
    display: flex; align-items: center; justify-content: space-between; gap: 20px;
    background: var(--grad-dark);
    color: #fff;
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 18px;
    box-shadow: var(--shadow-lg);
    flex-wrap: wrap;
    position: relative;
    overflow: hidden;
}
.welcome::after {
    content: ""; position: absolute; right: -60px; top: -60px;
    width: 240px; height: 240px; border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 194, 168, .5), transparent 70%);
}
.welcome__title { font-size: 22px; margin-bottom: 6px; }
.welcome__sub { margin: 0; color: rgba(255, 255, 255, .82); max-width: 620px; font-size: 13.5px; }
.welcome__side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; z-index: 1; }
.welcome__badge {
    display: inline-block; padding: 4px 12px; border-radius: 999px;
    background: linear-gradient(135deg, var(--c-teal), var(--c-primary));
    font-weight: 700; font-size: 13px;
}
.welcome__meta { font-size: 12.5px; color: rgba(255, 255, 255, .72); }

/* ---------------- 徽章 ---------------- */
.badge {
    display: inline-block; padding: 3px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 700; line-height: 1.5; white-space: nowrap;
    border: 1px solid transparent;
}
.badge--pending   { background: #FFF6E5; color: #B07A00; border-color: #FFE3AF; }
.badge--producing { background: #EAF1FF; color: #1D5BFF; border-color: #C9DCFF; }
.badge--ready     { background: #F1ECFF; color: #6A38F0; border-color: #DACFFF; }
.badge--shipping  { background: #FFEDE3; color: #D2541F; border-color: #FFD3BE; }
.badge--done      { background: #E7FBF5; color: #067F6E; border-color: #B4EFE4; }
.badge--danger    { background: #FFEDF2; color: #C81E56; border-color: #FFCAD9; }
.badge--muted     { background: #EEF1F8; color: #6B7793; border-color: #E1E6F0; }
.badge--up        { background: #FFEDF2; color: #C81E56; border-color: #FFCAD9; }
.badge--down      { background: #E7FBF5; color: #067F6E; border-color: #B4EFE4; }

/* ---------------- 库存预警列表 ---------------- */
.alert-list__item {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 11px 0; border-bottom: 1px dashed var(--c-line);
}
.alert-list__item:last-child { border-bottom: 0; }
.alert-list__name { font-weight: 600; }
.alert-list__name em { font-style: normal; color: var(--c-muted); font-size: 12.5px; font-weight: 400; }
.alert-list__qty { color: var(--c-muted); font-size: 13px; margin-left: auto; }
.alert-list__qty b { color: var(--c-rose); }

/* ---------------- 进度条 ---------------- */
.prog {
    height: 10px; background: #EEF1F8; border-radius: 999px;
    overflow: hidden; margin: 12px 0 8px;
}
.prog--lg { height: 13px; }
.prog__bar {
    height: 100%; border-radius: 999px;
    background: linear-gradient(90deg, var(--c-teal), var(--c-primary));
    transition: width .4s ease;
}
.prog__meta { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--c-muted); gap: 12px; flex-wrap: wrap; }
.prog__meta b { color: var(--c-ink); }

/* ---------------- 配送卡片 ---------------- */
.ship-card { border-left: 4px solid var(--c-orange); }
.ship__top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ship__no { font-weight: 800; }
.ship__node {
    margin: 12px 0 10px; padding: 11px 14px; border-radius: 10px;
    background: #F7F9FF; color: var(--c-ink); font-size: 13px;
    border-left: 3px solid var(--c-primary);
}
.ship__foot { display: flex; gap: 18px; flex-wrap: wrap; font-size: 12.5px; color: var(--c-muted); }
.ship__info { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; font-size: 13px; color: var(--c-muted); }
.ship__info span:first-child { color: var(--c-ink); font-weight: 600; }

/* ---------------- 时间轴 ---------------- */
.tl { display: flex; gap: 0; margin: 16px 0 0; flex-wrap: wrap; }
.tl__item {
    position: relative; flex: 1 1 0; min-width: 120px;
    padding-top: 20px; text-align: center;
    font-size: 12.5px; color: var(--c-muted);
}
.tl__item::before {
    content: ""; position: absolute; top: 6px; left: 50%; right: -50%;
    height: 2px; background: var(--c-line);
}
.tl__item:last-child::before { display: none; }
.tl__dot {
    position: absolute; top: 1px; left: 50%; transform: translateX(-50%);
    width: 13px; height: 13px; border-radius: 50%;
    background: #fff; border: 2px solid #C7CEDC;
}
.tl__item.is-done { color: var(--c-ink); font-weight: 600; }
.tl__item.is-done .tl__dot {
    background: linear-gradient(135deg, var(--c-teal), var(--c-primary));
    border-color: transparent;
}
.tl__item.is-done::before { background: linear-gradient(90deg, var(--c-teal), var(--c-primary)); }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
.pt-table { width: 100%; border-collapse: collapse; min-width: 640px; }
.pt-table th, .pt-table td { padding: 11px 12px; text-align: left; font-size: 13px; }
.pt-table thead th {
    background: #F7F9FF; color: var(--c-muted);
    font-weight: 600; font-size: 12.5px; white-space: nowrap;
    border-bottom: 1px solid var(--c-line);
}
.pt-table thead th:first-child { border-radius: 10px 0 0 10px; }
.pt-table thead th:last-child { border-radius: 0 10px 10px 0; }
.pt-table tbody tr { border-bottom: 1px solid var(--c-line); transition: background .18s; }
.pt-table tbody tr:hover { background: #FAFBFE; }
.pt-table tbody tr:last-child { border-bottom: 0; }
.pt-table .nowrap { white-space: nowrap; }
.pt-table .muted { color: var(--c-muted); }
.pt-table tr.row-warn { background: #FFF6F9; }
.pt-table tr.row-warn:hover { background: #FFEDF2; }
.pt-table tr.row-warn td:first-child { box-shadow: inset 3px 0 0 var(--c-rose); }

/* ---------------- 分页 ---------------- */
.pager-wrap { margin-top: 16px; }
.pager { display: flex; gap: 6px; flex-wrap: wrap; }
.pager__item {
    min-width: 34px; padding: 6px 10px; text-align: center;
    border-radius: 9px; border: 1px solid var(--c-line);
    color: var(--c-text); font-size: 13px; background: #fff;
}
.pager__item.is-active { background: var(--c-primary); color: #fff; border-color: var(--c-primary); font-weight: 700; }
.pager__item.is-disabled { color: #B7BFCE; background: #F7F9FF; }

/* ---------------- 状态筛选 chips ---------------- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
    padding: 6px 14px; border-radius: 999px; font-size: 13px;
    border: 1px solid var(--c-line); color: var(--c-muted); background: #fff;
    transition: .2s;
}
.chip:hover { border-color: var(--c-primary); color: var(--c-primary); }
.chip.is-active { background: var(--c-primary); color: #fff; border-color: var(--c-primary); font-weight: 700; }

/* ---------------- 按钮 ---------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 10px 18px; border-radius: 10px; font-size: 13.5px; font-weight: 700;
    cursor: pointer; border: 1px solid transparent; transition: .2s; white-space: nowrap;
}
.btn--primary { background: linear-gradient(135deg, var(--c-primary), var(--c-purple)); color: #fff; box-shadow: 0 8px 20px rgba(29, 91, 255, .3); }
.btn--primary:hover { filter: brightness(1.06); }
.btn--outline { background: #fff; color: var(--c-primary); border-color: #C9DCFF; }
.btn--outline:hover { background: #F2F6FF; }

/* ---------------- 库存健康度 ---------------- */
.health {
    background: var(--c-card); border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 18px 20px; display: flex; flex-direction: column; gap: 2px;
    border-left: 5px solid var(--h-accent, var(--c-primary));
}
.health__num { font-size: 30px; font-weight: 800; line-height: 1.1; color: var(--h-accent, var(--c-ink)); }
.health__label { font-weight: 700; font-size: 14px; }
.health__hint { font-size: 12px; color: var(--c-muted); }
.health--normal { --h-accent: #00A38C; }
.health--warn   { --h-accent: #F7A800; }
.health--danger { --h-accent: #FF4D8D; }

/* ---------------- 用量趋势迷你图 ---------------- */
.trends { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 24px; }
.trend {
    border: 1px solid var(--c-line); border-radius: 12px; padding: 12px 14px;
    background: #FCFDFF;
}
.trend__head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.trend__dot { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 10px; }
.trend__name { font-weight: 700; font-size: 13.5px; }
.trend__sum { margin-left: auto; font-size: 12.5px; color: var(--c-muted); }

.mini { display: flex; align-items: flex-end; gap: 6px; height: 82px; }
.mini__col { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.mini__bar { width: 100%; max-width: 26px; border-radius: 5px 5px 0 0; transition: height .3s; }
.mini__x { font-size: 10.5px; color: var(--c-muted); margin-top: 5px; }

/* ---------------- 占比环形图与图例 ---------------- */
.share { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; }
.donut {
    width: 168px; height: 168px; border-radius: 50%; flex: 0 0 168px;
    position: relative; display: grid; place-items: center;
    box-shadow: 0 10px 26px rgba(10, 22, 51, .12);
}
.donut__hole {
    width: 100px; height: 100px; border-radius: 50%; background: #fff;
    display: grid; place-items: center; font-size: 13px; font-weight: 800;
    color: var(--c-ink); box-shadow: inset 0 2px 8px rgba(10, 22, 51, .08);
}
.legend { flex: 1 1 200px; min-width: 200px; }
.legend__item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 0; border-bottom: 1px dashed var(--c-line); font-size: 13px;
}
.legend__item:last-child { border-bottom: 0; }
.legend__dot { width: 11px; height: 11px; border-radius: 3px; flex: 0 0 11px; }
.legend__label { font-weight: 600; }
.legend__pct { margin-left: auto; font-weight: 800; color: var(--c-primary); }
.legend__val { color: var(--c-muted); min-width: 84px; text-align: right; }

/* ---------------- 优化建议 ---------------- */
.suggest__item {
    position: relative; padding: 10px 12px 10px 30px; margin-bottom: 8px;
    background: #F7F9FF; border-radius: 10px; font-size: 13px;
    border-left: 3px solid var(--c-teal);
}
.suggest__item::before {
    content: "✦"; position: absolute; left: 11px; top: 10px; color: var(--c-teal); font-size: 12px;
}
.suggest__btn { margin-top: 12px; width: 100%; }

/* ---------------- 帮助条 ---------------- */
.helpbar {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    background: linear-gradient(120deg, #0A1633, #143A96);
    color: #fff; border-radius: var(--radius); padding: 20px 24px; flex-wrap: wrap;
    box-shadow: var(--shadow-lg);
}
.helpbar b { display: block; font-size: 15px; margin-bottom: 2px; }
.helpbar span { font-size: 13px; color: rgba(255, 255, 255, .78); }

/* ---------------- 空状态 ---------------- */
.empty { color: var(--c-muted); font-size: 13.5px; padding: 18px 4px; text-align: center; }

/* ---------------- 登录 ---------------- */
.login {
    max-width: 460px; margin: 40px auto 20px;
}
.login__card {
    background: var(--c-card); border-radius: 18px; box-shadow: var(--shadow-lg);
    padding: 30px 28px; border: 1px solid rgba(230, 234, 243, .9);
}
.login__brand { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.login__logo {
    width: 52px; height: 52px; border-radius: 14px; flex: 0 0 52px;
    display: grid; place-items: center; color: #fff; font-size: 24px; font-weight: 800;
    background: linear-gradient(135deg, var(--c-teal), var(--c-primary));
    box-shadow: 0 8px 22px rgba(29, 91, 255, .35);
}
.login__title { font-size: 18px; }
.login__sub { margin: 3px 0 0; font-size: 12.5px; color: var(--c-muted); }
.login__form { display: flex; flex-direction: column; gap: 14px; }
.login__field { display: flex; flex-direction: column; gap: 6px; }
.login__label { font-size: 13px; font-weight: 600; color: var(--c-muted); }
.login__input {
    width: 100%; padding: 11px 14px; border-radius: 10px;
    border: 1px solid var(--c-line); background: #F7F9FF;
    font-size: 14px; font-family: var(--font); color: var(--c-text);
    transition: .2s;
}
.login__input:focus { outline: none; border-color: var(--c-primary); background: #fff; box-shadow: 0 0 0 3px rgba(29, 91, 255, .14); }
.login__submit {
    margin-top: 4px; padding: 12px; border: 0; border-radius: 10px; cursor: pointer;
    color: #fff; font-size: 15px; font-weight: 700; font-family: var(--font);
    background: linear-gradient(135deg, var(--c-primary), var(--c-purple));
    box-shadow: 0 10px 24px rgba(29, 91, 255, .32);
    transition: .2s;
}
.login__submit:hover { filter: brightness(1.06); }
.login__demo {
    margin-top: 18px; padding: 11px 14px; border-radius: 10px;
    background: #F1ECFF; border: 1px dashed #DACFFF;
    display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; color: #5B33C7;
}
.login__demo b { font-size: 12.5px; }
.login__demo code { background: rgba(124, 77, 255, .14); padding: 1px 6px; border-radius: 5px; font-family: Menlo, Consolas, monospace; }
.login__hint { margin: 16px 0 0; font-size: 12.5px; color: var(--c-muted); }

/* ---------------- 页脚 ---------------- */
.pt-footer {
    background: #0A1633; color: rgba(255, 255, 255, .72);
    padding: 22px;
}
.pt-footer__inner {
    max-width: 1240px; margin: 0 auto;
    display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; font-size: 12.5px;
}
.pt-footer__col { display: flex; flex-direction: column; gap: 4px; }
.pt-footer__col b { color: #fff; font-size: 13.5px; }
.pt-footer__col--right { text-align: right; }
.pt-footer a { color: #fff; font-weight: 600; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 900px) {
    .grid-2, .grid-3, .grid-4, .trends { grid-template-columns: 1fr; }
    .pt-header__inner { padding: 10px 16px; gap: 12px; }
    .pt-nav { order: 3; width: 100%; margin-left: 0; overflow-x: auto; padding-bottom: 4px; }
    .pt-user { margin-left: auto; }
    .pt-user__info { text-align: left; }
    .welcome__side { align-items: flex-start; text-align: left; }
    .pt-footer__col--right { text-align: left; }
    .share { justify-content: center; }
    .donut { margin: 0 auto; }
    .helpbar { flex-direction: column; align-items: stretch; text-align: center; }
    .pt-wrap { padding: 0 14px; }
    .pt-page-head__title { font-size: 20px; }
    .login { margin: 20px auto; }
}
