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

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --ink: #111827;
    --muted: #5f6b7a;
    --line: #d7dee8;
    --surface: #ffffff;
    --surface-soft: #f6f8fb;
    --success: #0f9f6e;
    --danger: #dc2626;
    --warning: #d97706;
    --accent: #0f766e;
    --shadow: 0 18px 42px rgba(20, 33, 61, 0.14);
    --shadow-soft: 0 8px 24px rgba(20, 33, 61, 0.08);
    --radius: 8px;
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
}

html {
    min-height: 100%;
}

body {
    min-height: 100vh;
    padding: var(--space-md);
    background: #eef4f8;
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        linear-gradient(180deg, rgba(37, 99, 235, 0.12), rgba(37, 99, 235, 0) 34%),
        linear-gradient(135deg, rgba(15, 118, 110, 0.09), rgba(245, 158, 11, 0.08));
}

.container {
    width: 100%;
    max-width: 620px;
    margin: 0 auto;
}

.admin-container {
    max-width: 1220px;
}

.card {
    width: 100%;
    margin-bottom: var(--space-md);
    padding: var(--space-lg);
    border: 1px solid rgba(215, 222, 232, 0.85);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow-soft);
}

.complaint-card,
.login-form {
    margin-top: clamp(0.5rem, 4vh, 2.5rem);
    box-shadow: var(--shadow);
}

.login-form {
    max-width: 420px;
}

.card-header {
    margin-bottom: var(--space-lg);
    text-align: center;
}

.card-kicker {
    margin-bottom: var(--space-xs);
    color: var(--accent);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.card-title {
    color: var(--primary);
    font-size: 1.55rem;
    font-weight: 800;
    line-height: 1.2;
}

.card-subtitle {
    margin-top: var(--space-sm);
    color: var(--muted);
    font-size: 0.93rem;
}

.form-group {
    margin-bottom: var(--space-md);
}

.form-section-title {
    margin-bottom: var(--space-sm);
    color: #253244;
    font-size: 0.9rem;
    font-weight: 800;
}

.form-label {
    display: block;
    margin-bottom: var(--space-sm);
    color: #253244;
    font-size: 0.88rem;
    font-weight: 700;
}

.required {
    color: var(--danger);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    min-height: 48px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-size: 1rem;
    padding: 0.78rem 0.9rem;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: #7b8794;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.13);
}

.form-input.error,
.form-select.error,
.form-textarea.error {
    border-color: var(--danger);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.upload-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
}

.upload-note {
    margin-top: var(--space-sm);
}

.topup-history-grid {
    display: grid;
    gap: var(--space-sm);
}

.topup-history-row {
    display: grid;
    grid-template-columns: 34px 1fr 1fr;
    gap: var(--space-sm);
    align-items: start;
    padding: var(--space-sm);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
}

.topup-history-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 0.82rem;
    font-weight: 850;
}

.upload-preview {
    display: grid;
    grid-template-columns: 64px 1fr auto;
    align-items: center;
    gap: var(--space-md);
    margin-top: var(--space-md);
    padding: var(--space-sm);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
}

.upload-preview img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 6px;
    background: #e5eaf1;
}

.upload-file-name {
    overflow-wrap: anywhere;
    font-size: 0.92rem;
    font-weight: 700;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border: 0;
    border-radius: var(--radius);
    cursor: pointer;
    font: inherit;
    font-size: 0.96rem;
    font-weight: 750;
    padding: 0.72rem 1.1rem;
    text-align: center;
    text-decoration: none;
    transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow-soft);
}

.btn:active:not(:disabled) {
    transform: translateY(0);
}

.btn:disabled {
    cursor: not-allowed;
    opacity: 0.58;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
}

.btn-secondary {
    background: #475569;
    color: #fff;
}

.btn-secondary:hover:not(:disabled) {
    background: #334155;
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-success:hover:not(:disabled) {
    background: #0b8a60;
}

.btn-ghost {
    border: 1px solid var(--line);
    background: #fff;
    color: #344054;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    min-height: 36px;
    padding: 0.48rem 0.8rem;
    font-size: 0.84rem;
}

.btn-upload {
    width: 100%;
}

.alert {
    margin-bottom: var(--space-md);
    border: 1px solid;
    border-radius: var(--radius);
    padding: 0.9rem 1rem;
    font-size: 0.9rem;
}

.alert-success {
    border-color: #a7f3d0;
    background: #ecfdf5;
    color: #065f46;
}

.alert-error {
    border-color: #fecaca;
    background: #fff1f2;
    color: #991b1b;
}

.alert-info {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: #1e3a8a;
}

.error-message {
    display: none;
    margin-top: var(--space-sm);
    color: var(--danger);
    font-size: 0.86rem;
}

.error-message.show {
    display: block;
}

.success-section {
    display: none;
    margin-top: var(--space-lg);
}

.success-section.show {
    display: block;
}

.ticket-number-display {
    margin-bottom: var(--space-md);
    padding: var(--space-md);
    border: 1px solid rgba(37, 99, 235, 0.35);
    border-radius: var(--radius);
    background: #f8fbff;
}

.ticket-number-text {
    width: 100%;
    min-height: 90px;
    border: 0;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: 0.92rem;
    resize: none;
}

.ticket-number-text:focus {
    outline: none;
}

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: var(--space-sm);
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.65s linear infinite;
}

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

.dashboard {
    display: none;
}

.dashboard.show {
    display: block;
}

.dashboard-header-card {
    margin-top: var(--space-md);
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
}

.admin-header .card-title,
.admin-header .card-subtitle,
.admin-header .card-kicker {
    text-align: left;
}

.admin-actions,
.action-buttons,
.form-actions {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.stat-card {
    padding: var(--space-md);
    border: 1px solid rgba(215, 222, 232, 0.85);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--shadow-soft);
}

.stat-label {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.stat-value {
    margin-top: 0.15rem;
    color: var(--ink);
    font-size: 1.6rem;
    font-weight: 850;
    line-height: 1.1;
}

.stat-value-small {
    overflow-wrap: anywhere;
    font-size: 1.1rem;
}

.section-title {
    margin-bottom: var(--space-md);
    color: var(--ink);
    font-size: 1rem;
    font-weight: 850;
}

.user-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 180px auto;
    gap: var(--space-md);
    align-items: end;
}

.user-form-grid .form-group {
    margin-bottom: 0;
}

.user-table {
    min-width: 720px;
}

.filter-container {
    display: grid;
    grid-template-columns: 1fr 1fr minmax(220px, 1fr) auto;
    gap: var(--space-md);
    align-items: end;
}

.filter-container .form-group {
    margin-bottom: 0;
}

.filter-actions {
    min-width: 180px;
}

.form-switcher {
    display: inline-flex;
    gap: 0.35rem;
    margin-bottom: var(--space-md);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #f8fafc;
    padding: 0.28rem;
}

.form-switch-btn {
    min-height: 38px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 800;
    padding: 0.5rem 0.9rem;
}

.form-switch-btn.active {
    background: var(--primary);
    color: #fff;
    box-shadow: var(--shadow-soft);
}

.table-card {
    padding: var(--space-lg) var(--space-lg) var(--space-md);
}

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

.table {
    width: 100%;
    min-width: 1180px;
    border-collapse: collapse;
    background: #fff;
}

.table th,
.table td {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

.table th {
    background: #f8fafc;
    color: #273449;
    font-size: 0.8rem;
    font-weight: 850;
    white-space: nowrap;
}

.table td {
    color: #0f172a;
    font-size: 0.86rem;
}

.table tbody tr:nth-child(even) {
    background: #fbfdff;
}

.table tbody tr:hover {
    background: #f3f7ff;
}

.table-empty {
    padding: var(--space-xl);
    color: var(--muted);
    text-align: center;
}

.table-subtext {
    display: block;
    margin-top: 0.18rem;
    color: var(--muted);
    font-size: 0.76rem;
}

.table-long-text {
    min-width: 220px;
    max-width: 320px;
    overflow-wrap: anywhere;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    margin-top: var(--space-lg);
}

.pagination-info {
    color: var(--muted);
    font-size: 0.88rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    border-radius: 5px;
    padding: 0.22rem 0.48rem;
    font-size: 0.72rem;
    font-weight: 850;
}

.badge-primary {
    background: #dbeafe;
    color: #1d4ed8;
}

.badge-form {
    background: #e0f2fe;
    color: #0369a1;
    white-space: nowrap;
}

.badge-success {
    background: #d1fae5;
    color: #047857;
}

.badge-status-open {
    background: #dbeafe;
    color: #1d4ed8;
}

.badge-status-proses {
    background: #fef3c7;
    color: #92400e;
}

.badge-status-done {
    background: #d1fae5;
    color: #047857;
}

.badge-status-batal {
    background: #fee2e2;
    color: #b91c1c;
}

.btn-proses,
.btn-done,
.btn-batal {
    min-height: 34px;
    padding: 0.42rem 0.72rem;
    color: #fff;
    font-size: 0.82rem;
}

.btn-proses {
    background: var(--warning);
}

.btn-done {
    background: var(--success);
}

.btn-batal {
    background: var(--danger);
}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
    background: rgba(15, 23, 42, 0.76);
}

.modal-overlay.show {
    display: flex;
}

.modal-content {
    position: relative;
    max-width: min(940px, 94vw);
    max-height: 92vh;
    overflow: auto;
    border-radius: var(--radius);
    background: #fff;
    padding: var(--space-md);
    box-shadow: var(--shadow);
}

.modal-dialog {
    width: min(480px, 94vw);
    padding: var(--space-lg);
}

.modal-close {
    position: absolute;
    top: 0.7rem;
    right: 0.7rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: #111827;
    color: #fff;
    cursor: pointer;
    font-size: 1.35rem;
    line-height: 1;
}

.modal-image {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 6px;
}

.receipt-modal-content {
    width: min(440px, 94vw);
    padding: 0;
    overflow: visible;
    background: transparent;
    box-shadow: none;
}

.receipt-modal-content .modal-close {
    top: -0.75rem;
    right: -0.75rem;
}

.receipt-card {
    width: 100%;
    border: 1px solid #d7dee8;
    border-radius: var(--radius);
    background: #fff;
    padding: 1.2rem;
    color: #111827;
    box-shadow: var(--shadow);
}

.receipt-header {
    padding-bottom: 0.95rem;
    border-bottom: 1px dashed #b8c2d1;
    text-align: center;
}

.receipt-brand {
    color: var(--accent);
    font-size: 0.76rem;
    font-weight: 900;
    letter-spacing: 0;
}

.receipt-header h2 {
    margin-top: 0.2rem;
    color: var(--primary);
    font-size: 1.25rem;
    line-height: 1.25;
}

.receipt-status {
    margin-top: 0.55rem;
}

.receipt-ticket {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 1rem 0;
    border-radius: var(--radius);
    background: #f6f8fb;
    padding: 0.8rem;
}

.receipt-ticket span,
.receipt-total span {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
}

.receipt-ticket strong {
    max-width: 62%;
    overflow-wrap: anywhere;
    text-align: right;
    font-size: 0.95rem;
}

.receipt-body {
    border-top: 1px solid #eef2f7;
}

.receipt-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.58rem 0;
    border-bottom: 1px solid #eef2f7;
}

.receipt-label {
    min-width: 42%;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
}

.receipt-value {
    max-width: 58%;
    overflow-wrap: anywhere;
    text-align: right;
    font-size: 0.88rem;
    font-weight: 750;
}

.receipt-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1rem;
    border: 1px solid #bfdbfe;
    border-radius: var(--radius);
    background: #eff6ff;
    padding: 0.85rem;
}

.receipt-total strong {
    color: var(--primary);
    text-align: right;
    font-size: 1.05rem;
}

.receipt-footer {
    margin-top: 1rem;
    padding-top: 0.95rem;
    border-top: 1px dashed #b8c2d1;
    color: var(--muted);
    text-align: center;
    font-size: 0.78rem;
}

.hidden {
    display: none !important;
}

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

.text-muted {
    color: var(--muted);
    font-size: 0.86rem;
}

.mt-1 {
    margin-top: var(--space-md);
}

.mb-1 {
    margin-bottom: var(--space-md);
}

@media (max-width: 900px) {
    .filter-container,
    .user-form-grid {
        grid-template-columns: 1fr 1fr;
    }

    .filter-actions {
        min-width: 0;
    }
}

@media (max-width: 700px) {
    body {
        padding: var(--space-sm);
    }

    .card {
        padding: var(--space-md);
    }

    .upload-actions,
    .topup-history-row,
    .filter-container,
    .user-form-grid,
    .stats-grid {
        grid-template-columns: 1fr;
    }

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

    .upload-preview {
        grid-template-columns: 56px 1fr;
    }

    .upload-preview .btn {
        grid-column: 1 / -1;
    }

    .admin-header {
        align-items: stretch;
        flex-direction: column;
    }

    .admin-actions,
    .form-actions,
    .pagination {
        flex-direction: column;
        align-items: stretch;
    }

    .admin-actions .btn,
    .form-actions .btn,
    .pagination .btn {
        width: 100%;
    }
}

@media print {
    body {
        background: #fff;
        padding: 0;
    }

    body::before,
    .btn,
    .admin-actions,
    .pagination,
    .filter-card {
        display: none;
    }
}
