* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Arial, sans-serif;
    background: #f4f6f8;
    color: #1f2937;

    display: flex;
    flex-direction: column;
}

a {
    color: inherit;
    text-decoration: none;
}

.topbar {
    background: #111827;
    color: white;
    padding: 14px 16px;
}

.topbar-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-weight: bold;
    font-size: 22px;
}

nav {
    display: flex;
    gap: 14px;
}

nav a {
    font-size: 14px;
    opacity: 0.9;
}

.page {
    width: 100%;
    padding: 22px 24px;
    flex: 1;
}

.narrow-page {
    max-width: 1100px;
    margin: 0 auto;
}

.card {
    background: white;
    border-radius: 14px;
    padding: 22px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.06);
    margin-bottom: 18px;
}

h1 {
    margin-top: 0;
    font-size: 28px;
}

.form-group {
    margin-bottom: 14px;
}

label {
    display: block;
    font-weight: bold;
    margin-bottom: 6px;
}

input {
    width: 100%;
    padding: 13px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-size: 16px;
}

button,
.button {
    display: inline-block;
    background: #2563eb;
    color: white;
    border: none;
    padding: 13px 18px;
    border-radius: 10px;
    font-size: 16px;
    cursor: pointer;
}

button:hover,
.button:hover {
    background: #1d4ed8;
}

.message {
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 14px;
}

.message.error {
    background: #fee2e2;
    color: #991b1b;
}

.message.success {
    background: #dcfce7;
    color: #166534;
}

@media (max-width: 700px) {
    .topbar-inner {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }

    nav {
        flex-wrap: wrap;
    }

    .card {
        padding: 18px;
    }

    h1 {
        font-size: 24px;
    }
}

textarea {
    width: 100%;
    padding: 13px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-size: 16px;
    font-family: inherit;
}

select {
    width: 100%;
    padding: 13px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-size: 16px;
    font-family: inherit;
    background: white;
}

.badge {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: bold;
    background: #e5e7eb;
}

.badge-new { background: #dbeafe; color: #1e40af; }
.badge-assigned { background: #ede9fe; color: #5b21b6; }
.badge-in_progress { background: #fef3c7; color: #92400e; }
.badge-waiting { background: #fee2e2; color: #991b1b; }
.badge-completed { background: #dcfce7; color: #166534; }

.badge-low { background: #e5e7eb; color: #374151; }
.badge-normal { background: #dbeafe; color: #1e40af; }
.badge-high { background: #fef3c7; color: #92400e; }
.badge-urgent { background: #fee2e2; color: #991b1b; }

.secondary-button {
    background: #e5e7eb;
    color: #111827;
}

.secondary-button:hover {
    background: #d1d5db;
}

.ticket-time {
    font-size: 13px;
    font-weight: bold;
    color: #2563eb;
    margin-bottom: 5px;
}

.ticket-title {
    font-weight: bold;
    margin-bottom: 6px;
}

.ticket-meta {
    font-size: 13px;
    color: #4b5563;
    margin-bottom: 5px;
}

.ticket-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 8px;
}


.unscheduled-ticket {
    display: block;
    color: inherit;
}

.unscheduled-ticket h3 {
    margin-top: 0;
}

.planning-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.planning-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}


.planning-board-wrap {
    overflow-x: auto;
    margin-bottom: 24px;
    border-radius: 16px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.06);
    background: white;
    display: inline-block;
    max-width: 100%;
}

.planning-board {
    border-collapse: separate;
    border-spacing: 0;
    width: max-content;
    min-width: auto;
}

.planning-board th:not(.day-column),
.planning-board td:not(.day-column) {
    width: 260px;
    min-width: 240px;
    max-width: 300px;
}

.planning-board th,
.planning-board td {
    border-right: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: top;
}

.planning-board thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #111827;
    color: white;
    padding: 12px;
    text-align: left;
    font-size: 14px;
}

.planning-board td {
    height: 145px;
}

.day-column {
    position: sticky;
    left: 0;
    z-index: 3;
    width: 120px;
    min-width: 120px;
    background: #f3f4f6 !important;
    color: #111827;
    padding: 12px;
}

.planning-board thead .day-column {
    background: #111827 !important;
    color: white;
}

.day-name {
    font-weight: bold;
}

.day-date {
    font-size: 13px;
    color: #6b7280;
    margin-top: 3px;
}

.today-day {
    background: #dbeafe !important;
}

.today-cell {
    background: #eff6ff !important;
}

.empty-cell {
    color: #c0c4cc;
    text-align: center;
    padding: 22px 0;
}

.planning-ticket {
    background: white;
    border: 1px solid #e5e7eb;
    border-left: 5px solid #2563eb;
    border-radius: 12px;
    padding: 10px;
    margin-bottom: 9px;
}

.planning-ticket-main {
    display: block;
}

.ticket-time {
    font-size: 13px;
    font-weight: bold;
    color: #2563eb;
    margin-bottom: 5px;
}

.ticket-title {
    font-weight: bold;
    margin-bottom: 6px;
}

.ticket-meta {
    font-size: 13px;
    color: #4b5563;
    margin-bottom: 5px;
}

.ticket-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.quick-assign-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-top: 9px;
}

.quick-assign-form select,
.quick-assign-form input {
    padding: 8px;
    font-size: 13px;
    border-radius: 8px;
}

.quick-assign-form button {
    grid-column: 1 / -1;
    padding: 8px 10px;
    font-size: 13px;
    border-radius: 8px;
}

.unscheduled-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
    gap: 14px;
}

.unscheduled-ticket a {
    display: block;
}

.unscheduled-ticket h3 {
    margin-top: 0;
}

.unscheduled-plan-form {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #e5e7eb;
}

@media (max-width: 800px) {
    .planning-actions .button {
        flex: 1;
        text-align: center;
    }

    .planning-board {
        min-width: 780px;
    }

    .planning-board td {
        min-width: 190px;
    }

    .day-column {
        width: 95px;
        min-width: 95px;
    }
}

.ticket-image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
}

.ticket-image-card img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    display: block;
}

.ticket-image-card p {
    padding: 10px;
    margin: 0;
    font-size: 13px;
    color: #4b5563;
}

.ticket-image-card {
    position: relative;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    background: #f9fafb;
}

.delete-image-form {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 5;
}

.delete-image-button {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    border: none;
    background: rgba(0,0,0,0.75);
    color: white;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.delete-image-button:hover {
    background: rgba(220,38,38,0.95);
}

.collapsible-column-header {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.collapsible-column-header.collapsed-column,
td.collapsed-column {
    width: 120px !important;
    min-width: 120px !important;
    max-width: 120px !important;
}

td.collapsed-column .planning-ticket,
td.collapsed-column .empty-cell {
    display: none;
}

td.collapsed-column {
    background: #f3f4f6 !important;
}

.unassigned-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.unassigned-ticket a {
    display: block;
}

.unassigned-ticket h3 {
    margin-top: 0;
}

.unassigned-compact-card {
    padding: 0;
    overflow: hidden;
}

.unassigned-table-wrap {
    overflow-x: auto;
}

.unassigned-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.unassigned-table th,
.unassigned-table td {
    padding: 9px 10px;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: middle;
}

.unassigned-table th {
    background: #f3f4f6;
    text-align: left;
    font-size: 13px;
    color: #374151;
}

.unassigned-table select,
.unassigned-table input {
    padding: 7px;
    font-size: 13px;
    border-radius: 8px;
}

.small-muted {
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
}

.time-cell {
    display: flex;
    gap: 6px;
}

.small-button {
    padding: 8px 10px;
    font-size: 13px;
    border-radius: 8px;
}

.dashboard-filter-card {
    padding: 16px;
}

.dashboard-filters {
    display: flex;
    gap: 18px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.filter-group {
    min-width: 220px;
}

.employee-filter-list {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.employee-filter-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f3f4f6;
    border-radius: 999px;
    padding: 7px 10px;
    font-size: 14px;
    cursor: pointer;
}

.employee-filter-item input {
    width: auto;
}

.public-holiday-day {
    background: #fecaca !important;
}

.flag-day-icon {
    margin-left: 5px;
    font-size: 16px;
    vertical-align: middle;
}

.holiday-icon {
    margin-left: 4px;
    color: #dc2626;
    font-size: 12px;
}

.calendar-day-note {
    margin-top: 5px;
    font-size: 11px;
    line-height: 1.25;
    color: #991b1b;
    font-weight: normal;
}

.fi-flag-icon {
    display: inline-block;
    width: 18px;
    height: 12px;
    margin-left: 6px;
    vertical-align: middle;
    border: 1px solid #d1d5db;
    background:
        linear-gradient(to right, transparent 0 32%, #003580 32% 48%, transparent 48% 100%),
        linear-gradient(to bottom, transparent 0 36%, #003580 36% 58%, transparent 58% 100%),
        #ffffff;
}

.danger-button {
    background: #dc2626;
}

.danger-button:hover {
    background: #b91c1c;
}

.template-draft-card {
    padding: 0;
    overflow: hidden;
}

.template-draft-table input[type="text"],
.template-draft-table textarea,
.template-draft-table select,
.template-draft-table input[type="time"] {
    width: 100%;
    padding: 7px;
    font-size: 13px;
    border-radius: 8px;
}

.template-draft-table textarea {
    margin-top: 6px;
}

.template-draft-table input[type="checkbox"] {
    width: auto;
    transform: scale(1.2);
}

.time-cell {
    display: flex;
    gap: 6px;
}

.already-added-row {
    opacity: 0.55;
    background: #f9fafb;
}

.quick-add-button {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: #2563eb;
    color: white;
    border: none;
    font-size: 18px;
    line-height: 1;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 10px auto 0 auto;
}

.quick-add-button:hover {
    background: #1d4ed8;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(17,24,39,0.55);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-box {
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    background: white;
    border-radius: 16px;
    padding: 20px;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 12px;
    background: #111827;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    padding: 0;
}

.customer-list-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.customer-list-card h2 {
    margin: 0 0 6px;
}

.customer-list-card p {
    margin: 3px 0;
    color: #4b5563;
}

.customer-list-arrow {
    font-size: 34px;
    color: #9ca3af;
}

.customer-field-list {
    display: grid;
    gap: 12px;
}

.customer-field-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 12px;
}

.circle-edit-button {
    min-width: 34px;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    padding: 0;
    background: #e5e7eb;
    color: #111827;
}

.circle-edit-button:hover {
    background: #d1d5db;
}

.complete-ticket-button {
    width: 100%;
    margin-top: 8px;
    background: #16a34a;
    padding: 8px 10px;
    font-size: 13px;
    border-radius: 8px;
}

.complete-ticket-button:hover {
    background: #15803d;
}

.success-button {
    background: #16a34a;
}

.success-button:hover {
    background: #15803d;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.stat-card {
    background: white;
    border-radius: 14px;
    padding: 18px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.06);
}

.stat-number {
    font-size: 30px;
    font-weight: bold;
    color: #111827;
}

.stat-label {
    color: #6b7280;
    font-size: 14px;
}

.ticket-timeline {
    display: grid;
    gap: 10px;
}

.timeline-ticket-card {
    display: block;
    border: 1px solid #e5e7eb;
    border-left: 5px solid #2563eb;
    border-radius: 12px;
    padding: 12px;
    background: #f9fafb;
}

.timeline-ticket-card:hover {
    background: #f3f4f6;
}

.timeline-ticket-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

.timeline-ticket-bottom {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 8px;
    color: #6b7280;
    font-size: 13px;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 18px;
    flex-wrap: wrap;
}

.pagination-info {
    color: #6b7280;
    font-size: 14px;
}

.property-mini-list {
    display: grid;
    gap: 10px;
}

.property-mini-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #f9fafb;
}

.property-mini-card:hover {
    background: #f3f4f6;
}

.property-mini-stats {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
    font-size: 13px;
    color: #6b7280;
}

.page-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.main-nav {
    display: flex;
    gap: 18px;
    align-items: center;
    flex-wrap: wrap;
}

.footer {
    margin-top: 50px;
    border-top: 1px solid #e5e7eb;
    background: #fff;
    padding: 18px 20px;
}

.footer-inner {
    max-width: 1100px;
    margin: 0 auto;

    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.footer-left {
    color: #6b7280;
    font-size: 14px;
}

.footer-right {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.footer-right a {
    color: #374151;
    text-decoration: none;
    font-size: 14px;
}

.footer-right a:hover {
    text-decoration: underline;
}

.quick-title-suggestions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.quick-title-chip {
    background: #e5e7eb;
    color: #111827;
    border-radius: 999px;
    padding: 7px 10px;
    font-size: 13px;
}

.quick-title-chip:hover {
    background: #d1d5db;
}

.access-code-list {
    margin-top: 10px;
    display: grid;
    gap: 6px;
}

.access-code-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 12px;
    color: #4b5563;
}

.access-code-row span {
    background: #f3f4f6;
    border-radius: 999px;
    padding: 3px 7px;
}

.badge-external {
    background: #dbeafe;
    color: #1d4ed8;
}

.badge-internal {
    background: #e5e7eb;
    color: #374151;
}

.portal-info-box {
    margin: 16px 0;
    padding: 14px;
    border-radius: 12px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
}

.portal-info-box h3 {
    margin-top: 0;
    margin-bottom: 10px;
}

.portal-info-box p {
    margin: 6px 0;
}

.dashboard-filter-layout {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    flex-wrap: wrap;
}

.dashboard-filter-left {
    flex: 1;
    min-width: 300px;
}

.dashboard-filter-right {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}