/* =============================================================
   Сервісна книжка — Design System (Light Theme, Mobile-First)
   ============================================================= */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* --- CSS Custom Properties --- */
:root {
    /* Colors */
    --bg-primary: #F5F7FA;
    --bg-secondary: #EDF0F5;
    --bg-card: #FFFFFF;
    --bg-card-hover: #F8F9FC;
    --bg-sidebar: #FFFFFF;
    --bg-input: #F9FAFB;

    --accent: #6C63FF;
    --accent-hover: #5A52E0;
    --accent-light: rgba(108, 99, 255, 0.08);
    --accent-gradient: linear-gradient(135deg, #6C63FF 0%, #897CFF 100%);

    --success: #10B981;
    --success-light: rgba(16, 185, 129, 0.1);
    --warning: #F59E0B;
    --warning-light: rgba(245, 158, 11, 0.1);
    --danger: #EF4444;
    --danger-light: rgba(239, 68, 68, 0.1);
    --info: #3B82F6;
    --info-light: rgba(59, 130, 246, 0.1);

    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --text-tertiary: #9CA3AF;
    --text-on-accent: #FFFFFF;

    --border: #E5E7EB;
    --border-strong: #D1D5DB;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.08);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.1);
    --shadow-accent: 0 4px 14px rgba(108, 99, 255, 0.25);

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.8125rem;
    --font-size-base: 0.9375rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.375rem;
    --font-size-2xl: 1.75rem;
    --font-size-3xl: 2.25rem;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms ease;

    /* Layout */
    --sidebar-width: 260px;
    --header-height: 64px;
    --content-max-width: 1200px;
}

/* --- Reset --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    color: var(--text-primary);
    background: var(--bg-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-hover);
}

img {
    max-width: 100%;
    height: auto;
}

/* --- Layout: Sidebar + Content --- */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform var(--transition-base);
    box-shadow: var(--shadow-lg);
}

.sidebar.open {
    transform: translateX(0);
}

.sidebar-brand {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.sidebar-brand-icon {
    width: 42px;
    height: 42px;
    background: var(--accent-gradient);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    box-shadow: var(--shadow-accent);
}

.sidebar-brand-text {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--text-primary);
}

.sidebar-brand-text span {
    display: block;
    font-size: var(--font-size-xs);
    font-weight: 400;
    color: var(--text-tertiary);
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-md);
    overflow-y: auto;
}

.sidebar-nav-section {
    margin-bottom: var(--space-lg);
}

.sidebar-nav-title {
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-xs);
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: 10px var(--space-md);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: var(--font-size-sm);
    transition: all var(--transition-fast);
    position: relative;
}

.sidebar-nav-link:hover {
    background: var(--accent-light);
    color: var(--accent);
}

.sidebar-nav-link.active {
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 600;
}

.sidebar-nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--accent);
    border-radius: var(--radius-full);
}

.sidebar-nav-icon {
    font-size: 1.15rem;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: var(--space-md);
    border-top: 1px solid var(--border);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm);
}

.sidebar-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: var(--font-size-sm);
    flex-shrink: 0;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-weight: 600;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
}

/* --- Overlay --- */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 99;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.active {
    display: block;
}

/* --- Main Content --- */
.main-content {
    flex: 1;
    margin-left: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- Top Header --- */
.top-header {
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 var(--space-lg);
    position: sticky;
    top: 0;
    z-index: 50;
    gap: var(--space-md);
}

.burger-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1.3rem;
    transition: all var(--transition-fast);
}

.burger-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.top-header-title {
    flex: 1;
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--text-primary);
}

.top-header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

/* --- Page Content --- */
.page-content {
    flex: 1;
    padding: var(--space-lg);
    max-width: var(--content-max-width);
    width: 100%;
    margin: 0 auto;
}

/* --- Page Header --- */
.page-header {
    margin-bottom: var(--space-xl);
}

.page-header h1 {
    font-size: var(--font-size-2xl);
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.page-header p {
    color: var(--text-secondary);
    font-size: var(--font-size-base);
}

.page-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-md);
}

/* --- Cards --- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
}

.card-header h2,
.card-header h3 {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--text-primary);
}

.card-body {
    padding: var(--space-lg);
}

.card-footer {
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
}

/* --- Stat Cards --- */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.stat-icon.accent { background: var(--accent-light); color: var(--accent); }
.stat-icon.success { background: var(--success-light); color: var(--success); }
.stat-icon.warning { background: var(--warning-light); color: var(--warning); }
.stat-icon.danger { background: var(--danger-light); color: var(--danger); }
.stat-icon.info { background: var(--info-light); color: var(--info); }

.stat-content {
    flex: 1;
    min-width: 0;
}

.stat-label {
    font-size: var(--font-size-sm);
    color: var(--text-tertiary);
    font-weight: 500;
    margin-bottom: var(--space-xs);
}

.stat-value {
    font-size: var(--font-size-xl);
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-sub {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    margin-top: var(--space-xs);
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 10px 20px;
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.4;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--accent-gradient);
    color: var(--text-on-accent);
    box-shadow: var(--shadow-accent);
}

.btn-primary:hover {
    background: var(--accent-hover);
    color: var(--text-on-accent);
    box-shadow: 0 6px 20px rgba(108, 99, 255, 0.35);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
    color: var(--text-primary);
}

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

.btn-success:hover {
    background: #0ea572;
    color: #fff;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: #dc2626;
    color: #fff;
}

.btn-outline {
    background: transparent;
    color: var(--accent);
    border: 1.5px solid var(--accent);
}

.btn-outline:hover {
    background: var(--accent-light);
    color: var(--accent-hover);
}

.btn-sm {
    padding: 6px 14px;
    font-size: var(--font-size-xs);
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 14px 28px;
    font-size: var(--font-size-base);
    border-radius: var(--radius-lg);
}

.btn-block {
    width: 100%;
}

.btn-icon {
    padding: 8px;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
}

/* --- Forms --- */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.form-label .required {
    color: var(--danger);
    margin-left: 2px;
}

.form-control {
    width: 100%;
    padding: 11px 14px;
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    outline: none;
}

.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
    background: var(--bg-card);
}

.form-control::placeholder {
    color: var(--text-tertiary);
}

.form-control.is-invalid {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px var(--danger-light);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236B7280' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-hint {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    margin-top: var(--space-xs);
}

.form-error {
    font-size: var(--font-size-xs);
    color: var(--danger);
    margin-top: var(--space-xs);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-md);
}

.form-divider {
    margin: var(--space-xl) 0;
    padding-top: var(--space-xl);
    border-top: 1px solid var(--border);
}

.form-divider h3 {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.form-divider p {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

/* --- Checkbox --- */
.form-check {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
}

.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}

.form-check-label {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    cursor: pointer;
}

/* --- Tables --- */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-sm);
}

.table th,
.table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.table th {
    background: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: sticky;
    top: 0;
}

.table tbody tr {
    transition: background var(--transition-fast);
}

.table tbody tr:hover {
    background: var(--bg-card-hover);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* --- Badges --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    font-size: var(--font-size-xs);
    font-weight: 600;
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.badge-accent { background: var(--accent-light); color: var(--accent); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: #92400E; }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-info { background: var(--info-light); color: var(--info); }

/* --- Progress Bar --- */
.progress-bar-container {
    margin: var(--space-md) 0;
}

.progress-bar-label {
    display: flex;
    justify-content: space-between;
    font-size: var(--font-size-xs);
    font-weight: 500;
    margin-bottom: var(--space-sm);
}

.progress-bar {
    height: 10px;
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
    overflow: hidden;
    display: flex;
}

.progress-bar-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width var(--transition-slow);
}

.progress-bar-fill.work {
    background: var(--accent-gradient);
}

.progress-bar-fill.parts {
    background: linear-gradient(135deg, var(--success), #34D399);
}

/* --- Alert / Flash --- */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
    animation: alertSlideIn 0.3s ease;
    border: 1px solid transparent;
}

.alert-success {
    background: var(--success-light);
    color: #065F46;
    border-color: rgba(16, 185, 129, 0.2);
}

.alert-danger {
    background: var(--danger-light);
    color: #991B1B;
    border-color: rgba(239, 68, 68, 0.2);
}

.alert-warning {
    background: var(--warning-light);
    color: #92400E;
    border-color: rgba(245, 158, 11, 0.2);
}

.alert-info {
    background: var(--info-light);
    color: #1E40AF;
    border-color: rgba(59, 130, 246, 0.2);
}

.alert-close {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0.5;
    font-size: 1.1rem;
    padding: 4px;
    transition: opacity var(--transition-fast);
}

.alert-close:hover {
    opacity: 1;
}

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

/* --- Toast (JS-driven) --- */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: #fff;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.35s ease;
    max-width: 360px;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.toast.success { background: var(--success); }
.toast.danger  { background: var(--danger); }
.toast.warning { background: #D97706; }
.toast.info    { background: var(--info); }

.toast.removing {
    animation: toastOut 0.3s ease forwards;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(40px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    to { opacity: 0; transform: translateX(40px); }
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: var(--space-2xl) var(--space-lg);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
    opacity: 0.4;
}

.empty-state h3 {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.empty-state p {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-lg);
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* --- Car Cards Grid --- */
.cars-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-md);
}

.car-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    transition: all var(--transition-base);
    text-decoration: none;
    color: var(--text-primary);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.car-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    color: var(--text-primary);
}

.car-card-top {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.car-card-icon {
    width: 52px;
    height: 52px;
    background: var(--accent-light);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    flex-shrink: 0;
}

.car-card-info {
    flex: 1;
    min-width: 0;
}

.car-card-title {
    font-size: var(--font-size-lg);
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.car-card-sub {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.car-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
}

.car-card-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* --- Service Record Item --- */
.record-item {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border);
    transition: background var(--transition-fast);
}

.record-item:hover {
    background: var(--bg-card-hover);
}

.record-item:last-child {
    border-bottom: none;
}

.record-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-sm);
    flex-wrap: wrap;
}

.record-date {
    font-weight: 700;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
}

.record-mileage {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
}

.record-description {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
    line-height: 1.5;
}

.record-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.record-sto {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
}

.record-total {
    font-weight: 700;
    font-size: var(--font-size-base);
    color: var(--accent);
}

.record-parts-list {
    margin-top: var(--space-sm);
    padding: var(--space-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
}

.record-parts-list li {
    padding: 4px 0;
    list-style: none;
    display: flex;
    justify-content: space-between;
    gap: var(--space-sm);
}

.record-actions {
    display: flex;
    gap: var(--space-sm);
}

/* --- Dynamic Parts Row (record form) --- */
.parts-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.part-row {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    position: relative;
    animation: fadeIn 0.3s ease;
}

.part-row .form-row {
    gap: var(--space-sm);
}

.part-remove {
    position: absolute;
    top: var(--space-sm);
    right: var(--space-sm);
    width: 28px;
    height: 28px;
    border: none;
    background: var(--danger-light);
    color: var(--danger);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all var(--transition-fast);
}

.part-remove:hover {
    background: var(--danger);
    color: #fff;
}

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

/* --- Auth Pages --- */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
    background: var(--bg-primary);
}

.auth-container {
    width: 100%;
    max-width: 440px;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.auth-card-header {
    padding: var(--space-xl) var(--space-xl) var(--space-lg);
    text-align: center;
}

.auth-logo {
    width: 56px;
    height: 56px;
    margin: 0 auto var(--space-md);
    background: var(--accent-gradient);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    box-shadow: var(--shadow-accent);
}

.auth-card-header h1 {
    font-size: var(--font-size-xl);
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.auth-card-header p {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

.auth-card-body {
    padding: var(--space-lg) var(--space-xl) var(--space-xl);
}

.auth-card-footer {
    padding: var(--space-md) var(--space-xl);
    background: var(--bg-secondary);
    text-align: center;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

/* --- Public Search (Index) --- */
.hero-section {
    text-align: center;
    padding: var(--space-2xl) var(--space-lg);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}

.hero-section h1 {
    font-size: var(--font-size-3xl);
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.hero-section p {
    color: var(--text-secondary);
    font-size: var(--font-size-lg);
    max-width: 560px;
    margin: 0 auto var(--space-xl);
}

.search-box {
    max-width: 500px;
    margin: 0 auto;
    display: flex;
    gap: var(--space-sm);
}

.search-box .form-control {
    font-size: var(--font-size-lg);
    padding: 14px 18px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.search-results {
    max-width: 800px;
    margin: var(--space-xl) auto;
    padding: 0 var(--space-lg);
}

/* --- Sharing Section --- */
.share-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.share-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
}

/* --- Utilities --- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-tertiary); }
.text-sm { font-size: var(--font-size-sm); }
.text-xs { font-size: var(--font-size-xs); }
.fw-bold { font-weight: 700; }
.fw-semibold { font-weight: 600; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }
.d-flex { display: flex; }
.d-block { display: block; }
.d-none { display: none; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }

/* --- Responsive: Tablet --- */
@media (min-width: 640px) {
    .form-row {
        grid-template-columns: 1fr 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .cars-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* --- Responsive: Desktop --- */
@media (min-width: 1024px) {
    .sidebar {
        transform: translateX(0);
        box-shadow: none;
    }

    .main-content {
        margin-left: var(--sidebar-width);
    }

    .burger-btn {
        display: none;
    }

    .sidebar-overlay {
        display: none !important;
    }

    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .cars-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .page-content {
        padding: var(--space-xl) var(--space-2xl);
    }

    .hero-section {
        padding: 80px var(--space-xl);
    }

    .hero-section h1 {
        font-size: 3rem;
    }
}

/* --- Print --- */
@media print {
    .sidebar,
    .sidebar-overlay,
    .top-header,
    .burger-btn,
    .btn,
    .record-actions,
    .toast-container,
    .no-print {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
    }

    .page-content {
        padding: 0;
        max-width: 100%;
    }

    body {
        background: #fff;
        color: #000;
        font-size: 12pt;
    }

    .card {
        border: 1px solid #ccc;
        box-shadow: none;
        break-inside: avoid;
    }

    .table th {
        background: #f0f0f0 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
