/* ===== Base Styles - 全站通用样式 ===== */

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s ease;
}

a,
a:visited {
    color: #93c5fd;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ===== 顶部导航条 ===== */
.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    padding: 10px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-pill {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    overflow: hidden;
    box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.9), 0 10px 25px rgba(15, 23, 42, 0.9);
}

.logo-pill img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.topbar-title-main {
    font-size: 17px;
    font-weight: 650;
    letter-spacing: 0.04em;
}

.topbar-title-sub {
    font-size: 12px;
    color: var(--text-muted);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 18px;
}

.topbar-tag {
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.55);
    font-size: 11px;
    color: var(--text-muted);
}

.topbar-date-form {
    display: inline-flex;
    align-items: center;
    height: 32px;
    margin: 0;
    vertical-align: middle;
}

.topbar-date-form input[type="date"] {
    background: rgba(15, 23, 42, 0.9);
    color: var(--text-main);
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.6);
    padding: 0 10px;
    font-size: 13px;
    min-width: 150px;
    height: 32px;
    line-height: 32px;
    box-sizing: border-box;
}

/* ===== 布局 ===== */
.layout-root {
    display: grid;
    grid-template-columns: 68px minmax(0, 1fr);
    column-gap: 0;

    /* 关键：不要写死 100vh，交给 body 的 flex 来分配剩余高度 */
    flex: 1;
    min-height: 0;
    height: auto;
}

@media (max-width: 960px) {
    .layout-root {
        grid-template-columns: minmax(0, 1fr);
        height: auto;
        min-height: 0;
    }
}

/* ===== 侧边栏 ===== */
.sidebar {
    border-right: 1px solid rgba(30, 64, 175, 0.6);
    background: linear-gradient(to bottom, rgba(15, 23, 42, 0.96), rgba(15, 23, 42, 0.98));
    padding-top: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.sidebar-group-title {
    margin-top: 10px;
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(148, 163, 184, 0.8);
}

.nav-pill {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 1px solid transparent;
    font-size: 18px;
    position: relative;
}

.nav-badge-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: rgba(239, 68, 68, 0.98);
    box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.95), 0 0 10px rgba(239, 68, 68, 0.35);
    display: none;
}

.nav-pill.has-badge .nav-badge-dot {
    display: block;
}

.nav-pill.active {
    background: radial-gradient(circle at 30% 20%, rgba(96, 165, 250, 0.32), rgba(37, 99, 235, 0.16));
    border-color: rgba(59, 130, 246, 0.8);
}

.nav-pill.inactive {
    background: rgba(15, 23, 42, 0.85);
    border-color: rgba(31, 41, 55, 0.9);
    color: var(--text-muted);
}

.sidebar-footer {
    margin-top: auto;
    margin-bottom: 10px;
}

.main {
    padding: 18px 26px 24px 22px;
    overflow: auto;
    min-height: 0;
    height: 100%;
}

.main-inner {
    max-width: none;
    width: 100%;
    margin: 0;
}

/* ===== 按钮 ===== */
button {
    margin-top: 10px;
    padding: 8px 15px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
}

.btn-primary {
    background: linear-gradient(135deg, #2563eb, #38bdf8);
    color: #f9fafb;
}

.btn-secondary {
    background: #020617;
    color: var(--text-main);
    border: 1px solid rgba(148, 163, 184, 0.7);
}

/* ===== 输入框 ===== */
label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

input[type="month"],
input[type="date"],
input[type="text"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 7px 10px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.5);
    background: #020617;
    color: var(--text-main);
    font-size: 13px;
}

/* ===== 表格通用 ===== */
.table-shell {
    margin-top: 4px;
    border-radius: 14px;
    background: radial-gradient(circle at top left, rgba(37, 99, 235, 0.18), transparent 56%), #020617;
    border: 1px solid rgba(31, 41, 55, 0.96);
    padding: 4px;

    /* 关键：不要用 100vh 计算高度 */
    max-height: none;

    /* 关键：作为滚动区，吃满父级剩余高度 */
    flex: 1 1 auto;
    min-height: 0;

    overflow: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

th,
td {
    padding: 8px 6px;
    text-align: left;
    border-bottom: 1px solid rgba(31, 41, 55, 0.9);
    vertical-align: top;
}

th {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(156, 163, 175, 0.95);
    position: sticky;
    top: 0;
    z-index: 2;
    background: linear-gradient(to right, rgba(15, 23, 42, 1), rgba(15, 23, 42, 0.92));
}

tbody tr:hover {
    background: rgba(15, 23, 42, 0.88);
}

.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* ===== 滚动条（纵横同一厚度，避免横向过细） ===== */
:root {
    /* 运营/调度表：纵向与横向（含自定义底栏）统一用此厚度 */
    --dx-scrollbar-thickness: 12px;
}

::-webkit-scrollbar {
    width: var(--dx-scrollbar-thickness);
    height: var(--dx-scrollbar-thickness);
}

::-webkit-scrollbar:vertical {
    width: var(--dx-scrollbar-thickness);
}

::-webkit-scrollbar:horizontal {
    height: var(--dx-scrollbar-thickness);
}

::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.5);
}

::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.4);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.6);
}

/* ===== Modal 通用 ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-elevated);
    border-radius: 12px;
    padding: 24px;
    max-width: 90vw;
    max-height: 90vh;
    overflow: auto;
    border: 1px solid var(--bg-card-border);
}

/* ===== 主题切换按钮 ===== */
.theme-toggle-btn {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    background: rgba(15, 23, 42, 0.5);
    color: var(--text-main);
    cursor: pointer;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    box-sizing: border-box;
    vertical-align: middle;
}

.theme-toggle-btn:hover {
    background: rgba(37, 99, 235, 0.2);
    border-color: rgba(59, 130, 246, 0.5);
}

/* ===== 统一右上角元素高度 ===== */
.topbar-right .theme-toggle-btn {
    height: 32px !important;
    padding: 0 12px !important;
    margin: 0 !important;
    line-height: 32px !important;
    display: inline-flex !important;
    align-items: center !important;
    box-sizing: border-box !important;
    vertical-align: middle !important;
}

.topbar-right .topbar-tag {
    height: 32px !important;
    padding: 0 10px !important;
    margin: 0 !important;
    line-height: 32px !important;
    display: inline-flex !important;
    align-items: center !important;
    box-sizing: border-box !important;
    vertical-align: middle !important;
}

.topbar-right .topbar-date-form {
    display: inline-flex !important;
    align-items: center !important;
    height: 32px !important;
    margin: 0 !important;
    vertical-align: middle !important;
}

.topbar-right .topbar-date-form input[type="date"] {
    height: 32px !important;
    padding: 0 10px !important;
    margin: 0 !important;
    line-height: 32px !important;
    display: inline-flex !important;
    align-items: center !important;
    box-sizing: border-box !important;
    vertical-align: middle !important;
}

/* =====================================================
   Laptop / Screen Responsive Readability Patch
   作用：
   - 修复笔记本上字体变小、界面拥挤
   - 让 1366 / 1440 屏幕接近台式机视觉密度
   ===================================================== */

/* 1. 防止浏览器/DPI 擅自缩放字体 - 使用固定字体大小保证笔记本和台式机显示一致 */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;

    /* 固定字体大小，不再根据屏幕宽度自适应 */
    font-size: 16px;
}

body {
    font-size: 16px;
    line-height: 1.35;
}

/* 2. 表格整体可读性 - 使用固定像素值 */
table {
    font-size: 13px;
}

th {
    font-size: 11px;
    letter-spacing: 0.02em;
}

/* 3. 常见笔记本分辨率（<= 1440px）优化 */
@media (max-width: 1440px) {

    .card,
    .panel,
    .content-card {
        padding: 14px 14px 16px;
    }

    th,
    td {
        padding: 8px 8px;
    }
}

/* 4. 更小的笔记本（1366 / 1280）进一步优化 */
@media (max-width: 1280px) {

    /* 次要信息隐藏，优先保证主信息清晰 */
    .topbar-subtitle,
    .topbar-title-sub {
        display: none;
    }

    /* 表格字体保持固定，不再随屏幕变化 */
    table {
        font-size: 13px;
    }
}

/* ===== 表格通用语义样式（全站统一） ===== */

/* 表头 */
.orders-table th {
    font-weight: 650;
    letter-spacing: 0.02em;
}

/* 关键字段（客户 / 地址 / 金额 / 里程） */
.orders-table td.col-customer,
.orders-table td.col-pickup,
.orders-table td.col-delivery,
.orders-table td.col-price,
.orders-table td.col-miles {
    font-weight: 600;
}

/* 普通信息 */
.orders-table td {
    font-weight: 500;
}

/* 次要备注 */
.orders-table td.col-note,
.orders-table td.col-remark {
    font-weight: 450;
    opacity: 0.9;
}

/* =====================================================
   Mobile Responsive Patch（手机端适配，<=768px）
   作用：
   - 顶栏 .topbar 元素过多时换行、收缩、隐藏次要信息
   - 侧栏 .sidebar 由竖向图标列改为顶部横向可滚动图标条
   - 主区 .main 收缩内边距，避免横向溢出
   说明：运营页的内联 <style> 会在 base.css 之后重新声明 .topbar /
   .layout-root / .sidebar 等，因此这里统一加 body 前缀提升特异性，
   确保移动端规则在窄屏断点内稳定生效；桌面端样式保持不变。
   ===================================================== */
@media (max-width: 768px) {

    /* 顶栏：允许换行，收缩内边距，隐藏次要信息 */
    body .topbar {
        padding: 8px 12px !important;
        flex-wrap: wrap;
        gap: 8px 10px;
        row-gap: 8px;
    }

    body .topbar-left {
        gap: 8px;
        min-width: 0;
    }

    body .topbar-title-main {
        font-size: 15px;
    }

    /* 副标题、BETA 标签等次要信息在手机上隐藏，给主信息让位 */
    body .topbar-title-sub,
    body .topbar-right .topbar-tag {
        display: none !important;
    }

    body .topbar-right {
        gap: 10px;
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    /* 布局：单列；侧栏从行高变成自动高度的横条
       说明：沿用已验证的 960px 折叠行为（height:auto + min-height:0，
       由 body 的 flex 分配剩余高度），避免与吸顶 topbar 叠加导致底部被裁切 */
    body .layout-root {
        grid-template-columns: minmax(0, 1fr) !important;
        grid-template-rows: auto minmax(0, 1fr);
        height: auto !important;
        min-height: 0;
    }

    /* 侧栏：横向可滚动图标条，吸顶，避免一长列图标把内容顶到屏幕下方 */
    body .sidebar {
        flex-direction: row !important;
        align-items: center;
        flex-wrap: nowrap;
        gap: 8px;
        padding: 8px 10px;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        border-right: none;
        border-bottom: 1px solid rgba(30, 64, 175, 0.6);
        position: sticky;
        top: 0;
        z-index: 30;
    }

    /* 分组标题在横条里太占位，隐藏 */
    body .sidebar .sidebar-group-title {
        display: none;
    }

    /* 横条内每个直接子项（含 a 包裹的图标）不被压缩 */
    body .sidebar > *,
    body .sidebar > a {
        flex: 0 0 auto;
    }

    body .sidebar .nav-pill {
        flex: 0 0 auto;
    }

    /* 底部项（如设置/登出）在横条里跟随排列，不再贴底 */
    body .sidebar .sidebar-footer {
        margin-top: 0;
        margin-bottom: 0;
        margin-left: auto;
    }

    /* 主区：收缩内边距 */
    body .main {
        padding: 12px 10px 16px 10px;
    }

    /* 表格触摸滑动更顺滑 */
    body .table-shell {
        -webkit-overflow-scrolling: touch;
    }

    /* 弹窗在手机上更贴边、可滚动 */
    body .modal-content {
        max-width: 94vw;
        max-height: 88vh;
        padding: 16px;
    }
}

/* 超小屏手机进一步压缩 */
@media (max-width: 480px) {
    body .topbar {
        padding: 6px 10px !important;
    }

    body .main {
        padding: 10px 8px 14px 8px;
    }

    body .topbar-date-form input[type="date"] {
        min-width: 120px;
    }
}

/* ===== Topbar 订单数量强化（可选） ===== */
.topbar-tag.orders-count {
    font-weight: 700;
}