* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    background-color: #ffffff;
    color: #333;
    font-size: 0.95rem;
    line-height: 1.5;
}

a {
    color: inherit;
}

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

.site-header,
.site-footer {
    background: #e7000b;
    color: #fff;
}

.site-header .container,
.site-footer .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.site-header nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.site-header nav form {
    margin: 0;
}

.logo {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
}

.logo-ka {
    color: #ED1C24;
    font-weight: 900;
}

nav a,
.link-button {
    color: #fff;
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
}

nav a:hover,
.link-button:hover {
    text-decoration: underline;
}

.site-footer p {
    margin: 0;
}

main.container {
    padding-top: 2.5rem;
    padding-bottom: 2.5rem;
    background-color: #f8f9fa;
}

.card,
.auth-card,
.dashboard-card {
    background-color: #fff;
    padding: 1.75rem;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    border: 1px solid #e0e0e0;
}

.auth-card {
    max-width: 480px;
    margin: 0 auto 2rem;
    display: grid;
    gap: 1.5rem;
}

.section-title {
    margin: 0 0 0.5rem;
    font-size: 1.4rem;
    font-weight: 700;
    color: #e7000b;
}

.section-subtitle {
    margin: 0 0 0.85rem;
    color: #616b80;
    font-size: 0.9rem;
}

.muted {
    color: #6f7793;
    font-style: italic;
}

form {
    display: grid;
    gap: 1rem;
}

.form-group {
    display: grid;
    gap: 0.35rem;
}

form label {
    font-weight: 600;
}

form input,
form select,
form textarea {
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid #c5c8d4;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

form input:focus,
form select:focus,
form textarea:focus {
    outline: none;
    border-color: #e7000b;
    box-shadow: 0 0 0 3px rgba(231, 0, 11, 0.15);
}

form button {
    background-color: #e7000b;
    color: #fff;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: background-color 0.2s ease;
}

form button:hover {
    background-color: #b50009;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.btn-primary {
    background-color: #e7000b;
    color: #fff;
}

.btn-primary:hover {
    background-color: #b50009;
}

.btn-secondary {
    background-color: #fff;
    color: #ED1C24;
    border: 1px solid #ED1C24;
}

.btn-secondary:hover {
    background-color: #fef2f2;
}

.form-output {
    display: none;
    border-radius: 8px;
}

.form-output.alert {
    display: block;
    margin-top: 0.25rem;
}

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

.alert-success {
    background-color: #e6f4ea;
    color: #1b5e20;
}

.alert-error {
    background-color: #fdeaea;
    color: #ED1C24;
}

.otp-details {
    margin-top: 1.5rem;
    display: grid;
    gap: 1rem;
}

.otp-details summary {
    cursor: pointer;
    font-weight: 600;
    color: #e7000b;
}

.otp-details summary::marker {
    color: #e7000b;
}

.otp-details[open] > summary {
    margin-bottom: 0.75rem;
}

.otp-details form {
    margin-top: 0.5rem;
    padding: 1.25rem;
    border-radius: 10px;
    background: #f0f4ff;
    border: 1px solid #d0e0ff;
}

.dashboard {
    display: grid;
    gap: 1.75rem;
}

.dashboard-header {
    display: grid;
    gap: 0.5rem;
}

.dashboard-card {
    display: grid;
    gap: 0.75rem;
}

.dashboard-card ul,
.dashboard-card ol {
    margin: 0;
    padding-left: 1.25rem;
    color: #4b5569;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 999;
}

.modal {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    z-index: 1000;
}

.modal[hidden],
.modal-backdrop[hidden] {
    display: none;
}

.modal-content {
    background: #ffffff;
    width: min(90vw, 520px);
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 12px;
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.2);
    padding: 24px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.modal-close {
    border: 0;
    background: none;
    font-size: 1.75rem;
    line-height: 1;
    color: #64748b;
    cursor: pointer;
    padding: 4px 8px;
}

.modal-close:hover {
    color: #1f2937;
}

body.modal-open {
    overflow: hidden;
}

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th,
table td {
    border: 1px solid #ddd;
    padding: 0.75rem;
    text-align: left;
}

table th {
    background-color: #f0f1f6;
    font-weight: 600;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
}

.searchable-select {
    position: relative;
}

.search-input {
    width: 100%;
    margin-bottom: 0.5rem;
}

.select-dropdown {
    width: 100%;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.form-section {
    margin-top: 1.5rem;
}

.form-section h4 {
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
    font-weight: 600;
}

/* Badge styling for messages and notifications */
.message-badge,
.notification-badge {
    display: none !important;
    background-color: #ff4444;
    color: white;
    border-radius: 50%;
    width: 1.25rem;
    height: 1.25rem;
    min-width: 1.25rem;
    min-height: 1.25rem;
    font-size: 0.75rem;
    font-weight: bold;
    text-align: center;
    line-height: 1.25rem;
    margin-left: 0.25rem;
    vertical-align: middle;
    z-index: 10;
    position: relative;
    padding: 0;
    flex-shrink: 0;
}

.notification-badge[style*="display: inline-block"],
.message-badge[style*="display: inline-block"] {
    display: inline-block !important;
    visibility: visible !important;
}

.notifications-link,
.messages-link {
    position: relative;
    display: inline-flex !important;
    align-items: center !important;
    text-decoration: none;
    color: inherit;
    gap: 0;
}

.notifications-link {
    font-size: 1.5rem;
    line-height: 1;
}

.notifications-link .notification-badge,
.messages-link .message-badge {
    display: none;
    margin: 0 0 0 0.25rem;
}

.notifications-link .notification-badge[style*="display: inline-block"],
.messages-link .message-badge[style*="display: inline-block"] {
    display: inline-block !important;
}

@media (max-width: 640px) {
    .site-header .container,
    .site-footer .container {
        flex-direction: column;
        align-items: flex-start;
    }

    .site-header nav {
        width: 100%;
        justify-content: flex-start;
    }

    .auth-card {
        padding: 1.5rem;
    }

    .dashboard {
        gap: 1.25rem;
    }
}