/* Reports — Tailwind-look design system. Mirrors the admin-app classes:
   bg-white rounded-xl shadow-sm border border-gray-200, gray-50/100/500 type ramp,
   red-700 primary, green-700 net-sales accent. */

.rpt-page {
    min-height: 100vh;
    background: #F3F4F6;            /* gray-100 */
    padding: 1rem;
    box-sizing: border-box;
}

.rpt-page-inner {
    max-width: 1280px;
    margin: 0 auto;
}

/* Card */
.rpt-card {
    background: #fff;
    border: 1px solid #E5E7EB;       /* gray-200 */
    border-radius: 0.75rem;          /* rounded-xl */
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    margin-bottom: 1rem;
}

.rpt-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #E5E7EB;
    background: #F9FAFB;             /* gray-50 */
    flex-wrap: wrap;
}

.rpt-card-header.dense {
    padding: 0.5rem 1rem;
}

.rpt-card-section-title {
    font-size: 0.6875rem;            /* text-[11px] */
    text-transform: uppercase;
    letter-spacing: 0.05em;          /* tracking-wider */
    color: #6B7280;                  /* gray-500 */
    font-weight: 600;
}

.rpt-card-title {
    font-size: 1.125rem;             /* text-lg */
    font-weight: 600;
    color: #111827;                  /* gray-900 */
    margin: 0;
}

.rpt-card-subtitle {
    font-size: 0.875rem;             /* text-sm */
    color: #6B7280;
    margin: 0.125rem 0 0;
}

.rpt-card-body {
    padding: 1rem;
}

.rpt-card-body.flush {
    padding: 0;
}

/* Page header */
.rpt-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.rpt-page-title {
    font-size: 1.25rem;              /* text-xl */
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.rpt-page-subtitle {
    font-size: 0.875rem;
    color: #6B7280;
    margin: 0.125rem 0 0;
}

/* Buttons */
.rpt-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;            /* px-4 py-2 */
    font-size: 0.875rem;             /* text-sm */
    font-weight: 600;                /* semibold */
    border-radius: 0.5rem;           /* rounded-lg */
    border: 1px solid transparent;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    white-space: nowrap;
}

.rpt-btn-primary {
    background: #B91C1C;             /* red-700 */
    color: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.rpt-btn-primary:hover:not(:disabled) {
    background: #991B1B;             /* red-800 */
}

.rpt-btn-primary:disabled {
    background: #E5E7EB;
    color: #9CA3AF;
    cursor: not-allowed;
    box-shadow: none;
}

.rpt-btn-secondary {
    background: #fff;
    color: #374151;                  /* gray-700 */
    border-color: #D1D5DB;           /* gray-300 */
}

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

.rpt-btn-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Filters */
.rpt-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
    padding: 1rem;
}

.rpt-filter {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.rpt-filter-label {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6B7280;
    font-weight: 600;
}

.rpt-input, .rpt-select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    border: 1px solid #D1D5DB;
    border-radius: 0.375rem;         /* rounded-md */
    background: #fff;
    color: #111827;
    box-sizing: border-box;
}

.rpt-input:focus, .rpt-select:focus {
    outline: none;
    border-color: #EF4444;           /* red-500 */
    box-shadow: 0 0 0 1px #EF4444;
}

/* Status callouts */
.rpt-empty, .rpt-loading {
    background: #fff;
    border: 1px solid #E5E7EB;
    border-radius: 0.75rem;
    padding: 2.5rem 1.25rem;
    text-align: center;
    color: #9CA3AF;                  /* gray-400 */
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.rpt-error {
    background: #FEF2F2;             /* red-50 */
    border: 1px solid #FECACA;       /* red-200 */
    color: #B91C1C;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.rpt-loading-spinner {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    border: 2px solid #E5E7EB;
    border-top-color: #B91C1C;
    border-radius: 50%;
    animation: rpt-spin 0.9s linear infinite;
}

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

/* Summary bar (stat grid) */
.rpt-summary-bar {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    border-top: 1px solid #E5E7EB;
}

.rpt-summary-cell {
    padding: 0.75rem 1rem;
    border-right: 1px solid #E5E7EB;
    border-bottom: 1px solid #E5E7EB;
}

.rpt-summary-cell:last-child {
    border-right: 0;
}

.rpt-summary-label {
    font-size: 0.625rem;             /* text-[10px] */
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #9CA3AF;                  /* gray-400 */
}

.rpt-summary-value {
    margin-top: 0.25rem;
    font-size: 1.125rem;             /* text-lg */
    font-weight: 600;
    color: #1F2937;                  /* gray-800 */
    font-variant-numeric: tabular-nums;
}

.rpt-accent-green { color: #15803D; } /* green-700 */
.rpt-accent-amber { color: #B45309; } /* amber-700 */

/* Table */
.rpt-table-wrap {
    overflow-x: auto;
}

.rpt-table {
    width: 100%;
    min-width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.rpt-table thead tr {
    border-bottom: 1px solid #E5E7EB;
    background: #fff;
}

.rpt-table th {
    padding: 0.5rem 0.75rem;
    text-align: left;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #6B7280;
    font-weight: 600;
    white-space: nowrap;
}

.rpt-table th.num, .rpt-table td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.rpt-table td {
    padding: 0.625rem 0.75rem;
    color: #1F2937;
    border-bottom: 1px solid #F3F4F6; /* gray-100 */
    vertical-align: middle;
}

.rpt-table tbody tr {
    transition: background-color 0.1s;
}

.rpt-table tbody tr.clickable {
    cursor: pointer;
}

.rpt-table tbody tr.clickable:hover {
    background: #F9FAFB;
}

.rpt-table tbody tr.row-open {
    background: rgba(254, 226, 226, 0.4); /* red-100/40 */
}

.rpt-table tbody tr.row-open + tr {
    background: transparent;
}

.rpt-row-item-name {
    font-weight: 500;
    color: #111827;
}

.rpt-row-item-sub {
    font-size: 0.75rem;
    color: #6B7280;
}

.rpt-arrow {
    width: 1rem;
    height: 1rem;
    color: #9CA3AF;
    transition: transform 0.15s ease;
    flex-shrink: 0;
}

.rpt-arrow.open {
    transform: rotate(90deg);
}

/* Item detail panel */
.rpt-details {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
    padding: 1.25rem;
    background: #F9FAFB;
    border-top: 1px solid #E5E7EB;
}

.rpt-details-section-title {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6B7280;
    font-weight: 600;
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid #D1D5DB;
}

.rpt-details-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.375rem 0;
    border-bottom: 1px solid #E5E7EB;
}

.rpt-details-row:last-child {
    border-bottom: 0;
}

.rpt-details-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #6B7280;
    flex-shrink: 0;
}

.rpt-details-value {
    font-size: 0.875rem;
    color: #111827;
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

.rpt-details-value.bold {
    font-weight: 700;
}

.rpt-details-value.wrap {
    word-break: break-word;
}

/* Group cards (for grouped views) */
.rpt-group-stack {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.rpt-group {
    border: 1px solid #E5E7EB;
    border-radius: 0.5rem;
    overflow: hidden;
    background: #fff;
}

.rpt-group.nested {
    box-shadow: none;
}

.rpt-group-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: #F9FAFB;
    border: 0;
    cursor: pointer;
    transition: background-color 0.1s;
    text-align: left;
    gap: 0.75rem;
}

.rpt-group.nested .rpt-group-toggle {
    background: #F3F4F6;
}

.rpt-group-toggle:hover {
    background: #F3F4F6;
}

.rpt-group-toggle-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.rpt-group-label {
    font-weight: 600;
    color: #111827;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rpt-group-sublabel {
    font-size: 0.75rem;
    color: #6B7280;
}

.rpt-group-headlines {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-shrink: 0;
}

.rpt-headline {
    text-align: right;
}

.rpt-headline-label {
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #9CA3AF;
}

.rpt-headline-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1F2937;
    font-variant-numeric: tabular-nums;
}

.rpt-group-body {
    background: #fff;
    border-top: 1px solid #E5E7EB;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Pivot */
.rpt-pivot-wrap {
    overflow-x: auto;
}

.rpt-pivot-table {
    width: 100%;
    min-width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.rpt-pivot-table thead tr {
    background: #F9FAFB;
    border-bottom: 1px solid #E5E7EB;
}

.rpt-pivot-table th {
    padding: 0.5rem 0.75rem;
    font-size: 0.6875rem;
    text-transform: uppercase;
    color: #6B7280;
    letter-spacing: 0.03em;
    font-weight: 600;
}

.rpt-pivot-table th.center {
    text-align: center;
    border-left: 1px solid #E5E7EB;
}

.rpt-pivot-table th.subhead {
    font-size: 0.625rem;
    color: #9CA3AF;
    font-weight: 400;
}

.rpt-pivot-table td {
    padding: 0.5rem 0.75rem;
    color: #1F2937;
    font-variant-numeric: tabular-nums;
    border-bottom: 1px solid #F3F4F6;
}

.rpt-pivot-axis {
    position: sticky;
    left: 0;
    background: #fff;
    font-weight: 500;
    white-space: nowrap;
    z-index: 1;
}

.rpt-pivot-table thead .rpt-pivot-axis {
    background: #F9FAFB;
}

.rpt-pivot-table tfoot tr {
    background: #F3F4F6;
    border-top: 2px solid #D1D5DB;
}

.rpt-pivot-table tfoot td {
    font-weight: 700;
    color: #111827;
}

.rpt-pivot-empty-cell {
    color: #D1D5DB;
}

/* Caption strip */
.rpt-caption {
    padding: 0.75rem 1rem;
    background: #F9FAFB;
    border-bottom: 1px solid #E5E7EB;
    font-weight: 600;
    color: #111827;
    font-size: 0.875rem;
}

.rpt-caption-sub {
    font-size: 0.75rem;
    color: #6B7280;
    margin-top: 0.125rem;
    font-weight: 400;
}

/* Responsive */
@media (min-width: 640px) {
    .rpt-summary-bar { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1024px) {
    .rpt-summary-bar { grid-template-columns: repeat(6, 1fr); }
    .rpt-details      { grid-template-columns: repeat(3, 1fr); gap: 2rem; }
}

@media (max-width: 768px) {
    .rpt-hide-md { display: none; }
}

@media (max-width: 640px) {
    .rpt-hide-sm { display: none; }
    .rpt-group-headlines { gap: 0.6rem; }
    .rpt-headline-value { font-size: 0.75rem; }
    .rpt-table { font-size: 0.8125rem; }
    .rpt-table th, .rpt-table td { padding: 0.375rem 0.5rem; }
}
