:root {
    --color-primary: #007aff;
    --color-primary-hover: #0066d6;
    --color-primary-active: #0055b3;
    
    --color-success: #34c759;
    --color-success-hover: #2db84d;
    
    --color-warning: #ff9500;
    --color-warning-hover: #e08600;
    
    --color-error: #ff3b30;
    --color-error-hover: #d63028;
    
    --color-info: #5ac8fa;
    --color-info-hover: #4ab4e0;
    
    --color-secondary: #8e8e93;
    --color-secondary-hover: #636366;
    
    --color-text-primary: #1d1d1f;
    --color-text-secondary: #666666;
    --color-text-tertiary: #8e8e93;
    --color-text-disabled: #c7c7cc;
    
    --color-bg-primary: #ffffff;
    --color-bg-secondary: #f5f5f7;
    --color-bg-tertiary: #f2f2f7;
    --color-bg-card: #ffffff;
    
    --color-border: #e5e5ea;
    --color-border-light: #f0f0f0;
    --color-border-focus: rgba(0, 122, 255, 0.3);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;
    
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-xl: 0 8px 32px rgba(0, 0, 0, 0.12);
    
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s ease;
    
    --font-size-xs: 12px;
    --font-size-sm: 13px;
    --font-size-md: 14px;
    --font-size-lg: 16px;
    --font-size-xl: 20px;
    --font-size-xxl: 28px;
    
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;

    --color-bg-dark-primary: #000000;
    --color-bg-dark-secondary: #1c1c1e;
    --color-bg-dark-tertiary: #2c2c2e;
    --color-text-dark-primary: #ffffff;
    --color-text-dark-secondary: #8e8e93;
    --color-text-dark-tertiary: #636366;
    --color-border-dark: #3a3a3c;
    --color-border-dark-light: #2c2c2e;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background: var(--color-bg-secondary);
    min-height: 100vh;
    padding: 44px var(--spacing-md) var(--spacing-xl);
    color: var(--color-text-primary);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* ===== Top Navigation Bar (Apple style) ===== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 200;
    height: 44px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
}

.header-inner {
    max-width: 1024px;
    margin: 0 auto;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 22px;
    position: relative;
}

/* Brand (left) */
.nb-brand {
    font-size: 17px;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: -0.01em;
    flex-shrink: 0;
    text-decoration: none;
    opacity: 0;
    animation: navFadeIn 0.6s ease forwards 0.05s;
}

/* Center nav items */
.nb-nav-center {
    display: flex;
    align-items: center;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.nb-nav-item {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    padding: 12px 16px;
    white-space: nowrap;
    cursor: pointer;
    text-decoration: none;
    user-select: none;
    opacity: 0;
    transform: translateY(-6px);
    transition: color 0.3s ease;
    position: relative;
    display: inline-block;
    animation: navItemAppear 0.5s ease forwards;
}

.nb-nav-item:hover {
    color: #ffffff;
}

.nb-nav-item.active {
    color: #ffffff;
}

.nb-nav-item.active::after {
    content: '';
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #ffffff;
}

.nb-nav-sep {
    width: 1px;
    height: 12px;
    background: rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

/* Right section */
.nb-nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    opacity: 0;
    animation: navFadeIn 0.6s ease forwards 0.4s;
}

.nb-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
}

.nb-username {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.55);
    white-space: nowrap;
}

.nb-logout {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.55);
    text-decoration: none;
    cursor: pointer;
    user-select: none;
    transition: color 0.3s ease;
    white-space: nowrap;
}

.nb-logout:hover {
    color: rgba(255, 255, 255, 0.9);
}

@keyframes navFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes navItemAppear {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
    .header-inner { padding: 0 16px; }
    .nb-username { display: none; }
    .nb-nav-item { padding: 12px 10px; font-size: 11px; }
}

@media (max-width: 560px) {
    .nb-nav-center { display: none; }
    .nb-brand { margin-right: auto; }
}

/* ===== Page Header (below navbar) ===== */
.page-header {
    padding: 40px 0 32px;
    opacity: 0;
    animation: contentFadeUp 0.6s ease forwards 0.3s;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.page-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-text-primary);
    letter-spacing: -0.02em;
    margin-bottom: 8px;
    line-height: 1.2;
}

.page-subtitle {
    font-size: 15px;
    color: var(--color-text-secondary);
    margin-bottom: 0;
}

@keyframes contentFadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.card {
    background: var(--color-bg-primary);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--spacing-lg);
}

.card-title {
    font-size: var(--font-size-xl);
    color: var(--color-text-primary);
    margin-bottom: var(--spacing-xl);
    font-weight: var(--font-weight-semibold);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--color-border);
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--spacing-md);
    margin-top: var(--spacing-lg);
    padding: var(--spacing-md);
    background: var(--color-bg-secondary);
    border-radius: var(--radius-lg);
    width: 100%;
}

.page-btn {
    padding: var(--spacing-sm) var(--spacing-lg);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    border: 1px solid var(--color-primary);
    border-radius: var(--radius-md);
    background: var(--color-bg-primary) !important;
    color: var(--color-primary) !important;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.page-btn:hover:not(:disabled) {
    background: var(--color-primary) !important;
    color: white !important;
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: var(--color-border);
    color: var(--color-text-tertiary) !important;
    background: var(--color-bg-tertiary) !important;
}

.page-info {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    font-weight: var(--font-weight-medium);
    min-width: 120px;
    text-align: center;
}

.btn {
    padding: var(--spacing-sm) var(--spacing-xl);
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--color-primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary:active {
    background: var(--color-primary-active);
    transform: translateY(0);
}

.btn-success {
    background: var(--color-success);
    color: white;
}

.btn-success:hover {
    background: var(--color-success-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-warning {
    background: var(--color-warning);
    color: white;
}

.btn-warning:hover {
    background: var(--color-warning-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-info {
    background: var(--color-info);
    color: white;
}

.btn-info:hover {
    background: var(--color-info-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-danger {
    background: var(--color-error);
    color: white;
}

.btn-danger:hover {
    background: var(--color-error-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--color-secondary);
    color: white;
}

.btn-secondary:hover {
    background: var(--color-secondary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-md);
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-bg-primary);
}

th {
    background: var(--color-bg-secondary);
    padding: var(--spacing-md) var(--spacing-lg);
    text-align: left;
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-secondary);
    font-size: var(--font-size-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--color-border);
}

td {
    padding: var(--spacing-md) var(--spacing-lg);
    color: var(--color-text-primary);
    font-size: var(--font-size-sm);
    border-bottom: 1px solid var(--color-border-light);
    transition: background var(--transition-fast);
}

tr:hover td {
    background: var(--color-bg-secondary);
}

.action-links {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

.action-links a {
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    text-decoration: none;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.action-links a:hover {
    transform: translateY(-1px);
}

.empty-state {
    text-align: center;
    padding: calc(var(--spacing-xl) * 2) var(--spacing-md);
    color: var(--color-text-tertiary);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: var(--spacing-md);
    opacity: 0.5;
}

.toast-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: toastFadeIn 0.3s ease;
}

.toast-container {
    width: 320px;
    max-width: 90%;
    background: var(--color-bg-primary);
    border-radius: 20px;
    box-shadow: 0 24px 64px -12px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    text-align: center;
    animation: faceidModalAppear 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast-icon-wrapper {
    width: 80px;
    height: 80px;
    margin: 56px auto 28px;
    border: 3px solid #34c759;
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: transparent;
    animation: faceidFrameAppear 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both,
               faceidSuccessGlow 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.3s both;
}

.toast-icon-wrapper.error {
    border-color: #ff3b30;
    background: transparent;
    animation: faceidFrameAppear 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both,
               faceidErrorGlow 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.3s both,
               faceidErrorShake 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.3s both;
}

.toast-icon-wrapper svg {
    width: 32px;
    height: 32px;
    display: block;
}

.toast-icon-wrapper .checkmark-path {
    stroke: #34c759;
    fill: none;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 24;
    stroke-dashoffset: 24;
    animation: checkmarkDraw 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.5s forwards;
}

.toast-icon-wrapper.error .x-path {
    stroke: #ff3b30;
    fill: none;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 20;
    stroke-dashoffset: 20;
    animation: xmarkDraw 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.6s forwards;
}

.toast-icon-wrapper.error .x-path-2 {
    stroke: #ff3b30;
    fill: none;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 20;
    stroke-dashoffset: 20;
    animation: xmarkDraw 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.75s forwards;
}

.toast-title {
    padding: 0 32px;
    font-size: 22px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 6px;
}

.toast-message {
    padding: 0 32px 32px;
    font-size: 14px;
    color: var(--color-text-secondary);
    line-height: 1.5;
}

@keyframes toastFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes faceidModalAppear {
    0% { opacity: 0; transform: scale(0.85); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes faceidFrameAppear {
    0% { opacity: 0; transform: scale(0.7); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes faceidSuccessGlow {
    0% { box-shadow: 0 0 0 0 rgba(52, 199, 89, 0.5); }
    50% { box-shadow: 0 0 30px 10px rgba(52, 199, 89, 0.3); }
    100% { box-shadow: 0 0 0 0 rgba(52, 199, 89, 0); }
}

@keyframes faceidErrorShake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

@keyframes faceidErrorGlow {
    0% { box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.5); }
    30% { box-shadow: 0 0 30px 10px rgba(255, 59, 48, 0.3); }
    100% { box-shadow: 0 0 0 0 rgba(255, 59, 48, 0); }
}

/* 规划路径按钮样式 */
.plan-route-btn {
    padding: var(--spacing-sm) var(--spacing-lg);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    border: 2px solid var(--color-primary);
    border-radius: var(--radius-md);
    background: var(--color-bg-primary);
    color: var(--color-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.plan-route-btn:hover {
    background: var(--color-primary);
    color: white;
    box-shadow: var(--shadow-md);
}

.plan-route-btn:active {
    transform: scale(0.98);
}

.legend-dot.plan-route {
    background: var(--color-primary);
    border: 2px solid var(--color-primary);
}

/* 出发点图例样式（绿色） */
.legend-dot.start-point {
    background: var(--color-success);
    border: 2px solid var(--color-success);
}

@keyframes checkmarkDraw {
    0% { stroke-dashoffset: 24; }
    100% { stroke-dashoffset: 0; }
}

@keyframes xmarkDraw {
    0% { stroke-dashoffset: 20; }
    100% { stroke-dashoffset: 0; }
}

body.dark-mode {
    --color-text-primary: var(--color-text-dark-primary);
    --color-text-secondary: var(--color-text-dark-secondary);
    --color-text-tertiary: var(--color-text-dark-tertiary);
    --color-text-disabled: #48484a;
    
    --color-bg-primary: var(--color-bg-dark-primary);
    --color-bg-secondary: var(--color-bg-dark-secondary);
    --color-bg-tertiary: var(--color-bg-dark-tertiary);
    --color-bg-card: var(--color-bg-dark-secondary);
    
    --color-border: var(--color-border-dark);
    --color-border-light: var(--color-border-dark-light);
    --color-border-focus: rgba(0, 122, 255, 0.3);
}

body.dark-mode table {
    background: var(--color-bg-dark-primary);
}

body.dark-mode th {
    background: var(--color-bg-dark-tertiary);
}

body.dark-mode tr:hover td {
    background: var(--color-bg-dark-tertiary);
}

.theme-toggle {
    position: fixed;
    top: var(--spacing-xl);
    right: var(--spacing-xl);
    z-index: 1000;
    padding: var(--spacing-md);
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-lg);
}

.theme-toggle:hover {
    background: var(--color-bg-secondary);
    transform: scale(1.1);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
    fill: var(--color-text-secondary);
}

body.dark-mode .theme-toggle svg {
    fill: var(--color-warning);
}