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

:root {
    --primary: #10b981;
    --primary-dark: #059669;
    --primary-light: #d1fae5;
    --danger: #ef4444;
    --danger-dark: #dc2626;
    --text: #1f2937;
    --text-light: #6b7280;
    --bg: #f9fafb;
    --card: #ffffff;
    --border: #e5e7eb;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.15);
}

html, body {
    width: 100%;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
}

#app {
    width: 100%;
    height: 100%;
}

.screen {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.screen.hidden {
    display: none;
}

/* Auth Screen */
#auth-screen {
    background: linear-gradient(135deg, #10b981 0%, #059669 50%, #047857 100%);
    align-items: center;
    justify-content: center;
}

.auth-container {
    background: var(--card);
    border-radius: 20px;
    padding: 48px 40px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    max-width: 400px;
    width: 90%;
}

.auth-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.auth-container h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text);
}

.auth-container p {
    color: var(--text-light);
    font-size: 15px;
    margin-bottom: 32px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-small {
    padding: 8px 16px;
    font-size: 13px;
}

.btn-large {
    width: 100%;
    padding: 14px 24px;
    font-size: 15px;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    gap: 16px;
    flex-wrap: wrap;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-icon {
    font-size: 28px;
}

.header-left h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-dark);
}

/* Navigation */
.header-nav {
    display: flex;
    gap: 4px;
    background: var(--bg);
    padding: 4px;
    border-radius: 10px;
}

.nav-link {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-light);
    text-decoration: none;
    transition: all 0.15s;
}

.nav-link:hover {
    color: var(--text);
    background: var(--card);
}

.nav-link.active {
    color: var(--primary-dark);
    background: var(--card);
    box-shadow: var(--shadow);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

#user-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

/* Main Content */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 24px;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

/* Pages */
.page {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.page.hidden {
    display: none;
}

.page-header {
    margin-bottom: 24px;
}

.page-header h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.page-header p {
    color: var(--text-light);
    font-size: 15px;
}

/* Todos Page */
.add-root-form {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.input-field {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
    background: var(--card);
}

.input-field:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.todos-container {
    flex: 1;
    overflow-y: auto;
    position: relative;
}

.todos-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.empty-state {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
}

.empty-state.hidden {
    display: none;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

/* Todo Items */
.todo-item {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 16px;
    transition: all 0.2s;
}

.todo-item:hover {
    box-shadow: var(--shadow);
}

.todo-item.completed > .todo-row .todo-title {
    text-decoration: line-through;
    color: var(--text-light);
}

.todo-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.todo-expand {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--text-light);
    font-size: 10px;
    border-radius: 4px;
    transition: all 0.15s;
}

.todo-expand:hover {
    background: var(--bg);
    color: var(--primary);
}

.todo-expand.has-children::before {
    content: '▶';
}

.todo-expand.expanded::before {
    content: '▼';
}

.todo-expand.no-children {
    visibility: hidden;
}

.todo-checkbox {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    cursor: pointer;
    accent-color: var(--primary);
}

.todo-title {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    word-break: break-word;
}

.todo-actions {
    display: flex;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.15s;
}

.todo-row:hover .todo-actions {
    opacity: 1;
}

.todo-action-btn {
    padding: 6px 10px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.todo-action-btn.add-child {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.todo-action-btn.add-child:hover {
    background: var(--primary);
    color: white;
}

.todo-action-btn.delete {
    background: #fee2e2;
    color: var(--danger);
}

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

/* Nested children */
.todo-children {
    margin-top: 12px;
    margin-left: 36px;
    padding-left: 16px;
    border-left: 2px solid var(--primary-light);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.todo-children.hidden {
    display: none;
}

/* Add child form */
.add-child-form {
    display: none;
    margin-top: 12px;
    margin-left: 36px;
    padding-left: 16px;
    border-left: 2px solid var(--primary-light);
}

.add-child-form.visible {
    display: flex;
    gap: 8px;
}

.add-child-form input {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid var(--primary);
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
}

.add-child-form input:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-light);
}

.add-child-form button {
    padding: 8px 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.add-child-form button:hover {
    background: var(--primary-dark);
}

/* Settings Page */
.settings-section {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
}

.settings-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text);
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.setting-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.setting-row:first-of-type {
    padding-top: 0;
}

.setting-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.setting-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

.setting-desc {
    font-size: 13px;
    color: var(--text-light);
}

.setting-select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: var(--bg);
    cursor: pointer;
    min-width: 140px;
}

.setting-select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Integrations Page */
.integrations-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.integration-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.integration-icon {
    font-size: 32px;
    line-height: 1;
}

.integration-info {
    flex: 1;
}

.integration-info h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.integration-info p {
    font-size: 14px;
    color: var(--text-light);
    line-height: 1.5;
}

.integration-status {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.integration-status.coming-soon {
    background: #fef3c7;
    color: #92400e;
}

.integration-status.connected {
    background: var(--primary-light);
    color: var(--primary-dark);
}

/* About Page */
.about-content {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
}

.about-section {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.about-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.about-logo {
    font-size: 48px;
    margin-bottom: 8px;
}

.about-section h3 {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 4px;
}

.about-tagline {
    color: var(--text-light);
    font-size: 16px;
}

.about-section h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
}

.about-section p {
    font-size: 14px;
    color: var(--text-light);
    line-height: 1.6;
}

.feature-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.feature-list li {
    font-size: 14px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.about-user-info {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 12px;
}

.about-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.about-user-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.about-user-email {
    font-size: 14px;
    color: var(--text-light);
}

/* Not Found Page */
.not-found-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.not-found-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.not-found-content h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.not-found-content p {
    color: var(--text-light);
    margin-bottom: 24px;
}

/* Density variations */
body[data-density="compact"] .todo-item {
    padding: 8px 12px;
}

body[data-density="compact"] .todos-list {
    gap: 4px;
}

body[data-density="compact"] .todo-children {
    gap: 4px;
    margin-top: 8px;
}

body[data-density="spacious"] .todo-item {
    padding: 16px 20px;
}

body[data-density="spacious"] .todos-list {
    gap: 12px;
}

body[data-density="spacious"] .todo-children {
    gap: 12px;
    margin-top: 16px;
}

/* Scrollbar */
.todos-container::-webkit-scrollbar {
    width: 8px;
}

.todos-container::-webkit-scrollbar-track {
    background: transparent;
}

.todos-container::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.todos-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 12px;
        padding: 12px 16px;
    }

    .header-left {
        width: 100%;
        justify-content: center;
    }

    .header-nav {
        width: 100%;
        justify-content: center;
        overflow-x: auto;
    }

    .nav-link {
        padding: 8px 12px;
        font-size: 13px;
    }

    .header-right {
        width: 100%;
        justify-content: center;
    }

    .main {
        padding: 16px;
    }

    .add-root-form {
        flex-direction: column;
    }

    .todo-actions {
        opacity: 1;
    }

    #user-name {
        display: none;
    }

    .setting-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .setting-select {
        width: 100%;
    }

    .integration-card {
        flex-direction: column;
    }

    .integration-status {
        align-self: flex-start;
    }
}
