@font-face {
    font-family: 'SicoobSans';
    src: url('../assets/sicoob-sans-regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'SicoobSans';
    src: url('../assets/sicoob-sans-medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'SicoobSans';
    src: url('../assets/sicoob-sans-semibold.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'SicoobSans';
    src: url('../assets/sicoob-sans-bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

:root {
    --bg: #edf2f0;
    --card: #ffffff;
    --ink: #142b2e;
    --muted: #6c817f;
    --line: #e2eae7;
    --green: #003641;
    --green-2: #004b5a;
    --teal: #00ae9d;
    --teal-600: #058075;
    --lime: #c9d200;
    --leaf: #7db61c;
    --red: #cf4b47;
    --amber: #a97a0b;
    --radius: 14px;
    --shadow: 0 10px 30px rgba(0, 54, 65, 0.06);
}

html {
    min-height: 100%;
}

body {
    font-family: 'SicoobSans', 'Sicoob sans', 'Asap', Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--ink);
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

body.no-scroll {
    overflow: hidden;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.admin-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 60;
    width: 260px;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(90% 50% at 0% 100%, rgba(0, 174, 157, 0.18), transparent 65%),
        linear-gradient(180deg, #003641 0%, #002f39 100%);
    color: #fff;
    transition: transform 0.25s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 20px 20px;
}

.sidebar-brand a {
    display: block;
    line-height: 0;
}

.sidebar-brand img {
    width: 148px;
    height: auto;
    display: block;
}

.admin-tag {
    padding: 3px 8px;
    border-radius: 6px;
    background: var(--lime);
    color: var(--green);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 8px 12px 20px;
    overflow-y: auto;
}

.nav-label {
    margin: 18px 10px 6px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 1.3px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.38);
}

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: rgba(255, 255, 255, 0.72);
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 500;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease;
}

.nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.9;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.nav-item.is-active {
    background: rgba(0, 174, 157, 0.18);
    color: #fff;
}

.nav-item.is-active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--lime);
}

.nav-badge {
    margin-left: auto;
    min-width: 22px;
    padding: 1px 6px;
    border-radius: 999px;
    background: rgba(0, 174, 157, 0.3);
    color: #d9fff9;
    font-size: 10.5px;
    font-weight: 700;
    text-align: center;
}

.nav-dot {
    margin-left: auto;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--lime);
    box-shadow: 0 0 0 3px rgba(201, 210, 0, 0.18);
}

.sidebar-footer {
    margin-top: auto;
    padding: 16px 20px 22px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.security-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 8px;
    font-size: 11.5px;
    font-weight: 600;
    color: #baf7ec;
}

.security-chip svg {
    width: 16px;
    height: 16px;
    color: var(--lime);
}

.sidebar-footer p {
    font-size: 10.5px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.42);
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(0, 22, 26, 0.55);
    backdrop-filter: blur(2px);
}

.main {
    flex: 1;
    min-width: 0;
    margin-left: 260px;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 16px;
    height: 68px;
    padding: 0 28px;
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(10px);
}

.menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff;
    color: var(--ink);
    cursor: pointer;
}

.menu-btn svg {
    width: 20px;
    height: 20px;
}

.topbar-brand {
    display: none;
}

.crumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: var(--muted);
}

.crumbs svg {
    width: 13px;
    height: 13px;
    opacity: 0.5;
}

.crumbs strong {
    color: var(--ink);
    font-weight: 600;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-left: auto;
}

.live-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 11px;
    border: 1px solid rgba(0, 174, 157, 0.28);
    border-radius: 999px;
    background: rgba(0, 174, 157, 0.1);
    color: var(--teal-600);
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}

.live-pill.is-paused {
    border-color: rgba(108, 129, 127, 0.3);
    background: rgba(108, 129, 127, 0.1);
    color: var(--muted);
}

.live-pill.is-paused .live-dot {
    background: var(--muted);
    animation: none;
}

.live-pill.small {
    padding: 4px 9px;
    font-size: 10.5px;
}

.live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--teal);
    animation: pulse 1.8s infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(0, 174, 157, 0.45); }
    50% { box-shadow: 0 0 0 5px rgba(0, 174, 157, 0); }
}

.icon-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff;
    color: var(--muted);
    cursor: pointer;
    transition: color 0.18s ease, border-color 0.18s ease;
}

.icon-btn:hover {
    color: var(--teal-600);
    border-color: rgba(0, 174, 157, 0.4);
}

.icon-btn svg {
    width: 19px;
    height: 19px;
}

.notif-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--lime);
    color: var(--green);
    font-size: 10px;
    font-weight: 700;
}

.profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-left: 14px;
    border-left: 1px solid var(--line);
}

.avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--lime), var(--teal));
    color: var(--green);
    font-size: 12.5px;
    font-weight: 700;
}

.profile-id {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.profile-id strong {
    font-size: 12.5px;
    font-weight: 600;
}

.profile-id span {
    font-size: 10.5px;
    color: var(--muted);
}

.conn-alert {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    margin-bottom: 18px;
    padding: 12px 16px;
    border: 1px solid rgba(207, 75, 71, 0.35);
    border-left: 4px solid var(--red);
    border-radius: 10px;
    background: rgba(207, 75, 71, 0.07);
    font-size: 12.5px;
    color: #7d2b28;
}

.conn-alert strong {
    font-weight: 700;
}

.conn-alert code {
    padding: 1px 5px;
    border-radius: 4px;
    background: rgba(0, 54, 65, 0.08);
    font-family: Consolas, 'SFMono-Regular', Menlo, monospace;
    font-size: 11.5px;
    color: var(--green);
}

.content {
    max-width: 1460px;
    margin: 0 auto;
    padding: 28px 32px 24px;
}

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}

.page-head h1 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.page-head p {
    margin-top: 4px;
    font-size: 13.5px;
    color: var(--muted);
}

.head-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    padding: 0 16px;
    border-radius: 10px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.1s ease;
}

.btn svg {
    width: 16px;
    height: 16px;
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    border: 1px solid var(--green);
    background: var(--green);
    color: #fff;
}

.btn-primary:hover {
    background: var(--green-2);
}

.btn-ghost {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
}

.btn-ghost:hover {
    border-color: #c7d6d2;
    background: #f7faf9;
}

.btn:focus-visible,
.icon-btn:focus-visible,
.menu-btn:focus-visible,
.nav-item:focus-visible,
.row-action:focus-visible,
.promo-arrow:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: 2px;
}

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

.kpi {
    padding: 18px 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: var(--shadow);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.kpi:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 34px rgba(0, 54, 65, 0.09);
}

.kpi-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 16px;
}

.kpi-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 11px;
}

.kpi-icon svg {
    width: 19px;
    height: 19px;
}

.icon-teal {
    background: rgba(0, 174, 157, 0.12);
    color: var(--teal-600);
}

.icon-lime {
    background: rgba(201, 210, 0, 0.18);
    color: #8b9300;
}

.icon-green {
    background: rgba(125, 182, 28, 0.14);
    color: #5f8c12;
}

.icon-dark {
    background: rgba(0, 54, 65, 0.09);
    color: var(--green);
}

.trend {
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 700;
    white-space: nowrap;
}

.trend.up {
    background: rgba(0, 174, 157, 0.12);
    color: var(--teal-600);
}

.trend.down {
    background: rgba(207, 75, 71, 0.1);
    color: var(--red);
}

.trend.live {
    background: rgba(201, 210, 0, 0.2);
    color: #7d8500;
}

.kpi-label {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--muted);
}

.kpi-value {
    margin-top: 3px;
    font-size: 29px;
    font-weight: 700;
    letter-spacing: -0.6px;
    line-height: 1.15;
}

.kpi-foot {
    margin-top: 5px;
    font-size: 11px;
    color: #93a5a2;
}

.panel {
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: var(--shadow);
}

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

.panel-head-wrap {
    flex-wrap: wrap;
}

.panel-head h2 {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.1px;
}

.panel-head p {
    margin-top: 2px;
    font-size: 11.5px;
    color: var(--muted);
}

.chip {
    padding: 4px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--muted);
    white-space: nowrap;
}

.chart-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 16px;
    margin-top: 16px;
}

.chart-wrap {
    position: relative;
    width: 100%;
    height: 238px;
}

.chart-wrap canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.donut-wrap {
    position: relative;
    width: 180px;
    height: 180px;
    margin: 4px auto 14px;
}

.donut-wrap canvas {
    display: block;
    width: 180px;
    height: 180px;
}

.donut-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.donut-center strong {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.donut-center span {
    font-size: 10.5px;
    color: var(--muted);
}

.legend {
    display: flex;
    flex-direction: column;
    gap: 9px;
    list-style: none;
}

.legend li {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 12px;
    color: var(--muted);
}

.legend .legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.legend strong {
    margin-left: auto;
    color: var(--ink);
    font-size: 12px;
    font-weight: 600;
}

.legend .legend-pct {
    width: 44px;
    text-align: right;
    font-size: 11px;
    color: var(--muted);
}

.bottom-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 16px;
    margin-top: 16px;
    align-items: start;
}

.table-panel {
    padding: 0;
    overflow: hidden;
}

.table-panel .panel-head {
    padding: 20px 20px 14px;
    margin-bottom: 0;
}

.table-tools {
    display: flex;
    align-items: center;
    gap: 8px;
}

.search {
    display: flex;
    align-items: center;
    gap: 7px;
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #f9fbfa;
    color: var(--muted);
}

.search:focus-within {
    border-color: var(--teal);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(0, 174, 157, 0.1);
}

.search svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.search input {
    width: 210px;
    border: 0;
    outline: 0;
    background: transparent;
    font-family: inherit;
    font-size: 12px;
    color: var(--ink);
}

.search input::placeholder {
    color: #93a5a2;
}

select {
    height: 34px;
    padding: 0 26px 0 10px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #f9fbfa;
    color: var(--ink);
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, #6c817f 50%), linear-gradient(135deg, #6c817f 50%, transparent 50%);
    background-position: calc(100% - 14px) 14px, calc(100% - 9px) 14px;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
}

select:focus {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(0, 174, 157, 0.1);
}

.table-wrap {
    max-height: 430px;
    overflow: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}

thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 9px 12px;
    background: #f9fbfa;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--muted);
    text-align: left;
    white-space: nowrap;
}

tbody td {
    padding: 11px 12px;
    border-bottom: 1px solid #eef3f1;
    vertical-align: middle;
}

tbody tr {
    transition: background 0.15s ease;
}

tbody tr:hover {
    background: #f7faf9;
}

tbody tr:last-child td {
    border-bottom: 0;
}

.time-cell {
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
}

.time-cell strong {
    display: block;
    color: var(--ink);
    font-size: 12.5px;
    font-weight: 600;
}

.user-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 170px;
}

.user-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    font-size: 10.5px;
    font-weight: 700;
    color: var(--green);
    background: rgba(0, 174, 157, 0.14);
}

.user-avatar.alt-1 { background: rgba(201, 210, 0, 0.24); }
.user-avatar.alt-2 { background: rgba(125, 182, 28, 0.18); }
.user-avatar.alt-3 { background: rgba(0, 54, 65, 0.1); }

.user-info {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.user-info strong {
    font-size: 12.5px;
    font-weight: 600;
}

.user-info span {
    font-size: 10.5px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.loc-cell {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
    white-space: nowrap;
}

.loc-cell strong {
    font-size: 12px;
    font-weight: 500;
}

.loc-cell span {
    font-size: 10.5px;
    color: var(--muted);
}

.device-cell {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--muted);
    white-space: nowrap;
}

.device-cell svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.device-cell span {
    font-size: 11.5px;
}

.ip-cell {
    font-family: Consolas, 'SFMono-Regular', Menlo, monospace;
    font-size: 11.5px;
    color: var(--muted);
    white-space: nowrap;
}

.status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 600;
    white-space: nowrap;
}

.status::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
}

.status-online {
    background: rgba(0, 174, 157, 0.12);
    color: var(--teal-600);
}

.status-success {
    background: rgba(125, 182, 28, 0.15);
    color: #557d10;
}

.status-failed {
    background: rgba(207, 75, 71, 0.11);
    color: var(--red);
}

.status-blocked {
    background: rgba(169, 122, 11, 0.12);
    color: var(--amber);
}

.row-action {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
    color: var(--muted);
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.row-action:hover {
    color: var(--teal-600);
    border-color: rgba(0, 174, 157, 0.4);
}

.row-action svg {
    width: 14px;
    height: 14px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 44px 20px;
    color: var(--muted);
    font-size: 12.5px;
}

.empty-state svg {
    width: 26px;
    height: 26px;
    opacity: 0.5;
}

.table-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 20px;
    border-top: 1px solid var(--line);
    font-size: 11.5px;
    color: var(--muted);
}

.demo-note {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    border-radius: 999px;
    background: #f2f6f4;
    font-size: 10px;
    font-weight: 600;
    color: #849693;
}

.feed-panel {
    max-height: 560px;
    display: flex;
    flex-direction: column;
}

.feed {
    list-style: none;
    overflow-y: auto;
    margin: 0 -4px;
    padding: 0 4px;
}

.feed li {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 11px 0;
    border-bottom: 1px solid #eef3f1;
}

.feed li:last-child {
    border-bottom: 0;
}

.feed-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    flex-shrink: 0;
}

.feed-icon svg {
    width: 14px;
    height: 14px;
}

.feed-icon.online { background: rgba(0, 174, 157, 0.13); color: var(--teal-600); }
.feed-icon.success { background: rgba(125, 182, 28, 0.15); color: #5f8c12; }
.feed-icon.failed { background: rgba(207, 75, 71, 0.11); color: var(--red); }
.feed-icon.blocked { background: rgba(169, 122, 11, 0.12); color: var(--amber); }

.feed-content {
    min-width: 0;
}

.feed-content p {
    font-size: 12px;
    line-height: 1.4;
    color: #3c5254;
}

.feed-content strong {
    font-weight: 600;
    color: var(--ink);
}

.feed-time {
    display: block;
    margin-top: 2px;
    font-size: 10.5px;
    color: #93a5a2;
}

.page-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 22px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    font-size: 10.5px;
    color: #93a5a2;
}

.page-footer p:last-child {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 24, 28, 0.58);
    backdrop-filter: blur(4px);
}

.modal-card {
    position: relative;
    width: min(520px, 100%);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    padding: 24px;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 30px 80px rgba(0, 20, 24, 0.35);
    animation: modalIn 0.22s ease-out;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--muted);
    cursor: pointer;
}

.modal-close:hover {
    color: var(--ink);
    background: #f7faf9;
}

.modal-close svg {
    width: 15px;
    height: 15px;
}

.modal-profile {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-right: 30px;
    margin-bottom: 20px;
}

.modal-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: rgba(0, 174, 157, 0.14);
    color: var(--green);
    font-size: 17px;
    font-weight: 700;
    flex-shrink: 0;
}

.modal-profile h3 {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.2px;
}

.modal-profile p {
    margin: 2px 0 6px;
    font-size: 12px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #f9fbfa;
}

.detail-item {
    min-width: 0;
}

.detail-item span {
    display: block;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.7px;
    text-transform: uppercase;
    color: #8fa19e;
}

.detail-item strong {
    display: block;
    margin-top: 2px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--ink);
    overflow-wrap: anywhere;
}

.risk-block {
    margin-top: 16px;
}

.risk-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 11.5px;
    color: var(--muted);
}

.risk-head strong {
    font-size: 12px;
    color: var(--ink);
}

.risk-track {
    height: 7px;
    border-radius: 999px;
    background: #edf2f0;
    overflow: hidden;
}

.risk-bar {
    height: 100%;
    border-radius: 999px;
    background: var(--teal);
    transition: width 0.3s ease;
}

.risk-bar.medium { background: var(--lime); }
.risk-bar.high { background: var(--red); }

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

.toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 120;
    max-width: 340px;
    padding: 12px 16px;
    border-radius: 11px;
    background: var(--green);
    color: #fff;
    font-size: 12.5px;
    line-height: 1.4;
    box-shadow: 0 16px 40px rgba(0, 24, 28, 0.35);
    animation: toastIn 0.25s ease-out;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.table-wrap::-webkit-scrollbar,
.feed::-webkit-scrollbar,
.nav::-webkit-scrollbar,
.modal-card::-webkit-scrollbar {
    width: 7px;
}

.table-wrap::-webkit-scrollbar-thumb,
.feed::-webkit-scrollbar-thumb,
.nav::-webkit-scrollbar-thumb,
.modal-card::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: #cfdcd8;
}

.table-wrap::-webkit-scrollbar-track,
.feed::-webkit-scrollbar-track,
.nav::-webkit-scrollbar-track,
.modal-card::-webkit-scrollbar-track {
    background: transparent;
}

@media (max-width: 1500px) {
    .bottom-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .feed-panel {
        max-height: none;
    }

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

    .feed li:nth-last-child(-n + 2) {
        border-bottom: 0;
    }
}

@media (max-width: 1280px) {
    .bottom-grid,
    .chart-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .devices-panel {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-areas:
            'head head'
            'donut legend';
        align-items: center;
        column-gap: 20px;
    }

    .devices-panel .panel-head { grid-area: head; }
    .devices-panel .donut-wrap { grid-area: donut; margin: 0 auto; }
    .devices-panel .legend { grid-area: legend; min-width: 220px; }
}

@media (max-width: 1100px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 20px 0 60px rgba(0, 20, 24, 0.25);
    }

    .sidebar.is-open {
        transform: translateX(0);
    }

    .main {
        margin-left: 0;
    }

    .menu-btn {
        display: flex;
    }
}

@media (max-width: 1000px) {
    .col-ip {
        display: none;
    }
}

@media (max-width: 900px) {
    .kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .content {
        padding: 24px 20px 20px;
    }

    .topbar {
        padding: 0 20px;
    }

    .devices-panel {
        display: block;
    }

    .devices-panel .legend {
        min-width: 0;
    }
}

@media (max-width: 720px) {
    .page-head {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
    }

    .head-actions {
        justify-content: flex-start;
    }

    .col-ip,
    .col-device {
        display: none;
    }

    .feed {
        grid-template-columns: minmax(0, 1fr);
        column-gap: 0;
    }

    .feed li:nth-last-child(2) {
        border-bottom: 1px solid #eef3f1;
    }

    .search input {
        width: 160px;
    }

    .profile-id {
        display: none;
    }

    .profile {
        padding-left: 0;
        border-left: 0;
    }

    .live-pill:not(.small) {
        display: none;
    }

    .page-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
}

@media (max-width: 560px) {
    .kpi-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    thead th {
        padding: 9px 8px;
    }

    tbody td {
        padding: 10px 8px;
    }

    .user-cell {
        min-width: 140px;
        gap: 8px;
    }

    .user-avatar {
        width: 28px;
        height: 28px;
    }

    .status {
        padding: 4px 7px;
        font-size: 10px;
    }

    .topbar {
        height: 60px;
        gap: 10px;
    }

    .crumbs span:first-child,
    .crumbs svg {
        display: none;
    }

    .table-tools {
        width: 100%;
    }

    .search {
        flex: 1;
    }

    .search input {
        width: 100%;
    }

    .panel-head-wrap .table-tools {
        margin-top: 4px;
    }

    .col-location {
        display: none;
    }

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

    .donut-wrap {
        margin-bottom: 8px;
    }

    .toast {
        left: 16px;
        right: 16px;
        bottom: 16px;
        max-width: none;
    }
}

@media (max-width: 430px) {
    thead th:last-child,
    tbody td:last-child {
        display: none;
    }

    .user-cell {
        min-width: 128px;
    }

    .table-tools {
        flex-wrap: wrap;
    }

    .search {
        flex: 1 1 100%;
    }

    .table-tools select {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== Refinos mobile (toque) ===== */
@media (max-width: 700px) {
    html {
        -webkit-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }

    * {
        -webkit-tap-highlight-color: transparent;
    }

    body {
        overscroll-behavior-y: none;
    }

    .topbar {
        height: auto;
        min-height: 62px;
        padding: max(9px, env(safe-area-inset-top)) 14px 9px;
        gap: 10px;
    }

    .menu-btn,
    .icon-btn {
        width: 44px;
        height: 44px;
        border-radius: 10px;
    }

    .topbar-brand {
        display: flex;
        align-items: center;
        height: 44px;
        padding: 0 11px;
        border-radius: 10px;
        background: var(--green);
    }

    .topbar-brand img {
        display: block;
        width: 88px;
        height: auto;
    }

    .crumbs {
        display: none;
    }

    .sidebar-brand a {
        display: flex;
        align-items: center;
        min-height: 44px;
    }

    .sidebar {
        width: min(280px, 84vw);
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }

    .nav-item {
        min-height: 46px;
        padding: 12px;
    }

    .sidebar-footer {
        padding-bottom: calc(18px + env(safe-area-inset-bottom));
    }

    .content {
        padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
    }

    .page-head h1 {
        font-size: 21px;
    }

    .head-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .head-actions .btn {
        width: 100%;
        height: 46px;
        padding: 0 10px;
    }

    .kpi-grid {
        gap: 12px;
    }

    .kpi {
        padding: 16px;
    }

    .kpi-value {
        font-size: 27px;
    }

    .panel {
        padding: 16px;
        border-radius: 12px;
    }

    .chart-wrap {
        height: 210px;
    }

    .table-panel {
        padding: 0;
    }

    .table-tools {
        gap: 8px;
    }

    .search,
    select {
        height: 44px;
        font-size: 14px;
    }

    .search input {
        height: 100%;
        font-size: 14px;
    }

    select {
        font-size: 14px;
    }

    .table-wrap {
        max-height: none;
        overflow: visible;
        padding: 0 12px 12px;
        background: #f5f9f8;
    }

    table,
    tbody {
        display: block;
    }

    thead {
        display: none;
    }

    tbody tr {
        display: block;
        margin: 10px 0;
        padding: 12px 14px;
        border: 1px solid var(--line);
        border-radius: 12px;
        background: #fff;
        box-shadow: 0 4px 14px rgba(0, 54, 65, 0.05);
        cursor: pointer;
    }

    tbody tr:active {
        background: #f2f8f6;
    }

    tbody tr:hover {
        background: #fff;
    }

    tbody td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 5px 0;
        border-bottom: 0;
        text-align: right;
    }

    tbody td::before {
        content: attr(data-label);
        flex: 0 0 auto;
        font-size: 10px;
        font-weight: 700;
        letter-spacing: 0.7px;
        text-transform: uppercase;
        color: #8fa19e;
        text-align: left;
    }

    tbody td.time-cell {
        justify-content: flex-start;
        gap: 8px;
        margin-bottom: 4px;
        padding-bottom: 10px;
        border-bottom: 1px dashed #e6efec;
    }

    tbody td.time-cell::before {
        content: none;
    }

    tbody td.time-cell strong {
        font-size: 13.5px;
    }

    tbody td.time-cell span {
        font-size: 11px;
        color: var(--muted);
    }

    .user-cell {
        min-width: 0;
        justify-content: flex-end;
    }

    .user-info {
        text-align: right;
    }

    .loc-cell {
        text-align: right;
    }

    .device-cell span {
        font-size: 12px;
    }

    .ip-cell {
        font-size: 12px;
    }

    tbody td.action-cell {
        justify-content: flex-end;
        padding-top: 10px;
        margin-top: 6px;
        border-top: 1px dashed #e6efec;
    }

    tbody td.action-cell::before {
        content: "Detalhes";
        font-size: 10px;
        font-weight: 700;
        letter-spacing: 0.7px;
        text-transform: uppercase;
        color: #8fa19e;
    }

    .row-action {
        width: 44px;
        height: 44px;
        border-radius: 9px;
    }

    .row-action svg {
        width: 17px;
        height: 17px;
    }

    /* mantém todas as informações visíveis nos cards */
    .col-ip,
    .col-device,
    .col-location {
        display: flex;
    }

    tbody td:last-child {
        display: flex;
    }

    .table-foot {
        flex-wrap: wrap;
        gap: 6px;
        padding: 12px 16px;
    }

    .feed {
        grid-template-columns: minmax(0, 1fr);
        column-gap: 0;
    }

    .feed li:nth-last-child(2) {
        border-bottom: 1px solid #eef3f1;
    }

    .modal {
        align-items: flex-end;
        padding: 0;
    }

    .modal-card {
        width: 100%;
        max-height: calc(100vh - 24px);
        max-height: 92dvh;
        padding: 20px 16px calc(18px + env(safe-area-inset-bottom));
        border-radius: 18px 18px 0 0;
        animation: sheetIn 0.25s ease-out;
    }

    @keyframes sheetIn {
        from { opacity: 0.7; transform: translateY(26px); }
        to { opacity: 1; transform: translateY(0); }
    }

    .modal-close {
        top: 12px;
        right: 12px;
        width: 40px;
        height: 40px;
    }

    .modal-foot .btn {
        width: 100%;
        height: 46px;
    }

    .detail-item strong {
        font-size: 13px;
    }

    .toast {
        left: 12px;
        right: 12px;
        bottom: calc(12px + env(safe-area-inset-bottom));
        max-width: none;
    }

    .page-footer {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

@media (max-width: 400px) {
    .content {
        padding-left: 12px;
        padding-right: 12px;
    }

    .page-head h1 {
        font-size: 19px;
    }

    .kpi-value {
        font-size: 25px;
    }

    thead th:last-child,
    tbody td:last-child {
        display: flex;
    }

    tbody td {
        gap: 8px;
    }

    .table-wrap {
        padding: 0 8px 10px;
    }

    .user-avatar {
        width: 30px;
        height: 30px;
    }

    .status {
        padding: 4px 8px;
    }
}