:root {
    /* --- Vision OS Palette --- */
    --primary: #025e73; /* Keeping brand color but used sparingly */
    --accent: #007AFF; /* Apple Blue */
    
    --app-bg: url('https://images.unsplash.com/photo-1618005182384-a83a8bd57fbe?q=80&w=2564&auto=format&fit=crop');
    
    /* The "Glass" Material - Lighter, thinner */
    --glass-bg: rgba(255, 255, 255, 0.65);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-shadow: 0 20px 40px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.4) inset;
    
    /* Text */
    --text-main: #1c1c1e;
    --text-muted: #666668;
    
    /* Shapes */
    --radius-window: 32px;
    --radius-platter: 20px;
    --radius-pill: 999px;
    --radius-sm: 12px;
    
    /* Animation */
    --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    background: var(--app-bg) no-repeat center center fixed;
    background-size: cover;
    color: var(--text-main);
    height: 100vh;
    overflow: hidden; /* App-like feel */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- App Window Layout --- */
.app-window {
    width: 95vw;
    height: 90vh;
    max-width: 1600px;
    background: rgba(245, 245, 247, 0.65);
    backdrop-filter: blur(50px) saturate(180%);
    -webkit-backdrop-filter: blur(50px) saturate(180%);
    border-radius: var(--radius-window);
    box-shadow: 
        0 0 0 1px rgba(255, 255, 255, 0.5) inset,
        0 50px 100px -20px rgba(0, 0, 0, 0.3);
    display: flex;
    overflow: hidden;
    position: relative;
}

/* Sidebar (Ornament) */
.sidebar {
    width: 260px;
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    gap: 32px;
    border-right: 1px solid rgba(0,0,0,0.05);
    background: rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-left: 12px;
    margin-bottom: 8px;
    text-decoration: none;
    color: var(--text-main);
}

.brand-logo {
    width: 32px;
    height: 32px;
    /* background: linear-gradient(135deg, #00C6FF, #0072FF); */
    /* border-radius: 8px; */
    /* box-shadow: 0 4px 12px rgba(0, 114, 255, 0.3); */
}

.brand-logo img {
    width: 100%;
    height: 100%;
}

.brand-name {
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: -0.5px;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-platter);
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-item:hover, .nav-item:focus-visible {
    background: rgba(255, 255, 255, 0.5);
    color: var(--text-main);
    transform: scale(1.02);
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.8);
    color: var(--text-main);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    font-weight: 600;
}

.nav-icon { width: 20px; height: 20px; opacity: 0.8; text-align: center;}

/* Main Stage */
.main-stage {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
    position: relative;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .app-window {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
    }
    .sidebar {
        display: none; /* For now, hide sidebar on mobile or implement hamburger later */
    }
    .main-stage {
        padding: 20px;
    }
}

/* --- Components --- */

/* Cards / Platters */
.glass, .glass-card, .card {
    background: rgba(255, 255, 255, 0.4);
    border-radius: var(--radius-platter);
    padding: 24px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    margin-bottom: 24px;
    transition: transform 0.2s var(--ease-spring), box-shadow 0.2s;
    backdrop-filter: blur(16px); /* Add blur back to cards */
}

.glass:hover, .glass-card:hover, .card:hover {
    background: rgba(255, 255, 255, 0.6);
    box-shadow: 0 8px 24px rgba(0,0,0,0.05);
}

/* Buttons - Pills */
.btn {
    padding: 10px 20px;
    border-radius: var(--radius-pill);
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s var(--ease-spring);
    text-decoration: none;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--text-main); /* Apple style dark button */
    color: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.btn-primary:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 20px rgba(0,0,0,0.25);
    background: black;
    color: white;
}

.btn-secondary, .btn-ghost {
    background: rgba(255, 255, 255, 0.5);
    color: var(--text-main);
    border: 1px solid rgba(0,0,0,0.05);
}

.btn-secondary:hover, .btn-ghost:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: translateY(-1px);
}

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

.btn-accent:hover {
    background: #0062cc;
    transform: translateY(-1px);
}


/* Form Inputs */
.form-control, 
input[type="text"],
input[type="password"],
input[type="email"],
select,
textarea {
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px; /* Slightly less than pill for inputs usually */
    border: 1px solid transparent;
    background: rgba(0, 0, 0, 0.05);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.2s;
    box-sizing: border-box;
    color: var(--text-main);
}

.form-control:focus,
input:focus,
select:focus,
textarea:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.15); /* Blue glow */
}

/* Quick Add Form */
.quick-add-form {
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}

.quick-add-fields {
    display: flex;
    flex-direction: row;
    gap: 0.75rem;
    align-items: center;
}

.quick-add-input,
.quick-add-link,
.quick-add-type {
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid transparent;
    background: rgba(0, 0, 0, 0.05);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.2s;
    box-sizing: border-box;
    color: var(--text-main);
}

.quick-add-input:focus,
.quick-add-link:focus,
.quick-add-type:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.15);
}

.quick-add-input {
    flex: 1 1 auto;
    min-width: 0;
}

.quick-add-link {
    flex: 0 0 200px;
}

.quick-add-type {
    flex: 0 0 120px;
}

.quick-add-submit {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    white-space: nowrap;
}

.quick-add-submit .btn-icon {
    font-size: 1.25rem;
    line-height: 1;
}

@media (max-width: 640px) {
    .quick-add-fields {
        flex-wrap: wrap;
    }

    .quick-add-input {
        flex: 1 1 100%;
        width: 100%;
    }

    .quick-add-link,
    .quick-add-type {
        flex: 1 1 auto;
    }

    .quick-add-submit .btn-text {
        display: none;
    }
}

/* Items List */
.item-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.item-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid transparent;
    transition: all 0.2s;
    margin-bottom: 0; /* Override old margin */
}

.item-card:hover, .item-card.kb-focused {
    background: rgba(255, 255, 255, 0.9);
    transform: scale(1.005);
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
    border-color: rgba(0,0,0,0.05);
}

.item-card.kb-focused {
    border-color: var(--accent);
}

/* Modals - Vision Style */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(230, 230, 235, 0.2); /* Very subtle tint */
    backdrop-filter: blur(20px) saturate(180%); /* Heavy blur is key */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.vision-modal {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(50px);
    width: 500px;
    max-width: 90vw;
    border-radius: 24px;
    box-shadow: 
        0 0 0 1px rgba(255, 255, 255, 0.5) inset, /* Inner rim */
        0 25px 50px -12px rgba(0, 0, 0, 0.25); /* Deep shadow */
    padding: 32px;
    transform: scale(0.9) translateY(10px);
    opacity: 0;
    transition: all 0.4s var(--ease-spring);
    display: flex;
    flex-direction: column;
    max-height: 85vh;
}

.modal-overlay.visible .vision-modal {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.modal-header {
    border-bottom: 1px solid rgba(0,0,0,0.05);
    padding-bottom: 16px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    margin: 0;
    font-size: 1.25rem;
}

.modal-body {
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding-top: 16px;
    margin-top: 16px;
    border-top: 1px solid rgba(0,0,0,0.05);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Flash Messages */
.flash-messages {
    margin-bottom: 2rem;
}

.flash-message {
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.flash-success { border-left: 4px solid #10b981; color: #065f46; }
.flash-error { border-left: 4px solid #ef4444; color: #991b1b; }


/* Utilities */
h1, h2, h3 {
    color: var(--text-main);
    font-weight: 600;
    letter-spacing: -0.5px;
}

.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.mt-4 { margin-top: 1.5rem; }
.mb-4 { margin-bottom: 1.5rem; }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.2); }

/* --- Restored Utilities --- */

/* Glass Checkbox - Apple-style circular */
.glass-checkbox {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 22px;
    height: 22px;
    min-width: 22px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1.5px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), inset 0 1px 2px rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    flex-shrink: 0;
    margin-right: 0.75rem;
}

.glass-checkbox:hover {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.6);
}

.glass-checkbox:checked {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 2px 12px rgba(0, 122, 255, 0.3);
}

.glass-checkbox:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

/* Toast notifications */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 3000; /* High z-index */
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-sm);
  padding: 0.875rem 1.25rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  font-size: 0.9375rem;
  color: var(--text-main);
  max-width: 360px;
  pointer-events: auto;
  transform: translateX(100%);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.toast-visible {
  transform: translateX(0);
  opacity: 1;
}

.toast-success { border-left: 4px solid #10b981; }
.toast-error { border-left: 4px solid #ef4444; }
.toast-warning { border-left: 4px solid #f59e0b; }
.toast-info { border-left: 4px solid var(--accent); }

/* Command palette (Ctrl+K) */
.command-palette-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
  z-index: 4000;
}

.command-palette {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(30px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-md);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  width: 600px;
  max-height: 60vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.command-palette-input {
  padding: 1.25rem;
  border: none;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  font-size: 1.25rem;
  background: transparent;
  outline: none;
  width: 100%;
  color: var(--text-main);
}

.command-palette-results {
  overflow-y: auto;
  flex: 1;
  padding: 0.5rem;
}

.command-palette-item {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: background 0.1s;
}

.command-palette-item:hover,
.command-palette-item.selected {
  background: rgba(0, 122, 255, 0.1);
  color: var(--text-main);
}

.command-palette-item-shortcut {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: monospace;
  background: rgba(0,0,0,0.05);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  background: var(--accent);
  color: white;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  z-index: 5000;
  text-decoration: none;
  font-weight: 500;
}

.skip-link:focus {
  top: 1rem;
}

/* Sidebar Groups */
.nav-group {
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-header {
    padding: 0 16px;
    margin-bottom: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    opacity: 0.7;
}

/* --- Status Filter Tabs --- */
.status-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.status-tabs::-webkit-scrollbar {
    display: none;
}

.status-tabs .tab {
    padding: 0.75rem 1.25rem;
    text-decoration: none;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all 0.15s ease;
    white-space: nowrap;
    font-size: 0.9rem;
    font-weight: 500;
}

.status-tabs .tab:hover {
    color: var(--text-main);
}

.status-tabs .tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Status badges in item lists */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.1rem 0.5rem;
    border-radius: 0.5rem;
}

.status-badge.waiting {
    color: #b45309;
    background: #fef3c7;
}

.status-badge.someday {
    color: #6366f1;
    background: rgba(99, 102, 241, 0.1);
}

.status-badge.archived {
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.05);
}

/* Archived items appear muted */
.item-card.archived {
    opacity: 0.6;
}