:root {
    --brand: #8A2061;
    --brand-light: #b8306e;
    --brand-dark: #621547;
    --brand-soft: rgba(138, 32, 97, 0.10);
    --brand-glow: rgba(138, 32, 97, 0.22);
    --bg: #0f0a0d;
    --surface: #1a1019;
    --surface2: #211521;
    --surface3: #2a1b2a;
    --border: rgba(138, 32, 97, 0.18);
    --border2: rgba(255, 255, 255, 0.07);
    --text: #f0e8ee;
    --text2: #c4a8be;
    --text3: #8a6d83;
    --success: #2dba7e;
    --warning: #e8a730;
    --danger: #e84545;
    --info: #3a8fe8;
    --radius: 14px;
    --radius-sm: 8px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
    --shadow-brand: 0 4px 24px rgba(138, 32, 97, 0.25);
}

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

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: -200px;
    left: -200px;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(138, 32, 97, 0.13) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

body::after {
    content: '';
    position: fixed;
    bottom: -150px;
    right: -150px;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(138, 32, 97, 0.08) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* ── HEADER ── */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(15, 10, 13, 0.88);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 0 clamp(16px, 4vw, 40px);
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.header-left a {
    background: #e84545;
    padding: 8px 12px;
    color: #fff;
    border-radius: 10px;
    text-decoration: none;
}

.logo-mark {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--brand), var(--brand-light));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Sora', sans-serif;
    font-weight: 700;
    font-size: 15px;
    color: #fff;
    box-shadow: var(--shadow-brand);
    flex-shrink: 0;
}

.header-title {
    font-family: 'Sora', sans-serif;
    font-weight: 600;
    font-size: 16px;
    color: var(--text);
}

.header-title a {
    font-weight: 600;
    font-size: 16px;
    color: var(--text);
    background: #e84545;
    padding: 8px 12px;
    border-radius: 10px;
    text-decoration: none;
}

.header-sub {
    font-size: 12px;
    color: var(--text3);
    margin-top: 1px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-dark), var(--brand));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    border: 2px solid var(--border);
}

/* ── MAIN ── */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: clamp(20px, 4vw, 40px) clamp(16px, 4vw, 40px);
    position: relative;
    z-index: 1;
    animation: fadeInUp 0.4s ease both;
}

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 32px;
}

.breadcrumb {
    font-size: 12px;
    color: var(--text3);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.breadcrumb span {
    color: var(--text2);
}

.page-title {
    font-family: 'Sora', sans-serif;
    font-size: clamp(22px, 4vw, 30px);
    font-weight: 700;
    background: linear-gradient(135deg, var(--text) 30%, var(--brand-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-desc {
    font-size: 14px;
    color: var(--text3);
    margin-top: 5px;
}

/* ── STATS ── */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 14px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    padding: 16px 18px;
    position: relative;
    overflow: hidden;
    transition: border-color 0.2s, transform 0.2s;
}

.stat-card:hover {
    border-color: var(--border);
    transform: translateY(-2px);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent-color, var(--brand));
    opacity: 0.6;
}

.stat-card[data-color="open"] {
    --accent-color: #3a8fe8;
}

.stat-card[data-color="prog"] {
    --accent-color: #e8a730;
}

.stat-card[data-color="res"] {
    --accent-color: #2dba7e;
}

.stat-card[data-color="closed"] {
    --accent-color: #8a6d83;
}

.stat-card[data-color="brand"] {
    --accent-color: var(--brand);
}

.stat-num {
    font-family: 'Sora', sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
}

.stat-label {
    font-size: 12px;
    color: var(--text3);
    margin-top: 5px;
}

.stat-icon {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 22px;
    opacity: 0.15;
}

/* ── FILTERS ── */
.filters-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.search-wrap {
    flex: 1;
    min-width: 200px;
    position: relative;
}

.search-wrap svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.4;
}

.search-input {
    width: 100%;
    height: 40px;
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    padding: 0 14px 0 38px;
    color: var(--text);
    font-size: 14px;
    font-family: 'DM Sans', sans-serif;
    transition: border-color 0.2s;
    outline: none;
}

.search-input:focus {
    border-color: var(--brand);
}

.search-input::placeholder {
    color: var(--text3);
}

.filter-select {
    height: 40px;
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    padding: 0 32px 0 12px;
    color: var(--text2);
    font-size: 13px;
    font-family: 'DM Sans', sans-serif;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238a6d83'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: border-color 0.2s;
}

.filter-select:focus {
    border-color: var(--brand);
}

.filter-select option {
    background: var(--surface2);
}

/* ── BUTTONS ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 40px;
    padding: 0 18px;
    border-radius: var(--radius-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-brand {
    background: linear-gradient(135deg, var(--brand), var(--brand-light));
    color: #fff;
    box-shadow: 0 2px 12px rgba(138, 32, 97, 0.35);
}

.btn-brand:hover {
    box-shadow: 0 4px 20px rgba(138, 32, 97, 0.5);
    transform: translateY(-1px);
}

.btn-ghost {
    background: var(--surface);
    color: var(--text2);
    border: 1px solid var(--border2);
}

.btn-ghost:hover {
    border-color: var(--brand);
    color: var(--text);
}

.btn-sm {
    height: 32px;
    padding: 0 12px;
    font-size: 13px;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    color: var(--text2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon.active,
.btn-icon:hover {
    border-color: var(--brand);
    color: var(--brand-light);
}

.btn-icon.active {
    background: var(--brand-soft);
}

/* ── TABLE WRAP ── */
.table-wrap {
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.table-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px 14px;
    border-bottom: 1px solid var(--border2);
    flex-wrap: wrap;
    gap: 10px;
}

.table-title {
    font-family: 'Sora', sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.table-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--brand-soft);
    color: var(--brand-light);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    padding: 1px 8px;
    min-width: 24px;
}

.tabs-row {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 10px 22px 0;
    border-bottom: 1px solid var(--border2);
    overflow-x: auto;
}

.tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 13px;
    color: var(--text3);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    white-space: nowrap;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    font-family: 'DM Sans', sans-serif;
    margin-bottom: -1px;
}

.tab-btn.active {
    color: var(--brand-light);
    border-bottom-color: var(--brand-light);
}

.tab-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

/* ── DESKTOP TABLE ── */
table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    padding: 12px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: var(--text3);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: var(--surface2);
    border-bottom: 1px solid var(--border2);
    white-space: nowrap;
}

thead th:first-child {
    padding-left: 22px;
}

thead th:last-child {
    padding-right: 22px;
}

tbody tr {
    border-bottom: 1px solid var(--border2);
    transition: background 0.15s;
    cursor: pointer;
}

tbody tr:last-child {
    border-bottom: none;
}

tbody tr:hover {
    background: var(--surface2);
}

td {
    padding: 14px 16px;
    font-size: 13.5px;
    color: var(--text2);
    vertical-align: middle;
}

td:first-child {
    padding-left: 22px;
}

td:last-child {
    padding-right: 22px;
}

.ticket-id {
    font-family: 'Sora', sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: var(--brand-light);
}

.ticket-subject {
    color: var(--text);
    font-weight: 500;
    font-size: 14px;
}

.ticket-subject small {
    display: block;
    font-size: 12px;
    color: var(--text3);
    font-weight: 400;
    margin-top: 2px;
}

/* ── BADGES ── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
}

.badge-open {
    background: rgba(58, 143, 232, 0.12);
    color: #5aa8f5;
}

.badge-open .badge-dot {
    background: #5aa8f5;
}

.badge-inprogress {
    background: rgba(232, 167, 48, 0.12);
    color: #f0bc50;
}

.badge-inprogress .badge-dot {
    background: #f0bc50;
}

.badge-resolved {
    background: rgba(45, 186, 126, 0.12);
    color: #3dd68c;
}

.badge-resolved .badge-dot {
    background: #3dd68c;
}

.badge-closed {
    background: rgba(138, 109, 131, 0.12);
    color: #a08099;
}

.badge-closed .badge-dot {
    background: #a08099;
}

.type-badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    background: var(--surface3);
    color: var(--text2);
    border: 1px solid var(--border2);
}

.priority-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
}

.priority-high {
    color: #e84545;
}

.priority-medium {
    color: #e8a730;
}

.priority-low {
    color: #3a8fe8;
}

.team-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: var(--text2);
}

.team-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-dark), var(--brand));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.date-text {
    font-size: 12px;
    color: var(--text3);
}

/* ── GRID VIEW ── */
.grid-view {
    display: none;
}

.grid-view.active {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 14px;
    padding: 18px;
}

.list-view {
    display: block;
}

.list-view.hidden {
    display: none;
}

.grid-ticket-card {
    background: var(--surface2);
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    padding: 18px;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}

.grid-ticket-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--brand), var(--brand-light));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.grid-ticket-card:hover {
    border-color: var(--border);
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.grid-ticket-card:hover::before {
    transform: scaleX(1);
}

.gtc-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 10px;
}

.gtc-id {
    font-family: 'Sora', sans-serif;
    font-size: 11px;
    font-weight: 600;
    color: var(--brand-light);
    margin-bottom: 4px;
}

.gtc-subject {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.4;
    margin-bottom: 6px;
}

.gtc-desc {
    font-size: 12px;
    color: var(--text3);
    line-height: 1.5;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.gtc-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.gtc-team {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    color: var(--text3);
}

.gtc-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border2);
    flex-wrap: wrap;
    gap: 6px;
}

/* ── MOBILE CARDS ── */
@media(max-width:768px) {
    .hide-mobile {
        display: none !important;
    }

    .table-card-mode table,
    .list-view.list-table {
        display: none !important;
    }

    .mobile-cards {
        display: flex !important;
    }

    .grid-view.active {
        grid-template-columns: 1fr;
    }
}

@media(min-width:769px) {
    .mobile-cards {
        display: none !important;
    }
}

.mobile-cards {
    flex-direction: column;
    gap: 10px;
    padding: 14px;
}

.ticket-card {
    background: var(--surface2);
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    padding: 14px 16px;
    cursor: pointer;
    transition: border-color 0.18s, transform 0.18s;
}

.ticket-card:hover {
    border-color: var(--border);
    transform: translateY(-1px);
}

.tc-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.tc-id {
    font-size: 11px;
    color: var(--brand-light);
    font-weight: 600;
    font-family: 'Sora', sans-serif;
}

.tc-subject {
    font-size: 14px;
    color: var(--text);
    font-weight: 500;
}

.tc-meta {
    font-size: 12px;
    color: var(--text3);
    margin-bottom: 10px;
}

.tc-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

/* ── PAGINATION ── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 22px;
    border-top: 1px solid var(--border2);
    flex-wrap: wrap;
    gap: 10px;
}

.page-info {
    font-size: 13px;
    color: var(--text3);
}

.page-btns {
    display: flex;
    gap: 6px;
}

.page-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 13px;
    cursor: pointer;
    border: 1px solid var(--border2);
    background: var(--surface);
    color: var(--text2);
    transition: all 0.2s;
    font-family: 'DM Sans', sans-serif;
}

.page-btn.active {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.page-btn:hover:not(.active) {
    border-color: var(--brand);
    color: var(--brand-light);
}

/* ── RAISE TICKET MODAL ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(138, 32, 97, 0.1);
    transform: translateY(24px) scale(0.97);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.modal-overlay.open .modal {
    transform: translateY(0) scale(1);
}

.modal-glow {
    position: absolute;
    top: -80px;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    height: 160px;
    background: radial-gradient(circle, rgba(138, 32, 97, 0.3) 0%, transparent 70%);
    pointer-events: none;
}

.modal-header {
    padding: 24px 24px 0;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.modal-eyebrow {
    font-size: 11px;
    font-weight: 600;
    color: var(--brand-light);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.modal-eyebrow::before {
    content: '';
    display: block;
    width: 16px;
    height: 2px;
    background: var(--brand-light);
    border-radius: 2px;
}

.modal-title {
    font-family: 'Sora', sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--surface2);
    border: 1px solid var(--border2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text3);
    flex-shrink: 0;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--brand-soft);
    color: var(--brand-light);
    border-color: var(--border);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px 24px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid var(--border2);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media(max-width:520px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text2);
    margin-bottom: 7px;
}

.form-label span {
    color: var(--brand-light);
    margin-left: 2px;
}

.form-control {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--text);
    font-size: 14px;
    font-family: 'DM Sans', sans-serif;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    appearance: none;
    -webkit-appearance: none;
}

.form-control:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(138, 32, 97, 0.15);
}

.form-control::placeholder {
    color: var(--text3);
}

.form-control option {
    background: var(--surface2);
}

select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238a6d83'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
    line-height: 1.5;
}

.priority-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.priority-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border2);
    background: var(--surface2);
    cursor: pointer;
    font-size: 13px;
    color: var(--text2);
    transition: all 0.18s;
}

.priority-chip input {
    display: none;
}

.priority-chip .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.priority-chip.high .dot {
    background: #e84545;
}

.priority-chip.medium .dot {
    background: #e8a730;
}

.priority-chip.low .dot {
    background: #3a8fe8;
}

.priority-chip.selected-high {
    border-color: #e84545;
    background: rgba(232, 69, 69, 0.08);
    color: #e84545;
}

.priority-chip.selected-medium {
    border-color: #e8a730;
    background: rgba(232, 167, 48, 0.08);
    color: #e8a730;
}

.priority-chip.selected-low {
    border-color: #3a8fe8;
    background: rgba(58, 143, 232, 0.08);
    color: #3a8fe8;
}

.attach-area {
    border: 1.5px dashed var(--border2);
    border-radius: var(--radius-sm);
    padding: 18px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    color: var(--text3);
    font-size: 13px;
}

.attach-area:hover {
    border-color: var(--brand);
    background: var(--brand-soft);
}

.attach-area svg {
    margin-bottom: 6px;
    opacity: 0.5;
}

/* ── TICKET DETAIL PANEL ── */
.detail-overlay {
    position: fixed;
    inset: 0;
    z-index: 900;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
}

.detail-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.detail-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(680px, 100vw);
    background: var(--surface);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 910;
    box-shadow: -20px 0 60px rgba(0, 0, 0, 0.5);
}

.detail-panel.open {
    transform: translateX(0);
}

.dp-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border2);
    flex-shrink: 0;
}

.dp-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.dp-id {
    font-family: 'Sora', sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: var(--brand-light);
    margin-bottom: 4px;
}

.dp-subject {
    font-family: 'Sora', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
}

.dp-close {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    flex-shrink: 0;
    background: var(--surface2);
    border: 1px solid var(--border2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text3);
    transition: all 0.2s;
}

.dp-close:hover {
    background: var(--brand-soft);
    color: var(--brand-light);
    border-color: var(--border);
}

.dp-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.dp-meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11.5px;
    font-weight: 500;
    background: var(--surface2);
    color: var(--text2);
    border: 1px solid var(--border2);
}

/* ── CHAT ── */
.dp-chat {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* day separator */
.chat-day {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 11px;
    color: var(--text3);
    margin: 4px 0;
}

.chat-day::before,
.chat-day::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border2);
}

/* message */
.msg {
    display: flex;
    flex-direction: column;
    max-width: 78%;
}

.msg.own {
    align-self: flex-end;
    align-items: flex-end;
}

.msg.other {
    align-self: flex-start;
    align-items: flex-start;
}

.msg-author {
    font-size: 11.5px;
    color: var(--text3);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.msg-author .author-av {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-dark), var(--brand));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.msg-author .author-av.green {
    background: linear-gradient(135deg, #1a6b4a, #2dba7e);
}

.msg-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.55;
    max-width: 100%;
    word-break: break-word;
}

.msg.own .msg-bubble {
    background: linear-gradient(135deg, var(--brand-dark), var(--brand));
    color: #fff;
    border-bottom-right-radius: 4px;
}

.msg.other .msg-bubble {
    background: var(--surface2);
    color: var(--text);
    border: 1px solid var(--border2);
    border-bottom-left-radius: 4px;
}

/* attachment in bubble */
.msg-attachment {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    margin-top: 8px;
    font-size: 12px;
    color: inherit;
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.12);
    cursor: pointer;
    transition: background 0.2s;
}

.msg-attachment:hover {
    background: rgba(255, 255, 255, 0.15);
}

.msg.other .msg-attachment {
    background: var(--surface3);
    border-color: var(--border2);
    color: var(--text2);
}

.msg.other .msg-attachment:hover {
    background: var(--surface2);
}

.msg-time {
    font-size: 10.5px;
    color: var(--text3);
    margin-top: 5px;
    padding: 0 2px;
}

/* ── REPLY BOX ── */
.dp-reply {
    padding: 16px 24px 20px;
    border-top: 1px solid var(--border2);
    flex-shrink: 0;
    background: var(--surface);
}

.reply-attach-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.attach-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 6px;
    background: var(--surface2);
    border: 1px solid var(--border2);
    font-size: 12px;
    color: var(--text2);
}

.attach-chip button {
    background: none;
    border: none;
    color: var(--text3);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0;
    margin-left: 2px;
}

.attach-chip button:hover {
    color: var(--danger);
}

.reply-input-row {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.reply-textarea {
    flex: 1;
    min-height: 72px;
    max-height: 160px;
    resize: none;
    background: var(--surface2);
    border: 1px solid var(--border2);
    border-radius: 12px;
    padding: 12px 14px;
    color: var(--text);
    font-size: 14px;
    font-family: 'DM Sans', sans-serif;
    outline: none;
    transition: border-color 0.2s;
    line-height: 1.5;
}

.reply-textarea:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(138, 32, 97, 0.12);
}

.reply-textarea::placeholder {
    color: var(--text3);
}

.reply-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.reply-attach-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--surface2);
    border: 1px solid var(--border2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text3);
    transition: all 0.2s;
}

.reply-attach-btn:hover {
    border-color: var(--brand);
    color: var(--brand-light);
}

.reply-send {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--brand), var(--brand-light));
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    transition: all 0.2s;
    box-shadow: 0 2px 10px rgba(138, 32, 97, 0.35);
}

.reply-send:hover {
    box-shadow: 0 4px 18px rgba(138, 32, 97, 0.5);
    transform: translateY(-1px);
}

/* ── TOAST ── */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    background: var(--surface);
    border: 1px solid var(--brand);
    border-radius: var(--radius-sm);
    padding: 12px 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), var(--shadow-brand);
    transform: translateY(80px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--brand-dark);
    border-radius: 3px;
}

/* ── EMPTY ── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text3);
}

.empty-state p {
    font-size: 14px;
    margin-top: 14px;
}

/* ── ANIMATIONS ── */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.container {
    animation: fadeInUp 0.4s ease both;
}

@media(max-width:600px) {
    .detail-panel {
        width: 100vw;
    }

    .dp-subject {
        font-size: 15px;
    }
}

/* ══════════════════════════════════════════════════════
   ADDITIONS ONLY — append these after your existing CSS
   Do NOT replace anything above. Dark theme preserved.
══════════════════════════════════════════════════════ */

/* ── REPLY LOCKED NOTICE (status 3 = Resolved, 4 = Closed) ── */
.reply-locked {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 24px;
    border-top: 1px solid var(--border2);
    background: var(--surface);
}

.reply-locked-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Resolved = green tint */
.reply-locked.resolved .reply-locked-icon {
    background: rgba(45, 186, 126, 0.12);
    color: #3dd68c;
}

/* Closed = muted tint */
.reply-locked.closed .reply-locked-icon {
    background: rgba(138, 109, 131, 0.12);
    color: #a08099;
}

.reply-locked-content strong {
    display: block;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text2);
    margin-bottom: 3px;
}

.reply-locked-content span {
    font-size: 12px;
    color: var(--text3);
    line-height: 1.5;
}

/* ── IMPROVED REPLY COMPOSER — connected bar layout ── */
/* Replaces the old .reply-input-row + .reply-actions stacked layout */

.dp-reply {
    padding: 0;
    border-top: 1px solid var(--border2);
    flex-shrink: 0;
    background: var(--surface);
}

/* Attach preview strip above composer */
.reply-attach-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 20px 0;
    margin-bottom: 0;
    /* override old margin */
}

.reply-attach-preview:empty {
    padding: 0;
}

/* The connected composer row */
.reply-composer {
    display: flex;
    align-items: stretch;
    gap: 0;
    padding: 14px 20px;
}

/* Override old .reply-textarea to work in new composer */
.reply-textarea {
    flex: 1;
    min-height: 52px;
    max-height: 160px;
    resize: none;
    background: var(--surface2);
    border: 1px solid var(--border2);
    border-radius: 12px 0 0 12px;
    /* left side rounded only */
    padding: 12px 14px;
    color: var(--text);
    font-size: 14px;
    font-family: 'DM Sans', sans-serif;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    line-height: 1.5;
}

.reply-textarea:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(138, 32, 97, 0.12);
    z-index: 1;
}

.reply-textarea::placeholder {
    color: var(--text3);
}

/* Action buttons column — flush to textarea */
.reply-actions {
    display: flex;
    flex-direction: column;
    align-self: stretch;
    gap: 0;
}

/* Attach button — middle segment */
.reply-attach-btn {
    flex: 1;
    width: 46px;
    height: auto;
    border-radius: 0;
    /* no rounding — flush join */
    background: var(--surface2);
    border: 1px solid var(--border2);
    border-left: none;
    /* share border with textarea */
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text3);
    transition: background 0.2s, color 0.2s;
}

.reply-attach-btn:hover {
    background: var(--surface3);
    color: var(--brand-light);
    border-color: var(--border2);
    /* keep flush */
}

/* Send button — rightmost segment */
.reply-send {
    flex: 1;
    width: 52px;
    height: auto;
    border-radius: 0 12px 12px 0;
    /* right side rounded */
    background: linear-gradient(135deg, var(--brand), var(--brand-light));
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    transition: all 0.2s;
    box-shadow: 0 2px 10px rgba(138, 32, 97, 0.35);
}

.reply-send:hover {
    box-shadow: 0 4px 20px rgba(138, 32, 97, 0.5);
    transform: translateY(-1px);
}

.reply-send:active {
    transform: scale(0.97);
}

/* Hint row below composer */
.reply-hint {
    padding: 0 20px 12px;
    font-size: 11px;
    color: var(--text3);
}

.reply-hint kbd {
    background: var(--surface2);
    padding: 1px 6px;
    border-radius: 5px;
    border: 1px solid var(--border2);
    font-size: 10.5px;
    color: var(--text2);
}

/* ── IMPROVED MESSAGE BUBBLES ── */
/* New structure: .msg > .msg-av + .msg-body(.msg-author + .msg-bubble + .msg-time) */

/* Reset old column layout */
.msg {
    display: flex;
    flex-direction: row;
    /* NEW: horizontal with avatar */
    gap: 10px;
    max-width: 80%;
    align-items: flex-end;
    /* avatar pins to bubble bottom */
    animation: bubbleIn 0.28s ease both;
}

.msg.own {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.msg.other {
    align-self: flex-start;
    flex-direction: row;
}

/* Avatar circle */
.msg-av {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.msg.own .msg-av {
    background: linear-gradient(135deg, var(--brand-dark), var(--brand-light));
}

.msg.other .msg-av {
    background: linear-gradient(135deg, #1a6b4a, #2dba7e);
}

/* Body wrapper */
.msg-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.msg.own .msg-body {
    align-items: flex-end;
}

.msg.other .msg-body {
    align-items: flex-start;
}

/* Author label */
.msg-author {
    font-size: 11px;
    font-weight: 600;
    color: var(--text3);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 0;
    /* avatar is now outside, no inline av needed */
}

/* Remove old inline .author-av (kept for backward compat if used elsewhere) */
.msg-author .author-av {
    display: none;
    /* hidden — avatar is now .msg-av outside */
}

/* Bubble */
.msg-bubble {
    padding: 11px 15px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.6;
    word-break: break-word;
    max-width: 100%;
}

/* Own bubble — brand gradient, strong presence */
.msg.own .msg-bubble {
    background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand) 60%, var(--brand-light) 100%);
    color: #fff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 3px 14px rgba(138, 32, 97, 0.28);
}

/* Other bubble — surface card */
.msg.other .msg-bubble {
    background: var(--surface2);
    color: var(--text);
    border: 1px solid var(--border2);
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Original request bubble — distinct softer tint */
.msg.own.original .msg-bubble {
    background: linear-gradient(135deg, rgba(138, 32, 97, 0.18) 0%, rgba(184, 48, 110, 0.12) 100%);
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: none;
}

/* Time stamp */
.msg-time {
    font-size: 10.5px;
    color: var(--text3);
    margin-top: 5px;
    padding: 0 2px;
}

/* ── CHAT AREA — tighter gap for new bubble layout ── */
.dp-chat {
    gap: 10px;
    /* slightly tighter than old 16px */
}

/* ── BUBBLE ENTER ANIMATION ── */
@keyframes bubbleIn {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ── RESPONSIVE — reply panel on small screens ── */
@media (max-width: 600px) {
    .reply-composer {
        padding: 10px 14px;
    }

    .reply-hint {
        padding: 0 14px 10px;
    }

    .reply-attach-preview {
        padding: 10px 14px 0;
    }

    .reply-locked {
        padding: 14px 18px;
    }

    .msg {
        max-width: 90%;
    }
}

/* ── Support Team Page — extends the shared CSS vars ── */
.support-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    background: linear-gradient(135deg, var(--brand), var(--brand-light));
    color: #fff;
    box-shadow: 0 2px 10px rgba(138, 32, 97, .35);
}

/* ── Editable meta chips in detail panel ── */
.dp-meta-edit {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11.5px;
    font-weight: 500;
    background: var(--surface2);
    color: var(--text2);
    border: 1px solid var(--border2);
    cursor: pointer;
    transition: border-color .2s, background .2s;
    position: relative;
}

.dp-meta-edit:hover {
    border-color: var(--brand);
    background: var(--brand-soft);
    color: var(--text);
}

.dp-meta-edit svg {
    opacity: .5;
    flex-shrink: 0;
}

.dp-meta-edit:hover svg {
    opacity: 1;
}

/* ── Inline edit dropdown ── */
.edit-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 180px;
    z-index: 200;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .55);
    overflow: hidden;
    animation: dropIn .18s cubic-bezier(.22, 1, .36, 1) both;
}

@keyframes dropIn {
    from {
        opacity: 0;
        transform: translateY(-6px) scale(.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.edit-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    font-size: 13px;
    color: var(--text2);
    cursor: pointer;
    transition: background .15s, color .15s;
}

.edit-dropdown-item:hover {
    background: var(--brand-soft);
    color: var(--text);
}

.edit-dropdown-item.active {
    color: var(--brand-light);
    font-weight: 600;
}

.edit-dropdown-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.edit-dropdown-header {
    padding: 8px 14px 6px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--text3);
    border-bottom: 1px solid var(--border2);
}

/* ── Status pill colors for dropdown ── */
.dot-open {
    background: #5aa8f5;
}

.dot-inprog {
    background: #f0bc50;
}

.dot-resolved {
    background: #3dd68c;
}

.dot-closed {
    background: #a08099;
}

.dot-high {
    background: #e84545;
}

.dot-medium {
    background: #e8a730;
}

.dot-low {
    background: #3a8fe8;
}

/* ── Saving spinner ── */
.saving-indicator {
    display: none;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--brand-light);
}

.saving-indicator.show {
    display: flex;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.spinner {
    width: 14px;
    height: 14px;
    border: 2px solid var(--border);
    border-top-color: var(--brand-light);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

/* ── Ticket count badge in header ── */
.queue-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 11px;
    background: var(--brand);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}

/* ── Assignee chip ── */
.assignee-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text2);
}

.assignee-av {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1a6b4a, #2dba7e);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    font-weight: 700;
    color: #fff;
}

/* ── Reply typing indicator ── */
.typing-dots span {
    display: inline-block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--text3);
    margin: 0 1px;
    animation: bounce .9s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: .15s;
}

.typing-dots span:nth-child(3) {
    animation-delay: .3s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-5px);
    }
}
