:root {
    --primary: #22d3ee;
    --primary-strong: #0ea5e9;
    --accent: #f59e0b;
    --surface: #0f172a;
    --surface-muted: #111827;
    --background: #0b1221;
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    --border: #1f2937;
    --shadow-soft: 0 20px 60px rgba(0, 0, 0, 0.35);
    --shadow-hard: 0 12px 40px rgba(0, 0, 0, 0.45);
    --glass: rgba(17, 24, 39, 0.75);
    --korean-font: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, 'Helvetica Neue', 'Segoe UI', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
    --sans-font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--sans-font);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-main);
    background: radial-gradient(circle at 20% 20%, rgba(34, 211, 238, 0.08), transparent 25%),
                radial-gradient(circle at 80% 0%, rgba(245, 158, 11, 0.08), transparent 25%),
                var(--background);
    min-height: 100vh;
    overflow: hidden;
    position: relative;
}

body:before {
    content: "";
    position: fixed;
    inset: 0;
    background: linear-gradient(120deg, rgba(255,255,255,0.04), rgba(255,255,255,0));
    pointer-events: none;
    z-index: 0;
}

/* Hangul Font Support */
body:lang(ko) {
    font-family: var(--korean-font);
}

#app {
    display: flex;
    height: 100vh;
    width: 100vw;
    position: relative;
    z-index: 1;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: linear-gradient(180deg, rgba(17, 24, 39, 0.95), rgba(17, 24, 39, 0.85));
    backdrop-filter: blur(12px);
    border-right: 1px solid rgba(255, 255, 255, 0.04);
    display: flex;
    flex-direction: column;
    padding: 28px 18px;
    flex-shrink: 0;
    box-shadow: 6px 0 24px rgba(0, 0, 0, 0.25);
}


.brand {
    padding: 0 10px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.brand-name {
    font-size: 18px;
    font-weight: 700;
    color: #f8fafc;
    letter-spacing: 0.2px;
    line-height: 1.2;
}

.brand-subtitle {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.3px;
    line-height: 1.2;
}

.brand-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 14px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    padding: 8px;
    box-shadow: 0 14px 38px rgba(0, 0, 0, 0.28);
}

.brand-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-strong) 100%);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: white;
    box-shadow: 0 16px 36px rgba(14, 165, 233, 0.3);
    flex-shrink: 0;
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 4px;
}

.tab {
    width: 100%;
    text-align: left;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.tab:before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    border-radius: 999px;
    background: linear-gradient(180deg, var(--primary), var(--primary-strong));
    opacity: 0;
    transition: opacity 0.25s ease;
}

.tab:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.06);
    color: #e2e8f0;
}

.tab:hover:before {
    opacity: 0.5;
}

.tab.active {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.08);
    color: #f8fafc;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.tab.active:before {
    opacity: 1;
}

.tab-icon {
    font-size: 18px;
}

/* Main Content */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    background: linear-gradient(145deg, rgba(15, 23, 42, 0.92) 0%, rgba(11, 18, 33, 0.95) 60%, rgba(10, 12, 24, 0.98) 100%);
}

.topbar {
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    padding: 18px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 76px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 5;
}

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

.file-status {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.file-name {
    font-weight: 700;
    color: #f8fafc;
    letter-spacing: 0.3px;
}

.file-meta {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    gap: 10px;
    align-items: center;
}

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

.language-select {
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
    font-weight: 600;
}

.unit-select {
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
    font-weight: 500;
    font-size: 13px;
    min-width: 90px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.unit-select:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255,255,255,0.12);
}

.unit-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.content-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
}

.main-content {
    max-width: 1240px;
    margin: 0 auto;
}

/* Notice */
.backup-notice {
    background: linear-gradient(120deg, rgba(34, 211, 238, 0.08), rgba(14, 165, 233, 0.04));
    border: 1px solid rgba(34, 211, 238, 0.18);
    color: #e0f2fe;
    padding: 14px 16px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    font-size: 13px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

/* Stats */
.summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
    margin-bottom: 26px;
}

.stat-card {
    background: linear-gradient(150deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.02) 100%);
    border-radius: 18px;
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: var(--shadow-soft);
    position: relative;
    overflow: hidden;
}

.stat-card:after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 20% 20%, rgba(34, 211, 238, 0.08), transparent 40%);
    pointer-events: none;
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: linear-gradient(145deg, rgba(34, 211, 238, 0.16), rgba(14, 165, 233, 0.08));
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}

.stat-content {
    flex: 1;
    position: relative;
    z-index: 1;
}

.stat-value {
    font-size: 20px;
    font-weight: 800;
    color: #f8fafc;
    letter-spacing: 0.2px;
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Filters */
.search-bar {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 22px;
    display: flex;
    gap: 10px;
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(12px);
}

.search-input, .vehicle-filter, .sort-filter {
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    font-size: 14px;
    background: rgba(0, 0, 0, 0.25);
    color: var(--text-main);
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.search-input:focus, .vehicle-filter:focus, .sort-filter:focus {
    outline: none;
    border-color: rgba(34, 211, 238, 0.7);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
    background: rgba(0, 0, 0, 0.35);
}

.search-input {
    flex: 1;
}

.vehicle-filter, .sort-filter {
    min-width: 160px;
}

.sort-filter {
    cursor: pointer;
}

.vehicle-filter option, .sort-filter option {
    background: var(--surface);
    color: var(--text-main);
}

/* Table */
.table-container {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    backdrop-filter: blur(10px);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: rgba(255, 255, 255, 0.03);
    padding: 14px 18px;
    text-align: left;
    font-weight: 700;
    color: #cbd5e1;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    position: sticky;
    top: 0;
    backdrop-filter: blur(10px);
    z-index: 2;
}

td {
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    color: var(--text-main);
    vertical-align: middle;
    font-weight: 500;
}

tr:nth-child(odd) td {
    background: rgba(255, 255, 255, 0.01);
}

tr:hover td {
    background: rgba(34, 211, 238, 0.06);
    cursor: pointer;
}

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

/* Badges */
.badge {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.2px;
    align-items: center;
    gap: 6px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.badge-primary, .badge-gasoline { background: rgba(34, 211, 238, 0.15); color: #22d3ee; }
.badge-diesel { background: rgba(148, 163, 184, 0.16); color: #cbd5e1; }
.badge-electric { background: rgba(34, 197, 94, 0.16); color: #34d399; }
.badge-hybrid { background: rgba(245, 158, 11, 0.16); color: #fbbf24; }
.badge-warning { background: rgba(239, 68, 68, 0.16); color: #fca5a5; }
.badge-success { background: rgba(34, 197, 94, 0.16); color: #34d399; }
.badge-info { background: rgba(99, 102, 241, 0.16); color: #a5b4fc; }

/* Buttons */
.btn-primary {
    background: linear-gradient(120deg, var(--primary) 0%, var(--primary-strong) 100%);
    color: #0b1221;
    border: 1px solid rgba(34, 211, 238, 0.4);
    padding: 11px 20px;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.16s ease, box-shadow 0.16s ease;
    box-shadow: 0 10px 30px rgba(14, 165, 233, 0.25);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 36px rgba(14, 165, 233, 0.3);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: #e2e8f0;
    padding: 11px 16px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.btn-secondary:hover {
    transform: translateY(-1px);
    border-color: rgba(34, 211, 238, 0.35);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.25);
}

.btn-icon {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 18px;
    cursor: pointer;
    padding: 10px;
    border-radius: 12px;
    color: var(--text-muted);
    transition: all 0.16s ease;
}

.btn-icon:hover {
    background: rgba(34, 211, 238, 0.12);
    color: #e0f2fe;
    border-color: rgba(34, 211, 238, 0.35);
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(7, 11, 20, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: rgba(15, 23, 42, 0.95);
    border-radius: 18px;
    padding: 28px;
    max-width: 640px;
    width: 90%;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: var(--shadow-hard);
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.modal-content h2 {
    font-size: 22px;
    font-weight: 800;
    color: #f8fafc;
    letter-spacing: 0.2px;
}

.modal-content h3 {
    font-size: 18px;
    font-weight: 700;
    color: #e0f2fe;
    margin-bottom: 10px;
}

.modal-content p {
    font-size: 15px;
    color: #e2e8f0;
    line-height: 1.7;
    margin: 6px 0;
}

.modal-content p strong {
    color: #fbbf24;
    font-weight: 800;
}

.modal-close {
    position: absolute;
    top: 18px;
    right: 18px;
    background: transparent;
    border: none;
    font-size: 22px;
    color: var(--text-muted);
    cursor: pointer;
}

/* Welcome Screen */
.welcome-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 20% 20%, rgba(34, 211, 238, 0.08), transparent 30%),
                radial-gradient(circle at 80% 0%, rgba(245, 158, 11, 0.08), transparent 30%),
                rgba(11, 18, 33, 0.96);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(6px);
}

.welcome-content {
    text-align: center;
    max-width: 880px;
    padding: 46px;
    background: rgba(15, 23, 42, 0.9);
    border-radius: 22px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: var(--shadow-hard);
}

.welcome-content h2 {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #22d3ee 0%, #0ea5e9 40%, #f59e0b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.welcome-content p {
    color: var(--text-muted);
}

.web-version-notice {
    margin-top: 6px;
    color: #f8fafc;
    font-weight: 600;
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 32px;
    text-align: left;
}

.feature {
    padding: 18px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.feature h3 {
    font-size: 16px;
    margin-bottom: 8px;
    color: #f8fafc;
}

.feature p {
    color: var(--text-muted);
}

.btn-large {
    margin-top: 22px;
    font-size: 16px;
    padding: 12px 32px;
}

/* Helpers */
.hidden {
    display: none !important;
}

.vehicle-icon-cell {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.plate-chip {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(34, 211, 238, 0.28);
    color: #e2e8f0;
    font-weight: 700;
    letter-spacing: 0.2px;
    font-family: "SFMono-Regular", ui-monospace, "SFMono-Light", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* Data Info Bar */
.info-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.info-item .label {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.info-item .value {
    color: #f8fafc;
    font-weight: 700;
}

/* Tab Logic */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* Responsive */
@media (max-width: 1080px) {
    .sidebar { width: 240px; }
    .topbar { padding: 14px 20px; }
    .content-scroll { padding: 24px; }
}

@media (max-width: 860px) {
    #app { flex-direction: column; }
    .sidebar { flex-direction: row; width: 100%; overflow-x: auto; height: auto; padding: 12px; }
    .sidebar-nav { flex-direction: row; }
    .tab { min-width: 160px; }
    .topbar { position: static; }
    .welcome-content { padding: 28px; }
}
