:root {
    color-scheme: light;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    --bg: #f3f6fb;
    --panel: #ffffff;
    --panel-soft: rgba(255, 255, 255, 0.75);
    --text: #162033;
    --muted: #5f6f89;
    --line: #d9e1ef;
    --accent: #4f46e5;
    --accent-soft: #eef2ff;
    --accent-strong: #3730a3;
    --danger: #dc2626;
    --shadow: 0 20px 60px rgba(15, 23, 42, 0.10);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: radial-gradient(circle at top, #e9efff 0, #f3f6fb 42%, #eef3f9 100%);
    color: var(--text);
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

.nav-link, .secondary-button, .ghost-button, button, .action-card, .journey-row, .badge, code, input {
    transition: .2s ease;
}

.page-shell {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 24px 20px 56px;
}

/* Topbar */
.topbar {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 14px;
    margin-bottom: 20px;
}

.brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.brand-tag {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--accent);
}

.brand-title { font-size: 24px; font-weight: 800; }
.brand-subtitle, .topbar-description { color: var(--muted); font-size: 14px; }

/* Navigation */
.nav { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 10px; }

.nav-link, .secondary-button, .ghost-button, button {
    border: none;
    border-radius: 14px;
    padding: 11px 16px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.nav-link {
    background: rgba(255, 255, 255, 0.6);
    color: var(--muted);
    border: 1px solid transparent;
}

.nav-link.active {
    background: var(--panel);
    color: var(--accent-strong);
    border-color: #c7d2fe;
    box-shadow: 0 10px 30px rgba(79, 70, 229, 0.12);
}

.secondary-button, .link-button {
    background: #fff;
    border: 1px solid var(--line);
    color: var(--text);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.nav-link:hover, .secondary-button:hover, .link-button:hover,
.ghost-button:hover, .action-card:hover, .journey-row:hover, button:hover {
    transform: translateY(-2px);
    border-color: #cbd5e1;
    box-shadow: 0 16px 34px rgba(79, 70, 229, 0.14);
    filter: brightness(1.01);
}

.nav-link:hover, .secondary-button:hover, .link-button:hover,
.ghost-button:hover, .action-card:hover, .journey-row:hover {
    background: #fff;
}

.nav-link:hover, .journey-row:hover, .action-card:hover {
    color: var(--accent-strong);
}

.nav-link.active:hover {
    border-color: #a5b4fc;
    box-shadow: 0 14px 34px rgba(79, 70, 229, 0.18);
}

button {
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    color: #fff;
    box-shadow: 0 14px 28px rgba(79, 70, 229, 0.28);
}

button:hover { box-shadow: 0 18px 34px rgba(79, 70, 229, 0.33); }

.ghost-button {
    background: #fff;
    color: var(--accent-strong);
    border: 1px solid #c7d2fe;
    box-shadow: none;
    padding: 9px 14px;
}

/* Hero / Page Header */
.hero { padding: 4px 0 18px; text-align: left; }
.hero .eyebrow { margin-bottom: 12px; }
.hero h1 { margin: 0 0 10px; }
.topbar-description { margin: 0; line-height: 1.65; }

.eyebrow {
    display: inline-block;
    padding: 7px 12px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

h1 { margin: 16px 0 10px; font-size: 40px; line-height: 1.05; }
h2 { margin: 0; font-size: 22px; }
p { margin: 0; color: var(--muted); line-height: 1.65; }

/* Cards */
.card, .stat-card {
    background: var(--panel-soft);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(217, 225, 239, 0.9);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.card { padding: 24px; margin-top: 20px; }
.login-card { max-width: 460px; padding: 28px; margin-top: 0; }

/* Login page */
.page-login .page-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding-top: 24px;
    padding-bottom: 24px;
}

.page-login .topbar { width: min(100%, 460px); margin-bottom: 28px; }
.page-login .card { width: min(100%, 460px); }

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-top: 10px;
}

.stat-card { padding: 22px; }

.stat-label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .08em;
    margin-bottom: 12px;
}

.stat-value { display: block; font-size: 34px; font-weight: 800; margin-bottom: 8px; }

/* Section Heading */
.section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

/* Action Grid */
.action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
}

.action-card {
    padding: 22px;
    border-radius: 22px;
    background: linear-gradient(180deg, #fff, rgba(238, 242, 255, 0.9));
    border: 1px solid #dbe4ff;
    box-shadow: 0 16px 40px rgba(79, 70, 229, 0.10);
    display: block;
    cursor: pointer;
}

.action-card strong { display: block; font-size: 20px; margin: 8px 0; color: var(--text); }

.action-kicker {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--accent);
}

/* Journey List */
.journey-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.journey-row {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 24px 26px;
    border-radius: 28px;
    background: #fff;
    border: 1px solid #e8edf7;
    box-shadow: 0 12px 36px rgba(15, 23, 42, 0.07);
    cursor: pointer;
    min-width: 0;
    height: 100%;
}

.journey-row-new {
    background: linear-gradient(180deg, #fffaf0, #ffffff);
    border-color: #f59e0b;
    box-shadow: 0 18px 42px rgba(245, 158, 11, 0.16);
}

.journey-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.journey-time { font-size: 22px; font-weight: 800; line-height: 1.2; }

.journey-card-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-width: 0;
}

.journey-route { display: flex; flex-direction: column; gap: 16px; min-width: 0; flex: 1; }

.journey-location-row { display: flex; align-items: center; gap: 12px; min-width: 0; }

.journey-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    flex: 0 0 auto;
    box-shadow: 0 0 0 6px rgba(15, 23, 42, 0.04);
}

.journey-dot-start { background: #14b8a6; }
.journey-dot-end { background: #f59e0b; }

.journey-location {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.45;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.journey-distance { font-size: 18px; color: #7b8799; white-space: nowrap; flex: 0 0 auto; }

.journey-price-panel {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 6px;
    min-width: 160px;
    flex: 0 0 auto;
}

.journey-price {
    font-size: 34px;
    font-weight: 800;
    line-height: 1;
    color: var(--text);
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.journey-price-unit { font-size: 18px; font-weight: 700; color: var(--text); }
.journey-price-note { font-size: 14px; color: var(--muted); text-align: right; }

.journey-tags { display: flex; flex-wrap: wrap; gap: 12px; }

.journey-tag {
    display: inline-flex;
    align-items: center;
    padding: 9px 14px;
    border-radius: 14px;
    background: #f2f5fb;
    color: #4b5565;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
}

.journey-tag-accent { background: #e0f2fe; color: #0284c7; }

/* Detail Page */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
}

.detail-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

.detail-grid-inner {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px 18px;
}

.detail-item { display: flex; flex-direction: column; gap: 6px; }

.detail-label {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
}

.detail-value { font-size: 18px; line-height: 1.45; color: var(--text); word-break: break-word; }
.detail-section { margin-top: 22px; }
.detail-section h3 { margin: 0 0 12px; font-size: 18px; }

/* Badges */
.badge-list { display: flex; flex-wrap: wrap; gap: 10px; }

.badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: #eef2f7;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.badge-accent { background: var(--accent-soft); color: var(--accent-strong); }
.badge-new { background: #fef3c7; color: #92400e; box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.28); align-self: flex-start; }

/* Price Options */
.price-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}

.price-option {
    padding: 18px;
    border-radius: 18px;
    background: #fff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}

.price-option p { margin-top: 6px; }

/* Code */
.code-list { display: flex; flex-wrap: wrap; gap: 10px; }
.compact-empty-state { padding: 18px; font-size: 14px; }

.code-block {
    margin: 0;
    padding: 20px;
    border-radius: 18px;
    background: #0f172a;
    color: #e2e8f0;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.6;
}

/* Forms */
.stack-form { display: flex; flex-direction: column; gap: 14px; }
.field-label { font-size: 14px; font-weight: 700; color: var(--text); }
.muted, .muted-value { color: var(--muted); font-size: 14px; }

input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid #cbd5e1;
    background: #fff;
    font-size: 15px;
    color: var(--text);
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease, background-color .2s ease;
}

input:hover { border-color: #a5b4fc; background: #f8faff; box-shadow: 0 0 0 4px rgba(129, 140, 248, 0.10); }
input:focus { border-color: #818cf8; box-shadow: 0 0 0 4px rgba(129, 140, 248, 0.18); }

/* Alerts */
.alert {
    padding: 13px 15px;
    border-radius: 16px;
    margin-bottom: 16px;
    border: 1px solid #c7d2fe;
    background: #eef2ff;
    color: var(--accent-strong);
}

.alert-error { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.alert-success { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }

/* Config */
.config-form { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.config-table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: #fff;
}

.config-form table { min-width: 860px; }

th, td {
    padding: 16px 14px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid #e5e7eb;
}

th {
    background: #f8fafc;
    font-size: 13px;
    font-weight: 800;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .06em;
}

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

code {
    font-family: Consolas, "SFMono-Regular", monospace;
    font-size: 13px;
    color: var(--accent-strong);
    background: var(--accent-soft);
    padding: 2px 7px;
    border-radius: 999px;
}

.toolbar { display: flex; justify-content: flex-end; margin-top: 0; }

.empty-state {
    padding: 28px;
    border: 1px dashed #cbd5e1;
    border-radius: 18px;
    background: #fff;
    text-align: left;
    color: var(--muted);
    font-weight: 600;
}

form { margin: 0; }

/* Location button */
.location-action {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.location-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 14px;
    border: 1px solid #c7d2fe;
    background: linear-gradient(135deg, #eef2ff, #fff);
    color: var(--accent-strong);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.10);
    transition: .2s ease;
}

.location-button:hover {
    transform: translateY(-2px);
    background: #fff;
    box-shadow: 0 14px 30px rgba(79, 70, 229, 0.18);
}

.location-button svg { flex-shrink: 0; }

.location-status {
    font-size: 13px;
    font-weight: 600;
    transition: color .2s;
}

.location-loading { color: var(--accent); }
.location-success { color: #16a34a; }
.location-error { color: var(--danger); }

/* Loading indicator */
.loading-indicator {
    display: none;
    position: fixed;
    top: 16px;
    right: 16px;
    padding: 8px 14px;
    border-radius: 12px;
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-size: 12px;
    font-weight: 700;
    z-index: 100;
    animation: pulse 1.5s ease infinite;
}

.loading-indicator.active { display: block; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Responsive */
@media (max-width: 760px) {
    .page-shell { padding: 20px 14px 36px; }
    .card, .stat-card { border-radius: 20px; }
    .card { padding: 18px; margin-top: 16px; }
    h1 { font-size: 32px; }
    .topbar, .section-heading, .journey-card-top, .journey-card-body { flex-direction: column; align-items: flex-start; }
    .nav { width: auto; }
    .stats-grid, .action-grid, .journey-list, .detail-grid, .detail-grid-inner, .price-options { grid-template-columns: 1fr; }
    .toolbar { justify-content: stretch; }
    .toolbar button, .secondary-button, .link-button, .ghost-button { width: 100%; }
    .journey-row { padding: 20px; }
    .journey-price-panel { align-items: flex-start; min-width: 0; width: 100%; }
    .journey-price-note { text-align: left; }
    .journey-location { white-space: normal; }
    .journey-distance { font-size: 16px; }
    .badge-list, .journey-tags, .code-list { gap: 8px; }
    .config-form table { min-width: 680px; }
    th, td { padding: 14px 12px; }
    .page-login .topbar, .page-login .card { width: 100%; }
}
