/**
 * Main Stylesheet - Airtable/Notion Inspired Design
 * Clean, modern, polished UI
 */

:root {
    /* Airtable-inspired color palette */
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-light: #eff6ff;
    --primary-dark: #1e40af;
    --secondary: #6b7280;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    
    /* Background colors - Airtable style (Light theme) */
    --bg-primary: #ffffff;
    --bg-secondary: #fafbfc;
    --bg-tertiary: #f5f6f8;
    --bg-hover: #f5f6f8;
    --bg-active: #e8f0fe;
    
    /* Text colors (Light theme) */
    --text-primary: #1a1a1a;
    --text-secondary: #6b7280;
    --text-tertiary: #9ca3af;
    --text-inverse: #ffffff;
    --text-muted: #9ca3af;
    
    /* Borders - very subtle like Airtable (Light theme) */
    --border-color: #e5e7eb;
    --border-hover: #d1d5db;
    --border-light: #f3f4f6;
    
    /* Shadows - subtle and clean */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px 0 rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* Border radius */
    --radius-sm: 4px;
    --radius: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    
    /* Typography */
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, "Courier New", monospace;
    
    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
}

/* Dark theme */
[data-theme="dark"] {
    /* Background colors - Dark theme */
    --bg-primary: #1a1a1a;
    --bg-secondary: #121212;
    --bg-tertiary: #1e1e1e;
    --bg-hover: #2a2a2a;
    --bg-active: #1e3a5f;
    
    /* Text colors - Dark theme */
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --text-tertiary: #707070;
    --text-inverse: #1a1a1a;
    --text-muted: #707070;
    
    /* Borders - Dark theme */
    --border-color: #333333;
    --border-hover: #404040;
    --border-light: #2a2a2a;
    
    /* Shadows - Dark theme (more subtle) */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.4), 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.4);
    
    /* Primary light adjustment for dark theme */
    --primary-light: #1e3a5f;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
}

body {
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.01em;
    width: 100%;
    overflow-x: hidden;
}

body:not(.login-page) {
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Typography - Airtable style */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
    margin-bottom: 0.5em;
    letter-spacing: -0.02em;
}

h1 { font-size: 28px; font-weight: 700; }
h2 { font-size: 24px; font-weight: 600; }
h3 { font-size: 20px; font-weight: 600; }
h4 { font-size: 18px; font-weight: 600; }
h5 { font-size: 16px; font-weight: 600; }
h6 { font-size: 14px; font-weight: 600; }

p {
    margin-bottom: 1em;
    color: var(--text-secondary);
}

/* Layout Structure */

/* Sidebar - Airtable style */
.sidebar {
    background: var(--bg-primary);
    border-right: 1px solid var(--border-light);
    width: 240px;
    min-height: 100vh;
    padding: 0;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1000;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.sidebar.collapsed {
    width: 64px;
}

.sidebar-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 60px;
}

.sidebar-header .navbar-brand {
    font-weight: 600;
    font-size: 17px;
    color: var(--text-primary) !important;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-header .navbar-brand:hover {
    color: var(--primary) !important;
}

.sidebar-header .navbar-brand i {
    font-size: 20px;
    flex-shrink: 0;
    color: var(--primary);
}

.sidebar-brand-text {
    transition: opacity 0.2s ease;
    opacity: 1;
}

.sidebar.collapsed .sidebar-brand-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
}

.sidebar-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.sidebar-toggle i {
    font-size: 16px;
    transition: transform 0.3s ease;
}

.sidebar-nav {
    list-style: none;
    padding: 8px;
    margin: 0;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Sidebar scrollbar styling */
.sidebar::-webkit-scrollbar,
.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track,
.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb,
.sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover,
.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* Navbar - Airtable style */
.navbar {
    background: var(--bg-primary) !important;
    border-bottom: 1px solid var(--border-light);
    padding: 10px 24px;
    box-shadow: none;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    width: 100%;
    box-sizing: border-box;
}

[data-theme="dark"] .navbar {
    background: rgba(26, 26, 26, 0.95) !important;
}

.navbar-content {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Theme Toggle Button */
.theme-toggle {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    width: 36px;
    height: 36px;
    font-size: 16px;
    flex-shrink: 0;
}

.theme-toggle:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.theme-toggle:active {
    transform: scale(0.95);
}

.theme-toggle i {
    transition: transform 0.3s ease;
    pointer-events: none;
}

/* User Dropdown */
.user-dropdown {
    position: relative;
    display: inline-block;
}

.user-dropdown-toggle {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    text-decoration: none;
    font-family: inherit;
}

.user-dropdown-toggle span {
    color: inherit;
    text-decoration: none;
}

.user-dropdown-toggle:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.user-dropdown-toggle:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.user-dropdown-toggle i:first-child {
    font-size: 18px;
}

.user-dropdown-toggle i:last-child {
    font-size: 12px;
    transition: transform 0.2s ease;
}

.user-dropdown.active .user-dropdown-toggle i:last-child {
    transform: rotate(180deg);
}

.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    padding: 4px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
    z-index: 1000;
    overflow: hidden;
}

.user-dropdown.active .user-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 400;
    transition: background 0.15s ease;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.user-dropdown-item,
.user-dropdown-item:link,
.user-dropdown-item:visited,
.user-dropdown-item:active {
    color: var(--text-primary);
    text-decoration: none;
    border: none;
    outline: none;
}

.user-dropdown-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    text-decoration: none;
}

.user-dropdown-item:focus {
    background: var(--bg-hover);
    outline: none;
}

.user-dropdown-item span {
    flex: 1;
    color: inherit;
}

.user-dropdown-item i {
    font-size: 16px;
    width: 18px;
    text-align: center;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.user-dropdown-item:hover i {
    color: var(--text-primary);
}

.user-dropdown-item-danger {
    color: var(--danger);
}

.user-dropdown-item-danger,
.user-dropdown-item-danger:link,
.user-dropdown-item-danger:visited,
.user-dropdown-item-danger:active {
    color: var(--danger);
    text-decoration: none;
}

.user-dropdown-item-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    text-decoration: none;
}

.user-dropdown-item-danger i {
    color: var(--danger);
}

.user-dropdown-item-danger:hover i {
    color: var(--danger);
}

.user-dropdown-divider {
    height: 1px;
    background: var(--border-light);
    margin: 4px 0;
    border: none;
}

/* Ensure dropdown items don't inherit any default link styles */
.user-dropdown-menu a,
.user-dropdown-menu a:link,
.user-dropdown-menu a:visited,
.user-dropdown-menu a:active,
.user-dropdown-menu a:hover {
    text-decoration: none !important;
    color: inherit !important;
    border: none !important;
    outline: none !important;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 80px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 320px;
    max-width: 420px;
    padding: 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto;
    cursor: default;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 14px;
}

.toast-info .toast-icon {
    background: var(--primary-light);
    color: var(--primary);
}

.toast-success .toast-icon {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.toast-warning .toast-icon {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.toast-error .toast-icon {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.toast-payment .toast-icon {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
}

.toast-maintenance .toast-icon {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.toast-lease .toast-icon {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
}

.toast-document .toast-icon {
    background: rgba(107, 114, 128, 0.1);
    color: var(--secondary);
}

.toast-system .toast-icon {
    background: rgba(107, 114, 128, 0.1);
    color: var(--secondary);
}

.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.4;
}

.toast-message {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.toast-close {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    padding: 0;
    transition: all 0.2s;
}

.toast-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.toast:hover {
    box-shadow: var(--shadow-xl);
}

/* Notification Dropdown */
.notification-dropdown {
    position: relative;
}

.notification-toggle {
    position: relative;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    padding: 8px;
    cursor: pointer;
    border-radius: var(--radius);
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--danger);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    line-height: 1.4;
}

.notification-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 380px;
    max-width: calc(100vw - 32px);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    display: none;
    flex-direction: column;
    max-height: 500px;
    overflow: hidden;
}

.notification-dropdown.active .notification-dropdown-menu {
    display: flex;
}

.notification-dropdown-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notification-dropdown-header h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

.notification-view-all {
    font-size: 13px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.notification-view-all:hover {
    text-decoration: underline;
}

.notification-dropdown-body {
    max-height: 400px;
    overflow-y: auto;
    padding: 8px 0;
}

.notification-loading {
    padding: 24px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

.notification-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    gap: 12px;
    transition: background 0.15s ease;
    cursor: pointer;
}

.notification-item:hover {
    background: var(--bg-hover);
}

.notification-item.unread {
    background: var(--primary-light);
}

.notification-item.unread:hover {
    background: var(--bg-hover);
}

.notification-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--text-secondary);
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 4px;
}

.notification-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.4;
}

.notification-time {
    font-size: 12px;
    color: var(--text-tertiary);
    white-space: nowrap;
    flex-shrink: 0;
}

.notification-message {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 4px 0 0 0;
    line-height: 1.5;
}

.notification-link {
    font-size: 13px;
    color: var(--primary);
    text-decoration: none;
    margin-top: 6px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
}

.notification-link:hover {
    text-decoration: underline;
}

.notification-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.notification-dropdown-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border-light);
    text-align: center;
}

.notification-view-all-link {
    font-size: 13px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.notification-view-all-link:hover {
    text-decoration: underline;
}

/* Notifications Page */
.notification-list {
    display: flex;
    flex-direction: column;
}

.notification-list .notification-item {
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    margin-bottom: 12px;
    padding: 16px;
}

.notification-list .notification-item.unread {
    border-left: 3px solid var(--primary);
}

.notification-item[data-link]:hover {
    background: var(--bg-hover);
    transform: translateX(-2px);
}

/* Main Wrapper */
.main-wrapper {
    margin-left: 240px;
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: calc(100% - 240px);
    box-sizing: border-box;
}

.sidebar.collapsed ~ .main-wrapper,
body.sidebar-collapsed .main-wrapper {
    margin-left: 64px;
    width: calc(100% - 64px);
}

.nav-link {
    color: var(--text-secondary);
    padding: 8px 12px;
    margin: 2px 0;
    border-radius: var(--radius);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s ease;
    position: relative;
    white-space: nowrap;
}

.nav-link:hover {
    color: var(--text-primary);
    background-color: var(--bg-hover);
}

.nav-link.active {
    color: var(--primary);
    background-color: var(--bg-active);
    font-weight: 600;
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--primary);
    border-radius: 0 2px 2px 0;
}

.nav-link i {
    font-size: 16px;
    width: 20px;
    text-align: center;
    opacity: 0.8;
    flex-shrink: 0;
}

.nav-link.active i {
    opacity: 1;
}

.nav-text {
    transition: opacity 0.2s ease;
    opacity: 1;
    overflow: hidden;
}

.sidebar.collapsed .nav-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 8px;
}

/* Main Content */
main {
    padding: 24px 32px;
    max-width: 1600px;
    margin: 0 auto;
    min-height: calc(100vh - 60px);
    flex: 1;
    width: 100%;
    box-sizing: border-box;
}

/* Cards - Airtable style */
.card {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: all 0.2s ease;
}

.card:hover {
    box-shadow: var(--shadow);
    border-color: var(--border-color);
}

.card-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-secondary);
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.card-body {
    padding: 20px;
}

/* Buttons - Airtable style */
.btn {
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: var(--text-inverse);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.btn-outline-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-outline-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-info {
    background: var(--info);
    color: var(--text-inverse);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-info:hover {
    background: #2563eb;
    color: var(--text-inverse);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Tables - Airtable style */
.table-responsive {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 0;
}

.table thead {
    background: var(--bg-secondary);
    position: sticky;
    top: 0;
    z-index: 10;
}

.table th {
    padding: 10px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-light);
    white-space: nowrap;
    position: relative;
}

.table th:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 0;
    top: 20%;
    height: 60%;
    width: 1px;
    background: var(--border-light);
}

.table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
    font-size: 14px;
    vertical-align: middle;
}

.table tbody tr {
    transition: background-color 0.1s ease;
    cursor: pointer;
}

.table tbody tr:hover {
    background-color: var(--bg-hover);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table tbody tr:not(:last-child) td {
    border-bottom: 1px solid var(--border-light);
}

/* Forms - Airtable style */
.form-control,
.form-select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.15s ease;
    width: 100%;
    line-height: 1.5;
}

.form-control:hover,
.form-select:hover {
    border-color: var(--border-hover);
}

.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-control::placeholder {
    color: var(--text-tertiary);
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 13px;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

/* Badges - Airtable style */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-transform: capitalize;
    letter-spacing: -0.01em;
}

.bg-success {
    background: #d1fae5;
    color: #065f46;
}

[data-theme="dark"] .bg-success {
    background: #064e3b;
    color: #6ee7b7;
}

.bg-primary {
    background: var(--primary-light);
    color: var(--primary-dark);
}

[data-theme="dark"] .bg-primary {
    background: #1e3a5f;
    color: #93c5fd;
}

.bg-warning {
    background: #fef3c7;
    color: #92400e;
}

[data-theme="dark"] .bg-warning {
    background: #78350f;
    color: #fcd34d;
}

.bg-danger {
    background: #fee2e2;
    color: #991b1b;
}

[data-theme="dark"] .bg-danger {
    background: #7f1d1d;
    color: #fca5a5;
}

.bg-info {
    background: #dbeafe;
    color: #1e40af;
}

[data-theme="dark"] .bg-info {
    background: #1e3a5f;
    color: #93c5fd;
}

.bg-secondary {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    border: 1px solid;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-danger {
    background: #fee2e2;
    border-color: #fecaca;
    color: #991b1b;
}

[data-theme="dark"] .alert-danger {
    background: #7f1d1d;
    border-color: #991b1b;
    color: #fca5a5;
}

.alert-success {
    background: #d1fae5;
    border-color: #a7f3d0;
    color: #065f46;
}

[data-theme="dark"] .alert-success {
    background: #064e3b;
    border-color: #065f46;
    color: #6ee7b7;
}

/* Modals - Airtable style */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

[data-theme="dark"] .modal {
    background: rgba(0, 0, 0, 0.7);
}

.modal.show {
    display: flex;
}

.modal-dialog {
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-dialog.modal-lg {
    max-width: 800px;
}

.modal-content {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

.modal-header {
    border-bottom: 1px solid var(--border-light);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.01em;
}

.btn-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-tertiary);
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    transition: all 0.15s ease;
}

.btn-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    border-top: 1px solid var(--border-light);
    padding: 16px 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    background: var(--bg-secondary);
}

/* Stats Cards - Airtable style */
.stats-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.stats-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--primary-hover));
    opacity: 0;
    transition: opacity 0.2s ease;
}

.stats-card:hover {
    box-shadow: var(--shadow);
    border-color: var(--border-color);
    transform: translateY(-1px);
}

.stats-card:hover::before {
    opacity: 1;
}

.stats-card h5 {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.stats-card h5 i {
    font-size: 14px;
    opacity: 0.7;
}

.stats-card h2 {
    font-size: 28px;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

[data-theme="dark"] .login-container {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.login-card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px;
    width: 100%;
    max-width: 400px;
}

.login-card h3 {
    text-align: center;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.login-card .text-muted {
    text-align: center;
    font-size: 13px;
    color: var(--text-tertiary);
    margin-bottom: 32px;
}

/* Utilities */
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-primary { color: var(--primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-tertiary); }

/* Grid utilities */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -8px;
}

.row.g-3 {
    gap: 12px;
    margin: 0;
}

.col-md-3,
.col-md-4,
.col-md-6 {
    padding: 0 8px;
    flex: 1;
    min-width: 0;
}

.col-md-3 {
    flex: 0 0 25%;
    max-width: 25%;
}

.col-md-4 {
    flex: 0 0 33.333333%;
    max-width: 33.333333%;
}

.col-md-6 {
    flex: 0 0 50%;
    max-width: 50%;
}

@media (max-width: 768px) {
    .col-md-3,
    .col-md-4,
    .col-md-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* Utilities */
.mb-4 { margin-bottom: 24px; }
.mb-3 { margin-bottom: 16px; }
.mt-3 { margin-top: 16px; }
.mt-5 { margin-top: 48px; }
.text-center { text-align: center; }

/* Responsive */
@media (max-width: 768px) {
    main {
        padding: 16px;
    }
    
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-wrapper {
        margin-left: 0 !important;
        width: 100% !important;
    }
    
    .sidebar.collapsed {
        width: 240px;
    }
}

/* Empty states */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-tertiary);
}

.empty-state i {
    font-size: 48px;
    opacity: 0.3;
    margin-bottom: 16px;
    display: block;
}

.empty-state p {
    font-size: 14px;
    margin: 0;
}

/* Page header */
.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

/* Filter bar */
.filter-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
}

/* Smooth transitions */
* {
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

/* Highlight row for deep linking */
.highlight-row {
    background: var(--primary-light) !important;
    animation: highlightFade 3s ease-out;
}

@keyframes highlightFade {
    0% {
        background: var(--primary-light);
    }
    100% {
        background: transparent;
    }
}
