:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --text: #1d1d1f;
    --muted: #6e6e73;
    --line: #e4e7ec;
    --primary: #1f2937;
    --accent: #0ea5a4;
}

html,
body {
    height: 100%;
}

body {
    font-family: "SF Pro Text", "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top right, rgba(14, 165, 164, 0.08), transparent 35%),
        radial-gradient(circle at top left, rgba(15, 23, 42, 0.06), transparent 28%),
        var(--bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body > main {
    flex: 1 0 auto;
    width: 100%;
}

.navbar {
    backdrop-filter: saturate(160%) blur(8px);
}

.app-nav-container {
    max-width: 1820px;
}

.app-navbar .navbar-brand {
    margin-right: 1rem;
    white-space: nowrap;
}

.app-builder-brand {
    display: inline-flex;
    align-items: center;
    margin-right: 1.5rem;
    padding: 0.1rem 0;
}

.app-builder-brand-logo {
    width: 112px;
    height: auto;
    max-width: 100%;
    display: block;
}

.app-navbar-auth .navbar-brand {
    width: clamp(170px, 14vw, 240px);
    margin-right: 0.4rem;
}

.app-navbar-auth .navbar-nav {
    margin-left: 2.5rem;
}

.app-navbar-auth .navbar-collapse {
    gap: 0.5rem 0.7rem;
}

.app-navbar-auth .app-nav-search-input {
    width: clamp(150px, 11vw, 220px);
}

.app-navbar .navbar-collapse {
    gap: 0.65rem 1rem;
}

.app-navbar .navbar-nav {
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.2rem;
}

.navbar .nav-link {
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 0.35rem 0.72rem;
    white-space: nowrap;
    line-height: 1.1;
    font-size: 0.97rem;
}

.navbar .nav-link.nav-pill-active {
    border-color: var(--primary);
    color: var(--primary);
}

.nav-user-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.nav-user-meta-link,
.nav-user-meta-link:link,
.nav-user-meta-link:visited,
.nav-user-meta-link:active {
    text-decoration: none !important;
    color: var(--text) !important;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 0.18rem 0.35rem;
    transition: background-color 0.16s ease, border-color 0.16s ease;
}

.nav-user-meta-link:hover,
.nav-user-meta-link:focus-visible {
    color: var(--text) !important;
    background-color: #f3f5f8;
    border-color: #dbe1ea;
    text-decoration: none !important;
}

.nav-user-meta-link span {
    text-decoration: none !important;
}

.nav-user-meta-link .small {
    color: var(--muted) !important;
    text-decoration: none !important;
}

.nav-user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    object-fit: cover;
    border: 1px solid #dbe1ea;
    display: inline-block;
    flex: 0 0 30px;
}

.nav-user-avatar-fallback {
    background: #eef2f7;
    color: #1f2937;
    font-size: 0.78rem;
    font-weight: 700;
    text-align: center;
    line-height: 28px;
}

.app-nav-utilities {
    flex-wrap: nowrap;
    row-gap: 0.5rem;
}

.app-nav-search-input {
    width: clamp(180px, 14vw, 260px);
}

.manage-user-identity {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.45rem 0.6rem;
    border: 1px solid #dbe1ea;
    border-radius: 999px;
    background: #ffffff;
}

.manage-user-avatar {
    width: 56px;
    height: 56px;
    border-radius: 999px;
    object-fit: cover;
    border: 1px solid #dbe1ea;
    display: inline-block;
    flex: 0 0 56px;
}

.manage-user-avatar-fallback {
    background: #eef2f7;
    color: #1f2937;
    font-size: 1rem;
    font-weight: 700;
    line-height: 54px;
    text-align: center;
}

.manage-user-meta {
    min-width: 0;
}

.manage-user-name {
    font-weight: 650;
    color: #1f2937;
    line-height: 1.2;
}

.note-author {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    min-width: 0;
}

.note-author-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50% !important;
    object-fit: cover;
    border: 1px solid #dbe1ea;
    display: inline-block;
    flex: 0 0 34px;
    background: #ffffff;
    overflow: hidden;
    clip-path: circle(50% at 50% 50%);
    vertical-align: middle;
}

.note-author-avatar-fallback {
    background: #eef2f7;
    color: #1f2937;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 32px;
    text-align: center;
}

.branch-image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 220px));
    gap: 0.75rem;
    align-items: start;
    justify-content: start;
}

.branch-image-card {
    border: 1px solid #dbe1ea;
    border-radius: 0.85rem;
    background: #ffffff;
    padding: 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 220px;
    max-width: 100%;
}

.branch-image-card > a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 170px;
    min-height: 170px;
    max-height: 170px;
    overflow: hidden;
    border-radius: 0.6rem;
    border: 1px solid #dbe1ea;
    background: #f8fafc;
}

.branch-image-thumb {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 0;
    border: 0;
    display: block;
    margin: 0 auto;
}

.app-builder-footer {
    border-top: 1px solid var(--line);
    background: #ffffff;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1030;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.06);
}

body.has-builder-footer {
    padding-bottom: calc(92px + env(safe-area-inset-bottom));
}

.app-builder-footer .container {
    min-height: 64px;
}

.app-builder-footer-logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.card,
.table,
.form-control,
.form-select,
.alert {
    border-radius: 1rem;
}

.card,
.table,
.alert,
.shadow-soft {
    border: 1px solid var(--line);
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.06);
}

.card-header {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border-bottom: 1px solid var(--line);
}

.btn {
    border-radius: 999px;
}

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

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

.dashboard-stat {
    border-radius: 1rem;
    padding: 1.1rem;
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.dashboard-stat .value {
    font-size: 1.7rem;
    font-weight: 700;
}

.dashboard-stat-link,
.dashboard-stat-link:link,
.dashboard-stat-link:visited,
.dashboard-stat-link:hover,
.dashboard-stat-link:active,
.dashboard-widget,
.dashboard-widget:link,
.dashboard-widget:visited,
.dashboard-widget:hover,
.dashboard-widget:active {
    text-decoration: none;
    color: inherit;
    display: block;
}

.dashboard-stat-link .dashboard-stat,
.dashboard-widget .dashboard-stat {
    transition: transform 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease, border-color 0.16s ease;
}

.dashboard-stat-link:hover .dashboard-stat,
.dashboard-stat-link:focus-visible .dashboard-stat,
.dashboard-widget:hover .dashboard-stat,
.dashboard-widget:focus-visible .dashboard-stat {
    transform: translateY(-2px);
    background-color: #f1f3f5;
    border-color: #dbe1ea;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
}

.dashboard-stat-link .value,
.dashboard-widget .value {
    color: var(--text);
}

.dashboard-stat-link:focus-visible,
.dashboard-widget:focus-visible {
    outline: none;
}

.dashboard-widget,
.dashboard-widget * {
    color: var(--text) !important;
    text-decoration: none !important;
}

.dashboard-widget .label {
    color: var(--text) !important;
    font-size: 0.9rem;
}

.dashboard-widget:hover,
.dashboard-widget:focus-visible,
.dashboard-widget:hover *,
.dashboard-widget:focus-visible * {
    color: var(--text) !important;
    text-decoration: none !important;
}

.dashboard-widget.is-active .dashboard-stat {
    background-color: #eef2f7;
    border-color: #cfd8e3;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
}

.anchored-section {
    scroll-margin-top: 96px;
}

.table > :not(caption) > * > * {
    border-bottom-color: #eef1f5;
    vertical-align: middle;
}

.form-label {
    font-weight: 600;
}

.section-title {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 1.1rem;
}

.status-pill {
    border-radius: 999px;
}

.presence-dot {
    display: inline-block;
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 999px;
    margin-right: 0.45rem;
    vertical-align: middle;
}

.presence-online {
    background-color: #16a34a;
}

.presence-offline {
    background-color: #dc2626;
}

.danger-zone-card {
    overflow: hidden;
    border-width: 1px;
}

.danger-zone-card .card-header {
    border-bottom-color: rgba(220, 38, 38, 0.35);
}

.assignment-timeline {
    position: relative;
    margin: 0;
    padding: 0;
}

.assignment-timeline-item {
    position: relative;
    display: flex;
    gap: 0.85rem;
    padding: 0 0 1rem;
}

.assignment-timeline-item:last-child {
    padding-bottom: 0;
}

.assignment-timeline-dot {
    width: 0.72rem;
    height: 0.72rem;
    border-radius: 999px;
    background: #6b7280;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 1px #d5dbe4;
    margin-top: 0.35rem;
    flex: 0 0 0.72rem;
}

.assignment-timeline-content {
    flex: 1;
    border: 1px solid var(--line);
    border-radius: 0.8rem;
    background: #fbfcfe;
    padding: 0.65rem 0.8rem;
}

.assignment-timeline-note {
    border: 1px solid #e2e8f0;
    border-radius: 0.65rem;
    background: #f8fafc;
    padding: 0.45rem 0.6rem;
    font-size: 0.9rem;
}

.profile-image-wrap {
    width: 100%;
    max-width: 220px;
    height: 220px;
    border: 1px solid var(--line);
    border-radius: 0.9rem;
    overflow: hidden;
    background: #f8fafc;
}

.profile-image-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    max-width: 100%;
    max-height: 100%;
}

.profile-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 0.92rem;
    padding: 0.75rem;
    text-align: center;
}

.promo-image-card {
    border: 1px solid var(--line);
    border-radius: 0.9rem;
    background: #fff;
    padding: 0.5rem;
    max-width: 240px;
    margin: 0 auto;
}

.promo-image-preview {
    width: 100%;
    height: 170px;
    object-fit: cover;
    border-radius: 0.65rem;
    display: block;
    max-width: 100%;
    max-height: 170px;
}

@media (max-width: 576px) {
    .branch-image-grid {
        grid-template-columns: 1fr;
    }

    .branch-image-card {
        width: 100%;
    }

    .branch-image-card > a {
        height: 150px;
        min-height: 150px;
        max-height: 150px;
    }

    .branch-image-thumb {
        max-height: 100%;
    }

    .profile-image-wrap {
        max-width: 170px;
        height: 170px;
    }

    .promo-image-preview {
        height: 150px;
        max-height: 150px;
    }
}

@media (max-width: 1199.98px) {
    .app-navbar-auth .navbar-nav {
        margin-left: 1.4rem;
    }

    .app-navbar .nav-link {
        font-size: 0.92rem;
        padding-inline: 0.55rem;
    }

    .app-nav-search-input {
        width: clamp(160px, 18vw, 220px);
    }
}

@media (max-width: 991.98px) {
    .app-builder-brand-logo {
        width: 96px;
    }

    .app-navbar-auth .navbar-brand {
        width: auto;
        margin-right: 0.75rem;
    }

    .app-navbar .navbar-nav {
        flex-wrap: wrap;
        align-items: stretch;
        gap: 0.25rem;
    }

    .app-navbar-auth .navbar-nav {
        margin-left: 0;
    }

    .app-navbar .nav-link {
        white-space: normal;
    }

    .app-nav-search-input {
        width: min(100%, 420px);
    }

    .app-nav-utilities {
        flex-wrap: wrap;
    }
}

.match-contractors-table {
    min-width: 1550px;
}

.match-contractors-table .categories-col,
.match-contractors-table .categories-cell {
    min-width: 200px;
}

.match-contractors-table .offer-col,
.match-contractors-table .offer-cell {
    min-width: 320px;
    width: 320px;
}

.match-contractors-table .profit-col,
.match-contractors-table .profit-cell {
    min-width: 145px;
    white-space: nowrap;
}

.offer-form {
    margin: 0;
}

.offer-input-group {
    min-width: 300px;
    flex-wrap: nowrap;
}

.offer-input {
    min-width: 150px;
    text-align: right;
}

.offer-input-group .btn {
    min-width: 110px;
    white-space: nowrap;
}

.calendar-shell {
    border: 1px solid var(--line);
    border-radius: 1rem;
    background: #fff;
    padding: 0.85rem;
    overflow: hidden;
}

.calendar-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    margin-bottom: 0.9rem;
}

.calendar-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.88rem;
    color: var(--muted);
}

.calendar-legend-dot {
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 999px;
    display: inline-block;
}

.calendar-dot-unassigned {
    background: #64748b;
}

.calendar-dot-held {
    background: #d97706;
}

.calendar-dot-accepted {
    background: #15803d;
}

.calendar-dot-emailed {
    background: #0ea5e9;
}

.calendar-dot-completed {
    background: #2563eb;
}

.calendar-dot-external {
    background: #7c3aed;
}

.calendar-dot-cancelled {
    background: #b91c1c;
}

#booking-calendar .fc-toolbar-title {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

#booking-calendar .fc-event {
    border-radius: 0.55rem;
    border-width: 1px;
}

#booking-calendar .fc-event .fc-event-main {
    overflow: hidden;
}

#booking-calendar .fc-event .fc-event-main-frame {
    display: block;
}

#booking-calendar .fc-event-scroll-viewport {
    display: block;
    overflow: hidden;
    white-space: nowrap;
}

#booking-calendar .fc-event-scroll-track {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    will-change: transform;
}

@keyframes calendar-event-marquee {
    0%, 14% {
        transform: translateX(0);
    }
    86%, 100% {
        transform: translateX(calc(-1 * var(--calendar-scroll-distance, 0px)));
    }
}

@media (min-width: 993px) {
    #booking-calendar .fc-event.fc-event-scroll-active .fc-event-scroll-track {
        display: inline-block;
        overflow: visible;
        text-overflow: clip;
        animation-name: calendar-event-marquee;
        animation-duration: var(--calendar-scroll-duration, 10s);
        animation-timing-function: linear;
        animation-iteration-count: infinite;
        animation-direction: alternate;
    }
}

#booking-calendar .fc {
    --fc-border-color: #e8ebf0;
    --fc-page-bg-color: #ffffff;
    --fc-neutral-bg-color: #f8fafc;
    --fc-list-event-hover-bg-color: #f3f5f8;
    font-family: "SF Pro Text", "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
}

#booking-calendar .fc-toolbar.fc-header-toolbar {
    margin: 0 0 0.9rem;
    padding: 0.2rem 0.15rem;
}

#booking-calendar .fc .fc-button-primary {
    background: #fff;
    border-color: #d6dbe4;
    color: #111827;
    border-radius: 0.6rem;
    box-shadow: none;
}

#booking-calendar .fc .fc-button-primary:hover,
#booking-calendar .fc .fc-button-primary:focus {
    background: #f3f5f8;
    border-color: #c7ced9;
    color: #111827;
}

#booking-calendar .fc .fc-button-primary:not(:disabled).fc-button-active {
    background: #e9edf4;
    border-color: #cfd7e3;
    color: #0f172a;
}

#booking-calendar .fc-daygrid-day-number {
    color: #111827;
    font-weight: 600;
    text-decoration: none;
}

#booking-calendar .fc-col-header-cell-cushion {
    color: #374151;
    font-weight: 600;
    text-decoration: none;
    padding: 0.5rem 0.25rem;
}

#booking-calendar .fc-daygrid-day-events {
    margin-top: 0.2rem;
}

#booking-calendar .fc-day-today {
    background: #f8fbff !important;
}

#booking-calendar .fc-event-title {
    font-weight: 600;
}

#booking-calendar .fc-daygrid-more-link {
    color: #475569;
    text-decoration: none;
}

@media (max-width: 992px) {
    #booking-calendar .fc-toolbar-title {
        font-size: 1.4rem;
    }
}
