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

:root {
    --bg: #0f0f1a;
    --bg-card: #1a1a2e;
    --bg-hover: #22223a;
    --fg: #eaeaea;
    --fg-muted: #8888a0;
    --accent: #00d4aa;
    --accent-hover: #00e8bb;
    --danger: #ff4757;
    --danger-hover: #ff6b7a;
    --border: #2a2a4a;
    --shadow: rgba(0, 0, 0, 0.4);
    --radius: 12px;
    --radius-sm: 8px;
    --gap: 16px;
    --gap-sm: 12px;
}

@media (prefers-color-scheme: light) {
    :root {
        --bg: #f5f5f8;
        --bg-card: #ffffff;
        --bg-hover: #eeeeef;
        --fg: #1a1a2e;
        --fg-muted: #666680;
        --accent: #00a884;
        --accent-hover: #00c896;
        --danger: #e03e4e;
        --danger-hover: #e85d6b;
        --border: #dddde8;
        --shadow: rgba(0, 0, 0, 0.08);
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--fg);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.app {
    max-width: 900px;
    margin: 0 auto;
    padding: env(safe-area-inset-top) var(--gap) var(--gap);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--gap-sm) 0;
    position: sticky;
    top: 0;
    background: var(--bg);
    z-index: 10;
    backdrop-filter: blur(8px);
}

header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.5px;
}

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

.btn-voice {
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: var(--bg-card);
    color: var(--fg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px var(--shadow);
    border: 1px solid var(--border);
    transition: all 0.15s;
}

.btn-voice:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    transform: scale(1.05);
}

.btn-voice.listening {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
    animation: pulse 1s infinite;
}

.btn-voice.listening .voice-icon {
    display: none;
}

.btn-voice.listening .voice-icon.listening {
    display: block;
}

.btn-voice .voice-icon.listening {
    display: none;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.7); }
    50% { box-shadow: 0 0 0 12px rgba(255, 71, 87, 0); }
}

.btn-add {
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: var(--accent);
    color: var(--bg);
    font-size: 1.5rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 212, 170, 0.3);
    transition: transform 0.15s, background 0.15s, box-shadow 0.15s;
}

.btn-add:active {
    transform: scale(0.95);
}

.btn-add:hover {
    background: var(--accent-hover);
    box-shadow: 0 6px 16px rgba(0, 212, 170, 0.4);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-voice {
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: var(--bg-card);
    color: var(--fg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px var(--shadow);
    border: 2px solid var(--border);
    transition: all 0.15s;
}

.btn-voice:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
}

.btn-voice.listening {
    background: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(0, 212, 170, 0.6); }
    50% { box-shadow: 0 0 0 12px rgba(0, 212, 170, 0); }
}

.btn-voice .voice-icon.listening {
    display: none;
}

.btn-voice.listening .voice-icon:not(.listening) {
    display: none;
}

.btn-voice.listening .voice-icon.listening {
    display: block;
}

.btn-voice .voice-icon {
    width: 24px;
    height: 24px;
}

.btn-voice .voice-icon.listening {
    display: none;
    width: 24px;
    height: 24px;
}

.columns {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--gap);
    flex: 1;
    min-height: 0;
}

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

.column {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--gap-sm) var(--gap);
    border-bottom: 1px solid var(--border);
}

.column-header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--fg-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge {
    background: var(--accent);
    color: var(--bg);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 100px;
    min-width: 24px;
    text-align: center;
}

.task-list {
    list-style: none;
    overflow-y: auto;
    flex: 1;
    padding: var(--gap-sm);
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 200px;
}

.task-item {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--gap-sm);
    display: flex;
    align-items: center;
    gap: var(--gap-sm);
    transition: border-color 0.15s, box-shadow 0.15s;
    animation: slideIn 0.2s ease-out;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.task-item:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 12px var(--shadow);
}

.task-item.concluida {
    opacity: 0.6;
    border-color: var(--border);
}

.task-item.concluida .task-title {
    text-decoration: line-through;
    color: var(--fg-muted);
}

.task-checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid var(--accent);
    border-radius: 6px;
    appearance: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
}

.task-checkbox:checked {
    background: var(--accent);
    border-color: var(--accent);
}

.task-checkbox:checked::after {
    content: '✓';
    color: var(--bg);
    font-size: 0.85rem;
    font-weight: 700;
}

.task-title {
    flex: 1;
    font-size: 0.95rem;
    word-break: break-word;
    min-width: 0;
}

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

.task-item:hover .task-actions {
    opacity: 1;
}

.btn-icon {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--fg-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--fg);
}

.btn-icon.delete:hover {
    background: rgba(255, 71, 87, 0.15);
    color: var(--danger);
}

.btn-icon svg {
    width: 20px;
    height: 20px;
}

.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--fg-muted);
    text-align: center;
    padding: var(--gap) var(--gap-sm);
    gap: 8px;
}

.empty-state svg {
    width: 48px;
    height: 48px;
    opacity: 0.4;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--gap);
    z-index: 100;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--gap);
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 40px var(--shadow);
    animation: slideUp 0.25s ease-out;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-content h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: var(--gap);
}

.form-group {
    margin-bottom: var(--gap);
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--fg-muted);
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--fg);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 212, 170, 0.15);
}

.form-group input::placeholder {
    color: var(--fg-muted);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--gap-sm);
    margin-top: var(--gap-sm);
}

.btn-cancel, .btn-save {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-cancel {
    background: transparent;
    color: var(--fg-muted);
    border: 1px solid var(--border);
}

.btn-cancel:hover {
    background: var(--bg-hover);
    color: var(--fg);
}

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

.btn-save:hover {
    background: var(--accent-hover);
}

.btn-save:active, .btn-cancel:active {
    transform: scale(0.98);
}

@media (max-width: 480px) {
    .app {
        padding: var(--gap-sm);
    }
    
    header h1 {
        font-size: 1.25rem;
    }
    
    .modal-content {
        margin: var(--gap-sm);
    }
    
    .task-actions {
        opacity: 1;
    }
}

/* PWA */
@media (display-mode: standalone) {
    .app {
        padding-top: env(safe-area-inset-top);
    }
}