:root {
    --app-primary: #1a227f;
    --app-bg: #f6f6f8;
    --app-card: #ffffff;
    --app-text: #1f2937;
    --app-muted: #64748b;
    --app-border: #e5e7eb;
    --app-success: #16a34a;
    --app-warning: #d97706;
    --app-danger: #dc2626;
}

* { box-sizing: border-box; }

body, html {
    margin: 0;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    color: var(--app-text);
    background: var(--app-bg);
}

.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    vertical-align: middle;
}

.app-body { background: var(--app-bg); }
.app-shell { min-height: 100vh; }

.app-sidebar {
    width: 265px;
    background: linear-gradient(165deg, #12195f 0%, var(--app-primary) 100%);
    color: #fff;
    transition: width 0.25s ease;
    overflow: hidden;
}

.brand-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(255,255,255,0.16);
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-nav .nav-link {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 0.65rem 0.8rem;
    margin-bottom: 0.25rem;
    border-radius: 0.65rem;
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    font-size: 0.94rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.app-nav .nav-link:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
}

.app-nav .nav-link.active {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

.app-nav .nav-label {
    white-space: nowrap;
    transition: opacity 0.2s ease;
}

.user-card {
    display: flex;
    gap: 10px;
    align-items: center;
}

.app-brand-text,
.user-meta,
.logout-label {
    transition: opacity 0.2s ease;
    white-space: nowrap;
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: rgba(255,255,255,0.15);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.82rem;
    position: relative;
    overflow: hidden;
}

.user-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-avatar-fallback {
    width: 100%;
    height: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.app-main {
    background: var(--app-bg);
    min-width: 0;
}

.app-topbar {
    min-height: 64px;
    background: #fff;
    border-bottom: 1px solid var(--app-border);
}

.app-topbar-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: #1e293b;
}

.app-topbar-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.12rem 0.55rem;
    border-radius: 999px;
    background: #dcfce7;
    color: #15803d;
    font-size: 0.64rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.app-topbar-icon-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 999px !important;
    color: #64748b;
}

.app-topbar-icon-btn:hover,
.app-topbar-icon-btn:focus {
    background: #f1f5f9;
    color: #334155;
}

.app-topbar-separator {
    width: 1px;
    height: 34px;
    background: var(--app-border);
}

.app-topbar-date {
    font-size: 0.75rem;
    font-weight: 500;
    color: #64748b;
}

.app-topbar-terminal {
    font-size: 0.75rem;
    font-weight: 700;
    color: #334155;
}

.topbar-user-menu {
    min-width: 210px;
    border-radius: 12px;
}

.topbar-user-menu .dropdown-item {
    font-size: 0.9rem;
    padding: 0.55rem 0.9rem;
}

.app-page-breadcrumb {
    width: 100%;
}

.app-breadcrumb .breadcrumb {
    --bs-breadcrumb-divider-color: #94a3b8;
    --bs-breadcrumb-divider: '›';
    font-size: 0.73rem;
}

.app-breadcrumb .breadcrumb-item,
.app-breadcrumb .breadcrumb-item.active {
    color: #64748b;
}

.app-breadcrumb .breadcrumb-item a {
    color: #475569;
    text-decoration: none;
}

.app-breadcrumb .breadcrumb-item a:hover {
    color: #1e3a8a;
}

.topbar-user-icon {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    border: 2px solid #e2e8f0;
    background: #f8fafc;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.topbar-user-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.topbar-user-fallback {
    font-size: 0.82rem;
    font-weight: 700;
    color: #334155;
}

@media (min-width: 992px) {
    .app-shell.sidebar-collapsed .app-sidebar {
        width: 84px;
    }

    .app-shell.sidebar-collapsed .app-nav .nav-link {
        justify-content: center;
        gap: 0;
    }

    .app-shell.sidebar-collapsed .app-nav .nav-link .nav-label,
    .app-shell.sidebar-collapsed .app-brand-text,
    .app-shell.sidebar-collapsed .user-meta,
    .app-shell.sidebar-collapsed .logout-label {
        opacity: 0;
        width: 0;
        overflow: hidden;
        pointer-events: none;
    }

    .app-shell.sidebar-collapsed .app-brand {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }

    .app-shell.sidebar-collapsed .app-nav {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }

    .app-shell.sidebar-collapsed .brand-icon {
        margin-inline: auto;
    }

    .app-shell.sidebar-collapsed .user-card {
        justify-content: center;
    }

    .app-shell.sidebar-collapsed .btn-logout {
        display: inline-flex;
        justify-content: center;
        align-items: center;
        width: 100%;
        padding-inline: 0 !important;
    }

    .app-shell.sidebar-collapsed .btn-logout .material-symbols-outlined {
        margin-right: 0 !important;
    }
}

.app-sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    z-index: 1030;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.app-sidebar-backdrop.show {
    opacity: 1;
    visibility: visible;
}

.app-page {
    width: 100%;
    max-width: 1440px;
}

.card {
    border-radius: 14px;
    border: 1px solid var(--app-border);
}

.kpi-card {
    border: 1px solid var(--app-border);
    box-shadow: 0 3px 12px rgba(15, 23, 42, 0.03);
}

.dashboard-banner {
    background: linear-gradient(135deg, #172554 0%, #1d4ed8 55%, #0ea5e9 100%);
    border-radius: 16px;
    overflow: hidden;
}

.dashboard-banner-eyebrow {
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.82);
    font-weight: 700;
}

.dashboard-banner-icon {
    width: 58px;
    height: 58px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.dashboard-banner-icon .material-symbols-outlined {
    font-size: 32px;
}

.dashboard-kpi {
    border: 0;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.dashboard-kpi .card-body {
    position: relative;
}

.dashboard-kpi-label {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.dashboard-kpi-meta {
    font-size: 0.75rem;
    color: #64748b;
}

.dashboard-kpi-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.dashboard-kpi-icon .material-symbols-outlined {
    font-size: 22px;
}

.dashboard-kpi.kpi-sales {
    background: linear-gradient(160deg, #fff 0%, #ecfeff 100%);
}

.dashboard-kpi.kpi-sales .dashboard-kpi-label {
    color: #0f766e;
}

.dashboard-kpi.kpi-sales .dashboard-kpi-icon {
    background: #ccfbf1;
    color: #0f766e;
}

.dashboard-kpi.kpi-tickets {
    background: linear-gradient(160deg, #fff 0%, #f5f3ff 100%);
}

.dashboard-kpi.kpi-tickets .dashboard-kpi-label {
    color: #5b21b6;
}

.dashboard-kpi.kpi-tickets .dashboard-kpi-icon {
    background: #ede9fe;
    color: #6d28d9;
}

.dashboard-kpi.kpi-month {
    background: linear-gradient(160deg, #fff 0%, #eff6ff 100%);
}

.dashboard-kpi.kpi-month .dashboard-kpi-label {
    color: #1d4ed8;
}

.dashboard-kpi.kpi-month .dashboard-kpi-icon {
    background: #dbeafe;
    color: #1d4ed8;
}

.dashboard-kpi.kpi-top {
    background: linear-gradient(160deg, #fff 0%, #fff7ed 100%);
}

.dashboard-kpi.kpi-top .dashboard-kpi-label {
    color: #b45309;
}

.dashboard-kpi.kpi-top .dashboard-kpi-icon {
    background: #ffedd5;
    color: #c2410c;
}

.dashboard-panel {
    border-radius: 15px;
}

.dashboard-section-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: #e2e8f0;
    color: #334155;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.dashboard-section-icon .material-symbols-outlined {
    font-size: 18px;
}

.table > :not(caption) > * > * {
    border-bottom-color: var(--app-border);
    vertical-align: middle;
}

.table thead th {
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--app-muted);
}

.table tbody td,
.table tbody th {
    font-size: 0.9rem;
}

.table-row-clickable {
    cursor: pointer;
}

.table-row-clickable > td {
    transition: background-color 0.18s ease;
}

.table-row-clickable:hover > td {
    background: #f4f7ff;
}

.detail-metrics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem;
}

.detail-metric-card {
    border: 1px solid #dbe4f5;
    border-radius: 12px;
    background: #fff;
    padding: 0.75rem 0.8rem;
}

.detail-metric-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: #64748b;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 0.2rem;
}

.detail-metric-value {
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
}

.table-user-avatar-wrap {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid #dbe4f5;
    background: #eff6ff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.table-user-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.table-user-avatar-fallback {
    font-size: 0.78rem;
    font-weight: 700;
    color: #1e3a8a;
}

.badge-soft {
    padding: 0.3rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
}

.badge-paid {
    background: #dcfce7;
    color: #166534;
}

.badge-pending {
    background: #fef3c7;
    color: #92400e;
}

.badge-void {
    background: #fee2e2;
    color: #991b1b;
}

.badge-active {
    background: #dcfce7;
    color: #166534;
}

.badge-inactive {
    background: #f1f5f9;
    color: #475569;
}

.pagination-wrap .btn {
    min-width: 36px;
}

.app-offcanvas {
    width: min(520px, 100vw);
}

.pdf-preview-modal .modal-dialog {
    max-width: min(1080px, 96vw);
}

.pdf-preview-modal .modal-body {
    background: #e2e8f0;
}

.pdf-preview-modal .modal-header {
    align-items: center;
    gap: 0.5rem;
}

.pdf-preview-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.pdf-preview-frame {
    width: 100%;
    height: min(78vh, 900px);
    border: 0;
    display: block;
    background: #fff;
}

.ticket-detail-offcanvas {
    width: 597px !important;
}

.user-avatar-uploader {
    display: flex;
    gap: 0.9rem;
    align-items: center;
    padding: 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
}

.user-avatar-preview-wrap {
    width: 74px;
    height: 74px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #cbd5e1;
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-avatar-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-avatar-placeholder {
    width: 100%;
    height: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    background: #f1f5f9;
}

.user-avatar-placeholder .material-symbols-outlined {
    font-size: 30px;
}

.user-avatar-actions {
    min-width: 0;
}

.user-avatar-uploader-centered {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1rem;
}

.user-avatar-uploader-centered .user-avatar-actions {
    width: 100%;
    max-width: 320px;
}

.detail-offcanvas-header {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
    color: #fff;
    border-bottom: 0 !important;
    padding: 1rem 1.1rem;
}

.detail-offcanvas .offcanvas-title {
    color: #fff;
}

.detail-offcanvas-subtitle {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.74rem;
}

.detail-offcanvas-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.18);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.detail-offcanvas-icon .material-symbols-outlined {
    font-size: 20px;
}

.detail-offcanvas-body {
    background: #f8fafc;
    padding: 1rem;
}

.detail-head-card {
    border: 1px solid #dbe4f5;
    border-radius: 12px;
    background: #fff;
    padding: 0.85rem 0.95rem;
}

.detail-ticket-code {
    font-size: 1rem;
    font-weight: 700;
    color: #1e3a8a;
}

.detail-ticket-meta {
    font-size: 0.78rem;
    color: #64748b;
}

.detail-table-card {
    border: 1px solid #dbe4f5;
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
}

.detail-section-title {
    padding: 0.6rem 0.85rem;
    font-size: 0.74rem;
    font-weight: 700;
    color: #334155;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

.detail-table-card .table thead th {
    background: #f8fafc;
}

.ticket-detail-items-table > :not(caption) > * > * {
    padding: 0.62rem 0.78rem;
}

.ticket-detail-total-row th {
    background: #f8fafc;
    border-top: 1px solid #dbe4f5;
    font-weight: 700;
    color: #0f172a;
}

.ticket-detail-status-wrap .badge-soft {
    font-size: 0.76rem;
    font-weight: 700;
    padding: 0.34rem 0.62rem;
}

.detail-grid-two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem;
}

.detail-field-card {
    border: 1px solid #dbe4f5;
    border-radius: 12px;
    background: #fff;
    padding: 0.7rem 0.8rem;
}

.detail-field-label {
    display: block;
    margin-bottom: 0.2rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #64748b;
}

.detail-field-value {
    color: #0f172a;
    font-weight: 600;
    font-size: 0.9rem;
    word-break: break-word;
}

.detail-offcanvas .badge-soft {
    display: inline-flex;
}

.customer-ticket-accordion .accordion-item {
    border: 0;
    border-bottom: 1px solid #e2e8f0;
}

.customer-ticket-accordion .accordion-button {
    background: #fff;
    font-size: 0.85rem;
    padding: 0.7rem 0.8rem;
}

.customer-ticket-accordion .accordion-button:not(.collapsed) {
    color: #0f172a;
    background: #f8fafc;
    box-shadow: none;
}

.customer-ticket-accordion .accordion-button:focus {
    box-shadow: none;
}

.customer-ticket-accordion .accordion-body {
    background: #fff;
    padding: 0.7rem 0.8rem;
}

.ticket-logo-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: contain;
    border: 1px solid var(--app-border);
    padding: 4px;
    background: #fff;
}

.btn-primary {
    background: var(--app-primary);
    border-color: var(--app-primary);
}

.btn-primary:hover,
.btn-primary:focus {
    background: #141a63;
    border-color: #141a63;
}

.login-body {
    min-height: 100vh;
    background: radial-gradient(circle at 1px 1px, rgba(255,255,255,0.05) 1px, transparent 0), linear-gradient(135deg, #12195f 0%, #1a227f 100%);
    background-size: 25px 25px, cover;
}

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

.login-panel {
    width: 100%;
    max-width: 500px;
}

.login-card { border-radius: 18px; overflow: hidden; }
.login-card .card-body {
    padding: 2rem;
}

.login-card .form-label {
    color: #334155;
    font-weight: 600;
    font-size: 0.92rem;
}

.login-group {
    border: 1px solid #d6dbe7;
    border-radius: 12px !important;
    overflow: hidden;
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.login-group:focus-within {
    border-color: #1d4ed8;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.login-group.login-group-invalid {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.14);
}

.login-group .input-group-text,
.login-pass-btn {
    width: 50px;
    min-width: 50px;
    height: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent;
    color: #64748b;
}

.login-group .input-group-text {
    padding: 0;
}

.login-group .form-control.login-control {
    height: 50px;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent;
    box-shadow: none !important;
    font-size: 0.98rem;
    padding-left: 0.45rem;
    padding-right: 0.45rem;
}

.login-group .form-control.login-control::placeholder {
    color: #94a3b8;
}

.login-pass-btn {
    border-left: 1px solid #e2e8f0 !important;
}

.login-pass-btn:hover,
.login-pass-btn:focus {
    background: #f8fafc;
    color: #334155;
    box-shadow: none !important;
}

.login-group .material-symbols-outlined {
    font-size: 20px;
}

.login-submit-btn {
    min-height: 46px;
    border-radius: 12px !important;
}

.login-alert {
    border-radius: 12px;
    font-size: 0.88rem;
    margin-top: 0.2rem;
    margin-bottom: 1rem !important;
}

.login-logo {
    width: 68px;
    height: 68px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(26, 34, 127, 0.1);
    color: var(--app-primary);
}

.login-logo .material-symbols-outlined {
    font-size: 36px;
}

.border-white-10 {
    border-color: rgba(255,255,255,0.12) !important;
}

.ts-control,
.ts-dropdown,
.form-control,
.form-select,
.input-group-text,
.btn {
    border-radius: 0.65rem !important;
}

@media (max-width: 992px) {
    .app-sidebar {
        position: fixed;
        z-index: 1040;
        height: 100vh;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .app-sidebar.open {
        transform: translateX(0);
    }

    .app-main {
        width: 100%;
    }
}

@media (max-width: 576px) {
    .app-breadcrumb {
        display: none;
    }

    .user-avatar-uploader {
        flex-direction: column;
        align-items: flex-start;
    }

    .detail-grid-two {
        grid-template-columns: 1fr;
    }

    .detail-metrics-grid {
        grid-template-columns: 1fr;
    }

    .app-topbar {
        padding-top: 0.35rem;
        padding-bottom: 0.35rem;
        min-height: 58px;
    }

    .app-topbar-date,
    .app-topbar-terminal {
        font-size: 0.68rem;
    }

    .app-topbar-separator {
        display: none;
    }

    .app-page-breadcrumb {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
        padding-top: 0.8rem !important;
    }

    .login-wrapper {
        padding: 14px;
    }

    .login-card .card-body {
        padding: 1.25rem;
    }

    .pdf-preview-modal .modal-header {
        flex-wrap: wrap;
    }

    .pdf-preview-actions {
        width: 100%;
        justify-content: flex-end;
        flex-wrap: wrap;
    }
}
