* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    --secondary-color: #818cf8;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #06b6d4;
    --text-primary: #1f2937;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --bg-white: #ffffff;
    --bg-light: #f8fafc;
    --bg-dark: #111827;
    --border-color: #e2e8f0;
    --sidebar-bg: #ffffff;
    --sidebar-hover: #f1f5f9;
    --sidebar-active: #4f46e5;
    --navbar-height: 64px;
    --sidebar-width: 260px;
    --transition-duration: 0.3s;
    
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;
    
    --font-size-xs: 12px;
    --font-size-sm: 14px;
    --font-size-md: 16px;
    --font-size-lg: 18px;
    --font-size-xl: 24px;
    --font-size-2xl: 32px;
    
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.15);
    --shadow-focus: 0 0 0 3px rgba(59,130,246,0.15);
    --transition-fast: 0.15s ease;
    --transition-base: 0.2s ease;
    --transition-smooth: 0.3s ease;
}

html, body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    background: var(--bg-light);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
}

.nav {
    --bs-nav-link-color: #4b5563;
}

section, main, aside, header, footer {
    max-width: 100%;
    overflow-x: hidden;
}

.card, .card-header, .card-body, .card-footer {
    overflow-x: visible;
    max-width: 100%;
}

.text-white {
    color: #ffffff !important;
}

.top-navbar {
    background: var(--bg-white);
    box-shadow: var(--shadow-sm);
    height: var(--navbar-height);
    min-height: var(--navbar-height);
    padding: 0 1rem;
    z-index: 1030;
}

.top-navbar .container-fluid {
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: background var(--transition-duration);
}

.menu-btn:hover,
.btn-theme-toggle:hover,
.btn-notification:hover {
    background: var(--bg-light);
}

.top-navbar .navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary-color);
    font-size: 1.25rem;
    font-weight: 700;
    text-decoration: none;
}

.top-navbar .navbar-brand i {
    font-size: 1.5rem;
}

.top-navbar .navbar-brand img.navbar-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.sidebar-header img.sidebar-logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.right-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.notification-dropdown,
.profile-dropdown {
    position: relative;
}

.btn-notification,
.btn-theme-toggle {
    width: 44px;
    height: 44px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 1.25rem;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all var(--transition-duration);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-notification {
    color: var(--text-secondary);
    border-radius: var(--radius-full);
    position: relative;
}

.btn-theme-toggle {
    margin-right: 0.5rem;
}

/* 客户搜索下拉 */
.customer-search-dropdown {
    position: relative;
}

.btn-customer-search {
    width: 44px;
    height: 44px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 1.25rem;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all var(--transition-duration);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-customer-search:hover,
.btn-customer-search.active {
    background: var(--bg-light);
}

.customer-search-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 360px;
    max-width: 90vw;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 1rem;
    z-index: 1100;
    display: none;
}

.customer-search-panel.show {
    display: block;
}

/* 搜索遮罩层 */
.customer-search-overlay {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    z-index: 1099;
    display: none;
}

.customer-search-overlay.show {
    display: block;
    opacity: 1;
}

.customer-search-input-wrap {
    position: relative;
    margin-bottom: 0.75rem;
}

.customer-search-input-wrap i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 1rem;
}

.customer-search-input-wrap input {
    width: 100%;
    padding: 0.6rem 0.75rem 0.6rem 2.25rem;
    border: 1px solid #e5e7eb;
    border-radius: var(--radius-md);
    background: #f9fafb;
    color: #374151;
    font-size: var(--font-size-sm);
    outline: none;
    transition: border-color var(--transition-duration);
}

.customer-search-input-wrap input::placeholder {
    color: #9ca3af;
}

.customer-search-input-wrap input:focus {
    border-color: #9ca3af;
}

.customer-search-input-wrap input:hover {
    border-color: #9ca3af;
}

.customer-search-results {
    max-height: 420px;
    overflow-y: auto;
}

.customer-search-results .search-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: #a7a9ac;
    font-size: var(--font-size-sm);
}

.customer-search-results .search-loading {
    text-align: center;
    padding: 1.5rem;
        color: #a7a9ac;
    font-size: var(--font-size-sm);
}

/* 客户搜索卡片 */
.customer-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: var(--radius-md);
    padding: 0.875rem;
    margin-bottom: 0.625rem;
    transition: all var(--transition-duration);
    outline: none;
}

.customer-card:hover,
.customer-card.active {
    border-color: #9ca3af;
    background: #f3f4f6;
    box-shadow: var(--shadow-sm);
}

.customer-card .card-name {
    font-weight: 600;
    font-size: var(--font-size-base);
    color: #1f2937;
    margin-bottom: 0.625rem;
}

.customer-card .card-name .card-name-link {
    color: #1f2937;
    text-decoration: none;
    display: inline-block;
}

.customer-card .card-name .card-name-link:hover {
    color: #6b7280;
    text-decoration: none;
}

.customer-card .card-info {
    font-size: var(--font-size-sm);
    color: #6b7280;
    line-height: 1.6;
}

.customer-card .card-info > div {
    margin-bottom: 0.375rem;
}

.customer-card .card-info > div:last-child {
    margin-bottom: 0;
}

.customer-card .card-info i {
    margin-right: 0.25rem;
    font-size: 0.85em;
    color: #9ca3af;
}

.customer-card .card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0;
    border-top: none;
}

.customer-card .card-actions .btn {
    flex: 1;
    font-size: var(--font-size-sm);
    padding: 0.4rem 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

/* 表格行内操作按钮 */
.btn-row-delete {
    color: #333333;
}

.btn-row-delete:hover {
    color: #555555;
}

/* 表格内添加行链接 */
.add-row-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 16px;
}

.add-row-link:hover {
    color: var(--primary-hover);
}

/* 客户下拉项 */
.customer-item {
    color: #64748b !important;
    text-decoration: none !important;
    display: block;
    padding: 8px 12px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.customer-item:hover {
    background-color: #f1f5f9 !important;
}

/* 表格列宽辅助类 */
.table-col-10 { width: 10%; }
.table-col-12 { width: 12%; }
.table-col-13 { width: 13%; }
.table-col-20 { width: 20%; }
.table-col-25 { width: 25%; }
.table-col-30 { width: 30%; }
.table-col-35 { width: 35%; }
.table-col-55 { width: 55%; }
.table-col-90 { width: 90%; }
.table-col-150 { width: 150px; }
.table-col-200 { width: 200px; }
.table-col-shrink { width: 1%; white-space: nowrap; }

/* 地图选择弹窗 */
.map-app-modal .modal-dialog {
    display: flex;
    align-items: center;
    min-height: calc(100% - 2rem);
    margin: 1rem auto;
}

.map-app-modal .modal-content {
    width: 100%;
}

.map-app-modal .modal-body {
    padding: 1.5rem;
}

.map-app-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.map-app-item {
    display: flex;
    align-items: center;
    padding: 0.875rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-main);
    color: var(--text-primary);
    text-decoration: none;
    transition: all var(--transition-duration);
}

.map-app-item:hover {
    border-color: var(--primary-color);
    background: var(--bg-light);
    color: var(--primary-color);
}

.map-app-item i {
    font-size: 1.5rem;
    margin-right: 0.75rem;
    width: 28px;
    text-align: center;
}

.map-app-item .app-name {
    font-weight: 500;
}

.map-app-item .app-desc {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    margin-left: auto;
}

@media (max-width: 575.98px) {
    .customer-search-panel {
        position: fixed;
        top: var(--navbar-height);
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        border-radius: 0;
        border-left: none;
        border-right: none;
        box-shadow: var(--shadow-lg);
    }
    
    .customer-search-results {
        max-height: calc(100vh - var(--navbar-height) - 120px);
    }
}

.notification-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    background: var(--danger-color);
    color: white;
    font-size: var(--font-size-xs);
    font-weight: 600;
    min-width: 18px;
    height: 18px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.notification-menu,
.profile-menu {
    right: 0;
    left: auto;
    top: 100%;
    margin-top: 0.5rem;
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 0.375rem 0;
    z-index: 1050;
    overflow: hidden;
}

.notification-menu {
    min-width: 300px;
    max-width: 360px;
}

.profile-menu {
    min-width: 180px;
}

.notification-item {
    display: flex;
    align-items: center;
    padding: 0.625rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: background var(--transition-duration);
}

.notification-item:hover,
.profile-menu .dropdown-item:hover,
.sidebar-menu > li > a:hover {
    background: var(--sidebar-hover);
}

.notification-item .info-icon {
    color: var(--warning-color);
    font-size: var(--font-size-lg);
    margin-right: 0.75rem;
}

.notification-item .msg-text {
    flex: 1;
    font-size: var(--font-size-sm);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.notification-item .count-badge {
    background: var(--danger-color);
    color: white;
    font-size: var(--font-size-sm);
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-full);
    min-width: 24px;
    text-align: center;
}

.btn-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.375rem 0.75rem;
    border: none;
    background: transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition-duration);
}

.btn-profile:hover {
    background: var(--bg-light);
}

.btn-profile .avatar {
    width: 36px;
    height: 36px;
    background: var(--primary-color);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: var(--font-size-md);
}

.btn-profile .user-name {
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    font-weight: 500;
}

.btn-profile .chevron {
    color: var(--text-light);
    font-size: var(--font-size-sm);
    transition: transform var(--transition-duration);
}

.profile-dropdown.show .chevron {
    transform: rotate(180deg);
}

.profile-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 1rem;
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    transition: background var(--transition-duration);
}

.profile-menu .dropdown-item:hover {
    color: var(--primary-color);
}

.profile-menu .dropdown-item i {
    font-size: var(--font-size-md);
    color: var(--text-secondary);
}

.profile-menu .dropdown-item:hover i {
    color: var(--primary-color);
}

.profile-menu .dropdown-divider {
    border-color: var(--border-color);
    margin: 0.5rem 0;
}

.sidebar {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    overflow-y: auto;
    transition: transform var(--transition-duration) ease;
    z-index: 1020;
    scrollbar-width: thin;
    scrollbar-color: #d1d5db transparent;
    border-right: 1px solid var(--border-color);
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.sidebar.collapsed {
    transform: translateX(-100%);
}

.sidebar-header {
    display: none;
    padding: 1.25rem;
    color: var(--text-primary);
    font-size: var(--font-size-lg);
    font-weight: 700;
    border-bottom: 1px solid var(--border-color);
    align-items: center;
    gap: 0.625rem;
}

.sidebar-header i {
    font-size: var(--font-size-xl);
    color: var(--primary-color);
}

.sidebar-menu {
    list-style: none;
    margin: 0;
    padding: 0.75rem;
}

.sidebar-menu > li {
    margin: 0;
}

.sidebar-menu > li > a {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition-duration);
    margin: 0.125rem 0;
    border-radius: var(--radius-md);
    position: relative;
    overflow: hidden;
    font-weight: 500;
}

.sidebar-menu > li > a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--sidebar-active);
    transform: scaleY(0);
    transition: transform var(--transition-duration);
    border-radius: 0 4px 4px 0;
}

.sidebar-menu > li > a:hover {
    color: var(--text-primary);
}

.sidebar-menu > li.active > a {
    color: var(--sidebar-active);
    background: var(--primary-light);
}

.sidebar-menu > li.active > a::before {
    transform: scaleY(1);
}

/* Sidebar Submenu */
.sidebar-item-has-sub > .sidebar-submenu-toggle {
    cursor: pointer;
}

.sidebar-item-has-sub .sidebar-chevron {
    margin-left: auto;
    font-size: 0.875rem;
    transition: transform var(--transition-duration);
}

.sidebar-item-has-sub.active .sidebar-submenu-toggle .sidebar-chevron,
.sidebar-item-has-sub .sidebar-submenu-toggle[data-expanded="true"] .sidebar-chevron {
    transform: rotate(180deg);
}

.sidebar-submenu {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-duration) ease, padding var(--transition-duration) ease;
}

.sidebar-submenu.show {
    padding: 0.25rem 0 0.25rem 1rem;
    max-height: 500px;
}

.sidebar-submenu > li > a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    transition: all var(--transition-duration);
    margin: 0.125rem 0;
    border-radius: var(--radius-md);
    position: relative;
    font-weight: 400;
}

.sidebar-submenu > li > a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--sidebar-active);
    transform: scaleY(0);
    transition: transform var(--transition-duration);
    border-radius: 0 3px 3px 0;
}

.sidebar-submenu > li > a:hover {
    color: var(--text-primary);
    background: var(--sidebar-hover);
}

.sidebar-submenu > li.active > a {
    color: var(--sidebar-active);
    background: var(--primary-light);
    font-weight: 500;
}

.sidebar-submenu > li.active > a::before {
    transform: scaleY(1);
}


.sidebar-menu > li > a > i {
    font-size: var(--font-size-lg);
    width: 24px;
    text-align: center;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1015;
    opacity: 0;
    transition: opacity var(--transition-duration);
    pointer-events: none;
}

.sidebar-overlay.show {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

.main-content {
    margin-left: var(--sidebar-width);
    padding: 1.5rem;
    margin-top: var(--navbar-height);
    min-height: calc(100vh - var(--navbar-height));
    transition: margin var(--transition-duration) ease;
    overflow-x: hidden;
}

.main-content.collapsed {
    margin-left: 0;
}

.card {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-duration);
    overflow: hidden;
}

.card-header {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.card-footer {
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.alert-reminder {
    background: #fff3cd;
    border-color: #ffc107;
    color: #856404;
    border-radius: var(--radius-md);
}

.table {
    background: var(--bg-white) !important;
    --bs-table-accent-bg: var(--bg-white) !important;
    border-radius: var(--radius-lg) !important;
    overflow: hidden !important;
    font-size: var(--font-size-sm) !important;
    color: var(--text-primary) !important;
    width: 100% !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
}

.table thead th {
    background: var(--bg-white) !important;
    border-bottom: 2px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    font-weight: 600 !important;
    padding: 0.625rem 1rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    font-size: var(--font-size-xs) !important;
    white-space: nowrap !important;
}

.table tbody td {
    padding: 0.375rem 1rem !important;
    vertical-align: middle !important;
    border-bottom: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    line-height: 1.4 !important;
}

.table tbody tr {
    transition: all var(--transition-base) !important;
}

.table tbody tr:hover {
    background: var(--bg-light) !important;
    --bs-table-accent-bg: var(--bg-light) !important;
}

.table tbody tr:last-child td {
    border-bottom: none !important;
}

.table .text-center {
    text-align: center !important;
}

.table .text-right {
    text-align: right !important;
}

.table .btn-sm {
    padding: 0.375rem 0.75rem !important;
    font-size: var(--font-size-xs) !important;
}

.table .badge {
    padding: 0.35em 0.65em !important;
    font-size: var(--font-size-xs) !important;
    font-weight: 600 !important;
}

.table-striped tbody tr:nth-of-type(odd) {
    background: var(--bg-white) !important;
    --bs-table-accent-bg: var(--bg-white) !important;
    --bs-table-striped-bg: var(--bg-white) !important;
}

.table-striped tbody tr:nth-of-type(odd):hover {
    background: var(--bg-light) !important;
    --bs-table-accent-bg: var(--bg-light) !important;
}

.table-bordered {
    border: 1px solid var(--border-color) !important;
}

.table-bordered th,
.table-bordered td {
    border: 1px solid var(--border-color) !important;
}

.table-bordered thead th {
    border-bottom-width: 2px !important;
}

/* 表格圆角修复 */
.table thead th:first-child {
    border-top-left-radius: var(--radius-lg);
}

.table thead th:last-child {
    border-top-right-radius: var(--radius-lg);
}

/* 表格底部圆角：仅对非动态表格（无 tfoot 添加行）生效 */
.table:not(#partsTable):not(#staffTable):not(#equipmentTable) tbody tr:last-child td:first-child {
    border-bottom-left-radius: var(--radius-lg);
}

.table:not(#partsTable):not(#staffTable):not(#equipmentTable) tbody tr:last-child td:last-child {
    border-bottom-right-radius: var(--radius-lg);
}

/* tbody 为空时，tfoot 底部圆角（仅对非动态表格生效） */
.table:not(#partsTable):not(#staffTable):not(#equipmentTable) tbody:empty + tfoot tr:last-child td:first-child {
    border-bottom-left-radius: var(--radius-lg);
}

.table:not(#partsTable):not(#staffTable):not(#equipmentTable) tbody:empty + tfoot tr:last-child td:last-child {
    border-bottom-right-radius: var(--radius-lg);
}

.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    -webkit-overflow-scrolling: touch;
}

.pagination {
    margin: 1.5rem 0;
}

.page-link {
    border: none;
    color: var(--text-secondary);
    padding: 0.5rem 0.875rem;
    border-radius: var(--radius-md);
    margin: 0 0.125rem;
}

.page-link:hover {
    background: var(--bg-light);
    color: var(--primary-color);
}

.page-item.active .page-link {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.btn {
    border-radius: var(--radius-md);
    padding: 0.625rem 1.25rem;
    font-weight: 500;
    transition: all var(--transition-base);
    font-size: var(--font-size-sm);
    border-width: 1px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
    background: var(--bg-light);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--border-color);
    border-color: var(--text-secondary);
}

.btn-success {
    background: var(--success-color);
    border-color: var(--success-color);
    color: #ffffff;
}

.btn-success:hover {
    background: #059669;
    border-color: #059669;
}

.btn-danger {
    background: var(--danger-color);
    border-color: var(--danger-color);
    color: #ffffff;
}

.btn-danger:hover {
    background: #dc2626;
    border-color: #dc2626;
}

.btn-warning {
    background: var(--warning-color);
    border-color: var(--warning-color);
    color: #ffffff;
}

.btn-warning:hover {
    background: #d97706;
    border-color: #d97706;
}

.btn-info {
    background: var(--info-color);
    border-color: var(--info-color);
    color: #ffffff;
}

.btn-info:hover {
    background: #0891b2;
    border-color: #0891b2;
}

.btn-outline-primary {
    background: transparent;
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-outline-primary:hover {
    background: var(--primary-color);
    color: #ffffff;
}

.btn-outline-secondary {
    background: transparent;
    border-color: var(--text-secondary);
    color: var(--text-secondary);
}

.btn-outline-secondary:hover {
    background: var(--text-secondary);
    color: #ffffff;
}

.btn-outline-success {
    background: transparent;
    border-color: var(--success-color);
    color: var(--success-color);
}

.btn-outline-success:hover {
    background: var(--success-color);
    color: #ffffff;
}

.btn-outline-danger {
    background: transparent;
    border-color: var(--danger-color);
    color: var(--danger-color);
}

.btn-outline-danger:hover {
    background: var(--danger-color);
    color: #ffffff;
}

.btn-outline-warning {
    background: transparent;
    border-color: var(--warning-color);
    color: var(--warning-color);
}

.btn-outline-warning:hover {
    background: var(--warning-color);
    color: #ffffff;
}

.btn-outline-info {
    background: transparent;
    border-color: var(--info-color);
    color: var(--info-color);
}

.btn-outline-info:hover {
    background: var(--info-color);
    color: #ffffff;
}

/* ============================================================
   统一表单输入框样式
   ============================================================ */
.form-control,
.form-select {
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-md) !important;
    padding: 0.5rem 0.75rem;
    min-height: 38px;
    font-size: var(--font-size-sm);
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-white);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:hover,
.form-select:hover {
    border-color: var(--text-secondary) !important;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color) !important;
    box-shadow: var(--shadow-focus) !important;
    outline: none;
}

.form-control::placeholder {
    color: var(--text-light);
}

/* 文本域 */
textarea.form-control {
    min-height: 80px;
    resize: vertical;
}

/* 搜索框去除默认样式 */
input[type="search"].form-control::-webkit-search-decoration,
input[type="search"].form-control::-webkit-search-cancel-button,
input[type="search"].form-control::-webkit-search-results-button,
input[type="search"].form-control::-webkit-search-results-decoration {
    display: none;
}

/* 数字输入框 */
input[type="number"].form-control {
    -moz-appearance: textfield;
}
input[type="number"].form-control::-webkit-inner-spin-button,
input[type="number"].form-control::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* 日期输入框统一样式 */
input[type="date"].form-control,
input[type="datetime-local"].form-control {
    min-height: 38px;
}

/* 下拉选择框 */
.form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    padding-right: 2.25rem;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    cursor: pointer;
}

.form-select option {
    color: var(--text-primary);
    background: var(--bg-white);
    padding: 0.5rem;
}

/* 多选/指定大小的 select 去掉箭头 */
.form-select[multiple],
.form-select[size]:not([size="1"]) {
    background-image: none;
    padding-right: 0.75rem;
}

/* 标签 */
.form-label {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
    font-size: var(--font-size-sm);
}

.form-text {
    color: var(--text-light);
    font-size: var(--font-size-xs);
    margin-top: 0.25rem;
}

.input-group {
    border-radius: var(--radius-md) !important;
    overflow: visible;
    border: 1px solid var(--border-color);
    position: relative;
    background-color: var(--bg-white);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input-group:hover {
    border-color: var(--text-secondary);
}

.input-group:focus-within {
    border-color: var(--primary-color) !important;
    box-shadow: var(--shadow-focus);
    border-radius: var(--radius-md) !important;
}

.input-group .form-control,
.input-group .form-select {
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
    background-color: transparent;
}

.input-group .form-control:focus,
.input-group .form-select:focus {
    border: none !important;
    box-shadow: none !important;
    outline: none;
}

.input-group .input-group-text {
    background: var(--bg-light);
    border-color: var(--border-color);
    color: var(--text-secondary);
    border-radius: 0 !important;
    border: none;
    border-left: 1px solid var(--border-color);
}

.input-group .btn {
    border-radius: 0 !important;
    border-top: none !important;
    border-right: none !important;
    border-bottom: none !important;
    border-left: 1px solid var(--border-color) !important;
}

.input-group .btn:hover {
    border-left-color: var(--border-color) !important;
}

.input-group [class*="btn-outline-"] {
    border-top: none !important;
    border-right: none !important;
    border-bottom: none !important;
    border-left: 1px solid var(--border-color) !important;
    border-radius: 0 !important;
}

.input-group [class*="btn-outline-"]:hover {
    border-left-color: var(--border-color) !important;
}

.form-check-input {
    border-color: var(--border-color);
    border-radius: var(--radius-sm);
}

.form-check-input:focus {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-focus);
}

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.form-check-label {
    color: var(--text-primary);
    font-size: var(--font-size-sm);
}

.form-control:disabled,
.form-select:disabled {
    background-color: var(--bg-light);
    color: var(--text-light);
    cursor: not-allowed;
    border-radius: var(--radius-md) !important;
}

.form-control[readonly] {
    background-color: var(--bg-light);
    color: var(--text-secondary);
    border-radius: var(--radius-md) !important;
}

.form-floating > .form-control,
.form-floating > .form-select {
    height: calc(3.5rem + 2px);
    padding: 1rem 1rem 0.25rem;
}

.form-floating > label {
    padding: 1rem 1rem;
    color: var(--text-secondary);
}

.form-group {
    margin-bottom: 1.25rem;
}

.row > .form-group {
    margin-bottom: 0;
}

.nav-tabs {
    border-bottom: 1px solid var(--border-color);
}

.nav-tabs .nav-link {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid transparent;
    border-top-left-radius: var(--radius-md);
    border-top-right-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    font-weight: 500;
    transition: all var(--transition-base);
}

.nav-tabs .nav-link:hover {
    background: var(--bg-light);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.nav-tabs .nav-link.active {
    background: var(--bg-white);
    color: var(--primary-color);
    border-color: var(--border-color);
    border-bottom-color: transparent;
}

.nav-pills .nav-link {
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    font-weight: 500;
    transition: all var(--transition-base);
}

.nav-pills .nav-link:hover {
    background: var(--bg-light);
    color: var(--text-primary);
}

.nav-pills .nav-link.active {
    background: var(--primary-color);
    color: #ffffff;
}

.tab-content {
    color: var(--text-primary);
}

.category-tabs,
.type-tabs {
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.category-tabs .nav-tabs,
.type-tabs .nav-tabs {
    border-bottom: none;
}

.category-tabs .nav-tabs .nav-link,
.type-tabs .nav-tabs .nav-link {
    border: 1px solid transparent;
    border-top-left-radius: var(--radius-md);
    border-top-right-radius: var(--radius-md);
    margin-right: 0.5rem;
    background-color: var(--bg-light);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    font-weight: 500;
    transition: all var(--transition-base);
    border-bottom: none;
}

.category-tabs .nav-tabs .nav-link:hover,
.type-tabs .nav-tabs .nav-link:hover {
    background-color: var(--border-color);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.category-tabs .nav-tabs .nav-link.active,
.type-tabs .nav-tabs .nav-link.active {
    background-color: var(--primary-color);
    color: #ffffff;
    border-color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar:not(.collapsed) {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
}

@media (max-width: 767px) {
    :root {
        --navbar-height: 56px;
    }
    
    .top-navbar {
        padding: 0 0.75rem;
    }
    
    .top-navbar .navbar-brand {
        display: none;
    }
    
    .top-navbar .navbar-logo {
        display: none;
    }
    
    .top-navbar .navbar-brand i {
        font-size: 1.25rem;
    }
    
    .btn-profile .user-name {
        display: none;
    }
    
    .btn-profile {
        padding: 0.375rem;
    }
    
    .sidebar {
        width: 280px;
    }
    
    .sidebar-header {
        display: flex;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .notification-menu,
    .profile-menu,
    .dropdown-menu {
        max-width: calc(100vw - 1.5rem);
        overflow-x: hidden;
    }
    
    .notification-item {
        max-width: 100%;
        overflow: hidden;
    }
    
    .notification-item .msg-text {
        max-width: 100%;
    }
    
    .btn {
        padding: 0.5rem 0.875rem;
        font-size: 0.875rem;
    }
    
    .card form.row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .card form.row .col-auto {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .card form.row .col-auto .form-control,
    .card form.row .col-auto .form-select,
    .card form.row .col-auto .btn {
        width: 100%;
    }
    
    .table-responsive {
        border: none;
        background: transparent;
    }
    
    .table-mobile {
        border: none !important;
        background: transparent !important;
    }
    
    .table-mobile thead {
        display: none !important;
    }
    
    .table-mobile tbody {
        display: block !important;
    }
    
    .table-mobile tbody tr {
        display: block !important;
        background: var(--bg-white) !important;
        border-radius: var(--radius-lg) !important;
        margin-bottom: 1rem !important;
        box-shadow: var(--shadow-sm) !important;
        border: 1px solid var(--border-color) !important;
        overflow: hidden !important;
        transition: transform var(--transition-base), box-shadow var(--transition-base) !important;
    }
    
    .table-mobile tbody tr:hover {
        transform: translateY(-2px) !important;
        box-shadow: var(--shadow-md) !important;
        border-color: var(--primary-color) !important;
    }
    
    .table-mobile tbody tr td {
        display: flex !important;
        align-items: center !important;
        padding: 0.85rem 1.25rem !important;
        border: none !important;
        border-bottom: 1px solid var(--border-color) !important;
        justify-content: space-between !important;
        gap: 0.75rem !important;
        color: var(--text-primary) !important;
        font-size: var(--font-size-sm) !important;
        background: var(--bg-white) !important;
        transition: background 0.15s ease !important;
    }

    .table-mobile tbody tr td:nth-child(odd) {
        background: rgba(0,0,0,0.012) !important;
    }
    
    .table-mobile tbody tr td:first-child {
        padding-top: 1.1rem !important;
        font-size: 1rem !important;
        font-weight: 600 !important;
        color: var(--text-primary) !important;
    }

    .table-mobile tbody tr td:first-child::before {
        color: var(--text-primary) !important;
    }
    
    .table-mobile tbody tr td.mobile-hide-column,
    .table-mobile tbody tr td.d-none.d-lg-table-cell {
        display: none !important;
    }
    
    .table-mobile tbody tr td:last-child {
        border-bottom: none !important;
    }
    
    .table-mobile tbody tr td::before {
        content: attr(data-label) !important;
        font-weight: 600 !important;
        color: var(--text-secondary) !important;
        text-align: left !important;
        flex-shrink: 0 !important;
        margin-right: 0.5rem !important;
        font-size: var(--font-size-xs) !important;
        letter-spacing: 0.05em !important;
        min-width: 3.5rem !important;
    }
    
    .table-mobile tbody tr td .badge + .badge,
    .table-mobile tbody tr td .btn + .btn,
    .table-mobile tbody tr td .badge + .btn,
    .table-mobile tbody tr td .btn + .badge {
        margin-left: 0.25rem;
    }
    
    .stats-value {
        font-size: var(--font-size-xl);
    }
    
    .stats-icon {
        width: 52px;
        height: 52px;
        font-size: var(--font-size-lg);
    }
    
    .form-search .search-input-group,
    .form-search .btn-mobile-hide {
        display: none;
    }
    
    .form-search .btn-mobile-show,
    .form-search .btn-mobile-show .btn {
        width: 100%;
    }
}

.stats-card {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-smooth);
    overflow: hidden;
}

.stats-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stats-card .card-body {
    padding: 1.25rem;
}

.stats-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.stats-card-customer .stats-icon {
    background: rgba(59, 126, 234, 0.1);
    color: var(--primary-color);
}

.stats-card-order .stats-icon {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.stats-card-equipment .stats-icon {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.stats-card-parts .stats-icon {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.stats-value {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stats-label {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-top: 4px;
}

.stats-sub {
    font-size: var(--font-size-xs);
    color: var(--text-light);
    margin-top: 4px;
}

.stats-card-customer .stats-sub {
    color: var(--primary-color);
}

.stats-card-order .stats-sub {
    color: var(--warning-color);
}

.stats-card-equipment .stats-sub {
    color: var(--success-color);
}

.stats-card-parts .stats-sub {
    color: var(--danger-color);
}

.card-footer-link {
    text-decoration: none;
}

.stats-card .card-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border-color);
    background: transparent;
    font-size: var(--font-size-sm);
    transition: all 0.3s ease;
}

.stats-card-customer .card-footer {
    color: var(--primary-color);
}

.stats-card-customer .card-footer:hover {
    background: rgba(59, 126, 234, 0.05);
}

.stats-card-order .card-footer {
    color: var(--warning-color);
}

.stats-card-order .card-footer:hover {
    background: rgba(245, 158, 11, 0.05);
}

.stats-card-equipment .card-footer {
    color: var(--success-color);
}

.stats-card-equipment .card-footer:hover {
    background: rgba(16, 185, 129, 0.05);
}

.stats-card-parts .card-footer {
    color: var(--danger-color);
}

.stats-card-parts .card-footer:hover {
    background: rgba(239, 68, 68, 0.05);
}

.theme-icon-light, .theme-icon-dark {
    position: absolute;
    transition: all var(--transition-duration);
}

.theme-light .theme-icon-dark,
.theme-dark .theme-icon-light {
    opacity: 0;
    transform: scale(0.5);
}

.theme-light .theme-icon-light,
.theme-dark .theme-icon-dark {
    opacity: 1;
    transform: scale(1);
}


/* Alert 增强动画 */
.alert.auto-dismiss {
    animation: alertSlideIn 0.3s ease;
}

@keyframes alertSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
