* {
    box-sizing: border-box;
}

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

.topbar {
    min-height: 72px;
    background: #111827;
    color: white;
    padding: 14px 24px;

    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.brand {
    font-size: 22px;
    font-weight: 700;
}

.subtitle {
    font-size: 12px;
    opacity: 0.7;
    margin-top: 3px;
}

.user-box {
    text-align: right;
    font-size: 14px;
}

.user-box small {
    display: block;
    opacity: 0.7;
    margin-bottom: 5px;
}

.logout-button {
    border: 0;
    background: transparent;
    color: #fff;
    cursor: pointer;
    padding: 0;
}

.page {
    max-width: 1200px;
    margin: auto;
    padding: 24px;
}

.welcome h1 {
    margin-bottom: 5px;
}

.welcome p {
    margin-top: 0;
    color: #6b7280;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
    margin: 24px 0;
}

.stat-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.stat-card span {
    display: block;
    color: #6b7280;
    font-size: 13px;
    margin-bottom: 8px;
}

.stat-card strong {
    font-size: 30px;
}

.panel {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.panel-header h2 {
    margin: 0;
}

.primary-button {
    border: 0;
    border-radius: 7px;
    background: #2563eb;
    color: white;
    padding: 11px 18px;
    font-weight: 600;
    cursor: pointer;
}

.primary-button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.ticket-list {
    margin-top: 20px;
}

.ticket-card {
    border-top: 1px solid #e5e7eb;
    padding: 16px 0;
}

.ticket-top {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.status {
    font-size: 12px;
    background: #eef2ff;
    padding: 5px 9px;
    border-radius: 20px;
}

.customer-name {
    font-weight: 600;
    margin-top: 8px;
}

.ticket-description {
    color: #4b5563;
    margin: 4px 0 8px;
}

.ticket-card small {
    color: #9ca3af;
}

.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: #6b7280;
}

.login-body {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 410px;
    background: white;
    padding: 32px;
    border-radius: 12px;
    box-shadow: 0 6px 30px rgba(0,0,0,0.1);
}

.login-logo {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo h1 {
    margin-bottom: 5px;
}

.login-logo p {
    margin-top: 0;
    color: #6b7280;
}

.login-card label {
    display: block;
    margin: 14px 0 6px;
    font-weight: 600;
}

.login-card input {
    width: 100%;
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: 7px;
    font-size: 16px;
}

.login-card .primary-button {
    width: 100%;
    margin-top: 20px;
}

.error-box {
    background: #fee2e2;
    color: #991b1b;
    padding: 12px;
    border-radius: 7px;
    margin-bottom: 15px;
}

@media (max-width: 800px) {

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .page {
        padding: 15px;
    }

    .topbar {
        padding: 12px 15px;
    }

    .brand {
        font-size: 18px;
    }
}

@media (max-width: 480px) {

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .stat-card {
        padding: 15px;
    }

    .stat-card strong {
        font-size: 25px;
    }

    .panel {
        padding: 15px;
    }

    .panel-header {
        align-items: flex-start;
        flex-direction: column;
    }
}

a.primary-button {
    display: inline-block;
    text-decoration: none;
}

.ticket-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.ticket-link:hover {
    background: #f9fafb;
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.photo-card {
    border: 1px solid #e5e7eb;
    border-radius: 9px;
    padding: 10px;
    background: #fff;
}

.evidence-photo {
    display: block;
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: 7px;
    margin-bottom: 10px;
}

.photo-card strong,
.photo-card small {
    display: block;
    margin-top: 6px;
}

.photo-card small {
    color: #6b7280;
}

/* Compact ticket photo evidence */
.photo-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(140px, 180px)) !important;
    gap: 12px !important;
    align-items: start;
    margin-top: 15px;
}

.photo-card {
    width: 100%;
    max-width: 180px;
    box-sizing: border-box;
    border: 1px solid #e5e7eb;
    border-radius: 9px;
    padding: 8px;
    background: #fff;
}

.photo-card a {
    display: block;
    width: 100%;
}

.photo-card .evidence-photo {
    display: block !important;
    width: 100% !important;
    max-width: 164px !important;
    height: 120px !important;
    object-fit: cover !important;
    border-radius: 7px;
    margin: 0 0 8px 0 !important;
}

.photo-card strong {
    font-size: 14px;
}

.photo-card small {
    font-size: 12px;
    color: #6b7280;
}

@media (max-width: 600px) {
    .photo-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    .photo-card {
        max-width: none;
    }

    .photo-card .evidence-photo {
        max-width: none !important;
        height: 110px !important;
    }
}

/* Global navigation */
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.dashboard-button {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 7px;
    text-decoration: none;
    font-weight: 600;
    background: #ffffff;
    color: #111827;
    border: 1px solid #d1d5db;
}

.dashboard-button:hover {
    background: #f3f4f6;
}

@media (max-width: 600px) {
    .topbar-actions {
        gap: 7px;
    }

    .dashboard-button {
        padding: 7px 10px;
        font-size: 13px;
    }
}

/* Dashboard button - high visibility */
.dashboard-button {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    background: #ffffff !important;
    color: #111827 !important;
    border: 1px solid #d1d5db !important;
    border-radius: 8px !important;
    padding: 9px 16px !important;
    font-weight: 700 !important;
    text-decoration: none !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.dashboard-button:hover,
.dashboard-button:focus {
    background: #f3f4f6 !important;
    color: #111827 !important;
}

@media (max-width: 600px) {
    .dashboard-button {
        padding: 8px 12px !important;
        font-size: 13px !important;
    }
}

/* Role-specific dashboard */
.dashboard-section {
    margin-top: 22px;
}

.ticket-meta {
    margin-top: 5px;
    font-size: 13px;
    line-height: 1.4;
    color: #4b5563;
}

.dashboard-section .ticket-card {
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.dashboard-section .ticket-card:active {
    transform: scale(0.99);
}

@media (max-width: 600px) {
    .dashboard-section {
        margin-top: 16px;
    }

    .dashboard-section .panel-header {
        align-items: flex-start;
    }

    .ticket-meta {
        font-size: 12px;
    }
}

/* Stronger ticket/task visual hierarchy */

.ticket-card .ticket-top > strong {
    font-weight: 800 !important;
    color: #111827 !important;
    font-size: 15px;
}

.ticket-card .customer-name {
    color: #374151 !important;
    font-weight: 600 !important;
    margin-top: 7px;
}

.ticket-card .ticket-description {
    color: #111827 !important;
    font-size: 16px !important;
    font-weight: 800 !important;
    line-height: 1.35;
    margin-top: 7px;
    margin-bottom: 7px;
}

.ticket-card .ticket-meta {
    color: #4b5563 !important;
    font-weight: 500;
}

.ticket-card small {
    color: #6b7280 !important;
}

.ticket-card.ticket-link {
    color: inherit !important;
    text-decoration: none !important;
}

.ticket-card.ticket-link:hover,
.ticket-card.ticket-link:focus {
    text-decoration: none !important;
}

/* Make status stand apart from the task itself */
.ticket-card .status {
    font-weight: 700 !important;
    white-space: nowrap;
}

@media (max-width: 600px) {
    .ticket-card .ticket-description {
        font-size: 15px !important;
    }

    .ticket-card .customer-name {
        font-size: 14px;
    }
}

/* Task priority colours */

.ticket-description.priority-normal {
    color: #d97706 !important;
    font-weight: 800 !important;
}

.ticket-description.priority-high {
    color: #dc2626 !important;
    font-weight: 800 !important;
}

.ticket-description.priority-urgent {
    color: #b91c1c !important;
    font-weight: 900 !important;
}

.ticket-description.priority-low {
    color: #374151 !important;
    font-weight: 700 !important;
}

.management-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

@media (max-width: 600px) {
    .management-actions {
        width: 100%;
        margin-top: 10px;
    }

    .management-actions .primary-button,
    .management-actions .dashboard-button {
        flex: 1 1 auto;
        text-align: center;
    }
}

/* Clickable dashboard counters */
.stat-link {
    text-decoration: none !important;
    color: inherit !important;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.stat-link:hover,
.stat-link:focus {
    text-decoration: none !important;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
}

.stat-link:active {
    transform: scale(0.97);
}

/* Ticket search */
.ticket-search {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 18px 0;
}

.ticket-search input {
    flex: 1;
    min-width: 0;
}

.search-summary {
    margin: 8px 0 16px;
    color: #4b5563;
}

@media (max-width: 600px) {
    .ticket-search {
        flex-wrap: wrap;
    }

    .ticket-search input {
        flex: 1 1 100%;
        width: 100%;
    }
}

.brand-area {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.company-logo {
    display: block;
    width: auto;
    height: 52px;
    max-width: 220px;
    object-fit: contain;
    flex-shrink: 0;
}

.brand-text {
    min-width: 0;
}

@media (max-width: 700px) {
    .topbar {
        padding: 12px 16px;
        gap: 12px;
    }

    .brand-area {
        gap: 10px;
    }

    .company-logo {
        height: 40px;
        max-width: 155px;
    }

    .brand {
        font-size: 18px;
    }

    .subtitle {
        font-size: 11px;
    }
}

@media (max-width: 520px) {
    .company-logo {
        height: 34px;
        max-width: 125px;
    }

    .brand-text {
        display: none;
    }
}
