* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #ed687b;
    --primary-dark: #d9576c;
    --secondary: #f6a05d;
    --text: #202124;
    --muted: #777b84;
    --border: #e8e9ed;
    --background: #f7f8fa;
    --white: #ffffff;
    --success: #28a36a;
    --danger: #df5264;
}

body {
    min-height: 100vh;
    background: var(--background);
    color: var(--text);
    font-family: "Manrope", sans-serif;
}

body.modal-open {
    overflow: hidden;
}


/* HEADER */

.topbar {
    height: 78px;
    padding: 0 42px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    background: rgba(255, 255, 255, 0.97);
    border-bottom: 1px solid var(--border);

    position: sticky;
    top: 0;
    z-index: 100;

    backdrop-filter: blur(12px);
}

.brand {
    display: flex;
    align-items: center;
}

.brand img {
    width: 190px;
    max-height: 54px;
    object-fit: contain;
    display: block;
    background-color: #2f1423;
    padding: 5px;
    border-radius: 10px;
}

.user-button {
    border: 0;
    background: transparent;

    display: flex;
    align-items: center;
    gap: 11px;

    padding: 7px 9px;
    border-radius: 12px;

    cursor: pointer;
    font-family: inherit;
    transition: 0.25s ease;
}

.user-button:hover,
.user-button.active {
    background: #f6f6f7;
}

.avatar {
    width: 42px;
    height: 42px;

    display: grid;
    place-items: center;

    border-radius: 50%;

    color: white;
    font-size: 13px;
    font-weight: 800;

    background: linear-gradient(135deg, var(--primary), var(--secondary));
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.25;
}

.user-info strong {
    font-size: 13px;
    font-weight: 800;
}

.user-info small {
    color: var(--muted);
    font-size: 10px;
    font-weight: 600;
    margin-top: 2px;
}

.user-button > i {
    color: #8b8d94;
    font-size: 10px;
}


/* PAGE */

.page-container {
    width: min(1440px, calc(100% - 56px));
    margin: auto;
    padding: 36px 0 70px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;

    color: var(--muted);
    text-decoration: none;

    font-size: 11px;
    font-weight: 700;

    margin-bottom: 20px;
}

.back-link:hover {
    color: var(--primary);
}

.heading-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
}

.eyebrow {
    display: block;

    color: var(--primary);

    font-size: 10px;
    font-weight: 800;

    letter-spacing: 1.7px;
    margin-bottom: 7px;
}

.heading-row h1 {
    font-size: 30px;
    line-height: 1.2;

    letter-spacing: -0.8px;
    font-weight: 800;
}

.heading-row p {
    color: var(--muted);
    font-size: 12px;
    margin-top: 8px;
}

.add-visit-btn {
    flex-shrink: 0;

    height: 44px;
    padding: 0 18px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    gap: 8px;

    border: 0;
    border-radius: 10px;

    color: #fff;

    background:
        linear-gradient(135deg, var(--primary), var(--secondary));

    box-shadow:
        0 8px 20px rgba(237, 104, 123, 0.2);

    font-family: inherit;
    font-size: 12px;
    font-weight: 800;

    cursor: pointer;
    transition: 0.25s ease;
}

.add-visit-btn:hover {
    transform: translateY(-1px);

    box-shadow:
        0 11px 25px rgba(237, 104, 123, 0.27);
}


/* TABLE */

.visit-card {
    margin-top: 30px;

    background: var(--white);

    border: 1px solid var(--border);
    border-radius: 16px;

    box-shadow:
        0 8px 30px rgba(30, 32, 40, 0.06);

    overflow: hidden;
}

.table-top {
    min-height: 76px;
    padding: 16px 20px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 20px;

    border-bottom: 1px solid var(--border);
}

.table-top h2 {
    font-size: 14px;
    font-weight: 800;
}

.table-top span {
    display: block;
    color: var(--muted);
    font-size: 10px;
    margin-top: 4px;
}

.search-box {
    width: 250px;
    height: 38px;

    display: flex;
    align-items: center;
    gap: 8px;

    padding: 0 12px;

    border: 1px solid var(--border);
    border-radius: 9px;

    background: #fafafa;
}

.search-box i {
    color: #9a9da5;
    font-size: 12px;
}

.search-box input {
    width: 100%;

    border: 0;
    outline: 0;

    background: transparent;

    font-family: inherit;
    font-size: 11px;
}


/* Keep table wide on mobile */

.table-scroll {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;

    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    min-width: 1380px;

    border-collapse: collapse;
    table-layout: fixed;
}

thead th {
    padding: 15px 16px;

    text-align: left;

    color: #555962;
    background: #fafafa;

    border-bottom: 1px solid var(--border);

    font-size: 11px;
    font-weight: 800;

    white-space: nowrap;
}

tbody td {
    padding: 15px 16px;

    color: #35383e;

    border-bottom: 1px solid #f0f1f3;

    font-size: 11px;
    font-weight: 500;

    vertical-align: middle;
    line-height: 1.55;
}

tbody tr {
    transition: background 0.2s ease;
}

tbody tr:hover {
    background: #fffafa;
}

tbody tr:last-child td {
    border-bottom: 0;
}


/* Column widths */

thead th:nth-child(1),
tbody td:nth-child(1) {
    width: 125px;
}

thead th:nth-child(2),
tbody td:nth-child(2) {
    width: 180px;
}

thead th:nth-child(3),
tbody td:nth-child(3) {
    width: 150px;
}

thead th:nth-child(4),
tbody td:nth-child(4) {
    width: 160px;
}

thead th:nth-child(5),
tbody td:nth-child(5) {
    width: 410px;
    min-width: 410px;
}

thead th:nth-child(6),
tbody td:nth-child(6) {
    width: 160px;
}

thead th:nth-child(7),
tbody td:nth-child(7) {
    width: 150px;
}

thead th:nth-child(8),
tbody td:nth-child(8) {
    width: 85px;
}


/* STATUS */

.status {
    display: inline-flex;
    align-items: center;
    gap: 6px;

    height: 28px;
    padding: 0 9px;

    border-radius: 7px;

    font-size: 9px;
    font-weight: 800;

    white-space: nowrap;
}

.status.upcoming {
    color: #d47a24;
    background: #fff6e9;
    border: 1px solid #f7dfbc;
}


/* FEEDBACK */

.feedback-btn {
    height: 31px;
    padding: 0 10px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    gap: 6px;

    border: 1px solid #eadde0;
    border-radius: 7px;

    background: #fff8f9;
    color: var(--primary);

    font-family: inherit;
    font-size: 9px;
    font-weight: 800;

    cursor: pointer;
    white-space: nowrap;

    transition: 0.2s ease;
}

.feedback-btn:hover {
    color: white;
    border-color: var(--primary);
    background: var(--primary);
}

.feedback-btn.has-feedback {
    color: var(--success);
    background: #effaf5;
    border-color: #d1efdf;
}


/* DELETE */

.delete-btn {
    width: 32px;
    height: 32px;

    display: grid;
    place-items: center;

    border: 0;
    border-radius: 8px;

    background: #fff1f3;
    color: var(--danger);

    cursor: pointer;
    transition: 0.2s ease;
}

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


/* EMPTY */

.empty-state {
    display: none;

    min-height: 190px;

    align-items: center;
    justify-content: center;
    flex-direction: column;

    gap: 7px;

    color: var(--muted);
}

.empty-state.show {
    display: flex;
}

.empty-state i {
    font-size: 28px;
    margin-bottom: 5px;
}

.empty-state strong {
    color: var(--text);
    font-size: 13px;
}

.empty-state span {
    font-size: 10px;
}


/* MODAL */

.modal-overlay {
    position: fixed;
    inset: 0;

    z-index: 500;

    padding: 25px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: rgba(20, 21, 25, 0.5);

    backdrop-filter: blur(5px);

    opacity: 0;
    visibility: hidden;

    transition: 0.25s ease;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal {
    width: min(600px, 100%);

    max-height: calc(100vh - 50px);

    overflow-y: auto;

    border-radius: 17px;

    background: white;

    box-shadow:
        0 25px 70px rgba(0, 0, 0, 0.18);

    transform: translateY(15px) scale(0.98);

    transition: 0.25s ease;
}

.modal-overlay.show .modal {
    transform: translateY(0) scale(1);
}

.modal-header {
    padding: 22px 24px;

    display: flex;
    align-items: flex-start;
    justify-content: space-between;

    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 19px;
    font-weight: 800;
}

.close-modal {
    width: 34px;
    height: 34px;

    border: 0;
    border-radius: 9px;

    background: #f5f5f6;
    color: #777b84;

    cursor: pointer;
}

.close-modal:hover {
    background: #ffecee;
    color: var(--primary);
}

#visitForm,
#feedbackForm {
    padding: 22px 24px 24px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 17px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

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

.form-group label {
    font-size: 11px;
    font-weight: 800;
    color: #454850;
}

.form-group input,
.form-group textarea {
    width: 100%;

    border: 1px solid #dedfe4;
    border-radius: 9px;

    outline: 0;

    background: #fff;

    padding: 11px 12px;

    color: var(--text);

    font-family: inherit;
    font-size: 11px;

    transition: 0.2s ease;
}

.form-group textarea {
    resize: vertical;
    min-height: 95px;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--primary);

    box-shadow:
        0 0 0 3px rgba(237, 104, 123, 0.09);
}

.modal-footer {
    margin-top: 22px;

    padding-top: 18px;

    display: flex;
    justify-content: flex-end;

    gap: 10px;

    border-top: 1px solid var(--border);
}

.cancel-btn,
.save-btn {
    height: 40px;
    padding: 0 16px;

    border-radius: 9px;

    font-family: inherit;
    font-size: 11px;
    font-weight: 800;

    cursor: pointer;
}

.cancel-btn {
    border: 1px solid var(--border);

    background: white;
    color: #656870;
}

.save-btn {
    border: 0;

    color: white;

    background:
        linear-gradient(
            135deg,
            var(--primary),
            var(--secondary)
        );
}


/* MOBILE */

@media (max-width: 700px) {

    .topbar {
        height: 68px;
        padding: 0 16px;
    }

    .brand img {
        width: 145px;
        max-height: 45px;
    }

    .user-info,
    .user-button > i {
        display: none;
    }

    .user-button {
        padding: 0;
    }

    .avatar {
        width: 40px;
        height: 40px;
    }

    .page-container {
        width: calc(100% - 24px);
        padding: 25px 0 45px;
    }

    .heading-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .heading-row h1 {
        font-size: 25px;
    }

    .heading-row p {
        line-height: 1.5;
    }

    .add-visit-btn {
        width: 100%;
    }

    .visit-card {
        margin-top: 22px;
        border-radius: 13px;
    }

    .table-top {
        padding: 14px;
        align-items: stretch;
        flex-direction: column;
        gap: 12px;
    }

    .search-box {
        width: 100%;
    }

    /*
       The table intentionally remains wide.
       Swipe left/right on mobile.
    */

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

    table {
        min-width: 1380px;
    }

    thead th,
    tbody td {
        padding-left: 13px;
        padding-right: 13px;
    }

    .modal-overlay {
        padding: 12px;
    }

    .modal {
        max-height: calc(100vh - 24px);
        border-radius: 14px;
    }

    .modal-header {
        padding: 18px;
    }

    #visitForm,
    #feedbackForm {
        padding: 18px;
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .form-group.full-width {
        grid-column: auto;
    }

    .modal-footer {
        flex-direction: column-reverse;
    }

    .cancel-btn,
    .save-btn {
        width: 100%;
    }
}
