* {
    box-sizing: border-box;
}

html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

body {
    font-family: Arial, sans-serif;
    background: #f4f6f8;
    margin: 0;
    color: #1f2937;
}

img,
input,
select,
textarea,
button,
table {
    max-width: 100%;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

.container-wide {
    max-width: 1800px;
    margin: 0 auto;
}

.page-shell {
    min-height: calc(100vh - 130px);
    padding: 25px 20px;
}

.card {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    margin-bottom: 20px;
    width: 100%;
}

.login-card {
    max-width: 450px;
    margin: 60px auto;
}

label {
    display: block;
    margin-top: 12px;
    margin-bottom: 5px;
    font-weight: bold;
}

input,
select,
textarea,
button {
    width: 100%;
    padding: 10px;
    box-sizing: border-box;
    margin-bottom: 10px;
}

button {
    background: #1f6feb;
    color: #fff;
    border: none;
    cursor: pointer;
    border-radius: 4px;
}


button:hover {
    background: #1558b0;
}

.btn-danger {
    background: #dc2626;
    color: #fff;
    border: none;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-danger:active {
    background: #991b1b;
}

.small-btn {
    width: auto;
    display: inline-block;
    padding: 8px 12px;
    margin-right: 6px;
}

.success {
    background: #e7f8ec;
    color: #167c3a;
    padding: 10px;
    margin-top: 10px;
    border-radius: 6px;
}

.error {
    background: #fdeaea;
    color: #a12626;
    padding: 10px;
    margin-top: 10px;
    border-radius: 6px;
}

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

.checkbox-row input[type="checkbox"] {
    width: auto;
    margin-bottom: 0;
}

.nav-links a {
    display: inline-block;
    margin-right: 12px;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    margin-bottom: 20px;
}

table th,
table td {
    border: 1px solid #ddd;
    padding: 10px;
    vertical-align: top;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
}

.icon-list {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.stat-box {
    background: #fff;
    border-radius: 10px;
    padding: 18px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

/* Header */
.site-header {
    background: #1f6feb;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.12);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-left .brand,
.header-brand a {
    color: #fff;
    text-decoration: none;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
}

.icon-nav {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.icon-nav a {
    color: #fff;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.08);
    transition: 0.2s ease;
    white-space: nowrap;
}

.icon-nav a:hover,
.icon-nav a.active {
    background: rgba(255,255,255,0.2);
}

/* Footer */
.site-footer {
    background: #111827;
    color: #fff;
    padding: 14px 20px;
    margin-top: 30px;
}

.footer-inner,
.site-footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

/* Calendar */


.calendar-toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.calendar-grid.month {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
}

.calendar-day {
    background: #fff;
    border-radius: 10px;
    min-height: 140px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.07);
    padding: 10px;
}

.calendar-day .day-label {
    font-weight: bold;
    margin-bottom: 10px;
}

.appt-chip {
    background: #dbeafe;
    border-left: 4px solid #1f6feb;
    padding: 6px 8px;
    border-radius: 6px;
    margin-bottom: 6px;
    font-size: 13px;
}

.week-grid,
.day-grid {
    display: grid;
    gap: 12px;
}

.week-grid {
    grid-template-columns: repeat(7, 1fr);
}

.day-grid {
    grid-template-columns: 1fr;
}

/* Strong vertical separators between days */
.fc .fc-timegrid-col {
    border-right: 2px solid #b00707fb !important;
}

/* Last column edge */
.fc .fc-timegrid-col:last-child {
    border-right: 2px solid #0c7e7e !important;
}

/* Header (day names) vertical lines */
.fc .fc-col-header-cell {
    border-right: 2px solid #0e5096 !important;
}

/* Grid alignment */
.fc .fc-scrollgrid,
.fc .fc-scrollgrid td,
.fc .fc-scrollgrid th {
    border-color: #cfd8e3 !important;
}

/* Make vertical lines span full height cleanly */
.fc .fc-timegrid-body {
    border-left: 2px solid #064487 !important;
}

/* Optional: slightly darker hour rows for contrast */
.fc .fc-timegrid-slot {
    border-bottom: 1px solid #787a7c66 !important;
}

/* Clean event look */
.fc .fc-event {
    border-radius: 4px;
    padding: 2px 4px;
    font-size: 12px;
}
/* Contracts table */
.contracts-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.contracts-table {
    min-width: 1350px;
    width: 100%;
}

.contracts-table th,
.contracts-table td {
    vertical-align: top;
}

.contracts-table th.col-status,
.contracts-table td.col-status {
    min-width: 120px;
}

.contracts-table th.col-tax,
.contracts-table td.col-tax {
    min-width: 110px;
}

.contracts-table th.col-total,
.contracts-table td.col-total {
    min-width: 130px;
}

.contracts-table th.col-subtotal,
.contracts-table td.col-subtotal {
    min-width: 120px;
}

.contracts-table th.col-sent,
.contracts-table td.col-sent,
.contracts-table th.col-signed,
.contracts-table td.col-signed {
    min-width: 140px;
}

.contracts-table th.col-signed-name,
.contracts-table td.col-signed-name {
    min-width: 160px;
}

.contracts-table select,
.contracts-table input,
.contracts-table textarea {
    width: 100%;
    min-width: 0;
}

.contracts-table textarea {
    min-height: 80px;
    resize: vertical;
}

.admin-tab-links {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.admin-tab-links a {
    display: inline-block;
    padding: 10px 14px;
    background: #1f6feb;
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
}

.admin-tab-links a:hover {
    background: #1558b0;
}

.admin-tab-links a.active {
    background: #420355;
}




/* Mobile layout */
@media (max-width: 768px) {
    body {
        padding: 0;
    }

    .page-shell {
        padding: 12px 12px 90px 12px;
    }

    .container,
    .container-wide {
        width: 100%;
        max-width: 100%;
        padding: 0;
        margin: 0 auto;
    }

    .card {
        width: 100%;
        max-width: 100%;
        padding: 14px;
        margin-bottom: 14px;
    }

    .grid-2,
    .grid-3,
    .grid-4,
    .dashboard-stats,
    .week-grid,
    .calendar-grid.month {
        grid-template-columns: 1fr !important;
    }

    /* mobile bottom nav */
    .site-header {
        position: sticky;
        top: 0;
        padding: 10px 16px;
        z-index: 1000;
    }

    .icon-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1100;
        display: flex;
        justify-content: space-around;
        align-items: center;
        gap: 0;
        flex-wrap: nowrap;
        padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
        background: #1f6feb;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.18);
        overflow-x: auto;
    }

    .icon-nav a {
        flex: 1 1 auto;
        min-width: 44px;
        max-width: 72px;
        padding: 8px 6px !important;
        gap: 0 !important;
        justify-content: center;
        border-radius: 10px;
    }

    .icon-nav a span {
        display: none !important;
    }

    .icon-nav a i {
        margin: 0 !important;
        font-size: 20px;
    }
}


/* ===== Alert Messages ===== */

.success,
.error {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-weight: 500;
}

.success {
    background: #e6f7ed;
    border: 1px solid #28a745;
    color: #155724;
}

.error {
    background: #fdecea;
    border: 1px solid #dc3545;
    color: #721c24;
}

/* Message text wrapper */
.alert-text {
    flex: 1;
}

/* Small inline X button */
.alert-close {
    background: rgba(0,0,0,0.1);
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 14px;
    line-height: 22px;
    text-align: center;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
}

.alert-close:hover {
    background: rgba(0,0,0,0.2);
}

/* =========================
   Mobile Calendar Toolbar Fix
========================= */
@media (max-width: 768px) {

    .fc .fc-toolbar {
        flex-wrap: wrap;
        gap: 6px;
    }

    /* Left buttons (prev/next/today) */
    .fc .fc-toolbar-chunk:first-child {
        flex: 1 1 auto;
        display: flex;
        justify-content: flex-start;
        gap: 6px;
    }

    /* Title (date/year) */
    .fc .fc-toolbar-chunk:nth-child(2) {
        flex: 1 1 100%;
        text-align: center;
        margin-top: 4px;
    }

    /* View buttons (week/day/month) */
    .fc .fc-toolbar-chunk:last-child {
        flex: 1 1 100%;
        display: flex;
        justify-content: center;
        gap: 6px;
        margin-top: 4px;
    }

    /* Make buttons smaller */
    .fc .fc-button {
        padding: 4px 8px !important;
        font-size: 12px !important;
    }

    /* Slightly smaller title */
    .fc .fc-toolbar-title {
        font-size: 1.1rem !important;
        white-space: normal;
    }
}
/* =========================
   GLOBAL MOBILE PAGE FIXES
========================= */

html, body {
    max-width: 100%;
    overflow-x: hidden;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

img,
table,
input,
select,
textarea {
    max-width: 100%;
}

.page-shell,
.container,
.container-wide,
.card {
    min-width: 0;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-wrap table {
    width: 100%;
}

/* Desktop defaults */
@media (min-width: 769px) {
    .table-wrap.desktop-wrap table {
        min-width: 0;
        width: 100%;
    }
}

/* Mobile layout fixes */
@media (max-width: 768px) {
    body {
        padding: 0;
    }

    .page-shell {
        padding: 12px 10px 80px 10px;
        min-width: 0;
        overflow-x: hidden;
    }

    .container,
    .container-wide {
        width: 100%;
        max-width: 100%;
        margin: 0 auto;
        padding-left: 0;
        padding-right: 0;
        min-width: 0;
    }

    .card {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        padding: 14px;
        margin-bottom: 14px;
        overflow-x: hidden;
    }

    h1 {
        font-size: 1.35rem;
        line-height: 1.2;
        margin-bottom: 12px;
    }

    h2 {
        font-size: 1.1rem;
        line-height: 1.2;
        margin-bottom: 10px;
    }

    h3 {
        font-size: 1rem;
    }

    label {
        font-size: 14px;
        margin-top: 8px;
        margin-bottom: 4px;
    }

    input,
    select,
    textarea,
    button {
        width: 100%;
        max-width: 100%;
        font-size: 14px;
        padding: 8px;
        margin-bottom: 8px;
    }

    textarea {
        min-height: 90px;
    }

    .checkbox-row {
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .checkbox-row input[type="checkbox"] {
        width: auto;
        margin-top: 3px;
    }

    /* Make button rows stack nicely */
    .button-row,
    .form-actions,
    .action-row,
    .scheduler-actions,
    .admin-tab-links {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .button-row button,
    .form-actions button,
    .action-row button,
    .scheduler-actions button,
    .admin-tab-links a {
        flex: 1 1 auto;
        width: auto;
    }

    /* Mobile tables scroll instead of forcing page width */
    .table-wrap {
        width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
        border: 1px solid #d7dee7;
        border-radius: 8px;
        background: #fff;
    }

    .table-wrap table {
        min-width: 900px;
        width: max-content;
        margin-bottom: 0;
    }

    .table-wrap th,
    .table-wrap td {
        white-space: nowrap;
        vertical-align: top;
    }

    .table-wrap td.wrap,
    .table-wrap td.notes-cell,
    .table-wrap td.message-cell,
    .table-wrap td.description-cell,
    .table-wrap td.address-cell {
        white-space: normal;
        min-width: 180px;
    }

    /* If a page has wide filter bars/forms, let them stack */
    .filters-row,
    .search-row,
    .top-actions,
    .toolbar-row,
    .calendar-toolbar {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .filters-row > *,
    .search-row > *,
    .top-actions > *,
    .toolbar-row > *,
    .calendar-toolbar > * {
        flex: 1 1 100%;
        min-width: 0;
    }

    /* Keep nav from causing width overflow */
    .icon-nav {
        max-width: 100%;
    }

    /* Prevent long text/URLs from pushing layout */
    td,
    th,
    p,
    span,
    div,
    a,
    small {
        overflow-wrap: anywhere;
        word-break: break-word;
    }
}