:root {
    --color-blue: #0047ab;
    --color-blue-dark: #003380;
    --color-blue-light: #eef4fc;
    --color-red: #e31937;
    --color-red-dark: #b8142c;
    --color-white: #ffffff;
    --color-text: #1a1a2e;
    --color-muted: #4b5563;
}

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

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--color-text);
    background: var(--color-blue-light);
}

a {
    color: var(--color-blue);
    text-decoration: none;
}

a:hover {
    color: var(--color-red);
    text-decoration: underline;
}

.topbar {
    background: var(--color-blue-dark);
    color: var(--color-white);
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(0, 51, 128, 0.25);
    border-bottom: 3px solid var(--color-red);
}

.topbar-inner {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.topbar h1 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--color-white);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.topbar .btn-secondary {
    background: rgba(255, 255, 255, 0.15);
    color: var(--color-white);
    border: 1px solid rgba(255, 255, 255, 0.45);
}

.topbar .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.28);
    color: var(--color-white);
}

.username {
    font-size: 0.9rem;
    opacity: 0.9;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 1.25rem;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    align-items: center;
    justify-content: space-between;
}

.search-form {
    display: flex;
    gap: 0.5rem;
    flex: 1;
    min-width: 200px;
}

.search-form input[type="search"] {
    flex: 1;
    min-width: 0;
}

.contact-list {
    display: grid;
    gap: 0.75rem;
}

.contact-card {
    background: var(--color-white);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    box-shadow: 0 1px 4px rgba(0, 51, 128, 0.1);
    border-left: 4px solid var(--color-blue);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
}

.contact-info h2 {
    margin: 0 0 0.35rem;
    font-size: 1.1rem;
    color: var(--color-blue-dark);
}

.contact-info p {
    margin: 0.15rem 0;
    font-size: 0.95rem;
    color: var(--color-muted);
}

.contact-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.inline-form {
    display: inline;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--color-muted);
    background: var(--color-white);
    border-radius: 10px;
    border-top: 3px solid var(--color-red);
}

.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: linear-gradient(180deg, var(--color-blue-light) 0%, var(--color-white) 100%);
}

.auth-card {
    background: var(--color-white);
    width: 100%;
    max-width: 400px;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 51, 128, 0.12);
    border-top: 4px solid var(--color-blue);
    border-bottom: 4px solid var(--color-red);
}

.auth-card-wide {
    max-width: 480px;
}

.auth-card h1 {
    margin: 0 0 0.25rem;
    font-size: 1.5rem;
    text-align: center;
    color: var(--color-blue-dark);
}

.subtitle {
    text-align: center;
    color: var(--color-muted);
    margin: 0 0 1.5rem;
}

.form label {
    display: block;
    margin-bottom: 1rem;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--color-blue-dark);
}

.form input[type="text"],
.form input[type="email"],
.form input[type="tel"],
.form input[type="password"],
.form input[type="search"] {
    display: block;
    width: 100%;
    margin-top: 0.35rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid #b8cce8;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    background: var(--color-white);
}

.form input:focus {
    outline: none;
    border-color: var(--color-blue);
    box-shadow: 0 0 0 3px rgba(0, 71, 171, 0.15);
}

fieldset {
    border: 1px solid #b8cce8;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

legend {
    font-weight: 600;
    padding: 0 0.5rem;
    color: var(--color-blue-dark);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    line-height: 1.2;
}

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

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

.btn-secondary {
    background: var(--color-white);
    color: var(--color-blue);
    border: 1px solid var(--color-blue);
}

.btn-secondary:hover {
    background: var(--color-blue-light);
    color: var(--color-blue-dark);
}

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

.btn-danger:hover {
    background: var(--color-red-dark);
    color: var(--color-white);
}

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
}

.btn-block {
    width: 100%;
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #eff6ff;
    color: var(--color-blue-dark);
    border: 1px solid #b8cce8;
}

.warning-text {
    font-size: 0.9rem;
    color: #92400e;
    background: #fffbeb;
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid #fde68a;
}

.modal {
    border: none;
    border-radius: 12px;
    padding: 0;
    width: calc(100% - 2rem);
    max-width: 440px;
    box-shadow: 0 8px 30px rgba(0, 51, 128, 0.2);
    border-top: 4px solid var(--color-blue);
}

.modal::backdrop {
    background: rgba(0, 51, 128, 0.45);
}

.modal .form {
    padding: 1.5rem;
}

.modal h2 {
    margin: 0 0 1rem;
    font-size: 1.2rem;
    color: var(--color-blue-dark);
}

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

.site-footer {
    text-align: center;
    padding: 1.25rem;
    font-size: 0.9rem;
    color: var(--color-muted);
}

.site-footer a {
    font-weight: 600;
    color: var(--color-blue);
}

.site-footer a:hover {
    color: var(--color-red);
}

.auth-page .site-footer {
    margin-top: 1.25rem;
}

@media (max-width: 600px) {
    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .search-form {
        width: 100%;
    }

    .contact-card {
        flex-direction: column;
    }

    .contact-actions {
        width: 100%;
        justify-content: flex-end;
    }
}
