:root {
    /* Refined Light Mode - "Ivory & Slate" */
    --bg-color: #f8f9fa;
    --text-color: #1a1c1e;
    --text-muted: #64748b;
    --card-bg: #ffffff;
    --nav-bg: rgba(248, 249, 250, 0.8);
    --border-color: rgba(0, 0, 0, 0.06);
    --primary: #0f172a;
    --primary-foreground: #ffffff;
    --accent: #3b82f6;
    --success: #10b981;
    --danger: #ef4444;
    --gold: #b45309;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.02);
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-3xl: 2rem;
}

.dark {
    /* Refined Dark Mode - "Obsidian & Slate" */
    --bg-color: #030712;
    --text-color: #f9fafb;
    --text-muted: #9ca3af;
    --card-bg: #0b0f1a;
    --nav-bg: rgba(3, 7, 18, 0.85);
    --border-color: rgba(255, 255, 255, 0.06);
    --primary: #f9fafb;
    --primary-foreground: #030712;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.5), 0 8px 10px -6px rgb(0 0 0 / 0.5);
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    transition: background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1), color 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-font-smoothing: antialiased;
}

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

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
}

input, select, textarea {
    font-family: inherit;
}

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

.page-transition {
    animation: fadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Ensure body starts hidden if using Alpine for entry, 
   but for CSS-only we apply to the main content area */
main {
    opacity: 0;
}

main.page-transition {
    opacity: 1;
}
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 70px;
    z-index: 1000;
    background: var(--nav-bg);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

.dark .navbar {
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.navbar-content {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-container {
    width: 40px;
    height: 40px;
    background: transparent;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Remove all logo filters */
.dark .logo-img, .logo-img {
    filter: none;
}

/* Remove the old .light .logo-img if it exists elsewhere, 
   but based on my previous Write call, it's near here. */


.nav-brand span:first-child {
    display: none;
}

@media (min-width: 640px) {
    .nav-brand span:first-child {
        display: block;
    }
}

.nav-brand div:last-child span:last-child {
    display: none;
}

@media (min-width: 768px) {
    .nav-brand div:last-child span:last-child {
        display: block;
    }
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

@media (min-width: 768px) {
    .nav-actions {
        gap: 1.5rem;
    }
}

.nav-link {
    font-size: 0.625rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.6;
    transition: opacity 0.2s;
}

@media (max-width: 639px) {
    .nav-link {
        font-size: 0.5rem;
    }
}

.nav-link:hover {
    opacity: 1;
}

.user-profile div {
    display: none;
}

@media (min-width: 768px) {
    .user-profile div {
        display: block;
    }
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.25rem;
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    transition: all 0.3s;
}

@media (min-width: 768px) {
    .user-profile {
        padding: 0.375rem 0.375rem 0.375rem 1rem;
    }
}

.dark .user-profile {
    background: rgba(128, 128, 128, 0.05);
}

.user-profile:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: var(--text-muted);
}

.avatar {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    object-fit: cover;
}

/* Main Content */
main.container {
    padding-top: 100px;
    padding-bottom: 64px;
    display: block;
}

@media (min-width: 768px) {
    main.container {
        padding-top: 120px;
    }
}

@media (min-width: 1024px) {
    main.container {
        padding-top: 140px;
    }
}

/* Stats Grid spacing */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 3rem;
    margin-top: 2rem;
}

@media (min-width: 640px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.stat-box {
    background: linear-gradient(145deg, var(--card-bg), #f1f3f5);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-2xl);
    padding: 2rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.dark .stat-box {
    background: var(--card-bg);
}

.stat-box::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, transparent 100%);
    pointer-events: none;
}

.stat-box:hover {
    transform: translateY(-6px);
    border-color: var(--accent);
    box-shadow: var(--shadow-lg);
    background: var(--card-bg);
}

.stat-label {
    font-size: 0.625rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-muted);
    margin-bottom: 1rem;
    display: block;
}

.stat-value {
    font-size: 2.25rem;
    font-weight: 800;
    letter-spacing: -0.05em;
    display: flex;
    align-items: baseline;
    gap: 0.375rem;
    color: var(--text-color);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.dark .stat-value {
    text-shadow: none;
}

.stat-unit {
    font-size: 0.875rem;
    font-weight: 700;
    opacity: 0.5;
    text-transform: uppercase;
}

/* Section Header */
.section-header {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    margin-bottom: 2.5rem;
    gap: 2rem;
}

@media (min-width: 768px) {
    .section-header {
        flex-direction: row;
        align-items: flex-end;
    }
}

.section-title {
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: -0.025em;
    margin-bottom: 0.75rem;
}

/* Premium Tab Switcher */
.tab-switch {
    display: inline-flex;
    background: rgba(0, 0, 0, 0.03);
    padding: 0.375rem;
    border-radius: 1.25rem;
    border: 1px solid var(--border-color);
    position: relative;
    gap: 0.25rem;
}

.dark .tab-switch {
    background: rgba(128, 128, 128, 0.08);
}

.tab-option {
    padding: 0.625rem 1.5rem;
    border-radius: 1rem;
    font-size: 0.6875rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    z-index: 1;
    cursor: pointer;
}

.tab-option:hover {
    color: var(--text-color);
    background: rgba(128, 128, 128, 0.05);
}

.tab-option.active {
    color: var(--primary-foreground);
    background: var(--primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.dark .tab-option.active {
    box-shadow: var(--shadow);
}

.tab-count {
    font-size: 0.625rem;
    background: rgba(128, 128, 128, 0.15);
    padding: 0.125rem 0.5rem;
    border-radius: 2rem;
    font-weight: 900;
}

.tab-option.active .tab-count {
    background: rgba(255, 255, 255, 0.2);
}

/* Cards Grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .cards-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .cards-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* Dashboard Card Enhancements */
.dashboard-card {
    background: linear-gradient(145deg, var(--card-bg), #fdfdfd);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-3xl);
    padding: 2rem;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.dark .dashboard-card {
    background: var(--card-bg);
}

.dashboard-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px) scale(1.01);
    border-color: var(--accent);
    background: var(--card-bg);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
}

.counterparty-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.icon-box {
    width: 36px;
    height: 36px;
    background: rgba(128, 128, 128, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
}

.card-label {
    font-size: 0.5rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.2;
    margin-bottom: 0.125rem;
}

.card-value {
    font-size: 0.75rem;
    font-weight: 700;
    opacity: 0.9;
}

.card-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.card-stat-title {
    font-size: 0.5rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    opacity: 0.2;
    margin-bottom: 0.375rem;
}

.card-stat-value {
    font-size: 1.5rem;
    font-weight: 900;
    display: flex;
    align-items: baseline;
    gap: 0.125rem;
}

.card-actions {
    display: flex;
    gap: 0.625rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-color);
}

.card-btn {
    flex: 1;
    padding: 0.75rem;
    border-radius: 0.75rem;
    background: rgba(128, 128, 128, 0.05);
    border: 1px solid var(--border-color);
    font-size: 0.5625rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    text-align: center;
    transition: all 0.2s;
}

.card-btn:hover {
    background: var(--primary);
    color: var(--primary-foreground);
}

/* Buttons */
.btn-primary {
    background: var(--primary);
    color: var(--primary-foreground);
    padding: 0.875rem 1.75rem;
    border-radius: var(--radius-xl);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
    cursor: pointer;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    filter: brightness(1.1);
    border-color: rgba(255, 255, 255, 0.1);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: rgba(128, 128, 128, 0.08);
    color: var(--text-color);
    padding: 0.875rem 1.75rem;
    border-radius: var(--radius-xl);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: all 0.3s;
    border: 1px solid var(--border-color);
    cursor: pointer;
}

.btn-secondary:hover {
    background: rgba(128, 128, 128, 0.12);
    border-color: var(--text-muted);
}

.action-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(128, 128, 128, 0.05);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: var(--text-color);
    cursor: pointer;
}

.action-btn:hover {
    background: var(--primary);
    color: var(--primary-foreground);
    transform: scale(1.1);
}

.action-btn.delete:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
}

/* Modal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.dark .modal-backdrop {
    background: rgba(0, 0, 0, 0.85);
}

.modal-container {
    background: var(--card-bg);
    width: 100%;
    max-width: 36rem;
    border-radius: var(--radius-3xl);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    position: relative;
    box-shadow: var(--shadow-lg);
    max-height: 95vh;
    overflow-y: auto;
}

@media (min-width: 640px) {
    .modal-container {
        padding: 3rem;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2.5rem;
}

.modal-title {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    margin-bottom: 0.375rem;
    color: var(--text-color);
}

.modal-subtitle {
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--text-muted);
}

.form-grid {
    display: grid;
    gap: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 1.5rem;
}

@media (min-width: 640px) {
    .form-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.form-label {
    font-size: 0.625rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-muted);
    padding-left: 0.25rem;
}

.input-field {
    background: rgba(128, 128, 128, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 0.875rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-color);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
}

.input-field:focus {
    outline: none;
    background: rgba(128, 128, 128, 0.08);
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

/* Tab Switcher Enhancements */
.tab-switch {
    background: rgba(0, 0, 0, 0.03);
    padding: 0.25rem;
    border-radius: var(--radius-2xl);
    border: 1px solid var(--border-color);
    display: inline-flex;
    backdrop-filter: blur(8px);
}

.dark .tab-switch {
    background: rgba(128, 128, 128, 0.05);
}

.tab-option {
    padding: 0.5rem 1.25rem;
    border-radius: calc(var(--radius-2xl) - 0.25rem);
    font-size: 0.6875rem;
    font-weight: 700;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
}

.tab-option.active {
    background: var(--card-bg);
    color: var(--text-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.dark .tab-option.active {
    background: var(--primary);
    color: var(--primary-foreground);
    box-shadow: var(--shadow);
}

.tab-count {
    font-size: 0.625rem;
    background: rgba(128, 128, 128, 0.1);
    padding: 0.125rem 0.375rem;
    border-radius: 0.5rem;
    font-weight: 800;
}

.tab-option.active .tab-count {
    background: rgba(128, 128, 128, 0.2);
}

.btn-submit {
    flex: 2;
}

/* Home Page Specific Styles */
.hero-section {
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 2rem;
    position: relative;
}

.hero-title {
    font-size: clamp(2.5rem, 8vw, 4.5rem);
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: -0.05em;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
}

.hero-subtitle {
    font-size: clamp(1rem, 2vw, 1.125rem);
    font-weight: 600;
    opacity: 0.5;
    max-width: 700px;
    margin-bottom: 4rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    line-height: 1.6;
}

.nav-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 1.5rem;
    width: 100%;
    max-width: 1100px;
}

@media (min-width: 768px) {
    .nav-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.nav-card {
    background: linear-gradient(145deg, var(--card-bg), #f8f9fa);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-3xl);
    padding: 2.5rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    cursor: pointer;
}

.dark .nav-card {
    background: var(--card-bg);
}

.nav-card:hover {
    transform: translateY(-8px);
    border-color: var(--accent);
    box-shadow: var(--shadow-lg);
    background: var(--card-bg);
}

.nav-card-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: rgba(128, 128, 128, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    transition: all 0.3s ease;
}

.nav-card:hover .nav-card-icon {
    background: var(--accent);
    color: white;
}

.nav-card-title {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.025em;
}

.nav-card-desc {
    font-size: 0.9375rem;
    opacity: 0.6;
    line-height: 1.6;
}

.hero-bg-accent {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
    opacity: 0.05;
    pointer-events: none;
    z-index: -1;
}

/* Responsive Utilities */
.flex-responsive {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

@media (min-width: 640px) {
    .flex-responsive {
        flex-direction: row;
        justify-content: center;
        gap: 3rem;
    }
}

.text-center { text-align: center; }
.max-w-800 { max-width: 800px; margin: 0 auto; }

/* Utilities */
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.opacity-20 { opacity: 0.2; }
.opacity-40 { opacity: 0.4; }
.animate-spin { animation: spin 1s linear infinite; }

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-color); }
::-webkit-scrollbar-thumb { 
    background: var(--border-color); 
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
