:root {
    --bg: #eef4fb;
    --bg-soft: #f8fbff;
    --surface: rgba(255, 255, 255, 0.92);
    --surface-solid: #ffffff;
    --surface-muted: #f3f7fc;

    --text: #0f172a;
    --text-soft: #475569;
    --text-muted: #64748b;

    --primary: #0f2f6b;
    --primary-2: #1d4ed8;
    --primary-3: #60a5fa;

    --border: #d9e2ef;
    --border-strong: #b9c9df;

    --success: #15803d;
    --success-bg: #ecfdf3;

    --warning: #b45309;
    --warning-bg: #fff7ed;

    --danger: #b91c1c;
    --danger-bg: #fef2f2;

    --shadow-sm: 0 8px 24px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 14px 34px rgba(15, 23, 42, 0.10);
    --shadow-lg: 0 24px 60px rgba(15, 23, 42, 0.16);

    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-xl: 24px;

    --container: 1280px;
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-width: 320px;
    font-family: Inter, Arial, Helvetica, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
}

img {
    max-width: 100%;
    height: auto;
}

button,
input,
select,
textarea {
    font: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}

[hidden] {
    display: none !important;
}

.has-ambient-bg {
    position: relative;
    min-height: 100vh;
    background: linear-gradient(180deg, #f7fbff 0%, #edf4fc 100%);
    overflow-x: hidden;
}

.ambient-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.auth-shell,
.page-shell,
.ticket-layout,
.panel,
.form-card {
    position: relative;
    z-index: 1;
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.page-shell {
    width: min(100%, var(--container));
    margin: 0 auto;
    padding: 18px;
}

.main-grid,
.dashboard-grid,
.ticket-layout {
    width: 100%;
}

.panel,
.form-card,
.ticket-chat,
.ticket-sidebar {
}

.container {
    width: min(100%, var(--container));
    margin: 0 auto;
    padding: 0 18px;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.gap-lg {
    gap: 24px;
}

.text-center {
    text-align: center;
}

.muted {
    color: var(--text-muted);
    text-align: center;
}

.eyebrow {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--primary-2);
}

.reveal {
    animation: revealUp 0.45s ease both;
}

@keyframes revealUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.panel,
.form-card {
    background: var(--surface);
    border: 1px solid rgba(217, 226, 239, 0.9);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 18px;
}

.panel--muted {
    background: rgba(248, 251, 255, 0.92);
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.section-head h1,
.section-head h2,
.section-head h3 {
    margin: 0;
}

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

.page-header h1 {
    margin: 4px 0 8px;
    font-size: clamp(1.6rem, 2vw, 2.1rem);
}

.hero-copy h1,
.hero-copy h2 {
    margin: 6px 0 10px;
    font-size: clamp(1.7rem, 2vw, 2.2rem);
    text-align: center;
}

.hero-copy p {
    margin: 0;
}

.button {
    appearance: none;
    border: none;
    border-radius: 12px;
    padding: 11px 16px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition:
        transform 0.18s ease,
        box-shadow 0.18s ease,
        background 0.18s ease,
        opacity 0.18s ease,
        border-color 0.18s ease;
    font-weight: 600;
}

.button:hover {
    transform: translateY(-1px);
}

.button:active {
    transform: translateY(0);
}

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

.button--primary {
    background: linear-gradient(135deg, var(--primary-2), var(--primary));
    color: #ffffff;
    box-shadow: 0 12px 24px rgba(15, 47, 107, 0.20);
}

.button--primary:hover {
    box-shadow: 0 16px 30px rgba(15, 47, 107, 0.26);
}

.button--ghost {
    background: rgba(255, 255, 255, 0.8);
    color: var(--primary);
    border: 1px solid var(--border);
}

.button--ghost:hover {
    background: #ffffff;
}

.button--danger {
    background: linear-gradient(135deg, #dc2626, #991b1b);
    color: #ffffff;
    box-shadow: 0 12px 24px rgba(185, 28, 28, 0.18);
}

.button--small {
    min-height: 38px;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 0.92rem;
}

.button--full {
    width: 100%;
}

.button-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.button-group--space {
    justify-content: space-between;
}

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

.field > span {
    color: var(--text-soft);
    font-size: 0.95rem;
    font-weight: 600;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
    width: 100%;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.95);
    color: var(--text);
    border-radius: 12px;
    padding: 12px 14px;
    outline: none;
    transition:
        border-color 0.18s ease,
        box-shadow 0.18s ease,
        background 0.18s ease;
}

textarea {
    min-height: 110px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary-2);
    box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.12);
    background: #ffffff;
}

.checkbox-grid {
    display: grid;
    gap: 12px;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-soft);
}

.checkbox input {
    width: 18px;
    height: 18px;
}

.alert {
    border-radius: 14px;
    padding: 14px 16px;
    border: 1px solid transparent;
    font-size: 0.95rem;
}

.alert--success {
    background: var(--success-bg);
    color: var(--success);
    border-color: #bbf7d0;
}

.alert--error {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: #fecaca;
}

.alert--warning {
    background: var(--warning-bg);
    color: var(--warning);
    border-color: #fed7aa;
}

.meta-list {
    display: grid;
    gap: 10px;
    margin: 0;
}

.meta-list div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 8px;
    border-bottom: 1px dashed var(--border);
}

.meta-list dt {
    color: var(--text-muted);
}

.meta-list dd {
    margin: 0;
    text-align: right;
    font-weight: 600;
}

.ticket-problem h3 {
    margin: 0 0 8px;
}

.ticket-problem p {
    margin: 0;
    white-space: normal;
    word-break: break-word;
}

.ticket-layout {
    display: grid;
    gap: 18px;
}

.ticket-sidebar,
.ticket-chat {
    min-width: 0;
}

.timeline {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.timeline__item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.7);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 700;
    border: 1px solid transparent;
}

.status-new {
    background: #eff6ff;
    color: #1d4ed8;
    text-align: center;
    border-radius: 10px;
    border-color: #bfdbfe;
}

.status-assigned {
    background: #eef2ff;
    color: #4338ca;
    text-align: center;
    border-radius: 10px;
    border-color: #c7d2fe;
}

.status-in_progress {
    background: #ecfeff;
    color: #0f766e;
    text-align: center;
    border-radius: 10px;
    border-color: #a5f3fc;
}

.status-waiting_response {
    background: #fff7ed;
    color: #b45309;
    text-align: center;
    border-radius: 10px;
    border-color: #fed7aa;
}

.status-waiting_confirmation {
    background: #f5f3ff;
    color: #6d28d9;
    text-align: center;
    border-radius: 10px;
    border-color: #ddd6fe;
}

.status-closed {
    background: #ecfdf3;
    color: #15803d;
    border-radius: 10px;
    text-align: center;
    border-color: #bbf7d0;
}

.status-cancelled {
    background: #fef2f2;
    color: #b91c1c;
    text-align: center;
    border-radius: 10px;
    border-color: #fecaca;
}

.auth-card,
.verify-container {
    width: min(100%, 460px);
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(217, 226, 239, 0.95);
    border-radius: 22px;
    box-shadow: var(--shadow-lg);
    padding: 26px;
}

.auth-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

.auth-logo img {
    max-height: 72px;
}

.verify-header {
    margin-bottom: 20px;
    text-align: center;
}

.verify-eyebrow {
    margin: 0 0 4px;
    color: var(--primary-2);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.verify-title {
    margin: 0 0 10px;
    font-size: 1.8rem;
    color: var(--primary);
}

.verify-subtitle {
    margin: 0;
    color: var(--text-soft);
}

.verify-form,
.verify-back,
.verify-resend-block {
    margin-top: 16px;
}

.verify-input {
    text-align: center;
    font-size: 1.3rem;
    letter-spacing: 0.35em;
}

.verify-timer {
    text-align: center;
    color: var(--text-muted);
    padding: 10px 0;
}

.ticket-chat .chat-messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 62vh;
    overflow-y: auto;
    padding-right: 4px;
}

.chat-message {
    max-width: min(100%, 760px);
    padding: 14px;
    border-radius: 18px;
    background: rgba(248, 251, 255, 0.95);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.chat-message header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 0.92rem;
}

.chat-message header strong {
    color: var(--primary);
}

.chat-message header span {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.chat-message p {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
}

.chat-message.is-own {
    align-self: flex-end;
    background: linear-gradient(180deg, #eef5ff, #e6f0ff);
    border-color: #cdddf7;
}

.chat-message.is-system {
    max-width: 100%;
    background: rgba(243, 247, 252, 0.9);
    border-style: dashed;
}

.chat-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 16px;
}

.dropzone {
    position: relative;
    border: 2px dashed #b9c9df;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.72);
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
    cursor: pointer;
    overflow: hidden;
}

.dropzone.is-dragover {
    border-color: var(--primary-2);
    background: rgba(219, 234, 254, 0.7);
    transform: translateY(-1px);
}

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

.dropzone__inner {
    padding: 24px 18px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
}

.dropzone__icon {
    font-size: 32px;
    line-height: 1;
}

.file-upload {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    flex-wrap: wrap;
}

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

.file-upload__button {
    padding: 10px 16px;
    background: linear-gradient(135deg, var(--primary-2), var(--primary));
    color: #ffffff;
    border-radius: 12px;
    font-size: 14px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 10px 20px rgba(15, 47, 107, 0.18);
}

.file-upload:hover .file-upload__button {
    transform: translateY(-1px);
    box-shadow: 0 14px 24px rgba(15, 47, 107, 0.22);
}

.file-upload__name {
    font-size: 13px;
    color: var(--text-muted);
}

.chat-preview-list[hidden] {
    display: none;
}

.chat-preview-list {
    display: grid;
    gap: 12px;
    margin-top: 14px;
}

.chat-preview-item {
    display: grid;
    grid-template-columns: 88px 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #f8fbff;
}

.chat-preview-item__image {
    width: 88px;
    height: 88px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid #dbe4f0;
}

.chat-preview-item__meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.chat-preview-item__meta strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-preview {
    margin-top: 12px;
}

.chat-preview__card {
    display: grid;
    grid-template-columns: 96px 1fr auto;
    gap: 14px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #f8fbff;
}

.chat-preview__image {
    width: 96px;
    height: 96px;
    object-fit: cover;
    border-radius: 14px;
    border: 1px solid #dbe4f0;
}

.chat-preview__meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.chat-preview__meta strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-gallery {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.chat-gallery__item {
    display: inline-flex;
}

.chat-gallery__image {
    display: block;
    width: 220px;
    max-width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: 14px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.table-wrap {
    overflow-x: auto;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.78);
}

.table {
    width: 100%;
    border-collapse: collapse;
    min-width: 680px;
}

.table th,
.table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.table th {
    background: rgba(248, 251, 255, 0.95);
    color: var(--text-soft);
    font-size: 0.92rem;
}

.table tbody tr:hover {
    background: rgba(241, 245, 249, 0.6);
}

.stats-grid,
.cards-grid {
    display: grid;
    gap: 14px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow-sm);
    padding: 18px;
}

.stat-card__label {
    color: var(--text-muted);
    font-size: 0.92rem;
}

.stat-card__value {
    margin-top: 8px;
    font-size: 1.9rem;
    font-weight: 800;
    color: var(--primary);
}

.ticket-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow-sm);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ticket-card__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.ticket-card__title {
    margin: 0;
    font-size: 1.05rem;
}

.ticket-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--text-muted);
    font-size: 0.92rem;
}

.ticket-card__text {
    margin: 0;
    color: var(--text-soft);
    word-break: break-word;
}

.login-layout {
    display: grid;
    gap: 22px;
}

.brand-card {
    text-align: center;
    padding: 18px;
}

.brand-card__title {
    margin: 10px 0 8px;
    font-size: clamp(1.7rem, 2vw, 2.4rem);
    color: var(--primary);
}

.brand-card__subtitle {
    margin: 0;
    color: var(--text-muted);
}

.nav-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.nav-tabs a,
.nav-tabs button {
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.8);
    color: var(--text-soft);
}

.nav-tabs .is-active {
    background: linear-gradient(135deg, var(--primary-2), var(--primary));
    color: #fff;
    border-color: transparent;
}

.empty-state {
    padding: 24px;
    text-align: center;
    color: var(--text-muted);
    border: 1px dashed var(--border-strong);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.56);
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: grid;
    place-items: center;
    padding: 18px;
    z-index: 1000;
}

.modal {
    width: min(100%, 480px);
    background: #ffffff;
    border-radius: 20px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    padding: 20px;
    animation: modalIn 0.22s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.lightbox[hidden] {
    display: none;
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
}

.lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.82);
}

.lightbox__dialog {
    position: relative;
    z-index: 2;
    max-width: min(92vw, 1200px);
    max-height: 90vh;
    margin: 4vh auto 0;
    padding: 18px;
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 20px 50px rgba(2, 6, 23, 0.35);
}

.lightbox__image {
    display: block;
    max-width: 100%;
    max-height: 72vh;
    margin: 0 auto;
    border-radius: 14px;
}

.lightbox__close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.08);
    color: #0f172a;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.lightbox__footer {
    margin-top: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

body.lightbox-open {
    overflow: hidden;
}

.footer-note {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 20px 0 10px;
}

@media (min-width: 768px) {
    .page-shell {
        padding: 24px;
    }

    .ticket-layout {
        grid-template-columns: 360px minmax(0, 1fr);
        align-items: start;
    }

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

    .login-layout {
        grid-template-columns: 1.1fr 0.9fr;
        align-items: center;
    }

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

@media (min-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .cards-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .ticket-chat .chat-messages {
        max-height: 68vh;
    }
}

@media (max-width: 767px) {
    .page-header,
    .section-head,
    .button-group--space {
        flex-direction: column;
        align-items: stretch;
    }

    .meta-list div {
        flex-direction: column;
        gap: 4px;
    }

    .meta-list dd {
        text-align: left;
    }

    .chat-preview-item,
    .chat-preview__card {
        grid-template-columns: 1fr;
    }

    .chat-preview-item__image,
    .chat-preview__image {
        width: 100%;
        height: 180px;
    }

    .chat-gallery__image {
        width: 100%;
        height: auto;
        max-height: 260px;
    }

    .auth-card,
    .verify-container {
        padding: 20px;
        border-radius: 18px;
    }

    .table {
        min-width: 560px;
    }
}

body {
    position: relative;
    min-height: 100vh;
    overflow-x: hidden;
    isolation: isolate;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(238, 244, 251, 0.98) 100%);
}

body::before,
body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.55;
    will-change: transform;
}

body::before {
    background:
        radial-gradient(circle at 14% 18%, rgba(29, 78, 216, 0.22), transparent 24%),
        radial-gradient(circle at 78% 16%, rgba(147, 197, 253, 0.22), transparent 26%),
        radial-gradient(circle at 60% 72%, rgba(59, 130, 246, 0.16), transparent 28%);
    animation: ambientDrift 18s ease-in-out infinite alternate;
}

body::after {
    background:
        radial-gradient(circle at 34% 56%, rgba(219, 234, 254, 0.55), transparent 24%),
        radial-gradient(circle at 82% 72%, rgba(191, 219, 254, 0.35), transparent 20%);
    animation: ambientDrift 24s ease-in-out infinite alternate-reverse;
}

@keyframes ambientDrift {
    from {
        transform: translate3d(0, 0, 0) scale(1);
    }
    to {
        transform: translate3d(1%, -1%, 0) scale(1.02);
    }
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
    margin-bottom: 26px;
    padding: 16px 18px;
    border-radius: 24px;
    border: 1px solid rgba(217, 226, 239, 0.9);
    background: rgba(255, 255, 255, 0.72);
    box-shadow: var(--shadow-sm);
}

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

.brand__mark {
    overflow: hidden;
}

.brand__mark img {
    border-radius: 11px;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.brand__mark--large {
    width: 68px;
    height: 68px;
    flex-basis: 68px;
    border-radius: 22px;
    font-size: 1.55rem;
}

.brand__lockup {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.brand__lockup--center {
    align-items: center;
    text-align: center;
}

.brand__title {
    font-size: clamp(1.05rem, 1.6vw, 1.35rem);
    font-weight: 800;
    color: var(--primary);
    letter-spacing: 0.03em;
}

.brand__title--auth {
    font-size: clamp(1.35rem, 2.2vw, 2rem);
}

.brand__subtitle {
    font-size: 0.84rem;
    line-height: 1.35;
    max-width: 38ch;
}

.brand__subtitle--auth {
    font-size: 0.96rem;
    max-width: 32ch;
    color: var(--primary-2);
}

.brand-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.topbar__nav {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    min-height: 42px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.76);
    color: var(--text-soft);
    font-weight: 600;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.nav-link:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.nav-link.is-active {
    color: #ffffff;
    border-color: transparent;
    background: linear-gradient(135deg, var(--primary-2), var(--primary));
    box-shadow: 0 12px 22px rgba(15, 47, 107, 0.18);
}

.topbar__user {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.user-badge {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 14px;
    border-radius: 16px;
    border: 1px solid rgba(217, 226, 239, 0.9);
    background: rgba(255, 255, 255, 0.78);
}

.auth-card__header {
    margin-bottom: 8px;
}

.chat-link {
    color: var(--primary-2);
    text-decoration: underline;
    text-decoration-thickness: 1.5px;
    text-underline-offset: 3px;
    word-break: break-word;
}

.dropzone {
    min-height: 180px;
}

.dropzone__button {
    margin-top: 8px;
}

.chat-preview-item__thumb {
    width: 88px;
    height: 88px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    border: 1px solid #dbe4f0;
    background: linear-gradient(135deg, rgba(219, 234, 254, 0.95), rgba(255, 255, 255, 0.95));
    font-size: 1.8rem;
}

.chat-attachment {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--shadow-sm);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.chat-attachment:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-strong);
}

.chat-attachment__icon {
    width: 50px;
    height: 50px;
    flex: 0 0 50px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(219, 234, 254, 0.95), rgba(191, 219, 254, 0.85));
    font-size: 1.45rem;
}

.chat-attachment__content {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1 1 auto;
}

.chat-attachment__content strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-attachment__action {
    color: var(--primary);
    font-size: 0.92rem;
    font-weight: 700;
    white-space: nowrap;
}

.chat-gallery__item {
    overflow: hidden;
    border-radius: 14px;
}

.chat-gallery__item:hover .chat-gallery__image {
    transform: scale(1.02);
}

.chat-gallery__image {
    transition: transform 0.2s ease;
}

.status-chart-grid {
    display: grid;
    gap: 16px;
    margin-bottom: 18px;
}

.status-chart-card {
    display: grid;
    grid-template-columns: 140px minmax(0, 1fr);
    align-items: center;
    gap: 18px;
	background: #ffffff;
    padding: 18px;
    border-radius: 22px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.78);
    box-shadow: var(--shadow-sm);
}

.status-chart {
    --chart-color: var(--primary-2);
    --chart-track: rgba(15, 23, 42, 0.08);
    position: relative;
    width: 140px;
    aspect-ratio: 1;
    display: grid;
    place-items: center;
	isolation: isolate;
    border-radius: 50%;
    background: conic-gradient(
        var(--chart-color) 0 var(--chart-value),
        var(--chart-track) var(--chart-value) 100%
    );
    box-shadow: none;
}

.status-chart::after {
    content: '';
    position: absolute;
    inset: 16px;
    border-radius: 50%;
    background: #f8fbff;
    box-shadow: none;
    border: 1px solid rgba(217, 226, 239, 0.7);
}

.status-chart__center {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.status-chart__center strong {
    font-size: 2rem;
    line-height: 1;
    color: var(--primary);
}

.status-chart__center span {
    color: var(--text-muted);
    font-size: 0.92rem;
    font-weight: 700;
}

.status-chart--open {
    --chart-color: #1d4ed8;
}

.status-chart--closed {
    --chart-color: #60a5fa;
}

.status-chart--cancelled {
    --chart-color: #bfdbfe;
}

.status-chart-card__body h3 {
    margin: 0 0 6px;
}

.status-chart-card__body p {
    margin: 0;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

@media (min-width: 768px) {
    .status-chart-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 960px) {
    .topbar {
        align-items: stretch;
    }

    .topbar__user {
        justify-content: space-between;
    }
}

@media (max-width: 767px) {
    .brand {
        align-items: flex-start;
    }

    .brand__subtitle {
        max-width: 28ch;
    }

    .status-chart-card {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
    }

    .chat-attachment {
        flex-wrap: wrap;
    }
}

@media (prefers-reduced-motion: reduce) {
    body::before,
    body::after,
    .chat-gallery__image {
        animation: none !important;
        transition: none !important;
    }
}

.hotkeys {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.88);
    color: var(--text-soft);
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.chip:hover,
.chip:focus-visible {
    transform: translateY(-1px);
    border-color: var(--primary-3);
    box-shadow: var(--shadow-sm);
}

.duplicate-ticket-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.duplicate-ticket-link {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid #fdba74;
    background: rgba(255, 255, 255, 0.75);
}

.modal-backdrop[hidden] {
    display: none !important;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: grid;
    place-items: center;
    padding: 18px;
    z-index: 1000;
}

.modal-backdrop .modal {
    width: min(100%, 480px);
}

.chat-attachments-list {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.rating-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
}

.rating-option {
    position: relative;
}

.rating-option input {
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
}

.rating-option span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.88);
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.rating-option input:checked + span,
.rating-option span:hover {
    border-color: #f59e0b;
    background: #fff7ed;
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.rating-result {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--warning);
}

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

.stat-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px 18px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.82);
}

.stat-card strong {
    font-size: clamp(1.4rem, 1.8vw, 1.8rem);
    color: var(--primary);
}

.admin-quick-links {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.admin-quick-link {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.72);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.admin-quick-link:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.admin-quick-link strong {
    color: var(--primary);
}

.site-toast-stack {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(92vw, 360px);
}

.site-toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 14px 14px 16px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow-md);
    animation: toastIn 0.2s ease;
}

.site-toast.is-leaving {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.site-toast__body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.site-toast__body strong {
    color: var(--primary);
}

.site-toast__close {
    appearance: none;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 900px) {
    .admin-quick-links,
    .stats-grid--admin-summary,
    .rating-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .hotkeys,
    .duplicate-ticket-list,
    .admin-quick-links,
    .stats-grid--admin-summary,
    .rating-grid {
        grid-template-columns: 1fr;
        display: grid;
    }

    .chip,
    .duplicate-ticket-link,
    .admin-quick-link {
        width: 100%;
        justify-content: center;
    }

    .site-toast-stack {
        right: 12px;
        left: 12px;
        width: auto;
    }
}

:root[data-theme="dark"] {
    --bg: #0b1120;
    --bg-soft: #111827;
    --surface: rgba(17, 24, 39, 0.92);
    --surface-solid: #111827;
    --surface-muted: #172033;
    --text: #e5eefc;
    --text-soft: #c7d2e5;
    --text-muted: #94a3b8;
    --primary: #93c5fd;
    --primary-2: #60a5fa;
    --primary-3: #1d4ed8;
    --border: #334155;
    --border-strong: #475569;
    --success-bg: rgba(20, 83, 45, 0.24);
    --warning-bg: rgba(146, 64, 14, 0.22);
    --danger-bg: rgba(127, 29, 29, 0.22);
    --shadow-sm: 0 8px 24px rgba(2, 6, 23, 0.34);
    --shadow-md: 0 14px 34px rgba(2, 6, 23, 0.45);
    --shadow-lg: 0 24px 60px rgba(2, 6, 23, 0.55);
}

:root[data-theme="dark"] body,
:root[data-theme="dark"] .has-ambient-bg {
    background: linear-gradient(180deg, #08101f 0%, #0b1120 100%);
}

:root[data-theme="dark"] .panel,
:root[data-theme="dark"] .form-card,
:root[data-theme="dark"] .ticket-chat,
:root[data-theme="dark"] .ticket-sidebar,
:root[data-theme="dark"] .topbar,
:root[data-theme="dark"] .modal,
:root[data-theme="dark"] .table,
:root[data-theme="dark"] .empty-state,
:root[data-theme="dark"] .stat-card,
:root[data-theme="dark"] .admin-quick-link,
:root[data-theme="dark"] .chat-attachment,
:root[data-theme="dark"] .site-toast,
:root[data-theme="dark"] .user-badge,
:root[data-theme="dark"] .nav-link,
:root[data-theme="dark"] .duplicate-ticket-link,
:root[data-theme="dark"] .chip,
:root[data-theme="dark"] .theme-option span,
:root[data-theme="dark"] .rating-line__item span,
:root[data-theme="dark"] .dropzone,
:root[data-theme="dark"] .status-chart-card,
:root[data-theme="dark"] .lightbox__dialog {
    background: rgba(17, 24, 39, 0.92);
    color: var(--text);
    border-color: var(--border);
}

:root[data-theme="dark"] .field input,
:root[data-theme="dark"] .field select,
:root[data-theme="dark"] .field textarea,
:root[data-theme="dark"] .search-bar input {
    background: rgba(15, 23, 42, 0.92);
    color: var(--text);
    border-color: var(--border);
}

:root[data-theme="dark"] .status-chart::after {
    background: #0f172a;
    border-color: rgba(71, 85, 105, 0.85);
}

:root[data-theme="dark"] .site-toast__body,
:root[data-theme="dark"] .site-toast__body strong,
:root[data-theme="dark"] .chat-attachment__action,
:root[data-theme="dark"] .brand__title,
:root[data-theme="dark"] .nav-link.is-active,
:root[data-theme="dark"] .stat-card strong,
:root[data-theme="dark"] .status-chart__center strong {
    color: inherit;
}

:root[data-theme="dark"] .nav-link.is-active {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
}

body.has-open-modal {
    overflow: hidden;
}

.muted--left {
    text-align: left;
}

.modal--wide {
    width: min(100%, 1080px);
}

.theme-options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.theme-option {
    position: relative;
}

.theme-option input {
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
}

.theme-option span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 14px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.88);
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.theme-option:hover span,
.theme-option.is-active span,
.theme-option input:checked + span {
    border-color: var(--primary-2);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.admin-quick-link--button {
    appearance: none;
    width: 100%;
    text-align: left;
    color: inherit;
    cursor: pointer;
}

.admin-log-filters {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.rating-line {
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    gap: 8px;
}

.rating-line__item {
    position: relative;
}

.rating-line__item input {
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
}

.rating-line__item span {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 56px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.88);
    color: #94a3b8;
    cursor: pointer;
    font-weight: 800;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}

.rating-line__item span small {
    font-size: 0.72rem;
    font-weight: 700;
}

.rating-line__item.is-active span,
.rating-line__item:hover span,
.rating-line__item input:checked + span {
    color: #f59e0b;
    border-color: #f59e0b;
    background: #fff7ed;
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.rating-line__hint {
    font-size: 0.95rem;
    color: var(--text-muted);
}

.site-toast__body {
    min-width: 0;
}

.site-toast__body[href] {
    text-decoration: none;
}

.site-toast__body span {
    word-break: break-word;
}

.topbar__nav,
.button-group--header {
    row-gap: 8px;
}

.button-group--header {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.button-group--stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ticket-chat .button-group--space {
    align-items: center;
}

@media (max-width: 1100px) {
    .ticket-layout {
        grid-template-columns: 1fr;
    }

    .ticket-sidebar {
        order: 2;
    }

    .ticket-chat {
        order: 1;
    }
}

@media (max-width: 900px) {
    .theme-options,
    .admin-log-filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .rating-line {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }

    .topbar {
        padding: 14px;
    }

    .topbar__nav {
        width: 100%;
    }

    .topbar__user {
        width: 100%;
    }

    .button-group--header {
        width: 100%;
    }
}

@media (max-width: 640px) {
    .page-shell {
        padding: 12px;
    }

    .container {
        padding: 0 10px;
    }

    .topbar {
        gap: 12px;
        border-radius: 18px;
    }

    .brand {
        width: 100%;
        gap: 10px;
    }

    .brand__subtitle {
        max-width: 100%;
        font-size: 0.78rem;
    }

    .topbar__nav {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
    }

    .nav-link,
    .button-group--header .button,
    .button-group--header form,
    .button-group--header form button {
        width: 100%;
        justify-content: center;
    }

    .user-badge,
    .topbar__user,
    .button-group--header {
        width: 100%;
    }

    .modal,
    .modal--wide {
        width: min(100%, 100%);
        padding: 16px;
        border-radius: 18px;
    }

    .admin-log-filters,
    .theme-options,
    .rating-line {
        grid-template-columns: 1fr;
    }

    .chat-form textarea {
        min-height: 110px;
    }

    .chat-preview-item,
    .chat-attachment {
        align-items: flex-start;
    }

    .chat-preview-item {
        grid-template-columns: 56px minmax(0, 1fr);
    }

    .chat-preview-item > .button {
        grid-column: 1 / -1;
        width: 100%;
    }

    .dropzone {
        min-height: 150px;
        padding: 12px;
    }

    .dropzone__inner {
        gap: 8px;
        text-align: center;
    }

    .table-responsive {
        border-radius: 16px;
    }

    .ticket-chat .button-group--space {
        flex-direction: column;
        align-items: stretch;
    }

    .ticket-chat .button-group--space .button {
        width: 100%;
    }
}


/* 2026-04-25 patch: sticky header, fixed wide modals, dark theme cleanup */
.topbar {
    position: sticky;
    top: 12px;
    z-index: 60;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.topbar__nav {
    flex: 1 1 auto;
    min-width: 0;
}

.topbar__user {
    flex: 0 1 auto;
    justify-content: flex-end;
    min-width: 0;
    flex-wrap: nowrap;
}

.user-badge--inline {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.user-badge--inline span::before {
    content: '—';
    margin-right: 8px;
    color: var(--text-muted);
}

.button-group--header {
    flex-wrap: nowrap;
    align-items: center;
}

.button-group--header form {
    margin: 0;
}

.modal {
    max-width: min(100%, 480px);
    max-height: min(88vh, 960px);
    overflow: auto;
    overscroll-behavior: contain;
}

.modal-backdrop {
    align-items: start;
    overflow-y: auto;
}

.modal-backdrop .modal {
    width: min(100%, 480px);
    margin: auto;
}

.modal-backdrop .modal.modal--wide,
.modal--wide {
    width: min(100%, 1080px);
    max-width: min(100%, 1080px);
}

.status-chart-grid,
.status-chart-grid--adaptive {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    align-items: stretch;
}

.status-chart-card {
    grid-template-columns: minmax(120px, 140px) minmax(0, 1fr);
    align-items: center;
    min-width: 0;
    overflow: hidden;
}

.status-chart-card__body {
    min-width: 0;
}

.status-chart-card__body p {
    word-break: break-word;
}

.table-responsive--modal {
    max-width: 100%;
}

.table-responsive--stats {
    max-height: 42vh;
    overflow: auto;
}

.table-responsive--logs {
    max-height: 52vh;
    overflow: auto;
    border-radius: 18px;
}

.table--logs {
    min-width: 880px;
}

.table--logs thead th {
    position: sticky;
    top: 0;
    z-index: 2;
}

.admin-quick-links {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.admin-log-filters {
    align-items: end;
}

:root[data-theme="dark"] body::before,
:root[data-theme="dark"] body::after {
    opacity: 0.22;
}

:root[data-theme="dark"] .auth-card,
:root[data-theme="dark"] .verify-container,
:root[data-theme="dark"] .brand-card,
:root[data-theme="dark"] .timeline__item,
:root[data-theme="dark"] .table-wrap,
:root[data-theme="dark"] .table-responsive,
:root[data-theme="dark"] .panel--filters,
:root[data-theme="dark"] .chat-preview__card,
:root[data-theme="dark"] .chat-preview-item,
:root[data-theme="dark"] .chat-preview__image,
:root[data-theme="dark"] .chat-preview-item__image {
    background: rgba(17, 24, 39, 0.92);
    color: var(--text);
    border-color: var(--border);
}

:root[data-theme="dark"] .table th,
:root[data-theme="dark"] .table thead th {
    background: rgba(15, 23, 42, 0.98);
    color: var(--text-soft);
}

:root[data-theme="dark"] .table tbody tr:hover {
    background: rgba(30, 41, 59, 0.72);
}

:root[data-theme="dark"] .button--ghost {
    background: rgba(15, 23, 42, 0.88);
    color: var(--text);
    border-color: var(--border);
}

:root[data-theme="dark"] .button--ghost:hover {
    background: rgba(30, 41, 59, 0.96);
}

:root[data-theme="dark"] input:focus,
:root[data-theme="dark"] select:focus,
:root[data-theme="dark"] textarea:focus {
    background: rgba(15, 23, 42, 0.98);
}

:root[data-theme="dark"] .brand__subtitle,
:root[data-theme="dark"] .brand__subtitle--auth,
:root[data-theme="dark"] .eyebrow,
:root[data-theme="dark"] .muted,
:root[data-theme="dark"] .stat-card__label {
    color: var(--text-muted);
}

:root[data-theme="dark"] .status-chart {
    --chart-track: rgba(148, 163, 184, 0.18);
}

@media (max-width: 1180px) {
    .admin-quick-links {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 960px) {
    .topbar {
        top: 8px;
    }

    .topbar__user {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .button-group--header {
        flex-wrap: wrap;
    }
}

@media (max-width: 900px) {
    .status-chart-grid,
    .status-chart-grid--adaptive {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }
}

@media (max-width: 640px) {
    .topbar {
        top: 6px;
    }

    .topbar__user,
    .user-badge--inline,
    .button-group--header {
        width: 100%;
    }

    .user-badge--inline {
        flex-wrap: wrap;
        white-space: normal;
    }

    .user-badge--inline span::before {
        content: '';
        margin-right: 0;
    }

    .button-group--header {
        flex-wrap: wrap;
    }

    .button-group--header .button,
    .button-group--header form,
    .button-group--header form button {
        width: 100%;
    }

    .modal-backdrop {
        padding: 10px;
    }

    .modal,
    .modal--wide,
    .modal-backdrop .modal,
    .modal-backdrop .modal.modal--wide {
        width: min(100%, 100%);
        max-width: 100%;
        max-height: 90vh;
    }

    .status-chart-card {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
    }

    .status-chart-card__body {
        text-align: center;
    }

    .admin-quick-links,
    .status-chart-grid,
    .status-chart-grid--adaptive,
    .stats-grid--admin-summary,
    .admin-log-filters,
    .theme-options,
    .rating-line {
        grid-template-columns: 1fr;
    }
}


/* 2026-04-26 cleanup: unified header + dark auth inputs + autofill fix */
.topbar {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) auto !important;
    align-items: center !important;
    gap: 18px !important;
}

.topbar__toolbar {
    display: contents !important;
}

.topbar > .brand {
    grid-column: 1 !important;
    min-width: 0;
}

.topbar > .topbar__nav {
    grid-column: 2 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 12px !important;
    flex-wrap: wrap !important;
    min-width: 0 !important;
}

.topbar > .topbar__userline {
    grid-column: 3 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 12px !important;
    flex-wrap: nowrap !important;
    min-width: max-content !important;
}

.topbar__user {
    display: none !important;
}

.user-badge {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: center !important;
    gap: 3px !important;
    min-height: 58px !important;
    padding: 10px 16px !important;
    border-radius: 16px !important;
}

.user-badge--inline {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: center !important;
    gap: 3px !important;
    line-height: 1.15 !important;
    white-space: normal !important;
}

.user-badge--inline strong {
    display: block !important;
    font-size: 1rem !important;
    font-weight: 800 !important;
    line-height: 1.15 !important;
}

.user-badge--inline span,
.user-badge__role {
    display: block !important;
    font-size: 0.86rem !important;
    font-weight: 600 !important;
    line-height: 1.15 !important;
    color: var(--text-soft) !important;
}

.user-badge__separator,
.user-badge--inline span::before {
    display: none !important;
    content: none !important;
}

.button-group--header,
.button-group--header form {
    display: flex !important;
    align-items: center !important;
    margin: 0 !important;
}

.button-group--header {
    gap: 10px !important;
    flex-wrap: nowrap !important;
}

:root[data-theme="dark"] .auth-card,
:root[data-theme="dark"] .verify-container {
    background: rgba(10, 16, 31, 0.96) !important;
    border-color: var(--border) !important;
}

:root[data-theme="dark"] .auth-card .field > span,
:root[data-theme="dark"] .verify-container .field > span,
:root[data-theme="dark"] .verify-subtitle,
:root[data-theme="dark"] .verify-timer {
    color: var(--text-soft) !important;
}

:root[data-theme="dark"] .auth-card input[type="text"],
:root[data-theme="dark"] .auth-card input[type="password"],
:root[data-theme="dark"] .auth-card input[type="email"],
:root[data-theme="dark"] .auth-card input[type="number"],
:root[data-theme="dark"] .verify-form input[type="text"],
:root[data-theme="dark"] .verify-form input[type="password"],
:root[data-theme="dark"] .verify-form input[type="number"],
:root[data-theme="dark"] .verify-input {
    background: #0f172a !important;
    color: #e5eefc !important;
    -webkit-text-fill-color: #e5eefc !important;
    caret-color: #60a5fa !important;
    border: 1px solid var(--border) !important;
    box-shadow: none !important;
    text-shadow: none !important;
}

:root[data-theme="dark"] .auth-card input[type="text"]:focus,
:root[data-theme="dark"] .auth-card input[type="password"]:focus,
:root[data-theme="dark"] .auth-card input[type="email"]:focus,
:root[data-theme="dark"] .auth-card input[type="number"]:focus,
:root[data-theme="dark"] .verify-form input[type="text"]:focus,
:root[data-theme="dark"] .verify-form input[type="password"]:focus,
:root[data-theme="dark"] .verify-form input[type="number"]:focus,
:root[data-theme="dark"] .verify-input:focus,
:root[data-theme="dark"] .auth-card input[type="text"]:not(:focus),
:root[data-theme="dark"] .auth-card input[type="password"]:not(:focus),
:root[data-theme="dark"] .auth-card input[type="email"]:not(:focus),
:root[data-theme="dark"] .auth-card input[type="number"]:not(:focus),
:root[data-theme="dark"] .verify-form input[type="text"]:not(:focus),
:root[data-theme="dark"] .verify-form input[type="password"]:not(:focus),
:root[data-theme="dark"] .verify-form input[type="number"]:not(:focus),
:root[data-theme="dark"] .verify-input:not(:focus) {
    background: #0f172a !important;
    color: #e5eefc !important;
    -webkit-text-fill-color: #e5eefc !important;
}

:root[data-theme="dark"] .auth-card input::placeholder,
:root[data-theme="dark"] .verify-form input::placeholder,
:root[data-theme="dark"] .verify-input::placeholder {
    color: #94a3b8 !important;
    -webkit-text-fill-color: #94a3b8 !important;
    opacity: 1 !important;
}

:root[data-theme="dark"] .auth-card input:-webkit-autofill,
:root[data-theme="dark"] .auth-card input:-webkit-autofill:hover,
:root[data-theme="dark"] .auth-card input:-webkit-autofill:focus,
:root[data-theme="dark"] .verify-form input:-webkit-autofill,
:root[data-theme="dark"] .verify-form input:-webkit-autofill:hover,
:root[data-theme="dark"] .verify-form input:-webkit-autofill:focus,
:root[data-theme="dark"] .verify-input:-webkit-autofill,
:root[data-theme="dark"] .verify-input:-webkit-autofill:hover,
:root[data-theme="dark"] .verify-input:-webkit-autofill:focus {
    -webkit-text-fill-color: #e5eefc !important;
    box-shadow: 0 0 0 1000px #0f172a inset !important;
    transition: background-color 9999s ease-out 0s !important;
}

@media (max-width: 1100px) {
    .topbar {
        grid-template-columns: 1fr !important;
    }

    .topbar > .brand,
    .topbar > .topbar__nav,
    .topbar > .topbar__userline {
        grid-column: auto !important;
        width: 100% !important;
    }

    .topbar > .topbar__nav,
    .topbar > .topbar__userline,
    .button-group--header {
        justify-content: flex-start !important;
        flex-wrap: wrap !important;
    }

    .user-badge {
        width: 100% !important;
    }
}

/* 2026-04-26 patch: password toggle + dark auth/chat/status fixes */
.password-field {
    position: relative;
}

.password-field input {
    padding-right: 54px;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.password-toggle:hover,
.password-toggle:focus-visible {
    background: rgba(148, 163, 184, 0.12);
    color: var(--primary);
    border-color: rgba(148, 163, 184, 0.2);
    outline: none;
}

.password-toggle.is-visible {
    color: var(--primary-2);
}

.password-toggle span {
    pointer-events: none;
    font-size: 18px;
    line-height: 1;
}

:root[data-theme="dark"] .password-toggle {
    color: #94a3b8;
}

:root[data-theme="dark"] .password-toggle:hover,
:root[data-theme="dark"] .password-toggle:focus-visible {
    background: rgba(148, 163, 184, 0.12);
    color: #e5eefc;
    border-color: rgba(148, 163, 184, 0.18);
}

:root[data-theme="dark"] .password-toggle.is-visible {
    color: #93c5fd;
}

:root[data-theme="dark"] .auth-card,
:root[data-theme="dark"] .verify-container {
    background: rgba(10, 16, 31, 0.96) !important;
    border-color: var(--border) !important;
}

:root[data-theme="dark"] .auth-card .field > span,
:root[data-theme="dark"] .verify-container .field > span,
:root[data-theme="dark"] .verify-subtitle,
:root[data-theme="dark"] .verify-timer,
:root[data-theme="dark"] .verify-field label {
    color: var(--text-soft) !important;
}

:root[data-theme="dark"] .auth-card input[type="text"],
:root[data-theme="dark"] .auth-card input[type="password"],
:root[data-theme="dark"] .auth-card input[type="email"],
:root[data-theme="dark"] .auth-card input[type="number"],
:root[data-theme="dark"] .verify-form input[type="text"],
:root[data-theme="dark"] .verify-form input[type="password"],
:root[data-theme="dark"] .verify-form input[type="number"],
:root[data-theme="dark"] .verify-input {
    background: #0f172a !important;
    color: #e5eefc !important;
    -webkit-text-fill-color: #e5eefc !important;
    caret-color: #60a5fa !important;
    border: 1px solid var(--border) !important;
    box-shadow: none !important;
    text-shadow: none !important;
}

:root[data-theme="dark"] .auth-card input[type="text"]:focus,
:root[data-theme="dark"] .auth-card input[type="password"]:focus,
:root[data-theme="dark"] .auth-card input[type="email"]:focus,
:root[data-theme="dark"] .auth-card input[type="number"]:focus,
:root[data-theme="dark"] .verify-form input[type="text"]:focus,
:root[data-theme="dark"] .verify-form input[type="password"]:focus,
:root[data-theme="dark"] .verify-form input[type="number"]:focus,
:root[data-theme="dark"] .verify-input:focus,
:root[data-theme="dark"] .auth-card input[type="text"]:not(:focus),
:root[data-theme="dark"] .auth-card input[type="password"]:not(:focus),
:root[data-theme="dark"] .auth-card input[type="email"]:not(:focus),
:root[data-theme="dark"] .auth-card input[type="number"]:not(:focus),
:root[data-theme="dark"] .verify-form input[type="text"]:not(:focus),
:root[data-theme="dark"] .verify-form input[type="password"]:not(:focus),
:root[data-theme="dark"] .verify-form input[type="number"]:not(:focus),
:root[data-theme="dark"] .verify-input:not(:focus) {
    background: #0f172a !important;
    color: #e5eefc !important;
    -webkit-text-fill-color: #e5eefc !important;
}

:root[data-theme="dark"] .auth-card input::placeholder,
:root[data-theme="dark"] .verify-form input::placeholder,
:root[data-theme="dark"] .verify-input::placeholder {
    color: #94a3b8 !important;
    -webkit-text-fill-color: #94a3b8 !important;
    opacity: 1 !important;
}

:root[data-theme="dark"] .auth-card input:-webkit-autofill,
:root[data-theme="dark"] .auth-card input:-webkit-autofill:hover,
:root[data-theme="dark"] .auth-card input:-webkit-autofill:focus,
:root[data-theme="dark"] .verify-form input:-webkit-autofill,
:root[data-theme="dark"] .verify-form input:-webkit-autofill:hover,
:root[data-theme="dark"] .verify-form input:-webkit-autofill:focus,
:root[data-theme="dark"] .verify-input:-webkit-autofill,
:root[data-theme="dark"] .verify-input:-webkit-autofill:hover,
:root[data-theme="dark"] .verify-input:-webkit-autofill:focus {
    -webkit-text-fill-color: #e5eefc !important;
    box-shadow: 0 0 0 1000px #0f172a inset !important;
    transition: background-color 9999s ease-out 0s !important;
}

:root[data-theme="dark"] .chat-message {
    background: #10192b !important;
    border-color: #334155 !important;
}

:root[data-theme="dark"] .chat-message.is-own {
    background: linear-gradient(180deg, #13233f, #10203b) !important;
    border-color: #27456f !important;
}

:root[data-theme="dark"] .chat-message.is-system {
    background: #0f172a !important;
    border-color: #334155 !important;
}

:root[data-theme="dark"] .chat-message p,
:root[data-theme="dark"] .chat-message header strong {
    color: #e5eefc !important;
}

:root[data-theme="dark"] .chat-message header span {
    color: #94a3b8 !important;
}

:root[data-theme="dark"] .status-closed {
    background: rgba(21, 128, 61, 0.22) !important;
    color: #bbf7d0 !important;
    border-color: rgba(74, 222, 128, 0.35) !important;
    box-shadow: none !important;
}

:root[data-theme="dark"] .status-assigned {
    background: rgba(37, 99, 235, 0.20) !important;
    color: #bfdbfe !important;
    border-color: rgba(96, 165, 250, 0.38) !important;
    box-shadow: none !important;
    filter: none !important;
}

/* 2026-04-27 patch: footer, mobile ticket workspace, low-load friendly UI fixes */
.site-footer {
    position: relative;
    z-index: 1;
    width: min(100%, var(--container));
    margin: 24px auto 0;
    padding: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    color: var(--text-muted);
    font-size: 0.92rem;
}

.site-footer__resources {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    flex-wrap: wrap;
    text-align: right;
}

.site-footer a {
    color: var(--primary-2);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.ticket-mobile-controls {
    display: none;
}

.ticket-info-modal__grid {
    display: grid;
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
    gap: 18px;
    align-items: start;
}

.ticket-info-modal__timeline {
    max-height: 52vh;
    overflow: auto;
    padding-right: 4px;
}

.ticket-chat {
    min-width: 0;
}

:root[data-theme="dark"] .chat-message,
:root[data-theme="dark"] .chat-message.is-system,
:root[data-theme="dark"] .chat-message.is-own,
:root[data-theme="dark"] .ticket-chat .chat-message,
:root[data-theme="dark"] .ticket-chat .chat-message.is-system {
    background: #10192b !important;
    color: #e5eefc !important;
    border-color: #334155 !important;
    box-shadow: 0 8px 24px rgba(2, 6, 23, 0.32) !important;
}

:root[data-theme="dark"] .chat-message.is-own {
    background: linear-gradient(180deg, #13233f, #10203b) !important;
    border-color: #27456f !important;
}

:root[data-theme="dark"] .chat-message.is-system {
    background: #0f172a !important;
    border-color: #475569 !important;
    border-style: dashed !important;
}

:root[data-theme="dark"] .status-closed {
    background: rgba(21, 128, 61, 0.22) !important;
    color: #bbf7d0 !important;
    border-color: rgba(74, 222, 128, 0.38) !important;
    box-shadow: none !important;
    filter: none !important;
}

:root[data-theme="dark"] .status-assigned {
    background: rgba(37, 99, 235, 0.20) !important;
    color: #bfdbfe !important;
    border-color: rgba(96, 165, 250, 0.38) !important;
    box-shadow: none !important;
    filter: none !important;
}

@media (max-width: 760px) {
    .site-footer {
        margin-top: 18px;
        padding: 16px 12px 24px;
        align-items: flex-start;
        flex-direction: column;
    }

    .site-footer__resources {
        justify-content: flex-start;
        text-align: left;
    }

    .ticket-layout {
        gap: 12px;
    }

    .ticket-main-info-panel,
    .ticket-sidebar [data-rating-panel],
    .ticket-sidebar [data-rating-result-panel],
    .ticket-sidebar [data-resolution-panel],
    .ticket-sidebar .timeline {
        display: none !important;
    }

    .ticket-mobile-controls {
        display: grid;
        gap: 10px;
        padding: 12px;
        border: 1px solid var(--border);
        border-radius: 18px;
        background: rgba(255, 255, 255, 0.72);
    }

    .ticket-mobile-controls__top,
    .ticket-mobile-controls__actions {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-wrap: wrap;
    }

    .ticket-mobile-controls__top {
        justify-content: space-between;
    }

    .ticket-mobile-controls__actions form {
        margin: 0;
        display: inline-flex;
    }

    .ticket-mobile-controls__actions .button,
    .ticket-mobile-controls__actions form {
        flex: 1 1 148px;
    }

    .ticket-mobile-controls__actions form .button {
        width: 100%;
    }

    .ticket-chat {
        padding: 14px;
    }

    .ticket-chat .section-head {
        gap: 6px;
    }

    .ticket-chat .chat-messages {
        max-height: 52vh;
        padding-right: 0;
    }

    .chat-message {
        padding: 12px;
        border-radius: 16px;
    }

    .chat-form {
        margin-top: 12px;
        padding: 12px;
        border: 1px solid var(--border);
        border-radius: 18px;
        background: rgba(255, 255, 255, 0.82);
        box-shadow: var(--shadow-sm);
    }

    .chat-form textarea {
        min-height: 86px;
    }

    .dropzone {
        min-height: 112px;
    }

    .dropzone__inner {
        padding: 16px 12px;
    }

    .dropzone__inner small {
        display: none;
    }

    .ticket-info-modal__grid {
        grid-template-columns: 1fr;
    }

    .ticket-info-modal__timeline {
        max-height: 36vh;
    }

    :root[data-theme="dark"] .ticket-mobile-controls,
    :root[data-theme="dark"] .chat-form {
        background: rgba(10, 16, 31, 0.94) !important;
        border-color: var(--border) !important;
    }
}

@media (max-width: 760px) {
    .ticket-history-panel {
        display: none !important;
    }
}

/* 2026-04-28 enterprise polish: readable dark theme, compact statuses, mobile chat, floating alerts, loader */
.muted {
    text-align: inherit;
}

.auth-shell .muted,
.auth-card .muted,
.verify-container .muted,
.brand-card .muted,
.text-center .muted,
.empty-state .muted {
    text-align: center;
}

.page-header .muted,
.section-head .muted,
.ticket-card__text,
.ticket-card__meta,
.chat-message .muted,
.meta-list .muted,
.muted--left {
    text-align: left;
}

.status-badge {
    width: fit-content !important;
    max-width: 100%;
    display: inline-flex !important;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 7px 12px !important;
    border-radius: 999px !important;
    white-space: nowrap;
    line-height: 1.15;
    text-align: center;
    vertical-align: middle;
}

.table .status-badge,
.ticket-card .status-badge {
    min-width: auto;
}

:root[data-theme="dark"] .status-badge {
    box-shadow: none !important;
    filter: none !important;
}

:root[data-theme="dark"] .status-new {
    background: rgba(37, 99, 235, 0.20) !important;
    color: #bfdbfe !important;
    border-color: rgba(96, 165, 250, 0.38) !important;
}

:root[data-theme="dark"] .status-assigned {
    background: rgba(79, 70, 229, 0.22) !important;
    color: #c7d2fe !important;
    border-color: rgba(129, 140, 248, 0.42) !important;
}

:root[data-theme="dark"] .status-in_progress {
    background: rgba(13, 148, 136, 0.20) !important;
    color: #99f6e4 !important;
    border-color: rgba(45, 212, 191, 0.38) !important;
}

:root[data-theme="dark"] .status-waiting_response {
    background: rgba(180, 83, 9, 0.22) !important;
    color: #fed7aa !important;
    border-color: rgba(251, 191, 36, 0.38) !important;
}

:root[data-theme="dark"] .status-waiting_confirmation {
    background: rgba(109, 40, 217, 0.22) !important;
    color: #ddd6fe !important;
    border-color: rgba(167, 139, 250, 0.40) !important;
}

:root[data-theme="dark"] .status-closed {
    background: rgba(21, 128, 61, 0.22) !important;
    color: #bbf7d0 !important;
    border-color: rgba(74, 222, 128, 0.40) !important;
}

:root[data-theme="dark"] .status-cancelled {
    background: rgba(185, 28, 28, 0.22) !important;
    color: #fecaca !important;
    border-color: rgba(248, 113, 113, 0.40) !important;
}

:root[data-theme="dark"] .chat-message,
:root[data-theme="dark"] .ticket-chat .chat-message {
    background: #10192b !important;
    color: #e5eefc !important;
    border-color: #334155 !important;
    box-shadow: 0 8px 24px rgba(2, 6, 23, 0.32) !important;
}

:root[data-theme="dark"] .chat-message.is-own {
    background: linear-gradient(180deg, #13233f, #10203b) !important;
    border-color: #27456f !important;
}

:root[data-theme="dark"] .chat-message.is-system {
    background: #0f172a !important;
    border-color: #475569 !important;
    border-style: dashed !important;
}

:root[data-theme="dark"] .chat-message p,
:root[data-theme="dark"] .chat-message header strong {
    color: #e5eefc !important;
}

:root[data-theme="dark"] .chat-message header span,
:root[data-theme="dark"] .chat-attachment .muted {
    color: #94a3b8 !important;
}

.alert-toast-stack {
    position: fixed;
    top: 88px;
    right: 18px;
    z-index: 1500;
    width: min(92vw, 430px);
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.alert.alert--floating {
    position: relative;
    width: 100%;
    margin: 0;
    padding: 14px 44px 16px 16px;
    border-radius: 18px;
    box-shadow: var(--shadow-lg);
    animation: alertToastIn 0.22s ease both;
    pointer-events: auto;
    overflow: hidden;
}

.alert.alert--floating.is-leaving {
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.24s ease, transform 0.24s ease;
}

.alert__close {
    position: absolute;
    top: 8px;
    right: 10px;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.08);
    color: currentColor;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
}

.alert__timer {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    width: 100%;
    background: currentColor;
    opacity: 0.28;
    transform-origin: left center;
    animation: alertTimerShrink 5s linear forwards;
}

@keyframes alertToastIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes alertTimerShrink {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

:root[data-theme="dark"] .alert--success {
    background: rgba(20, 83, 45, 0.96) !important;
    color: #bbf7d0 !important;
    border-color: rgba(74, 222, 128, 0.42) !important;
}

:root[data-theme="dark"] .alert--error {
    background: rgba(127, 29, 29, 0.96) !important;
    color: #fecaca !important;
    border-color: rgba(248, 113, 113, 0.42) !important;
}

:root[data-theme="dark"] .alert--warning {
    background: rgba(146, 64, 14, 0.96) !important;
    color: #fed7aa !important;
    border-color: rgba(251, 191, 36, 0.42) !important;
}

.site-toast-stack {
    top: 88px;
    right: 18px;
    bottom: auto;
    width: min(92vw, 440px);
}

.site-toast {
    border-radius: 20px;
    padding: 16px 14px 16px 18px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: var(--shadow-lg);
}

.site-toast__body strong {
    font-size: 1rem;
}

.site-toast__body span {
    line-height: 1.4;
}

:root[data-theme="dark"] .site-toast {
    background: rgba(10, 16, 31, 0.98) !important;
    color: #e5eefc !important;
    border-color: #334155 !important;
}

:root[data-theme="dark"] .site-toast__body strong {
    color: #bfdbfe !important;
}

.modal-close-button {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--danger);
    font-size: 28px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.modal-close-button:hover,
.modal-close-button:focus-visible {
    transform: translateY(-1px);
    border-color: #fca5a5;
    background: #fef2f2;
    outline: none;
}

:root[data-theme="dark"] .modal-close-button {
    background: #0f172a;
    color: #fecaca;
    border-color: #475569;
}

:root[data-theme="dark"] .modal-close-button:hover,
:root[data-theme="dark"] .modal-close-button:focus-visible {
    background: rgba(127, 29, 29, 0.34);
    border-color: rgba(248, 113, 113, 0.45);
}

.chat-form--modern {
    gap: 12px;
}

.chat-compose-line {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: end;
}

.chat-message-field textarea {
    min-height: 88px;
}

.chat-attach-button {
    min-width: 86px;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.86);
    color: var(--primary);
    font-weight: 800;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.chat-attach-button:hover,
.chat-attach-button:focus-visible {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    outline: none;
}

.chat-dropzone-compact {
    min-height: 96px;
}

.chat-dropzone-compact .dropzone__inner {
    padding: 14px;
}

.chat-submit-row {
    align-items: center;
}

button.is-loading,
.button.is-loading {
    pointer-events: none;
    opacity: 0.72;
}

.page-loader[hidden] {
    display: none !important;
}

.page-loader {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: grid;
    place-items: center;
    background: rgba(15, 23, 42, 0.22);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.page-loader__card {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: var(--surface-solid);
    color: var(--text);
    box-shadow: var(--shadow-lg);
    font-weight: 800;
}

.page-loader__spinner {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 3px solid rgba(96, 165, 250, 0.24);
    border-top-color: var(--primary-2);
    animation: loaderSpin 0.75s linear infinite;
}

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

:root[data-theme="dark"] .page-loader__card,
:root[data-theme="dark"] .chat-attach-button {
    background: #0f172a;
    color: #e5eefc;
    border-color: #334155;
}

.user-state-badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 6px 10px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 0.88rem;
    border: 1px solid transparent;
}

.user-state-badge.is-active {
    color: #15803d;
    background: #ecfdf3;
    border-color: #bbf7d0;
}

.user-state-badge.is-disabled {
    color: #b91c1c;
    background: #fef2f2;
    border-color: #fecaca;
}

:root[data-theme="dark"] .user-state-badge.is-active {
    color: #bbf7d0;
    background: rgba(21, 128, 61, 0.22);
    border-color: rgba(74, 222, 128, 0.38);
}

:root[data-theme="dark"] .user-state-badge.is-disabled {
    color: #fecaca;
    background: rgba(185, 28, 28, 0.22);
    border-color: rgba(248, 113, 113, 0.38);
}

@media (max-width: 760px) {
    .topbar {
        position: static !important;
        top: auto !important;
    }

    .ticket-mobile-controls {
        display: grid;
        gap: 10px;
    }

    .ticket-mobile-controls__actions:empty,
    .ticket-mobile-controls__actions span[hidden] + span[hidden] + span[hidden]:not(:first-child) {
        display: none;
    }

    .ticket-mobile-controls__actions {
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
    }

    .chat-compose-line {
        grid-template-columns: minmax(0, 1fr) 54px;
        align-items: stretch;
    }

    .chat-message-field textarea {
        min-height: 74px;
        border-radius: 16px;
    }

    .chat-attach-button {
        min-width: 54px;
        width: 54px;
        min-height: 74px;
        padding: 0;
        flex-direction: column;
        font-size: 0.78rem;
    }

    .chat-attach-button span:first-child {
        font-size: 1.4rem;
    }

    .chat-dropzone-compact {
        display: none;
    }

    .chat-preview-list {
        margin-top: 0;
    }

    .chat-preview-item {
        grid-template-columns: 54px minmax(0, 1fr) auto;
        padding: 10px;
    }

    .chat-preview-item__image,
    .chat-preview-item__thumb {
        width: 54px;
        height: 54px;
        border-radius: 12px;
    }

    .alert-toast-stack,
    .site-toast-stack {
        top: 12px;
        right: 12px;
        left: 12px;
        width: auto;
    }

    .modal-close-button {
        width: 46px;
        height: 46px;
        font-size: 30px;
    }
}

@supports selector(:has(*)) {
    .ticket-mobile-controls__actions:has([data-mobile-resolution-action][hidden]) {
        display: none !important;
    }
}

/* 2026-04-28 patch: desktop full file dropzone, mobile side attach button */
@media (min-width: 761px) {
    .chat-form--modern .chat-compose-line {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
        align-items: stretch !important;
        gap: 12px !important;
    }

    .chat-form--modern .chat-attach-button {
        display: none !important;
    }

    .chat-form--modern .chat-dropzone-compact {
        display: block !important;
        min-height: 180px !important;
    }

    .chat-form--modern .chat-dropzone-compact .dropzone__inner {
        min-height: 180px !important;
        padding: 24px 18px !important;
        justify-content: center !important;
    }

    .chat-form--modern .chat-message-field textarea {
        min-height: 110px !important;
    }
}

@media (max-width: 760px) {
    .chat-form--modern .chat-compose-line {
        grid-template-columns: minmax(0, 1fr) 54px !important;
        align-items: stretch !important;
    }

    .chat-form--modern .chat-attach-button {
        display: inline-flex !important;
    }

    .chat-form--modern .chat-dropzone-compact {
        display: none !important;
    }
}
