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

:root {
    --primary: #4F46E5;
    --primary-light: #818CF8;
    --bg: #F9FAFB;
    --card: #FFFFFF;
    --text: #111827;
    --text-muted: #6B7280;
    --border: #E5E7EB;
    --success: #10B981;
    --danger: #EF4444;
    --checked-bg: #F3F4F6;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100dvh;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
}

/* --- Login --- */
.login-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100dvh;
    padding: 2rem;
}

.login-screen h1 {
    font-size: 2rem;
    margin-bottom: 0.25rem;
    color: var(--primary);
}

.login-screen p {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.login-form {
    width: 100%;
    max-width: 320px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.login-form input {
    padding: 0.875rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.login-form input:focus {
    border-color: var(--primary);
}

.btn {
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-primary:active {
    background: #4338CA;
    transform: scale(0.98);
}

.login-error {
    color: var(--danger);
    font-size: 0.875rem;
    text-align: center;
    min-height: 1.25rem;
}

/* --- App --- */
.app-screen {
    display: none;
    flex-direction: column;
    min-height: 100dvh;
}

.app-screen.active { display: flex; }
.login-screen.hidden { display: none; }

/* Header */
.header {
    background: var(--primary);
    color: white;
    padding: 0.875rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: sticky;
    top: 0;
    z-index: 10;
}

.header h1 {
    font-size: 1.125rem;
    font-weight: 700;
    flex: 1;
}

.header-user span {
    font-size: 0.8rem;
    opacity: 0.85;
}

/* Hamburger */
.hamburger {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 28px;
}

.hamburger span {
    display: block;
    width: 100%;
    height: 2.5px;
    background: white;
    border-radius: 2px;
    transition: all 0.3s;
}

/* Sidebar */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 40;
}

.sidebar-overlay.active { display: block; }

.sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100%;
    background: var(--card);
    z-index: 50;
    transition: left 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 20px rgba(0,0,0,0.15);
}

.sidebar.open { left: 0; }

.sidebar-header {
    background: var(--primary);
    color: white;
    padding: 2.5rem 1.5rem 1.5rem;
}

.sidebar-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

.sidebar-sub {
    font-size: 0.85rem;
    opacity: 0.85;
}

.sidebar-menu {
    flex: 1;
    padding: 1rem 0;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s;
}

.sidebar-item:active { background: var(--checked-bg); }

.sidebar-item.active {
    background: #EEF2FF;
    color: var(--primary);
    font-weight: 600;
}

.sidebar-item.disabled {
    color: var(--text-muted);
    cursor: default;
    pointer-events: none;
}

.sidebar-icon { font-size: 1.25rem; }

.badge-soon {
    margin-left: auto;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--checked-bg);
    color: var(--text-muted);
    padding: 2px 8px;
    border-radius: 10px;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
}

.btn-logout-sidebar {
    background: none;
    border: 1.5px solid var(--danger);
    color: var(--danger);
    padding: 0.625rem 1.25rem;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
}

/* Add bar */
.add-bar {
    padding: 1rem 1.25rem;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 0.5rem;
    position: sticky;
    top: 52px;
    z-index: 9;
}

.add-bar input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 1rem;
    outline: none;
}

.add-bar input:focus {
    border-color: var(--primary);
}

.btn-add {
    background: var(--primary);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Items list */
.items-container {
    flex: 1;
    padding: 0.75rem 1.25rem;
    padding-bottom: 120px;
}

.section-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 0.75rem 0 0.5rem;
}

.item {
    background: var(--card);
    border-radius: 12px;
    padding: 0.875rem 1rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: var(--shadow);
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
    touch-action: pan-y;
}

.item.checked {
    background: var(--checked-bg);
    box-shadow: none;
}

.item-checkbox {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    transition: all 0.2s;
}

.item.checked .item-checkbox {
    background: var(--success);
    border-color: var(--success);
}

.item.checked .item-checkbox::after {
    content: '\2713';
    color: white;
    font-size: 0.8rem;
    font-weight: 700;
}

.item-content {
    flex: 1;
    min-width: 0;
}

.item-name {
    font-size: 1rem;
    font-weight: 500;
}

.item.checked .item-name {
    text-decoration: line-through;
    color: var(--text-muted);
}

.item-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.item-delete {
    background: var(--danger);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.item:hover .item-delete,
.item:active .item-delete {
    opacity: 1;
}

@media (hover: none) {
    .item .item-delete { opacity: 0.4; }
    .item.checked .item-delete { opacity: 0.6; }
}

/* Clear checked */
.clear-checked {
    padding: 1rem 1.25rem;
    text-align: center;
}

.btn-clear {
    background: none;
    border: 1.5px solid var(--danger);
    color: var(--danger);
    padding: 0.625rem 1.25rem;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
}

/* FAB micro */
.fab-mic {
    position: fixed;
    bottom: 2rem;
    right: 1.5rem;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    font-size: 1.75rem;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    transition: all 0.2s;
}

.fab-mic.recording {
    background: var(--danger);
    animation: fab-pulse 1s ease-in-out infinite;
}

@keyframes fab-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4); }
    50% { transform: scale(1.08); box-shadow: 0 4px 24px rgba(239, 68, 68, 0.6); }
}

/* Voice overlay - redesigned */
.voice-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 30;
    align-items: flex-end;
    justify-content: center;
}

.voice-overlay.active {
    display: flex;
}

.voice-sheet {
    background: var(--card);
    width: 100%;
    max-width: 420px;
    border-radius: 20px 20px 0 0;
    padding: 2rem 1.5rem 2.5rem;
    text-align: center;
}

.voice-recording-indicator {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.voice-pulse-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 3px solid var(--danger);
    animation: voice-ring 1.5s ease-out infinite;
}

@keyframes voice-ring {
    0% { transform: scale(0.8); opacity: 1; }
    100% { transform: scale(1.6); opacity: 0; }
}

.voice-mic-icon {
    font-size: 2.5rem;
    z-index: 1;
}

.voice-status {
    font-size: 1rem;
    font-weight: 600;
    color: var(--danger);
    margin-bottom: 0.5rem;
    animation: blink 1.2s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.voice-sheet .transcript {
    font-size: 1.125rem;
    min-height: 2.5rem;
    margin: 0.5rem 0 1rem;
    color: var(--text);
    font-style: italic;
}

.voice-sheet .hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
    line-height: 1.4;
}

.voice-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.btn-voice-cancel {
    background: var(--checked-bg);
    color: var(--text-muted);
}

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

/* Empty state */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.empty-state .icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 7rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text);
    color: white;
    padding: 0.75rem 1.25rem;
    border-radius: 10px;
    font-size: 0.875rem;
    opacity: 0;
    transition: all 0.3s;
    z-index: 50;
    white-space: nowrap;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
