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

:root {
    /* Pure Minimalist Dark Theme (Linear.app / Stripe Inspired) */
    --bg-base: #000000;
    --bg-app: #080808;
    --bg-surface: #121212;
    --bg-surface-hover: #1A1A1A;
    --bg-elevated: #1E1E1E;

    /* Very subtle, 1px sharp borders */
    --border: #222222;
    --border-light: rgba(255, 255, 255, 0.05);
    --border-focus: #333333;

    /* Typography */
    --text-primary: #EDEDED;
    --text-secondary: #A1A1AA;
    --text-tertiary: #71717A;

    /* Accents (Muted & Elegant) */
    --accent: #E5E5E5;
    /* Primary button background */
    --accent-text: #000000;
    /* Primary button text */

    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --info: #3B82F6;

    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 20px;
    --radius-pill: 9999px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: var(--bg-app);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    /* Subtle dot grid for depth */
    background-image: radial-gradient(var(--border) 1px, transparent 1px);
    background-size: 24px 24px;
}

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

/* ==========================================================================
   FLOATING PILL NAVIGATION (Dynamic Island Style)
   ========================================================================== */
.nav-wrapper {
    position: fixed;
    top: 24px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    z-index: 100;
    pointer-events: none;
    /* Let clicks pass through outside the pill */
}

.floating-nav {
    pointer-events: auto;
    background: rgba(18, 18, 18, 0.7);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    padding: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.02) inset;
}

.nav-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--text-primary);
    color: var(--bg-app);
    font-weight: 800;
    font-size: 16px;
    margin-right: 8px;
    margin-left: 2px;
}

.nav-links {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-pill);
    padding: 2px;
}

.nav-link {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: var(--radius-pill);
    transition: all 0.2s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-link:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
    color: var(--bg-app);
    background: var(--text-primary);
    font-weight: 600;
}

.nav-divider {
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 8px;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-action-btn:hover {
    color: var(--text-primary);
    background: var(--bg-surface-hover);
}

.nav-user {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #333, #111);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: white;
    cursor: pointer;
    margin-left: 4px;
}

/* ==========================================================================
   MAIN CONTENT & TYPOGRAPHY
   ========================================================================== */
.main-container {
    padding: 100px 32px 40px;
    /* Space for floating nav */
    flex: 1;
    max-width: 1280px;
    margin: 0 auto;
    width: 100%;
}

.page-header {
    margin-bottom: 32px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
}

.page-title {
    font-size: 32px;
    font-weight: 600;
    letter-spacing: -1px;
    color: var(--text-primary);
    line-height: 1.1;
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 8px;
}

/* ==========================================================================
   BENTO GRID LAYOUT
   ========================================================================== */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 180px;
    gap: 16px;
    margin-bottom: 24px;
}

.bento-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
    transition: border-color 0.2s, transform 0.2s;
}

.bento-card:hover {
    border-color: var(--border-focus);
}

.bento-card.wide {
    grid-column: span 2;
}

.bento-card.tall {
    grid-row: span 2;
}

.bento-card.large {
    grid-column: span 2;
    grid-row: span 2;
}

.bento-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.bento-value {
    font-size: 36px;
    font-weight: 500;
    letter-spacing: -1.5px;
    color: var(--text-primary);
}

.bento-trend {
    font-size: 12px;
    font-weight: 500;
    color: var(--success);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Inline Sparkline Container */
.sparkline-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    opacity: 0.3;
}

/* ==========================================================================
   SEGMENTED CONTROL (Marketplaces)
   ========================================================================== */
.segmented-control {
    display: inline-flex;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 4px;
    margin-bottom: 24px;
    overflow-x: auto;
    max-width: 100%;
    scrollbar-width: none;
}

.segmented-control::-webkit-scrollbar {
    display: none;
}

.segment-item {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

.segment-item:hover {
    color: var(--text-primary);
}

.segment-item.active {
    background: var(--border);
    color: var(--text-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.segment-count {
    background: var(--bg-app);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    border: 1px solid var(--border);
}

/* ==========================================================================
   MINIMALIST FORMS & BUTTONS
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

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

.btn-primary:hover {
    background: #FFFFFF;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
}

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

.btn-secondary:hover {
    background: var(--bg-surface-hover);
    border-color: var(--border-focus);
}

.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.form-group {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

@media (max-width: 600px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }
}

.w-full {
    width: 100%;
}

.form-control {
    width: 100%;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Fix for Chrome autofill in dark mode */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px var(--bg-surface) inset !important;
    -webkit-text-fill-color: var(--text-primary) !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* ==========================================================================
   MACOS STYLE TABLE
   ========================================================================== */
.table-wrapper {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-tertiary);
    border-bottom: 1px solid var(--border);
    background: var(--bg-surface);
}

td {
    padding: 14px 16px;
    font-size: 13px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
    background: var(--bg-app);
    vertical-align: middle;
}

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

tbody tr:hover td {
    background: var(--bg-surface);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
}

.dot-warning {
    background: var(--warning);
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}

.dot-info {
    background: var(--info);
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.4);
}

.dot-success {
    background: var(--success);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-blue {
    background: rgba(59, 130, 246, 0.15);
    color: #60A5FA;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-indigo {
    background: rgba(99, 102, 241, 0.15);
    color: #818CF8;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.badge-yellow {
    background: rgba(245, 158, 11, 0.15);
    color: #FBBF24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-green {
    background: rgba(16, 185, 129, 0.15);
    color: #34D399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-red {
    background: rgba(239, 68, 68, 0.15);
    color: #F87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-gray {
    background: rgba(156, 163, 175, 0.15);
    color: #9CA3AF;
    border: 1px solid rgba(156, 163, 175, 0.3);
}

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

/* Auth Styles */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top right, #111 0%, var(--bg-app) 40%);
}

.auth-card {
    background: rgba(18, 18, 18, 0.6);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 48px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 32px;
}

.auth-logo-icon {
    width: 40px;
    height: 40px;
    background: var(--text-primary);
    color: var(--bg-app);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
}

.auth-logo-text {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -1px;
}

.auth-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    text-align: center;
}

.auth-subtitle {
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 32px;
}

/* ==========================================================================
   MODALS & CARDS
   ========================================================================== */
.modal-overlay-flex {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-surface);
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    padding: 24px;
}

.card-footer {
    padding: 16px 24px;
    background: var(--bg-app);
}