:root {
    --bg: #f6f7f5;
    --surface: #ffffff;
    --surface-soft: #eef3ef;
    --text: #1c2b2a;
    --text-muted: #5a6d6b;
    --brand: #0c6b66;
    --brand-strong: #084a46;
    --accent: #ee8f42;
    --border: #d6e0df;
    --danger: #c53b4a;
    --shadow-sm: 0 8px 20px rgba(14, 35, 34, 0.08);
    --shadow-md: 0 14px 34px rgba(14, 35, 34, 0.16);
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
}

* {
    box-sizing: border-box;
}

@keyframes fade-slide-up {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

body {
    margin: 0;
    color: var(--text);
    font-family: "Space Grotesk", "Manrope", "Trebuchet MS", sans-serif;
    line-height: 1.45;
    background: radial-gradient(circle at 10% -20%, #d8ece5 0%, transparent 48%),
        radial-gradient(circle at 95% 10%, #fae4d1 0%, transparent 42%),
        var(--bg);
}

header {
    background: linear-gradient(120deg, #113a37 0%, #165652 62%, #1b6f69 100%);
    color: #f6fbfa;
    padding: 18px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: var(--shadow-sm);
}

header h1 {
    margin: 0;
    font-size: clamp(1.25rem, 2vw, 1.65rem);
    font-weight: 700;
    letter-spacing: 0.02em;
}

h2 {
    margin: 0 0 12px;
    padding: 0;
    color: #1a302f;
    font-size: clamp(1.05rem, 1.6vw, 1.4rem);
}

nav {
    background: rgba(15, 54, 51, 0.94);
    backdrop-filter: blur(7px);
    color: #fff;
    padding: 8px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

nav ul li {
    position: relative;
}

nav ul li a {
    color: #eaf5f3;
    text-decoration: none;
    padding: 8px 12px;
    display: inline-block;
    border-radius: var(--radius-sm);
    transition: background-color 0.2s ease, color 0.2s ease;
}

nav ul li a:hover,
nav ul li a:focus-visible {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
}

.dropdown-toggle {
    background: transparent;
    border: none;
    color: #eaf5f3;
    padding: 8px 6px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    border-radius: var(--radius-sm);
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.dropdown-toggle:hover,
.dropdown-toggle:focus-visible {
    background: rgba(255, 255, 255, 0.16);
}

.submenu-toggle {
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    color: #ecf8f6;
    padding: 10px;
    cursor: pointer;
    border-radius: 8px;
    font-family: inherit;
}

.submenu-toggle:hover {
    background: rgba(255, 255, 255, 0.12);
}

.has-dropdown .dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    background: linear-gradient(140deg, #1c4f4b 0%, #103935 100%);
    border: 1px solid rgba(214, 237, 234, 0.25);
    border-radius: 12px;
    min-width: 190px;
    z-index: 1000;
    padding: 8px;
    box-shadow: var(--shadow-md);
    animation: fade-slide-up 0.18s ease;
}

.menu-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.24);
    margin: 8px 4px;
}

.has-dropdown .dropdown-menu li {
    width: 100%;
}

.has-dropdown .dropdown-menu a {
    width: 100%;
    box-sizing: border-box;
    border-radius: 8px;
    padding: 10px;
}

.has-dropdown .dropdown-menu a:hover {
    background: rgba(255, 255, 255, 0.12);
}

.has-submenu {
    position: relative;
}

.dropdown-submenu {
    display: none;
    position: absolute;
    top: 0;
    left: calc(100% + 8px);
    background: linear-gradient(140deg, #1c4f4b 0%, #103935 100%);
    border: 1px solid rgba(214, 237, 234, 0.25);
    border-radius: 12px;
    min-width: 210px;
    z-index: 1001;
    padding: 8px;
    list-style: none;
    box-shadow: var(--shadow-md);
    animation: fade-slide-up 0.18s ease;
}

.dropdown-submenu li a,
.submenu-empty {
    display: block;
    color: #ecf8f6;
    padding: 10px;
    text-decoration: none;
    border-radius: 8px;
}

.dropdown-submenu li a:hover {
    background: rgba(255, 255, 255, 0.12);
}

.submenu-empty {
    color: #b4d2cf;
}

.has-submenu:hover .dropdown-submenu,
.has-submenu:focus-within .dropdown-submenu,
.has-submenu.open .dropdown-submenu {
    display: block;
}

.has-dropdown:hover .dropdown-menu,
.has-dropdown:focus-within .dropdown-menu,
.has-dropdown.open .dropdown-menu {
    display: block;
}

.has-dropdown.open .dropdown-toggle {
    transform: rotate(180deg);
}

.nav-logout-btn {
    background: none;
    border: none;
    color: #eaf5f3;
    text-decoration: none;
    cursor: pointer;
    padding: 8px 12px;
    font: inherit;
    border-radius: var(--radius-sm);
}

.nav-logout-btn:hover {
    background: rgba(255, 255, 255, 0.16);
}

main {
    width: min(1200px, 94vw);
    margin: 26px auto;
    padding: 0;
    animation: fade-slide-up 0.35s ease;
}

.container {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px;
    box-shadow: var(--shadow-sm);
}

.page-title,
h1 {
    margin: 0 0 12px;
    color: #193533;
    font-size: clamp(1.35rem, 2vw, 1.85rem);
}

footer {
    background: #113c39;
    color: #d9eeeb;
    padding: 14px;
    text-align: center;
    margin-top: 32px;
}

button,
.send-btn,
.filter-btn,
form button[type="submit"] {
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: linear-gradient(120deg, #0f756f 0%, #0c5f5a 100%);
    color: #fff;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    transition: transform 0.18s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

button:hover,
.send-btn:hover,
.filter-btn:hover,
form button[type="submit"]:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(12, 95, 90, 0.24);
    filter: brightness(1.04);
}

.form-container {
    max-width: 700px;
    margin: 0 auto;
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

form label {
    display: block;
    margin-bottom: 6px;
    font-weight: 700;
    color: #24403f;
}

form input[type="text"],
form input[type="email"],
form input[type="password"],
form input[type="date"],
form input[type="time"],
form input[type="number"],
form textarea,
form select,
.vendor-select {
    width: 100%;
    padding: 11px 12px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background-color: #fff;
    color: var(--text);
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

form input:focus,
form textarea:focus,
form select:focus,
.vendor-select:focus {
    outline: none;
    border-color: #2f8f89;
    box-shadow: 0 0 0 3px rgba(47, 143, 137, 0.18);
}

form textarea {
    min-height: 110px;
    resize: vertical;
}

form button[type="submit"] {
    width: 100%;
    margin-top: 4px;
}

.form-message {
    background-color: #eaf9f0;
    color: #174e31;
    border: 1px solid #bfe6cb;
    border-radius: var(--radius-sm);
    padding: 11px 12px;
    margin-bottom: 14px;
}

.btn-cancel {
    display: inline-block;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    padding: 10px;
    border-radius: var(--radius-sm);
    border: 1px solid #ccd8d7;
    background-color: #f3f5f4;
    color: #2c4b49;
    text-decoration: none;
    margin-top: 10px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.btn-cancel:hover {
    background-color: #e7eceb;
    color: #1f3736;
}

table {
    border-collapse: collapse;
    margin: 0 auto;
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

table td,
table th {
    border: 1px solid #e4ebea;
    padding: 11px;
    text-align: left;
}

table th {
    background-color: #f0f6f5;
    color: #264343;
    font-weight: 700;
}

table tr:nth-child(even) {
    background-color: #fafcfb;
}

.vendor-select {
    display: inline-block;
    max-width: 180px;
    margin-right: 6px;
    margin-bottom: 0;
}

.send-btn {
    padding: 8px 14px;
    font-size: 14px;
    background: linear-gradient(120deg, #1e9665 0%, #177e54 100%);
}

.opportunities-page {
    position: relative;
    overflow: hidden;
}

.opportunities-page::before {
    content: "";
    position: absolute;
    inset: 0 auto auto 0;
    width: 220px;
    height: 220px;
    background: radial-gradient(circle, rgba(45, 161, 152, 0.2) 0%, rgba(45, 161, 152, 0) 70%);
    pointer-events: none;
}

.sync-form {
    margin-bottom: 16px;
}

.sync-form-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.sync-option {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    margin: 0;
    padding: 10px 12px;
    border-radius: 10px;
    background: #f0f6f5;
    color: #254443;
}

.sync-option input[type="checkbox"] {
    margin: 0;
    accent-color: #0f6c66;
}

.table-shell {
    border-radius: var(--radius-md);
    overflow: auto;
    border: 1px solid var(--border);
    background: #f8fbfa;
}

.leads-table {
    min-width: 1100px;
    margin: 0;
    border: none;
    box-shadow: none;
}

.leads-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: linear-gradient(180deg, #e6f1f0 0%, #deeceb 100%);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.edit-link {
    color: var(--brand);
    font-weight: 700;
    text-decoration: none;
}

.edit-link:hover {
    color: var(--brand-strong);
    text-decoration: underline;
}

.vendor-sent {
    font-weight: 700;
}

.vendor-sent.is-sent {
    color: #167b4e;
}

.vendor-sent.not-sent {
    color: #8b2c3a;
}

.home-page {
    position: relative;
    overflow: hidden;
    min-height: 360px;
}

.home-page::after {
    content: "";
    position: absolute;
    right: -40px;
    bottom: -60px;
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(238, 143, 66, 0.22) 0%, rgba(238, 143, 66, 0) 70%);
    pointer-events: none;
}

.home-hero {
    background: linear-gradient(140deg, #144b46 0%, #0f6c66 58%, #27a198 100%);
    color: #f5fffd;
    border-radius: var(--radius-lg);
    padding: 26px;
    box-shadow: var(--shadow-md);
}

.home-hero h1 {
    color: #f5fffd;
    margin-bottom: 6px;
}

.home-welcome {
    margin: 0;
    color: #def5f2;
    font-size: 1.02rem;
}

.auth-card {
    max-width: 480px;
    margin: 18px auto;
    background: linear-gradient(180deg, #ffffff 0%, #f8fcfb 100%);
}

.auth-card h1 {
    margin-bottom: 4px;
}

.auth-card h2 {
    color: var(--text-muted);
    margin-bottom: 18px;
    font-size: 1rem;
}

.auth-form p {
    margin: 0 0 10px;
}

.auth-form label {
    font-size: 14px;
}

.auth-form .helptext {
    display: block;
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 12px;
}

.filter-container {
    background: linear-gradient(135deg, #145650 0%, #0e7d75 62%, #31a39a 100%);
    padding: 24px;
    border-radius: var(--radius-lg);
    margin-bottom: 22px;
    box-shadow: var(--shadow-md);
    color: #fff;
}

.filter-form {
    display: flex;
    align-items: flex-end;
    gap: 14px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.filter-group label {
    font-size: 13px;
    font-weight: 700;
    color: #e8faf8;
    margin-bottom: 0;
}

.filter-group input[type="date"] {
    min-width: 160px;
    margin-bottom: 0;
    border-color: rgba(255, 255, 255, 0.36);
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: none;
}

.filter-group input[type="date"]:hover {
    border-color: #f8cd9e;
}

.filter-group input[type="date"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(238, 143, 66, 0.28);
}

.filter-group input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    border-radius: 4px;
    padding: 3px;
}

.filter-btn {
    height: 43px;
    border: 1px solid rgba(255, 255, 255, 0.42);
}

.clear-btn {
    padding: 10px 16px;
    background-color: #fff;
    color: #0e6f69;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    height: 43px;
    transition: transform 0.18s ease, box-shadow 0.2s ease;
}

.clear-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 18px rgba(8, 45, 42, 0.18);
}

.filter-info {
    margin-top: 14px;
    font-size: 14px;
    color: #f7fffd;
    background-color: rgba(255, 255, 255, 0.16);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
}

.calendar-header {
    margin-bottom: 18px;
}

.calendar-page {
    background: linear-gradient(180deg, #ffffff 0%, #f9fcfb 100%);
}

.calendar-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.calendar-nav h2 {
    color: #1e3433;
    padding: 0;
}

.calendar-nav-btn {
    color: var(--brand);
    text-decoration: none;
    font-weight: 700;
    padding: 6px 10px;
    border-radius: 8px;
}

.calendar-nav-btn:hover {
    background-color: #e6f0ef;
}

.calendar-table {
    table-layout: fixed;
}

.calendar-day {
    vertical-align: top;
    height: 160px;
    background-color: #fff;
    transition: background-color 0.2s ease;
}

.calendar-day:hover {
    background-color: #f8fbfb;
}

.calendar-empty {
    background-color: #f4f7f6;
}

.calendar-day-number {
    font-weight: 700;
    color: #274443;
    margin-bottom: 8px;
}

.calendar-appointments {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.appointment-card {
    border-left: 4px solid #6e7f7d;
    background-color: #f1f6f5;
    padding: 7px 8px;
    border-radius: 8px;
}

.appointment-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
    cursor: pointer;
    transition: transform 0.18s ease;
}

.appointment-card-link:hover .appointment-card {
    background-color: #e6efee;
    box-shadow: 0 6px 14px rgba(21, 52, 50, 0.14);
}

.appointment-card-link:hover {
    transform: translateY(-1px);
}

.appointment-time {
    font-size: 12px;
    font-weight: 700;
}

.appointment-name,
.appointment-status {
    font-size: 12px;
}

.appointment-city {
    font-size: 12px;
    color: var(--text-muted);
}

.status-unconfirmed {
    border-left-color: #6a7f7d;
}

.status-confirmed {
    border-left-color: #1f8a83;
}

.status-issued {
    border-left-color: #ee8f42;
}

.status-completed {
    border-left-color: #299565;
}

.status-cancelled,
.status-no-show {
    border-left-color: var(--danger);
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 22px;
    padding: 12px 0;
}

.page-link {
    padding: 9px 13px;
    background: #0f6c66;
    color: #fff;
    text-decoration: none;
    border-radius: 10px;
    transition: transform 0.18s ease, background-color 0.2s ease;
}

.page-link:hover {
    background-color: #0b5853;
    transform: translateY(-1px);
}

.page-current {
    padding: 8px 12px;
    font-weight: 700;
    color: #2b4544;
}

@media (max-width: 900px) {
    main {
        width: min(1200px, 96vw);
    }

    .filter-form {
        align-items: stretch;
    }

    .filter-btn,
    .clear-btn {
        height: auto;
    }

    .container {
        padding: 18px;
    }
}

@media (max-width: 768px) {
    nav {
        padding: 8px 12px;
    }

    nav ul {
        gap: 6px;
    }

    .dropdown-menu {
        position: static;
        margin-top: 6px;
    }

    .dropdown-submenu {
        position: static;
        margin-top: 6px;
        margin-left: 12px;
    }

    .has-dropdown .dropdown-toggle {
        padding-right: 10px;
    }

    .form-container {
        padding: 18px;
    }

    .sync-option {
        width: 100%;
    }

    .home-hero,
    .auth-card {
        padding: 18px;
    }

    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}