:root {
    --bg: #090d16;
    --panel: #101726;
    --panel-2: #131d31;
    --line: #22304a;
    --text: #eef3ff;
    --muted: #91a1bd;
    --accent: #3b82f6;
    --accent-2: #2563eb;
    --danger: #ef4444;
    --success: #10b981;
    --radius: 22px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: Inter, Segoe UI, system-ui, sans-serif;
    background: radial-gradient(circle at top, #15213a 0%, var(--bg) 45%);
    color: var(--text);
    min-height: 100vh;
}
button, input, select { font: inherit; }

.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.login-card,
.card,
.modal-content,
.stat-card {
    background: rgba(16, 23, 38, 0.96);
    border: 1px solid var(--line);
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.3);
}
.login-card {
    width: 100%;
    max-width: 420px;
    border-radius: 30px;
    padding: 34px;
    text-align: center;
}
.brand-mark {
    width: 72px;
    height: 72px;
    margin: 0 auto 14px;
    border-radius: 20px;
    background: linear-gradient(135deg, #5da3ff, #1f4fcc);
    display: grid;
    place-items: center;
    font-size: 28px;
    font-weight: 800;
}
.login-card h1 { margin: 0 0 6px; font-size: 28px; }
.muted { color: var(--muted); }
.login-card input,
.card input,
.card select,
.modal-content input,
.modal-content select {
    width: 100%;
    background: #0b1220;
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 14px 16px;
    outline: none;
}
input:focus, select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}
.login-card input { margin-top: 12px; }
.error { color: #ff8e8e; min-height: 20px; margin-top: 10px; }

.btn {
    border: none;
    border-radius: 16px;
    padding: 13px 18px;
    background: var(--accent);
    color: white;
    cursor: pointer;
    transition: .18s ease;
    font-weight: 700;
}
.btn:hover { background: var(--accent-2); transform: translateY(-1px); }
.btn.secondary { background: #1b2942; }
.btn.secondary:hover { background: #233453; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.ghost:hover { background: #18243a; }

.app-shell {
    max-width: 1380px;
    margin: 0 auto;
    padding: 24px;
}
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}
.topbar h1 { margin: 4px 0 0; font-size: 32px; }
.eyebrow { color: #6ea8ff; font-weight: 700; font-size: 13px; letter-spacing: .08em; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.user-badge {
    background: #12213a;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 10px 14px;
    color: var(--muted);
}
.tabs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}
.tab {
    background: #131d31;
    color: var(--text);
    border: 1px solid var(--line);
    padding: 12px 16px;
    border-radius: 14px;
    cursor: pointer;
    font-weight: 700;
}
.tab.active { background: var(--accent); border-color: var(--accent); }
.panel { display: none; }
.panel.active-panel { display: block; }

.card {
    border-radius: 26px;
    padding: 22px;
    margin-bottom: 22px;
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.card-header h2 { margin: 0; font-size: 22px; }
.grid { display: grid; gap: 14px; }
.grid-1 { grid-template-columns: 1fr; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.actions-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
.stack { display: grid; gap: 12px; }

.item-row {
    display: grid;
    grid-template-columns: 1.5fr 1.2fr 0.7fr 0.9fr 0.8fr auto auto;
    gap: 10px;
    background: #0b1220;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 12px;
    margin-bottom: 12px;
    align-items: center;
}
.item-row.sale-row { grid-template-columns: 2fr 0.8fr auto 0.8fr auto auto; }
.pill {
    background: #12213a;
    border: 1px solid #24406b;
    color: #b9d2ff;
    border-radius: 999px;
    padding: 9px 12px;
    font-size: 13px;
    white-space: nowrap;
}
.icon-btn {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #132039;
    color: white;
    cursor: pointer;
}
.icon-btn.danger { background: rgba(239, 68, 68, 0.12); color: #ff8e8e; }

.table-wrap { overflow-x: auto; }
.table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}
.table th, .table td {
    border-bottom: 1px solid var(--line);
    padding: 14px 12px;
    text-align: left;
    vertical-align: top;
}
.table th { color: #b9c7e0; font-size: 14px; }
.table td.actions-cell { white-space: nowrap; }
.table tr:last-child td { border-bottom: none; }
.empty {
    color: var(--muted);
    background: #0d1524;
    border: 1px dashed var(--line);
    border-radius: 18px;
    padding: 18px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}
.stat-card {
    border-radius: 22px;
    padding: 20px;
}
.stat-card span {
    display: block;
    color: var(--muted);
    margin-bottom: 10px;
}
.stat-card strong {
    font-size: 30px;
    color: #72abff;
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    align-items: center;
    justify-content: center;
    padding: 18px;
    z-index: 1000;
}
.modal-content {
    width: min(560px, 100%);
    border-radius: 26px;
    padding: 22px;
    max-height: 90vh;
    overflow-y: auto;
}
.modal-content.wide { width: min(1000px, 100%); }
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.modal-close {
    background: transparent;
    color: white;
    border: none;
    font-size: 30px;
    cursor: pointer;
}
.pagination {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 16px;
}
.page-btn {
    min-width: 42px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #132039;
    color: white;
    cursor: pointer;
}
.page-btn.active { background: var(--accent); border-color: var(--accent); }

.receipt-preview {
    background: white;
    color: black;
    padding: 24px;
    font-family: Arial, sans-serif;
}
.receipt-preview table { width: 100%; border-collapse: collapse; }
.receipt-preview th, .receipt-preview td { border-bottom: 1px solid #ddd; padding: 8px; text-align: left; }

@media (max-width: 980px) {
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-2 { grid-template-columns: 1fr; }
    .item-row, .item-row.sale-row { grid-template-columns: 1fr; }
    .topbar { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 640px) {
    .app-shell { padding: 14px; }
    .stats-grid { grid-template-columns: 1fr; }
    .card { padding: 16px; }
    .login-card { padding: 24px; }
}


.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    border: 1px solid transparent;
}
.status-new { background: rgba(59, 130, 246, 0.14); color: #93c5fd; border-color: rgba(59, 130, 246, 0.25); }
.status-in_progress { background: rgba(245, 158, 11, 0.14); color: #fcd34d; border-color: rgba(245, 158, 11, 0.25); }
.status-resolved { background: rgba(16, 185, 129, 0.14); color: #86efac; border-color: rgba(16, 185, 129, 0.25); }
.status-rejected { background: rgba(239, 68, 68, 0.14); color: #fca5a5; border-color: rgba(239, 68, 68, 0.25); }
.status-row { display:flex; flex-wrap:wrap; gap:12px; align-items:center; }
.evidence-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap:14px; margin-top:12px; }
.evidence-card { background:#0b1220; border:1px solid var(--line); border-radius:18px; padding:12px; display:grid; gap:10px; }
.evidence-card img, .evidence-card video { width:100%; max-height:240px; object-fit:cover; border-radius:12px; background:#08101b; }
textarea { width:100%; background:#0b1220; color:var(--text); border:1px solid var(--line); border-radius:16px; padding:14px 16px; outline:none; resize:vertical; min-height:120px; font:inherit; }


.report-shell { max-width: 860px; margin: 0 auto; padding: 24px; min-height:100vh; display:flex; align-items:center; }
.report-card { width:100%; background: rgba(16, 23, 38, 0.96); border:1px solid var(--line); box-shadow: 0 20px 45px rgba(0,0,0,.3); border-radius: 30px; padding: 30px; }
.report-grid { display:grid; gap:16px; }
.report-grid input[type=file] { padding: 12px; }
.report-note { color: var(--muted); font-size: 14px; }
.report-success { text-align:center; display:none; }
.report-success.show { display:block; }
.report-form.hide { display:none; }
.success-emoji { width:88px; height:88px; border-radius:24px; background: linear-gradient(135deg, #5da3ff, #1f4fcc); display:grid; place-items:center; font-size:38px; margin:0 auto 16px; }
@media (max-width: 640px) { .report-card { padding:20px; } .report-shell { padding:14px; align-items:flex-start; } }


/* Modern report form */
.report-card-modern {
    padding: 34px;
    background: linear-gradient(180deg, rgba(12,19,34,.98) 0%, rgba(8,14,27,.98) 100%);
}
.report-header {
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:16px;
    margin-bottom: 26px;
}
.report-title {
    margin: 10px 0 10px;
    font-size: 52px;
    line-height: 1.02;
    letter-spacing: -0.03em;
}
.report-subtitle {
    max-width: 760px;
    font-size: 18px;
    line-height: 1.6;
}
.report-chip {
    white-space: nowrap;
    align-self: flex-start;
    border: 1px solid rgba(110,168,255,.22);
    background: rgba(20,31,55,.7);
    color: #c5d8ff;
    border-radius: 999px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 700;
}
.modern-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}
.field-span-2 { grid-column: span 2; }
.field-card {
    background: linear-gradient(180deg, rgba(10,18,32,.92) 0%, rgba(8,14,27,.92) 100%);
    border: 1px solid rgba(52,80,130,.35);
    border-radius: 22px;
    padding: 18px 18px 16px;
    transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.field-card:hover {
    border-color: rgba(86,139,255,.45);
}
.field-card:focus-within {
    border-color: rgba(86,139,255,.85);
    box-shadow: 0 0 0 4px rgba(59,130,246,.14);
    transform: translateY(-1px);
}
.field-card label {
    display:block;
    color:#dce7ff;
    font-size:14px;
    font-weight:700;
    margin-bottom:12px;
}
.report-card-modern input[type=text],
.report-card-modern input[type=password],
.report-card-modern textarea,
.report-card-modern select {
    width:100%;
    border:none;
    outline:none;
    background: transparent;
    color: var(--text);
    font-size: 18px;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
}
.report-card-modern input::placeholder,
.report-card-modern textarea::placeholder {
    color: #7588ad;
}
.report-card-modern textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.6;
}
.upload-card {
    display:grid;
    gap:12px;
}
.upload-row {
    display:flex;
    align-items:center;
    gap:14px;
    flex-wrap:wrap;
}
.file-input {
    position:absolute;
    opacity:0;
    pointer-events:none;
}
.upload-btn {
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-height: 48px;
    padding: 0 18px;
    border-radius: 14px;
    background: #132445;
    border: 1px solid rgba(94,137,226,.35);
    color: #e8f0ff;
    font-weight: 700;
    cursor: pointer;
}
.file-names {
    flex: 1 1 260px;
    font-size: 14px;
    line-height: 1.5;
}
.report-actions-block {
    display:grid;
    gap:12px;
    margin-top: 6px;
}
.btn-lg {
    min-height: 58px;
    border-radius: 18px;
    font-size: 18px;
}
.report-note-inline {
    font-size: 14px;
}
.status-actions {
    display:flex;
    flex-wrap:wrap;
    gap:10px;
}
.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.admin-hidden { display:none; }

@media (max-width: 860px) {
    .report-header { flex-direction: column; }
    .report-title { font-size: 38px; }
    .report-subtitle { font-size: 16px; }
    .modern-grid { grid-template-columns: 1fr; }
    .field-span-2 { grid-column: span 1; }
}
