:root {
    --bg-primary: #f4f6f8;
    --bg-secondary: #ffffff;
    --bg-tertiary: #2c3e50;
    --bg-info: #e8f5e9;
    --bg-warning: #fff9e6;
    --bg-error: #fef2f2;
    --bg-code: #f4f6f8;
    --bg-task-completed: #f4f6f8;
    --bg-filter: #f4f6f8;
    --border-color: #d1d9e0;
    --text-primary: #2c3e50;
    --text-secondary: #586069;
    --text-tertiary: #7f8c8d;
    --text-header: #ffffff;
    --text-info: #2e7d32;
    --text-warning: #7d6608;
    --text-error: #dc2626;
    --text-completed: #7f8c8d;
    --border-error: #fca5a5;
    --border-warning: #e6b800;
    --button-bg: #4a90e2;
    --button-hover: #357abd;
    --button-active: #2a5f9e;
    --button-secondary: #f4f6f8;
    --button-secondary-hover: #e8eaed;
    --save-saved: #27ae60;
    --save-unsaved: #e74c3c;
    --shadow: rgba(0, 0, 0, 0.1);
    --priority-a: #e74c3c;
    --priority-b: #e67e22;
    --priority-c: #95a5a6;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #1a1a1a;
        --bg-secondary: #2d2d2d;
        --bg-tertiary: #3d3d3d;
        --bg-info: #1a3a1a;
        --bg-warning: #fff9e6;
        --bg-error: #3a1a1a;
        --bg-code: #3d3d3d;
        --bg-task-completed: #252525;
        --bg-filter: #3d3d3d;
        --border-color: #404040;
        --text-primary: #e0e0e0;
        --text-secondary: #a0a0a0;
        --text-tertiary: #808080;
        --text-header: #ffffff;
        --text-info: #66bb6a;
        --text-warning: #7d6608;
        --text-error: #ef5350;
        --text-completed: #808080;
        --border-error: #c62828;
        --border-warning: #e6b800;
        --button-bg: #4a90e2;
        --button-hover: #357abd;
        --button-active: #2a5f9e;
        --button-secondary: #3d3d3d;
        --button-secondary-hover: #4d4d4d;
        --save-saved: #27ae60;
        --save-unsaved: #e74c3c;
        --shadow: rgba(0, 0, 0, 0.3);
        --priority-a: #ef5350;
        --priority-b: #ff9800;
        --priority-c: #9e9e9e;
    }
}

[data-theme="light"] {
    --bg-primary: #f4f6f8;
    --bg-secondary: #ffffff;
    --bg-tertiary: #2c3e50;
    --bg-info: #e8f5e9;
    --bg-warning: #fff9e6;
    --bg-error: #fef2f2;
    --bg-code: #f4f6f8;
    --bg-task-completed: #f4f6f8;
    --bg-filter: #f4f6f8;
    --border-color: #d1d9e0;
    --text-primary: #2c3e50;
    --text-secondary: #586069;
    --text-tertiary: #7f8c8d;
    --text-header: #ffffff;
    --text-info: #2e7d32;
    --text-warning: #7d6608;
    --text-error: #dc2626;
    --text-completed: #7f8c8d;
    --border-error: #fca5a5;
    --border-warning: #e6b800;
    --button-bg: #4a90e2;
    --button-hover: #357abd;
    --button-active: #2a5f9e;
    --button-secondary: #f4f6f8;
    --button-secondary-hover: #e8eaed;
    --save-saved: #27ae60;
    --save-unsaved: #e74c3c;
    --shadow: rgba(0, 0, 0, 0.1);
    --priority-a: #e74c3c;
    --priority-b: #e67e22;
    --priority-c: #95a5a6;
}

[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-tertiary: #3d3d3d;
    --bg-info: #1a3a1a;
    --bg-warning: #fff9e6;
    --bg-error: #3a1a1a;
    --bg-code: #3d3d3d;
    --bg-task-completed: #252525;
    --bg-filter: #3d3d3d;
    --border-color: #404040;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --text-tertiary: #808080;
    --text-header: #ffffff;
    --text-info: #66bb6a;
    --text-warning: #7d6608;
    --text-error: #ef5350;
    --text-completed: #808080;
    --border-error: #c62828;
    --border-warning: #e6b800;
    --button-bg: #4a90e2;
    --button-hover: #357abd;
    --button-active: #2a5f9e;
    --button-secondary: #3d3d3d;
    --button-secondary-hover: #4d4d4d;
    --save-saved: #27ae60;
    --save-unsaved: #e74c3c;
    --shadow: rgba(0, 0, 0, 0.3);
    --priority-a: #ef5350;
    --priority-b: #ff9800;
    --priority-c: #9e9e9e;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 2px;
    box-shadow: 0 1px 3px var(--shadow);
    max-width: 900px;
    width: 100%;
    min-height: 600px;
    position: relative;
}

.container.landing {
    max-width: 500px;
    min-height: auto;
}

.theme-toggle {
    position: absolute;
    top: 16px;
    right: 16px;
    background: var(--bg-filter);
    border: 1px solid var(--border-color);
    border-radius: 2px;
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    color: var(--text-primary);
    transition: all 0.2s;
    z-index: 10;
}

.theme-toggle:hover {
    background: var(--border-color);
}

/* Theme toggle in action buttons (not floating) */
#themeToggleEditor {
    position: static;
    padding: 5px 16px;
    font-size: 14px;
    min-height: 32px;
    line-height: 20px;
}

#themeToggleEditor:hover {
    background: var(--button-secondary-hover);
}

.beta-banner {
    background: var(--bg-warning);
    color: var(--text-warning);
    padding: 8px 20px;
    text-align: center;
    font-size: 12px;
    font-weight: 500;
    border-bottom: 1px solid var(--border-color);
    border-radius: 2px 2px 0 0;
}

.header {
    background: var(--bg-tertiary);
    color: var(--text-header);
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.landing-header {
    padding: 32px 32px 24px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.landing-header h1 {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.landing-header p {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-secondary);
    line-height: 1.5;
}

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

.header h1 {
    font-size: 16px;
    font-weight: 600;
}

.header h1 a {
    color: var(--text-header);
    text-decoration: none;
    cursor: pointer;
}

.header h1 a:hover {
    color: var(--button-bg);
}

.header-note-path {
    font-size: 13px;
    font-family: 'SF Mono', 'Courier New', monospace;
    color: var(--text-secondary);
}

.content {
    padding: 24px;
}

.landing-content {
    padding: 32px;
}

.action-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.action-buttons .button {
    margin: 0;
}

.screen {
    display: none;
}

.screen.active {
    display: block;
}

.form-group {
    margin-bottom: 16px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 5px 12px;
    border: 1px solid var(--border-color);
    border-radius: 2px;
    background: var(--bg-secondary);
    font-size: 14px;
    line-height: 20px;
    color: var(--text-primary);
    font-family: 'SF Mono', 'Courier New', monospace;
    transition: all 0.2s;
    min-height: 32px;
}

input[type="text"]:focus,
input[type="password"]:focus {
    outline: none;
    border-color: var(--button-bg);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

textarea {
    width: 100%;
    min-height: 400px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 2px;
    background: var(--bg-secondary);
    font-size: 13px;
    font-family: 'SF Mono', 'Courier New', monospace;
    resize: vertical;
    transition: all 0.2s;
    line-height: 1.6;
    color: var(--text-primary);
}

textarea:focus {
    outline: none;
    border-color: var(--button-bg);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.button {
    background: var(--button-bg);
    color: #ffffff;
    border: 1px solid var(--button-bg);
    border-radius: 2px;
    padding: 5px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 32px;
    line-height: 20px;
}

.button:hover {
    background: var(--button-hover);
}

.button:active {
    background: var(--button-active);
    box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.15);
}

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

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

.button.full-width {
    width: 100%;
}

.error {
    background: var(--bg-error);
    border: 1px solid var(--border-error);
    border-radius: 2px;
    color: var(--text-error);
    padding: 16px;
    margin-bottom: 16px;
    font-size: 14px;
}

.info {
    background: var(--bg-info);
    border: 1px solid var(--border-color);
    border-radius: 2px;
    color: var(--text-info);
    padding: 16px;
    margin-bottom: 16px;
    font-size: 14px;
    line-height: 1.6;
}

.button-group {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.note-info {
    background: var(--bg-code);
    border: 1px solid var(--border-color);
    border-radius: 2px;
    padding: 16px;
    margin-bottom: 16px;
    font-size: 13px;
}

.note-info strong {
    color: var(--text-primary);
    font-weight: 600;
}

.save-status {
    font-size: 12px;
    font-weight: 500;
    color: #ffffff;
    padding: 4px 12px;
    border-radius: 2px;
    background: var(--save-saved);
}

.save-status.unsaved {
    background: var(--save-unsaved);
}

.save-status.saved {
    background: var(--save-saved);
}

/* Task Manager Styles */
.tasks-section {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.tasks-header {
    margin-bottom: 12px;
    text-align: right;
}

.button-link {
    background: none;
    border: none;
    color: var(--button-bg);
    font-size: 12px;
    cursor: pointer;
    text-decoration: none;
    padding: 0;
}

.button-link:hover {
    text-decoration: underline;
}

.tasks-help {
    background: var(--bg-code);
    border: 1px solid var(--border-color);
    border-radius: 2px;
    padding: 16px;
    margin-bottom: 16px;
    font-size: 13px;
    line-height: 1.8;
}

.help-content code {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 2px;
    padding: 2px 6px;
    font-family: 'SF Mono', 'Courier New', monospace;
    font-size: 12px;
}

.task-input-group {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.task-input-group input {
    flex: 1;
    padding: 5px 12px;
    border: 1px solid var(--border-color);
    border-radius: 2px;
    background: var(--bg-secondary);
    font-size: 14px;
    line-height: 20px;
    color: var(--text-primary);
    font-family: 'SF Mono', 'Courier New', monospace;
    min-height: 32px;
}

.task-input-group input:focus {
    outline: none;
    border-color: var(--button-bg);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.task-input-group .button {
    width: auto;
    margin: 0;
}

.task-search-group {
    margin-bottom: 16px;
}

.task-search-group input {
    width: 100%;
    padding: 5px 12px;
    border: 1px solid var(--border-color);
    border-radius: 2px;
    background: var(--bg-secondary);
    font-size: 14px;
    line-height: 20px;
    color: var(--text-primary);
    font-family: 'SF Mono', 'Courier New', monospace;
    min-height: 32px;
}

.task-search-group input:focus {
    outline: none;
    border-color: var(--button-bg);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.filter-section {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

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

.filter-section-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.tasks-filter {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.filter-btn {
    background: var(--bg-filter);
    border: 1px solid var(--border-color);
    border-radius: 2px;
    color: var(--text-primary);
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 24px;
    line-height: 16px;
}

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

.filter-btn.active {
    background: var(--button-bg);
    color: #ffffff;
    border-color: var(--button-bg);
}

.tasks-list {
    min-height: 100px;
    max-height: 400px;
    overflow-y: auto;
}

.task-item {
    display: flex;
    align-items: flex-start;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 2px;
    margin-bottom: 8px;
    background: var(--bg-secondary);
    font-family: 'SF Mono', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
}

.task-item.completed {
    background: var(--bg-task-completed);
    color: var(--text-completed);
}

.task-item.completed .task-text {
    text-decoration: line-through;
}

.task-checkbox {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-radius: 2px;
    margin-right: 12px;
    cursor: pointer;
    flex-shrink: 0;
    margin-top: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.task-checkbox:hover {
    background: var(--bg-code);
    border-color: var(--button-bg);
}

.task-content {
    flex: 1;
}

.task-text {
    word-break: break-word;
    cursor: pointer;
    padding: 2px 4px;
    margin: -2px -4px;
    border-radius: 2px;
}

.task-text:hover {
    background: var(--bg-code);
}

.task-edit-input {
    width: 100%;
    padding: 5px 8px;
    border: 1px solid var(--border-color);
    border-radius: 2px;
    background: var(--bg-secondary);
    font-size: 13px;
    font-family: 'SF Mono', 'Courier New', monospace;
    line-height: 1.6;
    color: var(--text-primary);
}

.task-edit-input:focus {
    outline: none;
    border-color: var(--button-bg);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.task-priority {
    font-weight: bold;
    margin-right: 6px;
}

.task-priority.priority-a { color: var(--priority-a); }
.task-priority.priority-b { color: var(--priority-b); }
.task-priority.priority-c { color: var(--priority-c); }

.task-tags {
    margin-top: 4px;
    font-size: 12px;
}

.task-tag {
    display: inline-block;
    margin-right: 8px;
    color: var(--text-tertiary);
}

.task-delete {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 18px;
    padding: 0 4px;
    margin-left: 8px;
    border-radius: 2px;
}

.task-delete:hover {
    color: var(--text-error);
    background: var(--bg-error);
}

.notes-section {
    margin-bottom: 20px;
}

.notes-section textarea {
    min-height: 200px;
}

.hidden {
    display: none;
}

.security-notice {
    background: var(--bg-warning);
    border: 2px solid var(--border-warning);
    border-radius: 2px;
    padding: 16px;
    margin-bottom: 24px;
    font-size: 13px;
    line-height: 1.6;
    color: #000000;
}

.security-notice strong {
    color: #000000;
    font-weight: 600;
}

.footer-note {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.footer-note p {
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.6;
}

.footer-note code {
    background: var(--bg-code);
    padding: 2px 6px;
    border-radius: 2px;
    font-family: 'SF Mono', 'Courier New', monospace;
    font-size: 12px;
    color: var(--text-primary);
}

.page-footer {
    margin-top: 32px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    text-align: center;
    font-size: 12px;
    color: var(--text-tertiary);
}

.page-footer a {
    color: var(--button-bg);
    text-decoration: none;
}

.page-footer a:hover {
    text-decoration: underline;
}
