* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #f4f6fb;
    color: #172033;
}

body.modal-open {
    overflow: hidden;
}

a {
    color: #2349d7;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px 20px;
}

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

.topbar h1 {
    margin: 0 0 8px;
}

.topbar p {
    margin: 0;
    color: #53617c;
}

.topbar-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.card,
.auth-card {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 12px 34px rgba(18, 33, 67, 0.08);
    border: 1px solid #e4e9f3;
}

.card {
    padding: 20px;
}

.auth-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 460px;
    padding: 32px;
}

.auth-card h1 {
    margin-top: 0;
}

.auth-form,
.form-grid {
    display: grid;
    gap: 16px;
}

.form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.full-width {
    grid-column: 1 / -1;
}

label {
    display: grid;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #cfd8ea;
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 14px;
    background: #fff;
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #2349d7;
    box-shadow: 0 0 0 3px rgba(35, 73, 215, 0.12);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #2349d7;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 12px 16px;
    cursor: pointer;
    font-weight: 700;
    text-decoration: none;
}

.button:hover {
    text-decoration: none;
    opacity: 0.95;
}

.button.secondary {
    background: #eef2ff;
    color: #1e3274;
}

.button.danger {
    background: #cf3f4c;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.toolbar input {
    max-width: 420px;
}

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

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

th,
td {
    padding: 14px 12px;
    border-bottom: 1px solid #ebeff6;
    text-align: left;
    vertical-align: top;
    font-size: 14px;
}

th {
    background: #f9fbff;
    position: sticky;
    top: 0;
}

th a {
    color: #172033;
}

.notes-cell {
    max-width: 280px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.actions-cell {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.empty-state {
    text-align: center;
    color: #6b7690;
    padding: 30px;
}

.alert {
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 16px;
}

.alert.success {
    background: #e9f9ef;
    color: #186c3d;
}

.alert.error {
    background: #fff1f1;
    color: #aa3038;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(10, 16, 31, 0.55);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal.hidden {
    display: none;
}

.modal-content {
    width: 100%;
    max-width: 900px;
    background: #fff;
    border-radius: 18px;
    padding: 24px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.18);
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h2 {
    margin: 0;
}

.modal-close {
    border: none;
    background: transparent;
    font-size: 28px;
    cursor: pointer;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
}

@media (max-width: 860px) {
    .topbar,
    .toolbar,
    .form-grid {
        grid-template-columns: 1fr;
        display: grid;
    }

    .toolbar input {
        max-width: none;
    }
}


.found-via-group {
    display: grid;
    gap: 10px;
}

.found-via-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.field-label {
    font-size: 14px;
    font-weight: 600;
}

.found-via-wrapper {
    display: grid;
    gap: 10px;
}

.found-via-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.found-via-row input {
    flex: 1;
}

.button.small {
    padding: 8px 12px;
    min-width: 42px;
}
