:root {
    --app-bg: #f3efe7;
    --app-surface: #fffdfa;
    --app-ink: #1f1b16;
    --app-muted: #6f685d;
    --app-accent: #1d4ed8;
    --app-accent-soft: #dbeafe;
    --app-danger: #b91c1c;
    --app-border: #ddd3c5;
    --app-shadow: 0 18px 48px rgba(43, 34, 24, 0.12);
}

body.app-body {
    background:
        radial-gradient(circle at top left, rgba(29, 78, 216, 0.08), transparent 28%),
        radial-gradient(circle at bottom right, rgba(180, 83, 9, 0.08), transparent 24%),
        var(--app-bg);
    color: var(--app-ink);
    font-family: 'Barlow', sans-serif;
    min-height: 100vh;
}

.development-banner {
    background: #c1121f;
    color: #ffffff;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 0.5rem 1rem;
    text-align: center;
    text-transform: uppercase;
}

.navbar-brand {
    font-family: 'IBM Plex Mono', monospace;
}

.brand-mark {
    align-items: center;
    background: linear-gradient(135deg, #1d4ed8, #0f172a);
    border-radius: 999px;
    color: #ffffff;
    display: inline-flex;
    height: 2rem;
    justify-content: center;
    width: 2rem;
}

.section-kicker {
    color: var(--app-accent);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.card,
.modal-content {
    background: rgba(255, 253, 250, 0.98);
    border: 1px solid rgba(221, 211, 197, 0.85);
    box-shadow: var(--app-shadow);
}

.auth-card {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 251, 245, 0.98)),
        var(--app-surface);
}

.auth-icon {
    align-items: center;
    background: linear-gradient(135deg, #111827, #1d4ed8);
    border-radius: 1rem;
    color: #ffffff;
    display: inline-flex;
    font-size: 1.5rem;
    height: 3.5rem;
    justify-content: center;
    width: 3.5rem;
}

.auth-icon-warning {
    background: linear-gradient(135deg, #9a3412, #ea580c);
}

.min-vh-100-minus-nav {
    min-height: calc(100vh - 7rem);
}

.ticket-table {
    table-layout: fixed;
    width: 100%;
}

.ticket-table .ticket-col-id {
    width: 5.5rem;
}

.ticket-table .ticket-col-status {
    width: 18rem;
}

.ticket-table .ticket-col-dates {
    width: 20rem;
}

.ticket-table th,
.ticket-table td {
    vertical-align: middle;
}

.ticket-table tbody tr {
    cursor: pointer;
    transition: background-color 0.18s ease, transform 0.18s ease;
}

.ticket-table tbody tr:hover,
.ticket-table tbody tr.is-active {
    background: rgba(29, 78, 216, 0.08);
}

.ticket-detail-placeholder {
    align-items: center;
    color: var(--app-muted);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    justify-content: center;
    min-height: 28rem;
    text-align: center;
}

.ticket-detail-modal-placeholder {
    min-height: 24rem;
}

.ticket-detail-placeholder i {
    font-size: 2.5rem;
}

.ticket-detail-summary,
.ticket-detail-panel {
    background: #fffaf2;
    border: 1px solid var(--app-border);
    border-radius: 1rem;
    padding: 1rem 1.1rem;
}

.ticket-detail-panel {
    background: linear-gradient(180deg, #eef4ff, #f8fbff);
    border-color: #c2d2ee;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.ticket-detail-header {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.ticket-detail-header-row {
    align-items: start;
    column-gap: 1rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
}

.ticket-detail-header-row-top {
    row-gap: 0.5rem;
}

.ticket-detail-header-row-meta {
    align-items: center;
}

.ticket-detail-header-primary {
    min-width: 0;
}

.ticket-detail-header-close {
    align-self: start;
    justify-self: end;
}

.ticket-detail-header-divider {
    background: var(--app-border);
    height: 1px;
    margin: 0 -1.5rem;
    width: calc(100% + 3rem);
}

.ticket-detail-ticket-number,
.ticket-detail-ticket-title {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.2;
}

.ticket-detail-ticket-number {
    color: #9a3412;
    flex: 0 0 auto;
}

.ticket-detail-ticket-title {
    min-width: 0;
    overflow-wrap: anywhere;
    white-space: normal;
}

.ticket-detail-meta {
    line-height: 1.4;
    min-width: 0;
}

.ticket-detail-main {
    min-height: 100%;
}

.ticket-detail-sidebar {
    min-height: 100%;
}

.ticket-detail-summary-strip {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

.ticket-detail-section-divider {
    background: var(--app-border);
    height: 1px;
    width: 100%;
}

.ticket-detail-summary-row {
    align-items: center;
    column-gap: 1rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 0.75rem;
}

.ticket-detail-summary-text {
    align-items: center;
    color: var(--app-ink);
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    min-width: 0;
}

.ticket-summary-item {
    align-items: center;
    display: inline-flex;
    gap: 0.35rem;
    min-width: 0;
}

.ticket-summary-item strong {
    color: var(--app-muted);
    font-weight: 600;
}

.ticket-summary-type {
    color: var(--app-muted);
    font-size: 1.05rem;
}

.ticket-summary-separator {
    color: var(--app-border);
    font-weight: 600;
}

.ticket-detail-summary-actions {
    align-items: center;
    display: inline-flex;
    flex: 0 0 auto;
    gap: 0.75rem;
    justify-content: flex-end;
}

.ticket-update-stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ticket-status-badge {
    border-radius: 999px;
    display: inline-flex;
    font-size: 0.85rem;
    font-weight: 600;
    gap: 0.5rem;
    padding: 0.4rem 0.8rem;
}

.ticket-status-trigger {
    align-items: center;
    border: 0;
    display: inline-flex;
    font-size: 0.85rem;
    font-weight: 600;
    gap: 0.5rem;
    line-height: 1.2;
    padding: 0.5rem 0.9rem;
    white-space: nowrap;
}

.ticket-status-trigger.dropdown-toggle::after {
    display: none;
}

.ticket-status-trigger:disabled {
    cursor: default;
    opacity: 1;
}

.ticket-status-trigger i {
    font-size: 0.75rem;
}

.ticket-status-menu {
    min-width: 16rem;
}

.ticket-status-menu .dropdown-item {
    align-items: center;
    display: flex;
    justify-content: space-between;
}

.ticket-status-badge.is-pakmail {
    background: #fee2e2;
    color: #b91c1c;
}

.ticket-status-badge.is-vendor {
    background: #f3e8ff;
    color: #7e22ce;
}

.ticket-status-badge.is-customer {
    background: #f5e8d5;
    color: #8b5e34;
}

.ticket-status-badge.is-closed {
    background: #dcfce7;
    color: #166534;
}

.ticket-status-badge.is-abandoned {
    background: #e5e7eb;
    color: #4b5563;
}

.ticket-update-card {
    background: #fffaf2;
    border: 1px solid var(--app-border);
    border-radius: 1rem;
    padding: 1rem;
}

.ticket-fact-value-group {
    align-items: center;
    display: inline-flex;
    gap: 0.35rem;
    justify-content: flex-start;
}

.ticket-copy-button {
    color: var(--app-muted);
    padding: 0;
    text-decoration: none;
}

.ticket-copy-button:hover,
.ticket-copy-button:focus {
    color: var(--app-ink);
}

.ticket-list-toolbar {
    align-items: stretch;
}

.ticket-toolbar-search {
    min-width: 0;
}

.ticket-search-input-wrap {
    position: relative;
}

.ticket-search-input {
    padding-right: 4.5rem;
}

.ticket-search-loading {
    align-items: center;
    color: var(--app-accent);
    display: inline-flex;
    justify-content: center;
    pointer-events: none;
    position: absolute;
    right: 1.75rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
}

.ticket-search-loading .spinner-border {
    height: 1.05rem;
    width: 1.05rem;
}

.ticket-toolbar-actions {
    flex: 0 0 auto;
}

.ticket-toolbar-actions .dropdown,
.ticket-toolbar-actions > .btn {
    flex: 0 0 auto;
}

.ticket-toolbar-actions .btn {
    white-space: nowrap;
}

.ticket-filter-dropdown {
    min-width: 18rem;
}

.ticket-filter-check + .ticket-filter-check {
    margin-top: 0.65rem;
}

.ticket-attachments {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.ticket-attachment-row {
    align-items: center;
    column-gap: 0.65rem;
    display: inline-flex;
    justify-content: flex-end;
    margin-left: auto;
    max-width: 100%;
    padding: 0.15rem 0;
}

.ticket-attachment-file {
    align-items: center;
    display: inline-flex;
    gap: 0.35rem;
    min-width: 0;
}

.ticket-attachment-name {
    font-size: 0.88rem;
    font-weight: 500;
    min-width: 0;
}

.ticket-attachment-type-icon {
    color: var(--app-muted);
    flex: 0 0 auto;
    font-size: 0.95rem;
}

.ticket-attachment-actions {
    display: inline-flex;
    gap: 0.35rem;
}

.ticket-attachment-icon {
    align-items: center;
    display: inline-flex;
    height: 1.95rem;
    justify-content: center;
    padding: 0;
    width: 1.95rem;
}

.ticket-attachment-icon.is-disabled {
    cursor: default;
    opacity: 0.45;
    pointer-events: none;
}

.ticket-image-preview-shell {
    align-items: center;
    background: #f6f1e8;
    border-radius: 1rem;
    display: flex;
    justify-content: center;
    min-height: 14rem;
    overflow: hidden;
    padding: 0.75rem;
}

.ticket-image-preview {
    display: block;
    height: auto;
    max-height: 75vh;
    max-width: 100%;
    object-fit: contain;
    width: auto;
}

.ticket-pending-file-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.ticket-pending-file-row {
    align-items: center;
    column-gap: 1rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 0.1rem 0;
}

.ticket-pending-file-link {
    color: var(--app-ink);
    font-size: 0.95rem;
    font-weight: 500;
    min-width: 0;
    text-decoration: none;
}

.ticket-pending-file-link:hover,
.ticket-pending-file-link:focus {
    color: #0f172a;
    text-decoration: underline;
}

.ticket-pending-file-remove {
    align-items: center;
    display: inline-flex;
    height: 2.25rem;
    justify-content: center;
    padding: 0;
    width: 2.25rem;
}

.ticket-update-edit-attachments:empty {
    display: none;
}

.ticket-update-edit-footer {
    align-items: center;
    gap: 0.75rem;
}

.form-control,
.form-select,
.input-group-text,
.btn {
    border-radius: 0.85rem;
}

.btn-dark {
    background: #111827;
}

.btn-outline-dark:hover,
.btn-dark:hover {
    transform: translateY(-1px);
}

@media (max-width: 991px) {
    .ticket-detail-placeholder {
        min-height: 18rem;
    }

    .ticket-detail-modal-placeholder {
        min-height: 18rem;
    }

    .ticket-toolbar-actions {
        flex: 1 1 auto;
    }

    .ticket-toolbar-actions .dropdown,
    .ticket-toolbar-actions > .btn {
        flex: 1 1 100%;
    }

    .ticket-detail-header-row {
        grid-template-columns: minmax(0, 1fr);
        row-gap: 0.75rem;
    }

    .ticket-detail-header-close,
    #ticketDetailStatusDropdown {
        justify-self: end;
    }

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

    .ticket-detail-summary-actions {
        justify-content: flex-start;
        width: 100%;
    }

    .ticket-attachment-row {
        grid-template-columns: minmax(0, 1fr);
        row-gap: 0.75rem;
    }

    .ticket-pending-file-row {
        grid-template-columns: minmax(0, 1fr);
        row-gap: 0.75rem;
    }
}
