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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f7fa;
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 15px;
}

header {
    text-align: center;
    padding: 15px 0;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 15px;
}

header h1 {
    font-size: 1.8rem;
    color: #2563eb;
    margin-bottom: 5px;
}

.subtitle {
    color: #666;
    font-size: 0.95rem;
}

.card {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 15px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.card h2 {
    margin-bottom: 15px;
    color: #2563eb;
    font-size: 1.1rem;
    border-bottom: 2px solid #2563eb;
    padding-bottom: 8px;
}

.hidden {
    display: none !important;
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-size: 0.85rem;
    font-weight: 500;
}

.form-row {
    display: flex;
    gap: 15px;
}

.form-row .form-group {
    flex: 1;
}

/* Date presets */
.date-presets {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.preset-btn {
    padding: 6px 14px;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    background: #f9fafb;
    color: #555;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.preset-btn:hover {
    background: #e5e7eb;
    border-color: #2563eb;
    color: #2563eb;
}

.preset-btn.active {
    background: #dbeafe;
    border-color: #2563eb;
    color: #2563eb;
}

input, select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    background: #fff;
    color: #333;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus, select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

input::placeholder {
    color: #999;
}

select option {
    background: #fff;
    color: #333;
}

.password-input {
    display: flex;
    align-items: center;
    gap: 5px;
}

.password-prefix {
    color: #666;
    font-family: monospace;
    font-size: 0.85rem;
}

.password-input input {
    width: 60px;
    text-align: center;
    font-family: monospace;
    font-size: 1rem;
    letter-spacing: 2px;
}

.btn {
    padding: 10px 24px;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
}

.btn-primary {
    background: #2563eb;
    color: #fff;
}

.btn-primary:hover {
    background: #1d4ed8;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
    border: 1px solid #d0d0d0;
}

.btn-secondary:hover {
    background: #e5e5e5;
}

.status {
    margin-top: 12px;
    padding: 10px;
    border-radius: 6px;
    font-size: 0.85rem;
}

.status.success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.status.error {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.status.loading {
    background: #dbeafe;
    color: #2563eb;
    border: 1px solid #bfdbfe;
}

/* Main layout - two columns */
.main-content {
    display: flex;
    gap: 15px;
    min-height: calc(100vh - 150px);
}

.left-panel {
    width: 400px;
    min-width: 350px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.right-panel {
    flex: 1;
    min-width: 0;
}

.right-panel .card {
    height: 100%;
    overflow: auto;
}

/* Train List */
.train-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: calc(100vh - 450px);
    overflow-y: auto;
}

.train-item {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px 15px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.train-item:hover {
    background: #f0f7ff;
    border-color: #2563eb;
}

.train-item.selected {
    background: #eff6ff;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.train-item.merits {
    border-left: 4px solid #2563eb;
}

.train-item.non-merits {
    border-left: 4px solid #f59e0b;
}

.train-item-date {
    font-size: 0.95rem;
    font-weight: 600;
    color: #333;
}

.train-item-route {
    color: #666;
    font-size: 0.85rem;
    margin-top: 3px;
}

.train-item-meta {
    font-size: 0.75rem;
    color: #888;
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.train-item-status {
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: 600;
}

.train-item-status.on-time {
    background: #dcfce7;
    color: #166534;
}

.train-item-status.delayed {
    background: #fef3c7;
    color: #92400e;
}

.train-item-status.cancelled {
    background: #fee2e2;
    color: #dc2626;
}

/* Selection header with toggle */
.selection-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 10px;
}

.selection-header h2 {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #555;
}

.toggle-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #2563eb;
    cursor: pointer;
}

.toggle-text {
    user-select: none;
}

/* Badges */
.merits-badge {
    background: #dbeafe;
    color: #2563eb;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
}

.provider-badge {
    background: #fef3c7;
    color: #92400e;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
}

/* Train Header */
.train-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.train-header h2 {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

.train-info {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.info-badge {
    background: #f3f4f6;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    color: #555;
    border: 1px solid #e0e0e0;
}

.brand-badge {
    background: #dbeafe;
    color: #2563eb;
    border-color: #bfdbfe;
}

/* Copyable ID */
.copyable {
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.75rem;
    background: #f3f4f6;
    border: 1px solid #e0e0e0;
    transition: all 0.2s;
}

.copyable:hover {
    background: #e5e7eb;
}

.copyable.copied {
    background: #dcfce7;
    border-color: #bbf7d0;
}

/* Data source info */
.data-source-info {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 10px 15px;
    margin-bottom: 15px;
    font-size: 0.8rem;
    color: #666;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.data-label {
    color: #555;
    font-weight: 600;
}

.data-value {
    color: #666;
}

.data-id {
    color: #888;
    font-family: monospace;
    font-size: 0.75rem;
    cursor: help;
}

/* Service IDs section */
.service-ids {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 10px 15px;
    margin-bottom: 15px;
    font-size: 0.8rem;
}

.service-ids-title {
    font-weight: 600;
    color: #555;
    margin-bottom: 8px;
}

.service-id-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
    flex-wrap: wrap;
}

.service-id-label {
    color: #888;
    min-width: 100px;
}

/* Route Visualization */
.route-container {
    position: relative;
    padding-left: 25px;
}

.route-line {
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, #2563eb, #10b981);
    border-radius: 2px;
}

.station {
    position: relative;
    padding: 10px 0 10px 25px;
    border-bottom: 1px solid #f0f0f0;
}

.station:last-child {
    border-bottom: none;
}

.station-dot {
    position: absolute;
    left: -21px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid #2563eb;
    z-index: 1;
}

.station.stop .station-dot {
    width: 16px;
    height: 16px;
    left: -22px;
    background: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.station.pass-through .station-dot {
    width: 10px;
    height: 10px;
    left: -19px;
    border-width: 2px;
    border-color: #9ca3af;
}

.station.arrived .station-dot {
    background: #10b981;
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.station.delayed .station-dot {
    background: #f59e0b;
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

.station.cancelled .station-dot {
    background: #ef4444;
    border-color: #ef4444;
}

.station-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
}

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

.station-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.station-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: #333;
}

.station.pass-through .station-name {
    color: #9ca3af;
    font-weight: 400;
    font-size: 0.85rem;
}

.station-country {
    font-size: 0.7rem;
    color: #666;
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 8px;
}

.station-code {
    font-size: 0.7rem;
    color: #888;
    font-family: monospace;
    background: #f9fafb;
    padding: 2px 6px;
    border-radius: 4px;
}

.station-name-replaced {
    color: #9333ea;
    font-size: 0.7rem;
    background: #f3e8ff;
    padding: 2px 6px;
    border-radius: 4px;
    cursor: help;
}

.station-name-added {
    color: #059669;
    font-size: 0.7rem;
    background: #d1fae5;
    padding: 2px 6px;
    border-radius: 4px;
    cursor: help;
}

.station-details {
    display: flex;
    gap: 8px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.station-platform {
    font-size: 0.75rem;
    color: #2563eb;
    background: #dbeafe;
    padding: 2px 8px;
    border-radius: 10px;
}

.station-extra {
    font-size: 0.75rem;
    color: #666;
}

/* Time display */
.station-times {
    text-align: right;
    min-width: 160px;
    flex-shrink: 0;
}

.time-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
    margin-bottom: 3px;
    font-size: 0.85rem;
}

.time-row:last-child {
    margin-bottom: 0;
}

.time-label {
    color: #888;
    font-size: 0.7rem;
    min-width: 28px;
}

.time-timetabled {
    color: #666;
    font-family: monospace;
}

.time-separator {
    color: #ccc;
    font-size: 0.75rem;
}

.time-estimated {
    color: #10b981;
    font-family: monospace;
    font-weight: 600;
}

.time-estimated.delayed {
    color: #f59e0b;
}

.time-diff {
    font-size: 0.7rem;
    padding: 1px 5px;
    border-radius: 6px;
    font-weight: 600;
}

.time-diff.late {
    background: #fef3c7;
    color: #92400e;
}

.time-diff.early {
    background: #d1fae5;
    color: #059669;
}

/* Status badges */
.station-status-badge {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 8px;
    margin-top: 4px;
    display: inline-block;
}

.station-status-badge.arrived {
    background: #d1fae5;
    color: #059669;
}

.station-status-badge.departed {
    background: #dbeafe;
    color: #2563eb;
}

.station-status-badge.cancelled {
    background: #fee2e2;
    color: #dc2626;
}

/* JSON Viewer */
.json-viewer-section {
    margin-top: 20px;
    border-top: 1px solid #e0e0e0;
    padding-top: 15px;
}

.json-toggle-btn {
    background: #f3f4f6;
    border: 1px solid #e0e0e0;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #555;
    display: flex;
    align-items: center;
    gap: 8px;
}

.json-toggle-btn:hover {
    background: #e5e7eb;
}

.json-viewer {
    margin-top: 10px;
    background: #1e293b;
    border-radius: 8px;
    padding: 15px;
    max-height: 400px;
    overflow: auto;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.8rem;
    line-height: 1.5;
}

.json-key {
    color: #7dd3fc;
}

.json-string {
    color: #86efac;
}

.json-number {
    color: #fcd34d;
}

.json-boolean {
    color: #f472b6;
}

.json-null {
    color: #9ca3af;
}

.json-bracket {
    color: #e2e8f0;
}

.json-collapsible {
    cursor: pointer;
    user-select: none;
}

.json-collapsible:hover {
    text-decoration: underline;
}

.json-collapsed::before {
    content: '+ ';
    color: #60a5fa;
}

.json-expanded::before {
    content: '- ';
    color: #60a5fa;
}

.json-content {
    padding-left: 20px;
}

.json-content.hidden {
    display: none;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #888;
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

/* Logs/Trace Viewer */
.logs-viewer-section {
    margin-top: 20px;
    border-top: 1px solid #e0e0e0;
    padding-top: 15px;
}

.logs-toggle-btn {
    background: #f3f4f6;
    border: 1px solid #e0e0e0;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #555;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logs-toggle-btn:hover {
    background: #e5e7eb;
}

.logs-viewer {
    margin-top: 12px;
}

.logs-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 12px;
    border-bottom: 2px solid #e5e7eb;
}

.logs-tab {
    padding: 8px 16px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.8rem;
    color: #888;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.logs-tab:hover {
    color: #2563eb;
}

.logs-tab.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
    font-weight: 600;
}

.logs-results {
    max-height: 500px;
    overflow-y: auto;
}

.logs-count {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 10px;
}

.trace-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px 15px;
    margin-bottom: 8px;
    font-size: 0.8rem;
}

.trace-card.provider-update {
    border-left: 3px solid #f59e0b;
}

.trace-card.consumer-get {
    border-left: 3px solid #2563eb;
}

.trace-card.consumer-query {
    border-left: 3px solid #8b5cf6;
}

.trace-header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.trace-time {
    font-weight: 600;
    color: #333;
    font-family: monospace;
    font-size: 0.8rem;
}

.trace-provider,
.trace-consumer {
    color: #666;
    font-size: 0.75rem;
}

.trace-flag {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
}

.trace-flag.success {
    background: #dcfce7;
    color: #166534;
}

.trace-flag.warning {
    background: #fef3c7;
    color: #92400e;
}

.trace-flag.error {
    background: #fee2e2;
    color: #dc2626;
}

.trace-flag.info {
    background: #dbeafe;
    color: #2563eb;
}

.trace-match,
.trace-changes,
.trace-events-detail,
.trace-validation,
.trace-distribution,
.trace-timing,
.trace-ids,
.trace-counts,
.trace-params {
    font-size: 0.75rem;
    color: #666;
    margin-top: 4px;
    padding: 4px 0;
}

.trace-validation.error {
    color: #dc2626;
}

.trace-ids span,
.trace-counts .trace-count {
    display: inline-block;
    margin-right: 15px;
    font-family: monospace;
}

.trace-timing {
    border-top: 1px solid #e5e7eb;
    padding-top: 6px;
    margin-top: 6px;
    color: #888;
    font-family: monospace;
}

.trace-params {
    font-family: monospace;
    word-break: break-all;
}

/* Hourly Histogram */
.histogram-section {
    margin-bottom: 15px;
    padding: 12px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.histogram-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 8px;
}

.histogram {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 60px;
    padding-top: 5px;
}

.hist-bar-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    position: relative;
    cursor: default;
}

.hist-bar {
    width: 100%;
    background: #e5e7eb;
    border-radius: 2px 2px 0 0;
    min-height: 2px;
    transition: background 0.2s;
    margin-top: auto;
}

.hist-bar.active {
    background: #2563eb;
}

.hist-bar-wrap:hover .hist-bar.active {
    background: #1d4ed8;
}

.hist-label {
    font-size: 0.55rem;
    color: #999;
    margin-top: 2px;
}

.hist-count {
    position: absolute;
    top: -2px;
    font-size: 0.55rem;
    font-weight: 700;
    color: #2563eb;
}

/* Hour Groups */
.hour-group {
    margin-bottom: 6px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

.hour-group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #f3f4f6;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}

.hour-group-header:hover {
    background: #e5e7eb;
}

.hour-group-time {
    font-weight: 700;
    font-size: 0.9rem;
    color: #2563eb;
    font-family: monospace;
}

.hour-group-count {
    font-size: 0.8rem;
    color: #666;
}

.hour-group-chevron {
    margin-left: auto;
    font-size: 0.7rem;
    color: #999;
    transition: transform 0.2s;
}

.hour-group.collapsed .hour-group-chevron {
    transform: rotate(-90deg);
}

.hour-group-content {
    padding: 8px;
}

.hour-group.collapsed .hour-group-content {
    display: none;
}

/* Trace section blocks */
.trace-section {
    margin-top: 8px;
    padding: 8px 10px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
}

.trace-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.trace-events-count {
    font-size: 0.7rem;
    color: #666;
    background: #f3f4f6;
    padding: 2px 8px;
    border-radius: 10px;
}

/* Match & fuzzy scoring */
.trace-match-method {
    font-size: 0.8rem;
    color: #333;
    font-weight: 500;
    margin-bottom: 6px;
}

.fuzzy-scores {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.fuzzy-total {
    font-size: 0.75rem;
    font-weight: 600;
    color: #2563eb;
    margin-bottom: 4px;
}

.score-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.7rem;
}

.score-name {
    min-width: 80px;
    color: #666;
    text-transform: capitalize;
}

.score-bar {
    flex: 1;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
}

.score-fill {
    display: block;
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s;
}

/* Change badges */
.change-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

/* Event selection summary */
.event-sel-summary {
    display: flex;
    gap: 10px;
    align-items: center;
}

.event-sel-locations {
    font-size: 0.75rem;
    color: #666;
}

/* Expandable Event Details */
.evt-section-header {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.evt-section-header:hover {
    color: #2563eb;
}

.evt-expand-icon {
    font-size: 0.6rem;
    color: #999;
    transition: transform 0.2s;
}

.evt-detail-list {
    margin-top: 8px;
    border-top: 1px solid #e5e7eb;
    padding-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.evt-detail-list.hidden {
    display: none;
}

.evt-detail-row {
    padding: 6px 8px;
    border-radius: 5px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    font-size: 0.72rem;
}

.evt-detail-row.modified {
    background: #fffbeb;
    border-color: #fde68a;
}

.evt-detail-row.unchanged {
    opacity: 0.6;
}

.evt-detail-main {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.evt-modify-icon {
    font-size: 0.8rem;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}

.evt-detail-row.modified .evt-modify-icon {
    color: #f59e0b;
}

.evt-detail-row.unchanged .evt-modify-icon {
    color: #ccc;
}

.evt-location {
    font-weight: 500;
    color: #333;
}

.evt-location code {
    font-size: 0.65rem;
    color: #888;
    background: #f3f4f6;
    padding: 1px 4px;
    border-radius: 3px;
}

.evt-type {
    font-size: 0.6rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 8px;
    text-transform: uppercase;
}

.evt-type.arr {
    background: #dbeafe;
    color: #2563eb;
}

.evt-type.dep {
    background: #fef3c7;
    color: #92400e;
}

.evt-significance {
    font-size: 0.6rem;
    color: #666;
    background: #f3f4f6;
    padding: 1px 5px;
    border-radius: 8px;
}

.evt-flag {
    font-size: 0.6rem;
    padding: 1px 5px;
    border-radius: 8px;
    font-weight: 500;
}

.evt-flag.newer {
    background: #d1fae5;
    color: #059669;
}

.evt-flag.master {
    background: #ede9fe;
    color: #7c3aed;
}

.evt-flag.fwd {
    background: #e0e7ff;
    color: #4338ca;
}

.evt-times {
    margin-top: 3px;
    padding-left: 22px;
    font-size: 0.68rem;
    color: #666;
    font-family: monospace;
}

.evt-detail-timestamps {
    margin-top: 2px;
    padding-left: 22px;
    font-size: 0.65rem;
    color: #999;
    font-family: monospace;
    display: flex;
    gap: 12px;
}

/* Consolidation summary */
.consolidation-summary {
    display: flex;
    gap: 10px;
    align-items: center;
    font-size: 0.75rem;
    color: #666;
}

/* Distribution */
.dist-summary {
    font-size: 0.75rem;
    color: #666;
}

/* Validation error detail */
.trace-validation-detail {
    font-size: 0.7rem;
    font-family: monospace;
    color: #dc2626;
    background: #fee2e2;
    padding: 6px 8px;
    border-radius: 4px;
    word-break: break-all;
}

/* Processing pipeline */
.pipeline-total {
    font-weight: 400;
    color: #2563eb;
    margin-left: 8px;
    font-size: 0.75rem;
}

.pipeline-track {
    position: relative;
    height: 40px;
    background: #f3f4f6;
    border-radius: 4px;
    margin-top: 4px;
}

.pipeline-track::before {
    content: '';
    position: absolute;
    top: 12px;
    left: 4%;
    right: 4%;
    height: 2px;
    background: #d1d5db;
}

.pipeline-step {
    position: absolute;
    top: 4px;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.pipeline-dot {
    width: 8px;
    height: 8px;
    background: #2563eb;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px #2563eb;
}

.pipeline-label {
    font-size: 0.55rem;
    color: #666;
    margin-top: 4px;
    white-space: nowrap;
}

/* Re-login Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(3px);
}

.modal-overlay.hidden {
    display: none !important;
}

.modal-content {
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    width: 400px;
    max-width: 90vw;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: modalSlideIn 0.25s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.modal-icon {
    font-size: 1.5rem;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: #dc2626;
}

.modal-message {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 20px;
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.modal-actions .btn {
    flex: 1;
}

/* Responsive */
@media (max-width: 1000px) {
    .main-content {
        flex-direction: column;
    }

    .left-panel {
        width: 100%;
        min-width: 0;
    }

    .train-list {
        max-height: 300px;
    }
}

@media (max-width: 600px) {
    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .station-content {
        flex-direction: column;
    }

    .station-times {
        text-align: left;
        margin-top: 8px;
    }

    .time-row {
        justify-content: flex-start;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .train-header {
        flex-direction: column;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}
