* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #0a1120;
  color: #e6eeff;
}
.main section,
.main article.card { min-width: 0; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 240px 1fr; }
.app-shell.light {
  background: #eef3fb;
  color: #0f172a;
}
.app-shell.presentation .sidebar,
.app-shell.presentation .notice-panel,
.app-shell.presentation .drawer,
.app-shell.presentation .modal-mask,
.app-shell.presentation .detail-page-mask,
.app-shell.presentation .img-preview-mask,
.app-shell.presentation .error-toast,
.app-shell.presentation .loading-mask {
  display: none !important;
}
.app-shell.presentation .topbar .actions .btn:nth-child(n+4) {
  display: none;
}
.app-shell.presentation .main {
  padding: 8px;
}
.app-shell.light .card,
.app-shell.light .sidebar { background: #ffffff; color: #10213d; border-color: #d6e0f0; }
.app-shell.light input,
.app-shell.light select { background: #f7faff; color: #0f172a; border-color: #cddaf0; }
.login-wrap {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 20% 0, #1a2a4c 0, #0a1120 45%, #070c17 100%);
  z-index: 50;
}
.login-card { width: 420px; max-width: 92vw; display: grid; gap: 10px; }
.login-card h2 { margin: 0; }
.login-card p { margin: 0 0 8px; color: #9eb0d4; }
.small-info { color: #9eb0d4; font-size: 12px; }
.sidebar { border-right: 1px solid #283756; background: #101a2f; padding: 16px 12px; }
.sidebar.collapsed { width: 78px; padding: 12px 8px; }
.sidebar.collapsed .brand p,
.sidebar.collapsed .menu-item small,
.sidebar.collapsed .side-bottom { display: none; }
.sidebar.collapsed .menu-item { padding: 12px 8px; text-align: center; }
.brand h1 { margin: 0; font-size: 20px; }
.brand p { margin: 6px 0 18px; color: #9eb0d4; font-size: 12px; }
.menu { display: grid; gap: 8px; }
.side-bottom { margin-top: 12px; }
.side-bottom small { color: #8ea2ce; }
.menu-item {
  border: 1px solid #2b3c5f; background: #121f39; color: #a9badf; text-align: left; border-radius: 10px;
  padding: 10px; cursor: pointer; display: flex; flex-direction: column; gap: 3px;
}
.menu-item small { font-size: 11px; color: #7f93bf; }
.menu-item.active { background: #243f74; border-color: #5077cc; color: #fff; }
.main { padding: 16px; display: grid; gap: 14px; }
.card { border: 1px solid #2a3a57; border-radius: 12px; background: #111b31; padding: 12px; }
.topbar { display: flex; justify-content: space-between; align-items: center; }
.topbar h2 { margin: 0; }
.topbar p { margin: 4px 0 0; color: #95a8d1; font-size: 13px; }
.actions { display: flex; gap: 8px; }
.btn {
  border: 1px solid #3a4d76; background: #1a2a49; color: #e6eeff; border-radius: 9px; padding: 8px 12px; cursor: pointer;
}
.btn.primary { background: #2d58b6; border-color: #5d83d8; }
.btn.ghost { background: transparent; }
.btn.mini { padding: 4px 8px; font-size: 12px; }
.btn.wide { width: 100%; margin-top: 8px; }
.content-grid { display: grid; gap: 12px; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi h3 { margin: 8px 0 4px; font-size: 28px; }
.kpi p, .kpi small { color: #97aad3; margin: 0; }
.card-title { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.filters { display: flex; gap: 8px; }
.bulk-row { display: flex; justify-content: space-between; align-items: center; margin: 8px 0; font-size: 13px; color: #9ab0dc; }
.notice-panel { display: grid; gap: 8px; }
.notice-item {
  border: 1px solid #293a5a; background: #0f192f; border-radius: 10px; padding: 8px; color: #c6d4f7;
}
.notice-item small { color: #88a1d3; }
input, select {
  width: 100%; padding: 8px; border-radius: 8px; border: 1px solid #2d3f61; background: #0d1528; color: #e6eeff;
}
textarea {
  width: 100%;
  min-height: 90px;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid #2d3f61;
  background: #0d1528;
  color: #e6eeff;
  resize: vertical;
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 6px; border-bottom: 1px solid #24314a; text-align: left; }
th { color: #94a8d1; font-weight: 500; }
.badge { padding: 2px 8px; border-radius: 999px; font-size: 12px; border: 1px solid transparent; }
.pending { background: #3d2f0f; border-color: #6e5516; color: #ffd789; }
.delivering { background: #153646; border-color: #2f718e; color: #8edfff; }
.done { background: #143428; border-color: #2a7052; color: #96e9c5; }
.kanban { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.column { min-height: 320px; }
.task-card {
  border: 1px solid #32496f; background: #172744; border-radius: 10px; padding: 8px; margin-bottom: 8px; cursor: grab;
}
.task-card p { margin: 4px 0; }
.task-card small { color: #9cb1de; }
.task-card.risk { border-color: #7e5d29; background: #332710; }
.tracking-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; }
.chart {
  height: 180px; display: flex; align-items: flex-end; gap: 8px; border-top: 1px solid #2a3a56; padding-top: 14px;
}
.heatmap {
  height: 220px; border-radius: 12px; border: 1px solid #38558c; position: relative;
  background: linear-gradient(180deg, #12213d, #0e1830);
  overflow: hidden;
}
.hot {
  position: absolute; border-radius: 50%; filter: blur(1px);
  background: radial-gradient(circle, rgba(73,132,255,.7) 0, rgba(73,132,255,.05) 70%, transparent 100%);
}
.hot.h1 { width: 180px; height: 180px; left: 8%; top: 24%; }
.hot.h2 { width: 210px; height: 210px; left: 52%; top: 8%; }
.hot.h3 { width: 140px; height: 140px; left: 30%; top: 62%; }
.hot.h4 { width: 160px; height: 160px; left: 72%; top: 50%; }
.chart-col { flex: 1; text-align: center; color: #90a6d2; font-size: 12px; }
.bar {
  margin: 0 auto 7px; width: 20px;
  background: linear-gradient(180deg, #69a0ff, #2f5fcb);
  border-radius: 8px 8px 4px 4px;
}
.map {
  height: 240px; border-radius: 10px; border: 1px dashed #46649e;
  background: repeating-linear-gradient(45deg, #13213d, #13213d 12px, #10203a 12px, #10203a 24px);
  position: relative;
}
.dot { position: absolute; width: 12px; height: 12px; border-radius: 50%; }
.dot.rider { background: #2fe28f; box-shadow: 0 0 0 5px rgba(47,226,143,.2); }
.dot.store { background: #f36; left: 8%; top: 70%; }
.hint { color: #9ab0dd; font-size: 13px; }
.timeline { margin: 0; padding-left: 16px; color: #c3d1f3; }
.timeline li { margin-bottom: 8px; }
.form-card { max-width: 520px; display: grid; gap: 10px; }
.drawer-mask, .modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); }
.drawer {
  position: fixed; top: 0; right: 0; width: 360px; max-width: 95vw; height: 100vh; background: #0f172a;
  border-left: 1px solid #2c3f61; transform: translateX(100%); transition: .2s; z-index: 9; padding: 12px;
}
.drawer.open { transform: translateX(0); }
.drawer header { display: flex; justify-content: space-between; align-items: center; }
.drawer-content p { margin: 10px 0; color: #d8e4ff; }
.tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.tab {
  border: 1px solid #37507f; background: #14223f; color: #9fb3de; border-radius: 999px;
  padding: 4px 9px; cursor: pointer; font-size: 12px;
}
.tab.active { background: #3159b8; color: #fff; border-color: #5780db; }
.modal {
  position: fixed; z-index: 10; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 520px; max-width: 95vw; display: grid; gap: 10px;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.compliance-card {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.compliance-card h3 { margin: 0 0 8px; }
.compliance-card p { margin: 0 0 6px; color: #b9c8ea; font-size: 13px; }
.quick-links { display: flex; gap: 8px; flex-wrap: wrap; }
.site-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.site-footer div { color: #9db1dc; font-size: 12px; }
.footer-links { display: flex; gap: 8px; }
.doc-modal { z-index: 85; }
.doc-body { color: #c5d4f4; line-height: 1.6; font-size: 13px; }
.pager { margin-top: 10px; display: flex; align-items: center; justify-content: flex-end; gap: 8px; color: #9ab0dd; }
.proof-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.proof-img {
  border: 1px dashed #5576b7; border-radius: 8px; background: #172948;
  height: 88px; display: flex; align-items: center; justify-content: center; color: #c9d7f7; font-size: 12px; cursor: zoom-in;
}
.loading-mask {
  position: fixed; inset: 0; background: rgba(5,9,16,.52); display: flex; align-items: center; justify-content: center; z-index: 60;
}
.skeleton { width: 420px; max-width: 92vw; }
.sk {
  height: 14px; border-radius: 8px;
  background: linear-gradient(90deg, #1c2b49 0, #2f4778 45%, #1c2b49 100%);
  background-size: 200% 100%; animation: shimmer 1.2s infinite linear;
}
.sk1 { width: 68%; margin-bottom: 10px; }
.sk2 { width: 92%; margin-bottom: 10px; }
.sk3 { width: 80%; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.error-toast {
  position: fixed; right: 16px; bottom: 16px; z-index: 80;
  border: 1px solid #9b3e4b; background: #4a1f28; color: #ffd2d9;
  padding: 8px 12px; border-radius: 10px; font-size: 13px;
}
.detail-page-mask, .img-preview-mask {
  position: fixed; inset: 0; background: rgba(2,7,16,.6); z-index: 70;
  display: flex; align-items: center; justify-content: center;
}
.detail-page { width: min(1100px, 95vw); max-height: 90vh; overflow: auto; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.img-preview { width: 420px; max-width: 90vw; text-align: center; }
.mobile-tabbar { display: none; }

@media (max-width: 860px) {
  .app-shell {
    display: block;
    min-height: 100dvh;
    padding-bottom: calc(66px + env(safe-area-inset-bottom));
  }
  .sidebar {
    display: none;
  }
  .main {
    padding: 10px;
    gap: 10px;
  }
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    gap: 6px;
  }
  .actions .btn {
    padding: 10px 8px;
    font-size: 12px;
  }
  .kpi-grid,
  .kanban,
  .content-grid,
  .tracking-grid {
    grid-template-columns: 1fr !important;
  }
  .filters {
    display: grid;
    grid-template-columns: 1fr;
  }
  .compliance-card,
  .site-footer {
    flex-direction: column;
    align-items: flex-start;
  }
  .bulk-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
  .drawer {
    width: 100vw;
    max-width: 100vw;
  }
  .modal {
    width: calc(100vw - 18px);
  }
  .mobile-tabbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    background: rgba(12, 19, 36, 0.95);
    border-top: 1px solid #2a3a57;
    backdrop-filter: blur(8px);
    z-index: 40;
  }
  .mobile-tab {
    border: 1px solid #2f446c;
    border-radius: 9px;
    background: #142543;
    color: #a9bee8;
    padding: 8px 4px;
    font-size: 12px;
  }
  .mobile-tab.active {
    background: #3159b8;
    color: #fff;
    border-color: #5e85dc;
  }
}
@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 190px 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tracking-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .app-shell {
    display: block;
    min-height: 100dvh;
  }
}
