*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 0;
    padding: 0;
    background: #f5f7fa;
    color: #1f2937;
    line-height: 1.5;
}

.lang-switcher {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.lang-switcher label {
    margin: 0;
}

.lang-switcher select {
    padding: 0.3rem 0.5rem;
    border-radius: 0.375rem;
    border: 1px solid #d1d5db;
    background: #fff;
}

header {
    background: #111827;
    color: #fff;
    padding: 1.5rem;
    text-align: center;
    position: relative;
}

header h1 {
    margin: 0;
    font-size: 1.75rem;
}

.subtitle {
    margin: 0.5rem 0 0;
    opacity: 0.8;
}

main {
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.card {
    background: #fff;
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

h2 {
    margin-top: 0;
    font-size: 1.25rem;
}

label {
    display: block;
    margin-top: 1rem;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

input[type="email"],
input[type="password"],
input[type="text"],
textarea {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 1rem;
}

button {
    margin-top: 1rem;
    padding: 0.6rem 1.2rem;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 0.375rem;
    font-size: 1rem;
    cursor: pointer;
}

button:hover {
    background: #1d4ed8;
}

button:disabled {
    background: #93c5fd;
    cursor: not-allowed;
}

.error {
    color: #dc2626;
    margin-top: 0.75rem;
}

.hint {
    color: #4b5563;
    font-size: 0.9rem;
}

.inline-form {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
}

.inline-form input {
    flex: 1;
    margin-top: 0;
}

.inline-form button {
    margin-top: 0;
    flex-shrink: 0;
}

.hidden {
    display: none !important;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    border-radius: 0.5rem;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

#logout-btn {
    margin-top: 0;
    background: #6b7280;
}

#logout-btn:hover {
    background: #4b5563;
}

.entry {
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
    background: #f9fafb;
}

.entry p {
    margin: 0.25rem 0;
}

.entry .source {
    font-weight: 600;
    font-size: 1.1rem;
}

.entry .badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    background: #fecaca;
    color: #991b1b;
}

.entry button {
    margin-top: 0.75rem;
    background: #dc2626;
}

.entry button:hover {
    background: #b91c1c;
}

dialog {
    border: none;
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
    max-width: 500px;
    width: 90%;
}

dialog::backdrop {
    background: rgba(0, 0, 0, 0.4);
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
}

#dialog-cancel {
    background: #6b7280;
}

#global-message {
    text-align: center;
    padding: 1rem;
    border-radius: 0.375rem;
}

#global-message.success {
    background: #d1fae5;
    color: #065f46;
}

#global-message.error {
    background: #fee2e2;
    color: #991b1b;
}

@media (max-width: 600px) {
    .inline-form {
        flex-direction: column;
    }

    .topbar {
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
    }
}
