:root {
    --bg-main: #fcfcfc;
    --sidebar-bg: #ffffff;
    --panel-bg: #ffffff;
    --accent: #fc4c02;
    /* Strava Orange */
    --accent-soft: rgba(252, 76, 2, 0.08);
    --primary: #6366f1;
    /* Indigo-like for AI feel */
    --text-primary: #1a1a1a;
    --text-secondary: #64748b;
    --border: #f1f5f9;
    --surface: #ffffff;
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.03);
    --shadow-medium: 0 10px 30px rgba(0, 0, 0, 0.06);
    --accent-low: rgba(252, 76, 2, 0.05);
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 12px;
}

body {
    margin: 0;
    font-family: 'Inter', -apple-system, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    overflow: hidden;
    /* App layout handles scrolling */
    height: 100vh;
}

.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
.sidebar {
    width: 240px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    flex-shrink: 0;
    transition: width 0.3s ease, padding 0.3s ease;
    position: relative;
    z-index: 10;
}

.sidebar.collapsed {
    width: 72px;
    padding: 1.5rem 0.5rem;
}

.sidebar-toggle,
.right-toggle {
    position: absolute;
    top: 1.5rem;
    width: 24px;
    height: 24px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.7rem;
    color: var(--text-secondary);
    box-shadow: var(--shadow-soft);
    transition: all 0.2s ease;
    z-index: 20;
}

.sidebar-toggle {
    right: -12px;
}

.right-toggle {
    left: -12px;
}

.sidebar-toggle:hover,
.right-toggle:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 2.5rem;
    padding: 0.5rem;
    overflow: hidden;
}

.sidebar.collapsed .logo-text {
    display: none;
}

.logo-img {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.logo-text {
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.nav-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 10px 0;
}

.sidebar.collapsed .nav-label {
    display: none;
}

.nav-icon {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.nav-item:hover,
.nav-item.active {
    background: var(--accent-soft);
    color: var(--accent);
}

.nav-item.active {
    background: #f8fafc;
    color: var(--text-primary);
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    overflow: hidden;
}

.sidebar.collapsed .user-info,
.sidebar.collapsed .version-text {
    display: none;
}

.sidebar.collapsed .user-profile {
    justify-content: center;
    padding: 10px 0;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 0.75rem;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--primary));
    flex-shrink: 0;
}

.footer-actions {
    display: flex;
    gap: 8px;
}

.sidebar.collapsed .footer-actions {
    flex-direction: column;
}

.footer-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    background: #ffffff;
    color: var(--text-secondary);
    text-decoration: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    font-size: 1.1rem;
}

.footer-action-btn:hover {
    background: var(--accent-low);
    color: var(--accent);
    border-color: rgba(252, 76, 2, 0.2);
    transform: translateY(-1px);
}

.footer-action-btn.logout:hover {
    background: #fff1f2;
    color: #e11d48;
    border-color: #fecaca;
}

/* Three-Column Layout */
.main-wrapper {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.center-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 2.5rem;
    overflow-y: auto;
    background: #ffffff;
}

.right-column {
    width: 380px;
    background: #f8fafc;
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    overflow-y: auto;
    flex-shrink: 0;
    transition: width 0.3s ease, padding 0.3s ease;
    position: relative;
    overflow-x: hidden;
}

.right-column.collapsed {
    width: 72px;
    padding: 1.5rem 0.5rem;
}

.right-column.collapsed .right-content {
    display: none;
}

.collapsed-marker-list {
    display: none;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.right-column.collapsed .collapsed-marker-list {
    display: flex;
}

.collapsed-marker {
    width: 44px;
    height: 44px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.collapsed-marker:hover {
    border-color: var(--accent);
    transform: scale(1.05);
}

/* Components */
.welcome-section {
    max-width: 800px;
    margin: 4rem auto;
    text-align: center;
}

.welcome-section h1 {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    margin-bottom: 0.5rem;
}

.welcome-section p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-top: 4rem;
}

.action-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem 1.5rem;
    text-align: left;
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: var(--shadow-soft);
}

.action-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-medium);
    border-color: #e2e8f0;
}

.action-card .icon-box {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

.action-card h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.action-card p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* History List (Right Column) */
.right-column h2 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-item {
    background: white;
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 0.75rem;
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.history-item:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.history-item .item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.history-item .title {
    font-weight: 600;
    font-size: 0.95rem;
}

.history-item .date {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.history-item .meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Interactive Elements */
.input-container {
    margin-top: auto;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-connected {
    background: #dcfce7;
    color: #166534;
}

.status-disconnected {
    background: #fee2e2;
    color: #991b1b;
}

/* Dashboard Specific */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.kpi-card {
    background: #f8fafc;
    padding: 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.kpi-card .value {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.kpi-card .label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Responsive Table (if still used) */
table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 12px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}

td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    font-size: 0.9rem;
}

.btn-primary {
    background: var(--text-primary);
    color: white;
}

.btn-primary:hover {
    background: #000;
}

.btn-accent {
    background: var(--accent);
    color: white;
}

.btn-accent:hover {
    filter: brightness(1.1);
}

/* Sortable Table Headers */
th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s;
    position: relative;
}

th.sortable:hover {
    background-color: var(--accent-low);
}

th.sortable::after {
    content: '↕';
    font-size: 0.8rem;
    margin-left: 8px;
    opacity: 0.3;
    transition: opacity 0.2s;
}

th.sortable.asc::after {
    content: '↑';
    opacity: 1;
    color: var(--accent);
}

th.sortable.desc::after {
    content: '↓';
    opacity: 1;
    color: var(--accent);
}