:root {
    --app-bg: #f5f7fb;
    --app-surface: #ffffff;
    --app-border: #dbe3ef;
    --app-text: #152033;
}

html,
body {
    background: var(--app-bg);
}

.app-bar {
    background: #123b63;
    border-bottom: 1px solid rgba(255, 255, 255, .18);
}

.app-title {
    font-size: 1rem;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.layout-user {
    color: rgba(255, 255, 255, .88);
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-content {
    padding-bottom: 32px;
    padding-top: 24px;
}

.page-heading {
    align-items: flex-start;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 18px;
}

.home-hero {
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(0, 1fr) auto;
    margin-bottom: 18px;
    padding: 24px;
}

.home-hero .mud-typography-h3 {
    font-weight: 800;
    line-height: 1.12;
}

.home-hero .mud-typography-body1 {
    color: #56657a;
    max-width: 760px;
}

.home-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.home-section {
    margin-top: 22px;
}

.home-section-heading {
    margin-bottom: 12px;
}

.home-section-heading .mud-typography-h5 {
    font-weight: 800;
}

.home-card {
    background: #ffffff;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: 100%;
    min-height: 230px;
    padding: 18px;
    transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}

.home-card:hover {
    border-color: #9db6d5;
    box-shadow: 0 12px 30px rgba(21, 32, 51, .08);
    transform: translateY(-2px);
}

.home-card-primary {
    background: #eef6ff;
    border-color: #b9d6f5;
}

.home-card.compact {
    min-height: 205px;
}

.home-card .mud-button-root {
    margin-top: auto;
}

.home-card-icon {
    align-items: center;
    background: #e8f1fb;
    border: 1px solid #c9dcec;
    border-radius: 8px;
    color: #123b63;
    display: inline-flex;
    height: 44px;
    justify-content: center;
    width: 44px;
}

.home-card-primary .home-card-icon {
    background: #ffffff;
}

.home-card .mud-typography-h6 {
    font-weight: 800;
}

.home-card .mud-typography-body2 {
    color: #5d6b7e;
}

.admin-panel,
.location-card,
.module-link,
.stat-tile {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: 8px;
}

.admin-panel {
    padding: 18px;
}

.qr-fallback-code {
    background: #f8fbff;
    border: 1px dashed #b8c8da;
    border-radius: 8px;
    margin-top: 10px;
    padding: 10px 12px;
    word-break: break-word;
}

.qr-fallback-code .mud-typography-body2 {
    color: #123b63;
    line-height: 1.35;
}

.issue-upload-dropzone {
    align-items: center;
    background: #f8fbff;
    border: 1px dashed #9db6d5;
    border-radius: 8px;
    color: #123b63;
    cursor: pointer;
    display: grid;
    gap: 6px;
    justify-items: center;
    margin-top: 10px;
    padding: 18px;
    text-align: center;
}

.issue-upload-dropzone input[type="file"] {
    display: none;
}

.issue-upload-dropzone span {
    color: #152033;
    font-weight: 700;
    max-width: 100%;
    overflow-wrap: anywhere;
}

.issue-upload-dropzone small {
    color: #64748b;
}

.issue-image-link {
    display: block;
    margin-top: 10px;
}

.issue-detail-image {
    background: #f8fbff;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    display: block;
    max-height: 420px;
    max-width: 100%;
    object-fit: contain;
    width: 100%;
}

.issue-thumbnail-link {
    display: inline-flex;
}

.issue-thumbnail {
    border: 1px solid var(--app-border);
    border-radius: 6px;
    height: 54px;
    object-fit: cover;
    width: 72px;
}

.location-search-panel {
    display: grid;
    gap: 8px;
    margin-bottom: 12px;
}

.location-pagination {
    display: flex;
    justify-content: center;
    margin-top: 16px;
}

.form-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.table-actions {
    text-align: right;
    white-space: nowrap;
}

.admin-issue-actions {
    min-width: 260px;
}

.admin-issue-actions .mud-input-control {
    margin-top: 6px;
}

.admin-issue-button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.admin-issue-button-row .mud-button-root {
    flex: 1 1 92px;
}

.issue-filter-grid {
    align-items: start;
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(5, minmax(150px, 1fr)) auto;
}

.pic-filter-grid {
    grid-template-columns: minmax(180px, 1fr) minmax(160px, 220px) auto;
}

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

.notification-list {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.notification-item {
    align-items: center;
    background: #f8fbff;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    color: inherit;
    display: grid;
    gap: 12px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    padding: 12px;
    text-decoration: none;
}

.notification-item:hover {
    border-color: #9db6d5;
}

.compact-notification-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dashboard-breakdown-list {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.dashboard-breakdown-row {
    align-items: center;
    background: #f8fbff;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    display: flex;
    gap: 10px;
    justify-content: space-between;
    padding: 10px 12px;
}

.report-breakdown-list {
    display: grid;
    gap: 12px;
    margin-top: 16px;
}

.report-filter-panel {
    margin-bottom: 14px;
}

.report-filter-grid {
    align-items: start;
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(180px, 260px) minmax(180px, 280px) auto;
}

.report-chart-panel {
    min-height: 390px;
}

.report-breakdown-row {
    display: grid;
    gap: 7px;
}

.report-breakdown-label {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.report-breakdown-label span {
    overflow-wrap: anywhere;
}

.report-breakdown-label strong {
    color: #123b63;
}

.report-breakdown-track {
    background: #edf2f7;
    border-radius: 999px;
    height: 10px;
    overflow: hidden;
}

.report-breakdown-fill {
    background: #1976d2;
    border-radius: inherit;
    height: 100%;
    min-width: 4px;
}

.ticket-lookup-form {
    align-items: start;
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(0, 1fr) auto;
    margin-top: 18px;
}

.ticket-status-card {
    border-top: 1px solid var(--app-border);
    margin-top: 22px;
    padding-top: 18px;
}

.ticket-status-header {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.line-clamp {
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    display: -webkit-box;
    overflow: hidden;
}

.pic-selector-panel {
    align-items: center;
    display: flex;
    gap: 12px;
}

.pic-selector-panel .mud-input-control {
    flex: 1 1 auto;
    margin-top: 0;
}

.issue-detail-panel {
    min-height: 100%;
}

.detail-list {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 14px;
}

.detail-list div {
    background: #f8fbff;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    padding: 10px;
}

.detail-list span {
    color: #627084;
    display: block;
    font-size: .75rem;
}

.detail-list strong {
    display: block;
    overflow-wrap: anywhere;
}

.issue-description {
    background: #ffffff;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    margin-top: 8px;
    padding: 12px;
    white-space: pre-wrap;
}

.qr-camera-actions {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 14px;
}

.qr-camera-picker {
    align-items: start;
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(0, 1fr) auto;
    margin-top: 14px;
}

.qr-camera-frame {
    align-items: center;
    aspect-ratio: 4 / 3;
    background: #0f172a;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    display: flex;
    justify-content: center;
    margin-top: 12px;
    max-height: 340px;
    overflow: hidden;
    position: relative;
    width: 100%;
}

.qr-camera-modal-backdrop {
    align-items: center;
    background: rgba(15, 23, 42, .62);
    display: flex;
    inset: 0;
    justify-content: center;
    padding: 16px;
    position: fixed;
    z-index: 1400;
}

.qr-camera-modal {
    background: #ffffff;
    border-radius: 8px;
    max-height: calc(100vh - 32px);
    overflow: auto;
    padding: 14px;
    width: min(760px, 100%);
}

.qr-camera-modal-header {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    margin-bottom: 10px;
}

.qr-camera-modal-frame {
    margin-top: 0;
    max-height: min(70vh, 560px);
}

.qr-camera-modal-actions {
    margin-top: 12px;
}

.qr-camera-frame.active {
    border-color: #1976d2;
}

.qr-camera-video {
    display: block;
    height: 100%;
    object-fit: cover;
    position: relative;
    width: 100%;
    z-index: 1;
}

.qr-camera-placeholder {
    align-items: center;
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    font-size: .85rem;
    gap: 8px;
    inset: 0;
    justify-content: center;
    position: absolute;
    text-align: center;
}

.qr-camera-reticle {
    border: 2px solid rgba(255, 255, 255, .9);
    border-radius: 8px;
    box-shadow: 0 0 0 999px rgba(15, 23, 42, .22);
    height: min(58%, 220px);
    left: 50%;
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(58%, 220px);
    z-index: 2;
}

.qr-camera-status {
    background: rgba(15, 23, 42, .72);
    border-radius: 6px;
    bottom: 10px;
    color: #ffffff;
    font-size: .78rem;
    left: 10px;
    max-width: calc(100% - 20px);
    padding: 6px 8px;
    position: absolute;
    z-index: 3;
}

.timeline-list {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.timeline-item {
    border-left: 4px solid #1976d2;
    padding-left: 12px;
}

.location-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    height: 100%;
    padding: 16px;
}

.location-card-header {
    align-items: flex-start;
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.qr-preview {
    align-items: center;
    align-self: center;
    background: #ffffff;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    display: flex;
    justify-content: center;
    padding: 12px;
    width: min(100%, 240px);
}

.qr-preview svg {
    display: block;
    height: auto;
    max-width: 100%;
}

.qr-url {
    overflow-wrap: anywhere;
}

.module-link {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 220px;
    padding: 18px;
}

.module-link .mud-button-root {
    margin-top: auto;
}

.stat-tile {
    padding: 16px;
}

.stat-tile .mud-typography-h4 {
    font-weight: 800;
}

.login-shell {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: 8px;
    margin: 0 auto;
    max-width: 460px;
    padding: 22px;
}

.login-brand {
    align-items: center;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.login-logo {
    display: block;
    height: auto;
    max-height: 64px;
    max-width: min(210px, 70vw);
    object-fit: contain;
}

.login-form {
    display: grid;
    gap: 14px;
    padding-top: 16px;
}

.public-layout {
    align-items: stretch;
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-height: 100vh;
    padding: 24px 14px 36px;
}

.public-brand {
    align-items: center;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0 auto;
    max-width: 680px;
    text-align: center;
    width: 100%;
}

.public-logo {
    display: block;
    height: auto;
    max-height: 72px;
    max-width: min(220px, 72vw);
    object-fit: contain;
}

.public-report-shell {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: 8px;
    box-sizing: border-box;
    margin: 0 auto;
    max-width: 680px;
    padding: 20px;
    width: 100%;
}

.public-state {
    align-items: center;
    display: flex;
    flex-direction: column;
    gap: 14px;
    text-align: center;
}

.report-location {
    align-items: flex-start;
    background: #eef5fb;
    border: 1px solid #c9dcec;
    border-radius: 8px;
    display: flex;
    gap: 12px;
    padding: 14px;
}

.field-block {
    margin-top: 20px;
}

.concern-choice-grid {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 10px;
}

.concern-choice {
    background: #ffffff;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    color: var(--app-text);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    font: inherit;
    gap: 3px;
    min-height: 66px;
    padding: 10px;
    text-align: center;
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.concern-choice span {
    align-items: center;
    display: flex;
    font-weight: 700;
    justify-content: center;
    line-height: 1.25;
    min-height: 32px;
    overflow-wrap: anywhere;
}

.concern-choice small {
    color: #627084;
    font-size: .7rem;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.concern-choice.selected {
    background: #edf7ff;
    border-color: #1976d2;
    box-shadow: 0 0 0 2px rgba(25, 118, 210, .14);
}

.ticket-number {
    background: #eef7ef;
    border: 1px solid #b9dfc1;
    border-radius: 8px;
    color: #14532d;
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: .02em;
    padding: 12px 18px;
    width: 100%;
}

@media (max-width: 600px) {
    .app-content {
        padding-left: 12px;
        padding-right: 12px;
        padding-top: 16px;
    }

    .app-title {
        max-width: 210px;
    }

    .layout-user {
        display: none;
    }

    .page-heading {
        margin-bottom: 14px;
    }

    .page-heading .mud-typography-h4 {
        font-size: 1.55rem;
        line-height: 1.2;
    }

    .home-hero {
        grid-template-columns: minmax(0, 1fr);
        padding: 18px;
    }

    .home-hero .mud-typography-h3 {
        font-size: 1.8rem;
    }

    .home-hero-actions {
        justify-content: stretch;
    }

    .home-hero-actions .mud-button-root {
        flex: 1 1 180px;
    }

    .home-card {
        min-height: 0;
    }

    .admin-panel {
        padding: 14px;
    }

    .form-actions .mud-button-root {
        flex: 1 1 130px;
    }

    .qr-camera-actions {
        grid-template-columns: minmax(0, 1fr);
    }

    .qr-camera-picker {
        grid-template-columns: minmax(0, 1fr);
    }

    .qr-camera-modal-backdrop {
        align-items: stretch;
        padding: 10px;
    }

    .qr-camera-modal {
        max-height: calc(100vh - 20px);
        padding: 12px;
    }

    .qr-camera-modal-frame {
        max-height: 68vh;
    }

    .admin-issue-actions {
        min-width: 0;
    }

    .issue-filter-grid,
    .pic-filter-grid,
    .report-filter-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .filter-actions .mud-button-root {
        flex: 1 1 120px;
    }

    .compact-notification-list {
        grid-template-columns: minmax(0, 1fr);
    }

    .notification-item {
        align-items: flex-start;
    }

    .ticket-lookup-form {
        grid-template-columns: minmax(0, 1fr);
    }

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

    .pic-selector-panel {
        align-items: stretch;
        flex-direction: column;
    }

    .detail-list {
        grid-template-columns: minmax(0, 1fr);
    }

    .location-card-header {
        flex-direction: column;
    }

    .module-link {
        min-height: 0;
    }

    .public-report-shell {
        padding: 14px;
    }

    .public-layout {
        gap: 14px;
        padding-left: 10px;
        padding-right: 10px;
        padding-top: 16px;
    }

    .public-logo {
        max-height: 58px;
    }

    .concern-choice {
        min-height: 62px;
        padding: 9px;
    }

    .ticket-number {
        font-size: 1.3rem;
    }
}

@media (max-width: 420px) {
    .concern-choice-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
