/* ==========================================================================
   城市数据库 · 专业工作台 App Shell（地图帮暖橙体系）
   设计令牌单一事实来源在 /static/css/main.css :root，本文件只消费令牌、不重定义品牌色。
   结构：左侧固定 Sidebar + 右侧 Main（轻量 Topbar + 内容区）。
   ========================================================================== */

:root {
    --ws-sidebar-w: 248px;
    --ws-topbar-h: 60px;
    /* 全站顶部导航栏高度（.dtb-nav 最小高度 56px）：侧边栏 / 工作台顶栏整体下移让位 */
    --ws-nav-h: 56px;
}

/* ---------- 页面背景：近白底 + 暖橙径向光晕（克制） ---------- */
body.app-shell {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(900px 480px at 100% -8%, rgba(255, 123, 0, .07), transparent 60%),
        radial-gradient(720px 480px at -8% 108%, rgba(255, 154, 60, .06), transparent 55%),
        linear-gradient(180deg, #fdfcfb 0%, #fafafb 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: var(--font-sans);
}

/* ==========================================================================
   布局骨架
   ========================================================================== */
.app-shell__layout { display: flex; min-height: calc(100vh - var(--ws-nav-h)); }

/* 全站顶部导航栏在工作台中置于最上层（含其下拉菜单），高于固定侧边栏与抽屉遮罩 */
.app-shell .dtb-nav { z-index: 1050; }

/* ---------- 左侧固定侧边栏（下移到全站导航栏之下） ---------- */
.app-sidebar {
    position: fixed; top: var(--ws-nav-h); left: 0; z-index: 1040;
    width: var(--ws-sidebar-w); height: calc(100vh - var(--ws-nav-h));
    display: flex; flex-direction: column;
    background: rgba(255, 255, 255, .88);
    border-right: 1px solid var(--border-soft);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}
.app-sidebar__brand {
    display: flex; align-items: center; gap: 10px;
    padding: 18px 18px 14px;
    text-decoration: none; color: var(--text-primary);
}
.app-sidebar__brand:hover { text-decoration: none; color: var(--text-primary); }
.app-sidebar__logo {
    width: 34px; height: 34px; border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--accent-gradient); color: #fff; font-size: 16px;
    box-shadow: var(--shadow-glow-sm); flex-shrink: 0;
}
.app-sidebar__brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.app-sidebar__brand-text strong { font-size: .98rem; font-weight: 800; letter-spacing: -.01em; }
.app-sidebar__brand-text span { font-size: .72rem; color: var(--text-muted); }

.app-sidebar__scroll { flex: 1; overflow-y: auto; padding: 6px 12px 12px; }
.app-sidebar__scroll::-webkit-scrollbar { width: 6px; }
.app-sidebar__scroll::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; }

.app-nav-group { margin-top: 14px; }
.app-nav-group__label {
    padding: 0 10px 6px; font-size: .68rem; font-weight: 700;
    letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted);
}
.app-nav-item {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 11px; margin-bottom: 2px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary); text-decoration: none;
    font-size: .9rem; font-weight: 500; line-height: 1.3;
    position: relative;
    transition: background .15s ease, color .15s ease;
}
.app-nav-item:hover { background: var(--bg-hover); color: var(--accent-primary); text-decoration: none; }
.app-nav-item i { width: 18px; text-align: center; font-size: .95rem; flex-shrink: 0; }
.app-nav-item .app-nav-item__count {
    margin-left: auto; font-size: .72rem; font-weight: 600;
    color: var(--text-muted); font-variant-numeric: tabular-nums;
}
.app-nav-item.is-active {
    background: var(--accent-light); color: var(--accent-primary); font-weight: 600;
}
.app-nav-item.is-active i { color: var(--accent-primary); }
.app-nav-item.is-active .app-nav-item__count { color: var(--accent-secondary); }
.app-nav-item.is-active::before {
    content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
    width: 3px; height: 18px; border-radius: 999px; background: var(--accent-gradient);
}

/* ---------- 侧边栏底部固定区：账户 / 用量 / 会员 ---------- */
.app-sidebar__footer { padding: 10px 12px 14px; border-top: 1px solid var(--border-soft); }
.app-sidebar__account {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 10px; border-radius: var(--radius-sm);
    text-decoration: none; color: var(--text-primary);
    background: var(--bg-soft); border: 1px solid var(--border-soft);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.app-sidebar__account:hover { border-color: var(--border-hover); box-shadow: var(--shadow-sm); text-decoration: none; color: var(--text-primary); }
.app-sidebar__avatar {
    width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--accent-light); color: var(--accent-primary); font-size: 14px;
    border: 1px solid var(--border-soft);
}
.app-sidebar__account-meta { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.app-sidebar__account-meta strong { font-size: .85rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.app-sidebar__account-meta span { font-size: .72rem; color: var(--text-muted); }
.app-sidebar__login {
    display: flex; align-items: center; justify-content: center; gap: 7px;
    padding: 10px; border-radius: var(--radius-sm);
    background: var(--accent-gradient); color: #fff; font-weight: 600; font-size: .9rem;
    text-decoration: none; box-shadow: var(--shadow-glow-sm);
    transition: transform .15s ease, box-shadow .15s ease;
}
.app-sidebar__login:hover { transform: translateY(-2px); box-shadow: var(--shadow-glow); color: #fff; text-decoration: none; }

/* ---------- 右侧主内容区 ---------- */
.app-content {
    flex: 1; min-width: 0; min-height: calc(100vh - var(--ws-nav-h));
    margin-left: var(--ws-sidebar-w);
    display: flex; flex-direction: column;
}

/* 顶部轻量栏：仅页标题 / 状态 / 用户入口，不与侧边栏重复主导航（吸附在全站导航栏之下） */
.app-topbar {
    position: sticky; top: var(--ws-nav-h); z-index: 1030;
    min-height: var(--ws-topbar-h);
    display: flex; align-items: center; gap: 14px;
    padding: 10px 26px;
    background: rgba(253, 252, 251, .82);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-soft);
}
.app-topbar__title { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.app-topbar__title strong { font-size: .98rem; font-weight: 700; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-topbar__title span { font-size: .76rem; color: var(--text-muted); }
.app-topbar__spacer { flex: 1; }
.app-topbar__chip {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 6px 12px; border-radius: var(--radius-pill);
    background: var(--bg-card); border: 1px solid var(--border-color);
    color: var(--text-secondary); font-size: .82rem; font-weight: 600; text-decoration: none;
    transition: border-color .15s ease, color .15s ease;
}
.app-topbar__chip:hover { border-color: var(--border-hover); color: var(--accent-primary); text-decoration: none; }
.app-topbar__chip i { color: var(--accent-primary); }

/* 汉堡按钮（窄屏抽屉触发） */
.app-topbar__toggler {
    display: none; align-items: center; justify-content: center;
    width: 38px; height: 38px; border-radius: var(--radius-sm);
    background: var(--bg-card); border: 1px solid var(--border-color);
    color: var(--text-secondary); cursor: pointer; font-size: 1rem;
}
.app-topbar__toggler:hover { color: var(--accent-primary); border-color: var(--border-hover); }

.app-main { flex: 1; padding: 26px; max-width: 1280px; width: 100%; }
.app-main > * { animation: ws-fade-up .4s ease both; }

/* 抽屉遮罩（窄屏） */
.app-backdrop {
    display: none; position: fixed; inset: 0; z-index: 1035;
    background: rgba(20, 20, 31, .42); backdrop-filter: blur(2px);
}

/* backdrop-filter 不支持时（部分 Edge / 旧内核）退化为不透明背景，
   避免侧栏 / 顶栏半透明透出正文，看起来像悬浮遮挡。 */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .app-sidebar { background: #fff; }
    .app-topbar { background: #fdfcfb; }
}

/* ==========================================================================
   主内容区组件
   ========================================================================== */
.page-header { margin-bottom: 22px; }
.page-header__bread { font-size: .78rem; color: var(--text-muted); margin-bottom: 8px; }
.page-header__bread a { color: var(--text-muted); text-decoration: none; }
.page-header__bread a:hover { color: var(--accent-primary); }
.page-header__row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-header__title { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; margin: 0; color: var(--text-primary); }
.page-header__desc { color: var(--text-secondary); font-size: .92rem; margin: 6px 0 0; line-height: 1.7; max-width: 720px; }
.page-header__actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

/* 通用表面卡片 */
.surface {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 22px;
    margin-bottom: 20px;
    transition: border-color .18s ease, box-shadow .18s ease;
}
.surface--hover:hover { border-color: var(--border-hover); box-shadow: var(--shadow-md); }
.surface__head { margin-bottom: 16px; }
.surface__title { font-size: 1.08rem; font-weight: 700; margin: 0; color: var(--text-primary); }
.surface__desc { font-size: .85rem; color: var(--text-secondary); margin: 5px 0 0; }

/* 工具条 */
.ws-toolbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    flex-wrap: wrap; margin-bottom: 18px;
}
.ws-toolbar__hint { font-size: .82rem; color: var(--text-secondary); }

/* ---------- 按钮（暖橙渐变 + 描边） ---------- */
.btn-ws {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 9px 18px; border-radius: var(--radius-sm);
    font-size: .88rem; font-weight: 600; line-height: 1.2;
    cursor: pointer; text-decoration: none; border: 1px solid transparent;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease, color .15s ease, border-color .15s ease;
}
.btn-ws--sm { padding: 7px 14px; font-size: .82rem; }
.btn-ws--primary { background: var(--accent-gradient); color: #fff; box-shadow: var(--shadow-glow-sm); }
.btn-ws--primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-glow); color: #fff; text-decoration: none; }
.btn-ws--primary:active { transform: translateY(0); }
.btn-ws--primary:disabled { filter: grayscale(.25) brightness(.97); box-shadow: none; transform: none; cursor: default; }
.btn-ws--outline { background: transparent; color: var(--accent-primary); border-color: var(--border-hover); }
.btn-ws--outline:hover { background: var(--accent-gradient); color: #fff; border-color: transparent; box-shadow: var(--shadow-glow-sm); text-decoration: none; }
.btn-ws--ghost { background: var(--bg-card); color: var(--text-secondary); border-color: var(--border-color); }
.btn-ws--ghost:hover { color: var(--accent-primary); border-color: var(--border-hover); text-decoration: none; }

/* ---------- 表单 ---------- */
.ws-field { display: flex; flex-direction: column; gap: 6px; }
.ws-field__label { font-size: .78rem; font-weight: 600; color: var(--text-secondary); }
.ws-control {
    width: 100%; padding: 9px 12px;
    background: var(--bg-card); color: var(--text-primary);
    border: 1px solid var(--border-color); border-radius: var(--radius-sm);
    font-size: .9rem; line-height: 1.3; appearance: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.ws-control:focus { outline: none; border-color: var(--accent-primary); box-shadow: 0 0 0 2px rgba(255, 123, 0, .16); }
.ws-control:disabled { background: var(--bg-base); color: var(--text-muted); cursor: not-allowed; }
select.ws-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%239a9aa6' d='M6 8 0 2l1.4-1.4L6 5.2 10.6.6 12 2z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center; padding-right: 30px;
}
.ws-filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; align-items: end; }

/* ---------- 统计卡 ---------- */
.ws-metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.ws-metric {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: var(--radius); padding: 16px 18px;
    box-shadow: var(--shadow-sm);
    transition: border-color .18s ease, box-shadow .18s ease;
}
.ws-metric:hover { border-color: var(--border-hover); box-shadow: var(--shadow-md); }
.ws-metric__v { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; color: var(--text-primary); line-height: 1.15; font-variant-numeric: tabular-nums; }
.ws-metric__k { font-size: .8rem; color: var(--text-muted); margin-top: 4px; }
.ws-metric--accent { background: var(--bg-soft); border-color: var(--border-hover); }
.ws-metric--accent .ws-metric__v { color: var(--accent-secondary); }

/* ---------- Tabs（文字标签 + 短橙色下划线） ---------- */
.ds-tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--border-color); margin-bottom: 20px; flex-wrap: wrap; }
.ds-tab {
    position: relative; padding: 12px 2px; margin-bottom: -1px;
    color: var(--text-secondary); font-weight: 600; font-size: .92rem;
    text-decoration: none; background: none; border: 0; cursor: pointer;
    transition: color .15s ease;
}
.ds-tab:hover { color: var(--accent-primary); text-decoration: none; }
.ds-tab.is-active { color: var(--accent-primary); }
.ds-tab.is-active::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: 0;
    height: 3px; border-radius: var(--radius-pill);
    background: var(--accent-gradient); box-shadow: var(--shadow-glow-sm);
}

/* ---------- 徽章 ---------- */
.ws-badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 11px; border-radius: var(--radius-pill);
    font-size: .74rem; font-weight: 600; line-height: 1.6;
    background: var(--accent-light); color: var(--accent-dark);
}
.ws-badge--gold { background: var(--gold-gradient); color: #fff; }

/* ==========================================================================
   动效
   ========================================================================== */
@keyframes ws-fade-up { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .app-main > * { animation: none; } }

/* ==========================================================================
   响应式：窄屏抽屉
   ========================================================================== */
@media (max-width: 1024px) {
    .app-main { padding: 20px 16px; }
}
@media (max-width: 860px) {
    /* 窄屏抽屉：除 transform 外再叠加 visibility/pointer-events 兜底，
       防止 Edge 等浏览器在 transform 未生效时固定侧栏仍覆盖正文。 */
    .app-sidebar {
        transform: translateX(-100%); transition: transform .25s ease, visibility .25s ease;
        visibility: hidden; pointer-events: none; box-shadow: var(--shadow-lg);
    }
    .app-shell.is-drawer-open .app-sidebar { transform: translateX(0); visibility: visible; pointer-events: auto; }
    .app-shell.is-drawer-open .app-backdrop { display: block; }
    .app-content { margin-left: 0; }
    .app-topbar__toggler { display: inline-flex; }
    .page-header__title { font-size: 1.28rem; }
}

/* ==========================================================================
   兼容：旧版 city-data 子页（hero / content-wrap / data-card 等）
   保持原 orange hero（子页白字依赖），仅在工作台内做轻量收敛，避免回归。
   ========================================================================== */
.app-main .hero {
    background: var(--accent-gradient); color: #fff;
    padding: 40px 32px 56px; border-radius: var(--radius-lg);
    margin: 0 0 0; box-shadow: var(--shadow-glow-sm);
}
.app-main .hero--plain {
    background: #fff; color: var(--text-primary);
    padding: 28px 32px 24px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}
.app-main .hero h1 { font-weight: 850; letter-spacing: -.02em; }
.app-main .hero--plain h1 { color: var(--text-primary); font-weight: 800; font-size: 1.65rem; }
.app-main .hero p { color: rgba(255, 255, 255, .92); line-height: 1.8; }
.app-main .hero--plain p { color: var(--text-secondary); font-size: .95rem; }
.app-main .hero .container { max-width: none; padding: 0; }
.app-main .hero--plain .doc-hero__tag {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: .74rem; font-weight: 700; color: var(--accent-primary);
    background: var(--accent-light); border: 1px solid var(--border-hover);
    border-radius: 999px; padding: 4px 12px; margin-bottom: 12px;
}
.app-main .hero--plain .doc-hero__tag i { font-size: .72rem; opacity: .9; }
.app-main .hero--plain + .content-wrap { margin-top: 20px; }
.content-wrap { margin-top: -34px; position: relative; z-index: 2; }
.content-wrap .container { max-width: none; padding: 0; }

.data-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.metric-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius); padding: 18px; height: 100%; box-shadow: var(--shadow-sm); transition: border-color .18s ease, box-shadow .18s ease; }
.metric-card:hover { border-color: var(--border-hover); box-shadow: var(--shadow-md); }
.metric-card strong { display: block; font-size: 1.5rem; line-height: 1.1; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.metric-card span { color: var(--text-muted); font-size: .84rem; }
.badge-soft { background: var(--accent-light); color: var(--accent-dark); border: 1px solid var(--border-hover); }
.btn-brand { background: var(--accent-gradient); color: #fff; border: 0; box-shadow: var(--shadow-glow-sm); }
.btn-brand:hover { color: #fff; transform: translateY(-2px); box-shadow: var(--shadow-glow); }
.product-card { border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 20px; height: 100%; background: var(--bg-card); box-shadow: var(--shadow-sm); transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.product-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-hover); }
.section-title h2 { font-weight: 800; font-size: 1.2rem; margin: 0; color: var(--text-primary); }
.section-title p { color: var(--text-secondary); margin: 6px 0 0; }
.map-panel { height: 420px; border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--border-color); background: #eef2f7; }

/* Leaflet 区县常驻标签（沿用） */
.leaflet-tooltip.district-label {
    background: transparent !important; border: none !important; box-shadow: none !important;
    padding: 0 2px; color: #1f2937; font-weight: 700; font-size: 11px; line-height: 1.25;
    text-align: center; text-shadow: 0 0 3px #fff, 0 0 5px #fff, 0 0 8px #fff;
    pointer-events: none; white-space: nowrap;
}
.leaflet-tooltip.district-label::before { display: none; }
.leaflet-tooltip.district-label .value { display: block; font-weight: 600; font-size: 10px; color: #475569; margin-top: 1px; }

/* ==========================================================================
   工作台紧凑字号统一（数据中心 / 地址解析 / 路线规划 / 开发者 API）
   目标：正文/列表项/控件 ≤ 导航(.92rem)，整体更紧凑统一。导航参照 .92rem。
   ========================================================================== */
.page-header__title { font-size: 1.1rem; }
.page-header__desc { font-size: .8rem; }
.surface__title { font-size: .92rem; }
.surface__desc { font-size: .78rem; }
.ws-toolbar__hint { font-size: .78rem; }
.btn-ws { font-size: .82rem; }
.btn-ws--sm { font-size: .76rem; }
.ws-field__label { font-size: .74rem; }
.ws-control { font-size: .82rem; }
.ws-metric__v { font-size: 1.1rem; }
.ws-metric__k { font-size: .74rem; }
.ds-tab { font-size: .84rem; }
.ws-badge { font-size: .72rem; }
/* 数据中心 App Shell */
.app-sidebar__brand-text strong { font-size: .9rem; }
.app-sidebar__brand-text span { font-size: .68rem; }
.app-nav-group__label { font-size: .66rem; }
.app-nav-item { font-size: .82rem; }
.app-sidebar__account-meta strong { font-size: .82rem; }
.app-topbar__title strong { font-size: .9rem; }
.app-topbar__title span { font-size: .72rem; }
.app-topbar__chip { font-size: .78rem; }
/* 旧 city-data 子页（hero / 卡片 / 区块标题） */
.section-title h2 { font-size: .98rem; }
.section-title p { font-size: .82rem; }
.metric-card strong { font-size: 1.1rem; }
.metric-card span { font-size: .76rem; }
