.rwid-app {
    --rwid-navy: #102c46;
    --rwid-teal: #238397;
    --rwid-teal-dark: #176879;
    --rwid-light: #e7f4f7;
    --rwid-border: #d7e2e8;
    --rwid-text: #153047;
    --rwid-muted: #607284;
    --rwid-success: #197a5d;
    --rwid-warning: #b66b12;
    --rwid-danger: #b42318;
    color: var(--rwid-text);
    font-family: "Rubik", "Segoe UI", Tahoma, Arial, sans-serif;
    line-height: 1.55;
    width: min(100%, 1800px);
    margin: 24px auto;
}

.rwid-app *, .rwid-app *::before, .rwid-app *::after { box-sizing: border-box; }
.rwid-app button, .rwid-app input { font: inherit; }
.rwid-app button { cursor: pointer; }
.rwid-app.is-busy { cursor: progress; }

.rwid-panel,
.rwid-section,
.rwid-dashboard-header,
.rwid-filters {
    background: #fff;
    border: 1px solid var(--rwid-border);
    border-radius: 14px;
    box-shadow: 0 8px 30px rgba(16, 44, 70, .06);
}

.rwid-panel { padding: 24px; }
.rwid-panel-heading,
.rwid-dashboard-header,
.rwid-section-title,
.rwid-upload-actions,
.rwid-header-actions,
.rwid-section-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.rwid-panel h2,
.rwid-dashboard-header h1,
.rwid-section h2 { margin: 0; color: var(--rwid-navy); }
.rwid-panel p,
.rwid-dashboard-header p,
.rwid-section-title span { margin: 4px 0 0; color: var(--rwid-muted); }

.rwid-file-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin: 24px 0;
}

.rwid-file-box {
    position: relative;
    display: grid;
    place-items: center;
    gap: 8px;
    min-height: 190px;
    padding: 24px;
    border: 2px dashed #a9c2cc;
    border-radius: 12px;
    background: #f8fbfc;
    text-align: center;
    cursor: pointer;
    transition: .2s ease;
}
.rwid-file-box:hover,
.rwid-file-box.is-dragover { border-color: var(--rwid-teal); background: #eaf8fa; transform: translateY(-1px); }
.rwid-file-box.is-selected { border-style: solid; border-color: #78adb9; background: #f1fafb; }
.rwid-file-box input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}
.rwid-file-icon {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    color: #fff;
    background: var(--rwid-teal);
    font-size: 28px;
    font-weight: 900;
    line-height: 1;
}
.rwid-file-title { font-weight: 800; font-size: 17px; }
.rwid-file-hint, .rwid-file-name, .rwid-upload-note { color: var(--rwid-muted); font-size: 13px; }
.rwid-file-name { min-height: 20px; max-width: 100%; overflow-wrap: anywhere; font-weight: 700; color: var(--rwid-navy); }

.rwid-primary-button,
.rwid-secondary-button,
.rwid-reset-button {
    border: 0;
    border-radius: 9px;
    padding: 10px 16px;
    font-weight: 750;
    transition: .18s ease;
}
.rwid-primary-button { color: #fff; background: var(--rwid-teal); min-width: 190px; }
.rwid-primary-button:hover { background: var(--rwid-teal-dark); transform: translateY(-1px); }
.rwid-primary-button:disabled { opacity: .65; cursor: wait; }
.rwid-secondary-button { color: var(--rwid-navy); background: #eef4f7; border: 1px solid #d2e0e6; }
.rwid-secondary-button:hover { background: #e1edf2; }
.rwid-reset-button { color: var(--rwid-danger); background: #fff0ee; }

.rwid-status { margin-top: 18px; padding: 13px 16px; border-radius: 9px; font-weight: 700; }
.rwid-status.is-info { background: #eef7ff; color: #175d8e; }
.rwid-status.is-success { background: #eaf8f1; color: var(--rwid-success); }
.rwid-status.is-error { background: #fff0ee; color: var(--rwid-danger); }

.rwid-dashboard { display: grid; gap: 22px; margin-top: 26px; }
.rwid-dashboard-header { padding: 22px 26px; background: var(--rwid-navy); color: #fff; }
.rwid-dashboard-header h1, .rwid-dashboard-header p { color: #fff; }
.rwid-header-actions { flex-wrap: wrap; }

.rwid-filters { position: sticky; top: 10px; z-index: 20; display: flex; align-items: end; gap: 14px; padding: 14px 18px; }
.rwid-filter { position: relative; min-width: 240px; }
.rwid-filter-label { display: block; margin-bottom: 5px; font-size: 13px; font-weight: 750; color: var(--rwid-muted); }
.rwid-filter-button {
    width: 100%; min-height: 42px; text-align: right; padding: 8px 12px;
    color: var(--rwid-text); background: #fff; border: 1px solid #becdd5; border-radius: 8px;
}
.rwid-filter-button::after { content: "▾"; float: left; }
.rwid-filter-menu {
    display: none; position: absolute; inset-inline-start: 0; top: calc(100% + 6px); width: min(360px, 90vw);
    max-height: 330px; overflow: auto; padding: 8px; background: #fff; border: 1px solid var(--rwid-border);
    border-radius: 10px; box-shadow: 0 16px 40px rgba(16,44,70,.18);
}
.rwid-filter.is-open .rwid-filter-menu { display: block; }
.rwid-filter-option { display: flex; align-items: center; gap: 9px; padding: 8px; border-radius: 7px; }
.rwid-filter-option:hover { background: #eff7f9; }
.rwid-filter-all { border-bottom: 1px solid var(--rwid-border); margin-bottom: 5px; font-weight: 800; }
.rwid-filter-loading { color: var(--rwid-teal-dark); font-weight: 750; }

.rwid-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}
.rwid-kpi-card {
    overflow: hidden; text-align: center; border: 1px solid var(--rwid-border); border-radius: 12px; background: #fff;
    box-shadow: 0 5px 18px rgba(16,44,70,.05);
}
.rwid-kpi-card h3 { margin: 0; padding: 12px; color: #fff; background: var(--rwid-teal); font-size: 15px; }
.rwid-kpi-card strong { display: block; padding: 12px 8px 5px; font-size: 27px; color: var(--rwid-navy); }
.rwid-kpi-card span { display: block; padding: 8px; background: var(--rwid-light); font-weight: 800; }
.rwid-kpi-card.is-dark h3 { background: var(--rwid-navy); }
.rwid-kpi-card.is-warning h3 { background: #a86618; }
.rwid-kpi-card.is-success h3 { background: var(--rwid-success); }
.rwid-kpi-card.is-compact strong { font-size: 23px; }

.rwid-section { overflow: hidden; }
.rwid-section-title { padding: 16px 20px; background: var(--rwid-navy); color: #fff; }
.rwid-section-title h2, .rwid-section-title span { color: #fff; }
.rwid-section-title h2 { font-size: 19px; }
.rwid-section-tools input {
    width: 250px; max-width: 45vw; padding: 9px 11px; border: 1px solid #cad7dd; border-radius: 8px;
}

.rwid-size-distribution { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 22px; padding: 20px; }
.rwid-dist-label { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; margin-bottom: 6px; }
.rwid-dist-label small { color: var(--rwid-muted); }
.rwid-dist-track { height: 11px; overflow: hidden; border-radius: 999px; background: #e4edf1; }
.rwid-dist-track span { display: block; height: 100%; border-radius: inherit; background: var(--rwid-teal); }

.rwid-summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--rwid-border); }
.rwid-summary-card { text-align: center; background: #fff; }
.rwid-summary-card h3 { min-height: 52px; margin: 0; padding: 12px; color: #fff; background: var(--rwid-teal); font-size: 14px; }
.rwid-summary-card strong { display: block; padding: 16px 8px 6px; font-size: 26px; }
.rwid-summary-card span { display: block; padding: 8px; background: var(--rwid-light); font-weight: 800; }

.rwid-table-wrap { max-width: 100%; overflow: auto; }
.rwid-table { width: 100%; min-width: 1180px; border-collapse: collapse; font-size: 13px; background: #fff; }
.rwid-table th,
.rwid-table td { padding: 9px 10px; border: 1px solid var(--rwid-border); white-space: nowrap; text-align: center; }
.rwid-table th { position: sticky; top: 0; z-index: 2; color: var(--rwid-navy); background: #dceef2; font-weight: 850; }
.rwid-table tbody tr:nth-child(even) { background: #f8fbfc; }
.rwid-table tbody tr:hover { background: #edf8fa; }
.rwid-table td:first-child, .rwid-table td:nth-child(2) { text-align: right; }
.rwid-empty { padding: 28px !important; color: var(--rwid-muted); text-align: center !important; }

.rwid-access-message { max-width: 850px; margin: 30px auto; padding: 18px; border: 1px solid #d9e2e7; border-radius: 10px; background: #fff; }

@media (max-width: 1100px) {
    .rwid-kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .rwid-size-distribution { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .rwid-filters { position: static; flex-wrap: wrap; align-items: stretch; }
    .rwid-filter { flex: 1 1 280px; }
}

@media (max-width: 760px) {
    .rwid-app { margin: 12px auto; }
    .rwid-panel { padding: 16px; }
    .rwid-panel-heading, .rwid-dashboard-header, .rwid-section-title, .rwid-upload-actions { align-items: stretch; flex-direction: column; }
    .rwid-file-grid { grid-template-columns: 1fr; }
    .rwid-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .rwid-size-distribution { grid-template-columns: 1fr; }
    .rwid-summary-grid { grid-template-columns: 1fr; }
    .rwid-section-tools { width: 100%; flex-direction: column; align-items: stretch; }
    .rwid-section-tools input { width: 100%; max-width: none; }
}
