* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f4f7fb;
    color: #1f2937;
}

.page {
    min-height: 100vh;
    padding: 40px 16px;
}

.card {
    max-width: 850px;
    margin: 0 auto;
    background: white;
    border-radius: 18px;
    padding: 32px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
}

.card-panel {
    max-width: 1500px;
}

h1 {
    margin-top: 0;
    font-size: 32px;
}

.subtitle {
    color: #6b7280;
    margin-bottom: 30px;
}

.question {
    padding: 20px;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    margin-bottom: 18px;
    background: #fafafa;
}

.question p {
    font-weight: 600;
    margin-top: 0;
}

.question label {
    display: block;
    margin: 8px 0;
    cursor: pointer;
}

.btn {
    display: inline-block;
    border: none;
    background: #2563eb;
    color: white;
    padding: 13px 24px;
    border-radius: 12px;
    font-size: 16px;
    cursor: pointer;
}

.btn:hover {
    background: #1d4ed8;
}

.input {
    width: 100%;
    padding: 13px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-size: 16px;
    background: #fff;
}

textarea.input {
    resize: vertical;
    min-height: 96px;
}

.progress {
    margin-bottom: 24px;
    color: #2563eb;
    font-weight: 600;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 24px;
    font-size: 14px;
}

.results-table th,
.results-table td {
    border-bottom: 1px solid #e5e7eb;
    padding: 12px;
    text-align: left;
}

.results-table th {
    background: #f9fafb;
    font-weight: 700;
}

.results-table tr:hover {
    background: #f9fafb;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 14px;
    padding: 18px;
}

.stat-card span {
    display: block;
    color: #64748b;
    font-size: 14px;
    margin-bottom: 8px;
}

.stat-card strong {
    font-size: 24px;
    color: #1d4ed8;
}

.filters-box {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
    align-items: end;
    margin-bottom: 24px;
    padding: 20px;
    border-radius: 14px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
}

.filters-box > div {
    min-width: 0;
}

.filters-box label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
}

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

.btn-secondary {
    display: inline-block;
    text-decoration: none;
    background: #e5e7eb;
    color: #111827;
    padding: 13px 20px;
    border-radius: 12px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.info-card {
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 18px;
    background: #fafafa;
}

.info-card h3 {
    margin-top: 0;
}

.info-card p {
    margin: 8px 0;
    font-size: 14px;
}

.badge {
    display: inline-block;
    background: #eef2ff;
    color: #3730a3;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
}

.badge--success {
    background: #dcfce7;
    color: #166534;
}

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

.badge--muted {
    background: #e5e7eb;
    color: #374151;
}

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

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
}

.panel-header .subtitle {
    margin-bottom: 0;
}

.panel-note {
    color: #6b7280;
    font-size: 14px;
    margin: 10px 0 0;
}

.filters-summary {
    margin-top: -8px;
    margin-bottom: 12px;
    color: #6b7280;
    font-size: 14px;
}

.advanced-filters {
    border: 1px dashed #cbd5e1;
    border-radius: 14px;
    padding: 16px;
    background: #fff;
}

.advanced-filters summary {
    cursor: pointer;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 12px;
}

.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.chart-card {
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 18px;
    background: #fafafa;
}

.chart-card h3 {
    margin-top: 0;
    margin-bottom: 14px;
    font-size: 18px;
}

.chart-row {
    display: grid;
    grid-template-columns: 1fr minmax(120px, 1.4fr) auto;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
    font-size: 14px;
}

.chart-label {
    color: #374151;
    font-weight: 600;
}

.chart-track {
    height: 10px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
}

.chart-fill {
    height: 100%;
    background: #2563eb;
    border-radius: 999px;
}

.chart-count {
    color: #1f2937;
    font-weight: 700;
    min-width: 2ch;
    text-align: right;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
}

.panel-table {
    margin-top: 0;
    min-width: 1180px;
}

.panel-table th,
.panel-table td {
    vertical-align: top;
}

.row-summary {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.row-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
}

.record-details {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
}

.record-details summary {
    cursor: pointer;
    font-weight: 700;
    color: #1d4ed8;
}

.detail-sections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
    margin-top: 14px;
}

.detail-section-card {
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    background: #fff;
    padding: 14px;
}

.detail-section-card h4 {
    margin: 0 0 10px;
    font-size: 16px;
}

.detail-meta {
    color: #6b7280;
    font-size: 13px;
    margin-bottom: 10px;
}

.field-list {
    display: grid;
    gap: 10px;
}

.field-row {
    display: grid;
    grid-template-columns: minmax(120px, 180px) 1fr;
    gap: 12px;
    align-items: start;
    padding: 10px 0;
    border-top: 1px solid #f3f4f6;
}

.field-row:first-child {
    border-top: 0;
    padding-top: 0;
}

.field-label {
    color: #6b7280;
    font-size: 13px;
    font-weight: 700;
}

.field-value {
    color: #111827;
    font-weight: 600;
    word-break: break-word;
}

.field-value.is-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.summary-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.summary-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 12px;
    background: #eff6ff;
    color: #1e40af;
    font-size: 13px;
    font-weight: 700;
}

.summary-chip span {
    font-weight: 600;
    color: #475569;
}

.link-btn {
    color: #2563eb;
    font-weight: 700;
    text-decoration: none;
}

.link-btn:hover {
    text-decoration: underline;
}

@media (max-width: 900px) {
    .stats-grid,
    .info-grid {
        grid-template-columns: 1fr;
    }

    .filters-box {
        grid-template-columns: 1fr;
    }

    .results-table {
        display: block;
        overflow-x: auto;
    }

    .panel-header {
        flex-direction: column;
    }

    .chart-row {
        grid-template-columns: 1fr;
    }

    .field-row {
        grid-template-columns: 1fr;
    }
}

.details-section {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.muted {
    color: #6b7280;
}
