/* Beemo - estilos minimalistas, mobile-first, dark/light auto */

:root {
    --bg:        #f8fafc;
    --bg-card:   #ffffff;
    --bg-input:  #f1f5f9;
    --border:    #e2e8f0;
    --text:      #0f172a;
    --text-mut:  #64748b;
    --primary:   #2563eb;
    --primary-h: #1d4ed8;
    --danger:    #dc2626;
    --success:   #16a34a;
    --raw:       #f59e0b;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg:        #0f172a;
        --bg-card:   #1e293b;
        --bg-input:  #0f172a;
        --border:    #334155;
        --text:      #f1f5f9;
        --text-mut:  #94a3b8;
        --primary:   #3b82f6;
        --primary-h: #2563eb;
    }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.error-banner {
    background: var(--danger);
    color: white;
    padding: 0.75rem 1rem;
    text-align: center;
}
.error-banner code {
    background: rgba(0,0,0,0.2);
    padding: 0.1em 0.4em;
    border-radius: 3px;
}

.topbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 10;
}
.topbar-inner {
    max-width: 720px;
    margin: 0 auto;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.topbar h1 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    flex: 1;
}
.totals {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.875rem;
}
.badge {
    background: var(--text-mut);
    color: var(--bg);
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.8rem;
    min-width: 1.6rem;
    text-align: center;
}
.badge-raw { background: var(--raw); color: #fff; }

main {
    max-width: 720px;
    margin: 0 auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.capture-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
}
#capture-form { display: flex; flex-direction: column; gap: 0.75rem; }
#capture-text {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem;
    font-family: inherit;
    font-size: 1rem;
    color: var(--text);
    resize: vertical;
    min-height: 4rem;
}
#capture-text:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.capture-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

button {
    cursor: pointer;
    font-family: inherit;
    font-size: 0.95rem;
}
#btn-capture {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-weight: 600;
}
#btn-capture:hover { background: var(--primary-h); }
#btn-capture:disabled { opacity: 0.5; cursor: wait; }

.btn-ghost {
    background: transparent;
    color: var(--text-mut);
    border: 1px solid var(--border);
    padding: 0.3rem 0.7rem;
    border-radius: 6px;
    font-size: 0.8rem;
}
.btn-ghost:hover { color: var(--text); }

.inbox-list {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
}
.list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}
.list-header h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-mut);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.filters {
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
}
.filter-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-mut);
    padding: 0.25rem 0.7rem;
    border-radius: 6px;
    font-size: 0.8rem;
}
.filter-btn:hover { color: var(--text); }
.filter-btn.active {
    background: var(--text);
    color: var(--bg);
    border-color: var(--text);
}

.items {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.item {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    transition: opacity 0.2s;
}
.item.removing { opacity: 0; transform: translateX(50px); transition: all 0.3s; }
.item-text {
    white-space: pre-wrap;
    word-break: break-word;
}
.item-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-mut);
    flex-wrap: wrap;
}
.item-meta-left {
    display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap;
}
.source {
    background: var(--border);
    padding: 0.1em 0.5em;
    border-radius: 4px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.item-actions { display: flex; gap: 0.3rem; }
.action-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-mut);
    padding: 0.2rem 0.6rem;
    border-radius: 5px;
    font-size: 0.75rem;
}
.action-btn:hover { color: var(--text); }
.action-btn.danger:hover { color: var(--danger); border-color: var(--danger); }

.muted { color: var(--text-mut); }
.small { font-size: 0.8rem; }
.empty, .loading { text-align: center; color: var(--text-mut); padding: 2rem; }
.hidden { display: none !important; }

dialog {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-card);
    color: var(--text);
    padding: 1.5rem;
    max-width: 360px;
    width: 90%;
}
dialog::backdrop {
    background: rgba(0, 0, 0, 0.6);
}
dialog h3 { margin: 0 0 0.5rem; }
dialog input {
    width: 100%;
    margin-top: 0.75rem;
    padding: 0.6rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: monospace;
    color: var(--text);
}
.dialog-actions {
    margin-top: 1rem;
    display: flex;
    justify-content: flex-end;
}
.dialog-actions button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
}

.toast {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text);
    color: var(--bg);
    padding: 0.75rem 1.5rem;
    border-radius: 999px;
    font-size: 0.875rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    z-index: 100;
    animation: toast-in 0.2s ease-out;
}
.toast.error { background: var(--danger); color: white; }
.toast.success { background: var(--success); color: white; }
@keyframes toast-in {
    from { opacity: 0; transform: translate(-50%, 1rem); }
    to   { opacity: 1; transform: translate(-50%, 0); }
}
