:root {
    --main-color: #2563eb;
    --bg: #eef3f8;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --text: #172033;
    --muted: #657085;
    --line: #e4e9f2;
    --danger: #dc2626;
    --success: #16803c;
    --warning: #b45309;
    --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.07);
    --shadow-md: 0 20px 48px rgba(15, 23, 42, 0.14);
    --radius: 10px;
}

* { box-sizing: border-box; }

html {
    min-width: 320px;
}

body {
    margin: 0;
    color: var(--text);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.65), rgba(255,255,255,0) 260px),
        var(--bg);
    font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

a { color: inherit; }

button,
input,
select,
textarea {
    font: inherit;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        linear-gradient(135deg, rgba(37, 99, 235, 0.10), transparent 34%),
        linear-gradient(315deg, rgba(22, 128, 60, 0.10), transparent 30%),
        #f7f9fc;
}

.login-card {
    width: min(100%, 420px);
    padding: 32px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--shadow-md);
    text-align: center;
}

.login-card img {
    max-width: 180px;
    max-height: 72px;
    object-fit: contain;
    margin-bottom: 22px;
}

.login-card h2 {
    margin: 0 0 24px;
    font-size: 1.2rem;
    color: var(--text);
}

.app-shell {
    display: flex;
    height: 100vh;
    overflow: hidden;
    background: #edf2f7;
}

.sidebar {
    width: 286px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    color: #e8eef8;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0) 28%),
        #0b1220;
    border-right: 1px solid rgba(255, 255, 255, 0.10);
    box-shadow: 18px 0 36px rgba(15, 23, 42, 0.12);
}

.sidebar-header {
    min-height: 96px;
    padding: 26px 24px;
    display: flex;
    align-items: center;
    color: #fff;
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1.2;
    border-bottom: 1px solid rgba(255, 255, 255, 0.10);
}

.sidebar-header::before {
    content: "";
    width: 42px;
    height: 42px;
    margin-right: 14px;
    border-radius: 12px;
    background: var(--main-color);
    box-shadow: 0 12px 28px color-mix(in srgb, var(--main-color) 45%, transparent);
}

.sidebar nav {
    padding: 18px 12px;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    padding: 12px 14px;
    margin-bottom: 7px;
    color: #aeb8ca;
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: 12px;
    transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.menu-item i {
    width: 18px;
    text-align: center;
    color: #7f8ba0;
}

.menu-item:hover,
.menu-item.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.10);
    border-color: rgba(255, 255, 255, 0.10);
    transform: translateX(2px);
}

.menu-item.active i {
    color: var(--main-color);
}

.menu-item.active {
    box-shadow: inset 4px 0 0 var(--main-color);
}

.main-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.navbar {
    min-height: 78px;
    padding: 0 34px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
    z-index: 10;
}

.brand-title {
    font-weight: 800;
    color: var(--text);
    font-size: 1.02rem;
}

.logout-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #b91c1c;
    padding: 9px 12px;
    border: 1px solid #fecaca;
    border-radius: 999px;
    background: #fff5f5;
    text-decoration: none;
    font-weight: 700;
}

.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 34px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 26px;
    padding: 24px 26px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--main-color) 12%, #fff), #fff 45%),
        #fff;
    box-shadow: var(--shadow-sm);
}

.page-header h2 {
    margin: 0;
    font-size: 1.72rem;
    line-height: 1.1;
    text-transform: capitalize;
}

.muted-count {
    color: var(--muted);
    font-size: 0.92rem;
}

.card,
.info-box {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 12px 34px rgba(15, 23, 42, 0.07);
}

.card {
    padding: 24px;
    margin-bottom: 20px;
}

.info-box {
    padding: 20px;
    border-top: 4px solid var(--main-color);
}

.btn-csv {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 10px 16px;
    border: 0;
    border-radius: 999px;
    color: white;
    background: var(--main-color);
    font-weight: 800;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 10px 22px color-mix(in srgb, var(--main-color) 22%, transparent);
    transition: transform 0.16s ease, filter 0.16s ease, box-shadow 0.16s ease;
}

.btn-csv:hover {
    filter: brightness(0.96);
    transform: translateY(-1px);
}

.form-group {
    text-align: left;
    margin-bottom: 16px;
}

.form-group label,
label {
    display: block;
    margin-bottom: 6px;
    color: #3f4a5f;
    font-size: 0.86rem;
    font-weight: 700;
}

input,
select,
textarea,
.form-control {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid #ccd5e3;
    border-radius: 12px;
    background: #fff;
    color: var(--text);
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

input:focus,
select:focus,
textarea:focus,
.form-control:focus {
    outline: none;
    border-color: var(--main-color);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--main-color) 18%, transparent);
}

.error-msg {
    margin-bottom: 16px;
    padding: 12px;
    border: 1px solid #fecaca;
    border-radius: var(--radius);
    color: #991b1b;
    background: #fef2f2;
    font-size: 0.9rem;
}

.footer-text {
    margin-top: 22px;
    color: var(--muted);
    font-size: 0.82rem;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-panel {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.08);
}

.data-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 22px 24px;
    border-bottom: 1px solid var(--line);
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--main-color) 10%, #fff), #fff 50%),
        #fff;
}

.data-panel-head h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 1.1rem;
}

.data-panel-head h3 i {
    color: var(--main-color);
}

.data-panel-head p {
    margin: 4px 0 0;
    color: var(--muted);
}

.metric-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 6px 12px;
    border: 1px solid color-mix(in srgb, var(--main-color) 28%, var(--line));
    border-radius: 999px;
    color: color-mix(in srgb, var(--main-color) 78%, #0f172a);
    background: color-mix(in srgb, var(--main-color) 9%, #fff);
    font-weight: 800;
    white-space: nowrap;
}

.modern-table {
    border-collapse: separate;
    border-spacing: 0;
    min-width: 760px;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

th {
    padding: 14px 16px;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0;
    border-bottom: 1px solid var(--line);
    background: #f8fafc;
    white-space: nowrap;
}

td {
    padding: 16px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

.clickable-row {
    cursor: pointer;
    background: var(--surface);
    transition: background 0.16s ease, box-shadow 0.16s ease;
}

.clickable-row:hover {
    background: var(--surface-soft);
    box-shadow: inset 4px 0 0 var(--main-color);
}

.nowrap {
    white-space: nowrap;
}

.subject-cell {
    min-width: 280px;
}

.subject-cell > div {
    color: var(--text);
    font-weight: 800;
}

.subject-cell small {
    display: block;
    max-width: 520px;
    margin-top: 2px;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sentiment-chip {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 800;
    white-space: nowrap;
}

.sentiment-positive { background: #dcfce7; color: #166534; }
.sentiment-neutral { background: #eef2f7; color: #475569; }
.sentiment-negative { background: #fee2e2; color: #991b1b; }
.sentiment-urgent { background: #ffedd5; color: #9a3412; }
.sentiment-info { background: #dbeafe; color: #1d4ed8; }
.sentiment-purple { background: #ede9fe; color: #6d28d9; }

.badge,
.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    white-space: nowrap;
}

.status-badge {
    color: #fff;
}

.badge-pendiente { background: #fff4ce; color: #92400e; }
.badge-en-tramite { background: #dbeafe; color: #1d4ed8; }
.badge-derivada { background: #ede9fe; color: #6d28d9; }
.badge-finalizado { background: #dcfce7; color: #166534; }

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    inset: 0;
    background: rgba(15, 23, 42, 0.58);
    overflow-y: auto;
    padding: 24px;
}

.modal-content {
    width: min(90vw, 700px);
    margin: 4vh auto;
    padding: 26px;
    position: relative;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: var(--surface);
    box-shadow: var(--shadow-md);
}

.modal-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 20px;
    color: var(--main-color);
    font-size: 1.18rem;
}

.modal-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 15px;
}

.modal-grid.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.modal-actions.split {
    justify-content: space-between;
    align-items: center;
}

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

.summary-box {
    padding: 12px 15px;
    margin-bottom: 15px;
    border-left: 4px solid var(--success);
    border-radius: var(--radius);
    background: var(--surface-soft);
    font-size: 0.9rem;
}

.close {
    position: absolute;
    right: 18px;
    top: 14px;
    color: var(--muted);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.close:hover {
    color: var(--text);
}

.comment-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: background 0.16s ease, border-color 0.16s ease;
}

.comment-card:hover {
    border-color: color-mix(in srgb, var(--main-color) 45%, var(--line));
    background: var(--surface-soft);
}

.detail-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--main-color);
    text-decoration: none;
    font-weight: 800;
}

.detail-grid {
    display: grid;
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.detail-stack {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.profile-card {
    padding: 0;
    overflow: hidden;
}

.profile-hero {
    padding: 30px 20px;
    text-align: center;
    background: var(--surface-soft);
    border-bottom: 1px solid var(--line);
}

.profile-avatar {
    width: 80px;
    height: 80px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    border-radius: 999px;
    color: #fff;
    background: var(--main-color);
    font-size: 2rem;
}

.profile-hero h3 {
    margin: 0;
    color: var(--text);
}

.profile-hero p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 0.85rem;
}

.profile-body {
    padding: 20px;
}

.field-item {
    margin-bottom: 18px;
}

.field-item:last-child {
    margin-bottom: 0;
}

.field-label {
    display: block;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
}

.field-value {
    color: #334155;
    font-weight: 700;
}

.field-value.soft {
    color: var(--muted);
    font-weight: 500;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--line);
}

.section-title {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 1.05rem;
}

.section-title i {
    color: var(--main-color);
}

.section-body {
    padding: 20px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 15px;
}

.action-row {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-secondary {
    background: #64748b;
}

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

.empty-state {
    padding: 34px;
    text-align: center;
    color: var(--muted);
}

.notice-danger {
    padding: 20px;
    border: 1px solid #fecaca;
    border-radius: var(--radius);
    color: #991b1b;
    background: #fef2f2;
}

.choice-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.choice-card {
    display: block;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    cursor: pointer;
}

.choice-card.is-selected {
    border-color: var(--main-color);
    background: color-mix(in srgb, var(--main-color) 8%, #fff);
}

.choice-card input {
    width: auto;
    margin-right: 10px;
}

.subtle-note {
    color: var(--muted);
    font-size: 0.82rem;
}

.hub-dashboard {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.hub-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.hub-title h1 {
    margin: 0;
    color: #070f1f;
    font-size: 1.75rem;
    line-height: 1.1;
}

.hub-title p {
    margin: 6px 0 0;
    color: #52627a;
}

.hub-user-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
}

.hub-user-chip span {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    color: #fff;
    background: var(--main-color);
    font-size: 0.78rem;
    font-weight: 900;
}

.hub-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.hub-kpi,
.hub-card {
    border: 1px solid #dbe3ee;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.06);
}

.hub-kpi {
    position: relative;
    min-height: 140px;
    padding: 24px;
}

.hub-kpi > span {
    display: block;
    color: #5c6d86;
    font-weight: 600;
}

.hub-kpi strong {
    display: block;
    margin-top: 10px;
    color: #08111f;
    font-size: 2rem;
    line-height: 1;
}

.hub-kpi p {
    margin: 14px 0 0;
    color: #58677f;
    font-size: 0.85rem;
}

.hub-kpi-icon {
    position: absolute;
    right: 24px;
    top: 28px;
    color: var(--main-color);
    font-size: 1.1rem;
}

.hub-kpi-icon.green { color: #22c55e; }
.hub-kpi-icon.amber { color: #f59e0b; }
.hub-kpi-icon.purple { color: #7c3aed; }

.dot {
    width: 8px;
    height: 8px;
    display: inline-block;
    margin: 0 6px 1px 0;
    border-radius: 999px;
    background: #64748b;
}

.dot.green { background: #22c55e; }
.dot.amber { background: #f59e0b; }
.dot.blue { background: #2f80ed; }
.dot.red { background: #ef4444; }

.hub-card {
    padding: 24px;
}

.hub-wide {
    min-height: 380px;
}

.hub-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 12px;
}

.hub-card-head h3 {
    margin: 0;
    color: #111827;
    font-size: 1rem;
}

.hub-card-head i {
    color: #64748b;
}

.line-chart {
    height: 300px;
    position: relative;
    padding: 10px 0 28px;
    background-image:
        linear-gradient(to right, #e6eef8 1px, transparent 1px),
        linear-gradient(to bottom, #e6eef8 1px, transparent 1px);
    background-size: 6.67% 20%;
    border-left: 1px solid #94a3b8;
    border-bottom: 1px solid #94a3b8;
}

.chart-frame {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 10px;
    min-width: 0;
}

.chart-frame > div:last-child {
    min-width: 0;
}

.chart-y-axis {
    height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-end;
    padding: 6px 0 28px;
    color: #52627a;
    font-size: 0.72rem;
    font-weight: 700;
}

.line-chart svg {
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
}

.line-chart polygon {
    fill: color-mix(in srgb, var(--main-color) 14%, transparent);
}

.line-chart polyline {
    fill: none;
    stroke: #2f80ed;
    stroke-width: 0.55;
    vector-effect: non-scaling-stroke;
}

.trend-point {
    fill: #fff;
    stroke: #2f80ed;
    stroke-width: 0.7;
    vector-effect: non-scaling-stroke;
}

.chart-axis {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: space-between;
    color: #52627a;
    font-size: 0.72rem;
}

.trend-axis {
    display: grid;
    grid-template-columns: repeat(30, minmax(0, 1fr));
    gap: 0;
    justify-content: stretch;
}

.trend-axis span {
    min-width: 0;
    overflow: hidden;
    text-align: center;
    text-overflow: clip;
    white-space: nowrap;
    font-size: 0.64rem;
}

.chart-caption {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    margin-top: 10px;
    color: #52627a;
    font-size: 0.78rem;
}

.chart-caption strong {
    color: #172033;
}

.hub-grid-two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.hub-grid-three {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

.bar-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bar-row {
    display: grid;
    grid-template-columns: 150px 1fr 28px;
    align-items: center;
    gap: 10px;
}

.bar-row span {
    color: #52627a;
    font-size: 0.78rem;
    line-height: 1.1;
    text-align: right;
}

.bar-row div {
    height: 20px;
    overflow: hidden;
    border-radius: 4px;
    background: #edf2f7;
}

.bar-row b {
    display: block;
    height: 100%;
    border-radius: 4px;
    background: #2f80ed;
}

.bar-row:nth-child(2n) b { background: #24418f; }
.bar-row:nth-child(3n) b { background: #22c55e; }
.bar-row:nth-child(4n) b { background: #f59e0b; }
.bar-row:nth-child(5n) b { background: #ef4444; }
.bar-row:nth-child(6n) b { background: #a855f7; }

.bar-row em {
    color: #52627a;
    font-style: normal;
    font-weight: 800;
}

.hour-bars {
    height: 260px;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 24px 0 0;
    border-bottom: 1px solid #94a3b8;
    background-image:
        linear-gradient(to right, #e6eef8 1px, transparent 1px),
        linear-gradient(to bottom, #e6eef8 1px, transparent 1px);
    background-size: 8.33% 25%;
}

.hour-frame .chart-y-axis {
    height: 260px;
    padding-bottom: 0;
}

.hour-bars span {
    position: relative;
    flex: 1;
    min-width: 8px;
    border-radius: 4px 4px 0 0;
    background: #24418f;
}

.hour-bars span b {
    position: absolute;
    left: 50%;
    top: -21px;
    transform: translateX(-50%);
    color: #24418f;
    font-size: 0.7rem;
    font-weight: 800;
}

.hour-bars span.has-value {
    box-shadow: 0 8px 16px rgba(36, 65, 143, 0.18);
}

.hour-axis {
    display: grid;
    grid-template-columns: repeat(24, minmax(0, 1fr));
    gap: 8px;
    min-height: 44px;
    margin-top: 18px;
    color: #52627a;
    font-size: 0.68rem;
}

.hour-axis span {
    min-width: 0;
    transform: rotate(-45deg);
    transform-origin: top left;
    white-space: nowrap;
}

.dashboard-notes {
    padding-top: 20px;
    padding-bottom: 20px;
}

.notes-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.notes-grid span {
    min-height: 54px;
    display: flex;
    align-items: center;
    padding: 12px;
    border: 1px solid #e4e9f2;
    border-radius: 8px;
    background: #f8fafc;
    color: #52627a;
    font-size: 0.84rem;
    font-weight: 700;
}

.donut {
    width: 172px;
    height: 172px;
    margin: 36px auto 28px;
    border-radius: 999px;
    background: conic-gradient(#22c55e 0 var(--a), #2f80ed var(--a) var(--b), #ef4444 var(--b) var(--c), #f59e0b var(--c) 100%);
    position: relative;
}

.donut::after {
    content: "";
    position: absolute;
    inset: 44px;
    border-radius: inherit;
    background: #fff;
}

.donut-status {
    background: conic-gradient(#f59e0b 0 var(--a), #2f80ed var(--a) var(--b), #22c55e var(--b) 100%);
}

.legend-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    color: #52627a;
    font-size: 0.82rem;
}

.latest-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.latest-list a {
    display: grid;
    grid-template-columns: 12px 1fr;
    gap: 10px;
    color: inherit;
    text-decoration: none;
}

.latest-list strong {
    display: block;
    color: #111827;
    font-size: 0.9rem;
}

.latest-list small {
    display: block;
    margin-top: 3px;
    color: #52627a;
}

@media (max-width: 1180px) {
    .sidebar {
        width: 250px;
    }

    .content-area {
        padding: 26px;
    }

    .hub-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hub-grid-three,
    .notes-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hub-grid-two {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .app-shell {
        height: auto;
        min-height: 100vh;
        flex-direction: column;
        overflow: visible;
    }

    .sidebar {
        width: 100%;
        box-shadow: none;
        border-right: 0;
    }

    .sidebar-header {
        min-height: 76px;
        padding: 18px;
    }

    .sidebar-header::before {
        width: 34px;
        height: 34px;
        border-radius: 10px;
    }

    .sidebar nav {
        display: flex;
        overflow-x: auto;
        padding: 10px;
        gap: 6px;
        scrollbar-width: thin;
    }

    .menu-item {
        flex: 0 0 auto;
        min-height: 42px;
        margin: 0;
        padding: 10px 12px;
        white-space: nowrap;
    }

    .menu-item:hover,
    .menu-item.active {
        transform: none;
    }

    .main-content {
        overflow: visible;
    }

    .navbar {
        min-height: 64px;
        padding: 0 22px;
    }

    .content-area {
        overflow: visible;
        padding: 18px;
    }

    .page-header {
        align-items: flex-start;
        flex-direction: column;
        padding: 20px;
        border-radius: 14px;
    }

    .page-header h2 {
        font-size: 1.38rem;
    }

    .data-panel-head,
    .hub-title {
        align-items: flex-start;
        flex-direction: column;
    }

    .metric-pill,
    .hub-user-chip {
        width: 100%;
        justify-content: flex-start;
    }

    .card,
    .hub-card,
    .hub-kpi,
    .info-box {
        border-radius: 12px;
    }

    .hub-card,
    .hub-kpi {
        padding: 20px;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .hub-kpis,
    .hub-grid-two,
    .hub-grid-three,
    .notes-grid {
        grid-template-columns: 1fr;
    }

    .bar-row {
        grid-template-columns: 116px 1fr 24px;
    }

    .subject-cell {
        min-width: 240px;
    }
}

@media (max-width: 620px) {
    body {
        font-size: 13px;
    }

    .login-page {
        padding: 14px;
    }

    .login-card,
    .modal-content {
        padding: 18px;
        border-radius: 14px;
    }

    .navbar {
        min-height: 58px;
        padding: 0 14px;
        gap: 10px;
    }

    .brand-title {
        max-width: 54vw;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .logout-link {
        min-height: 36px;
        padding: 8px 10px;
        font-size: 0.82rem;
        white-space: nowrap;
    }

    .content-area {
        padding: 14px;
    }

    .data-panel-head,
    .section-head,
    .section-body,
    .profile-body,
    .card,
    .hub-card,
    .hub-kpi {
        padding: 16px;
    }

    .detail-toolbar,
    .section-head,
    .action-row {
        align-items: stretch;
        flex-direction: column;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .modal-grid,
    .modal-grid.three {
        grid-template-columns: 1fr;
    }

    .modal-actions.split {
        align-items: stretch;
    }

    .modal {
        padding: 10px;
    }

    .modal-content {
        width: 100%;
        margin: 2vh auto;
    }

    .modal-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .modal-actions .btn-csv,
    .action-row .btn-csv,
    .page-header .btn-csv {
        width: 100%;
    }

    .hub-dashboard {
        gap: 16px;
    }

    .hub-title h1 {
        font-size: 1.45rem;
    }

    .hub-title p {
        font-size: 0.9rem;
    }

    .hub-kpi {
        min-height: 124px;
    }

    .hub-kpi strong {
        font-size: 1.72rem;
    }

    .chart-frame {
        grid-template-columns: 30px minmax(0, 1fr);
    }

    .chart-frame > div:last-child {
        overflow-x: auto;
        overflow-y: hidden;
        padding-bottom: 2px;
        -webkit-overflow-scrolling: touch;
    }

    .line-chart {
        min-width: 720px;
        height: 260px;
    }

    .chart-y-axis {
        height: 260px;
        font-size: 0.66rem;
    }

    .trend-axis span {
        font-size: 0.6rem;
    }

    .chart-caption {
        min-width: 720px;
        font-size: 0.72rem;
    }

    .hour-bars {
        min-width: 620px;
        height: 230px;
        gap: 4px;
    }

    .hour-frame .chart-y-axis {
        height: 230px;
    }

    .hour-bars span b {
        display: none;
    }

    .hour-axis {
        min-width: 620px;
        gap: 4px;
        font-size: 0.62rem;
    }

    .bar-row {
        grid-template-columns: 1fr 26px;
        gap: 6px;
    }

    .bar-row span {
        grid-column: 1 / -1;
        text-align: left;
    }

    .donut {
        width: 150px;
        height: 150px;
        margin: 24px auto 22px;
    }

    .donut::after {
        inset: 38px;
    }

    th,
    td {
        padding: 12px;
    }

    .modern-table {
        min-width: 680px;
    }

    .subject-cell small {
        max-width: 300px;
    }
}

@media (max-width: 420px) {
    .sidebar-header {
        padding: 16px 14px;
        font-size: 0.92rem;
    }

    .menu-item {
        gap: 8px;
        padding: 9px 10px;
        font-size: 0.86rem;
    }

    .page-header,
    .data-panel,
    .hub-card,
    .hub-kpi,
    .card,
    .info-box {
        border-radius: 10px;
    }

    .hub-card-head h3,
    .section-title,
    .data-panel-head h3 {
        font-size: 0.96rem;
    }

    .profile-avatar {
        width: 64px;
        height: 64px;
        font-size: 1.55rem;
    }

    .profile-hero {
        padding: 24px 16px;
    }
}
