:root {
    /* ISP Digital palette (RnB Networks) */
    --isp-primary: #143652;
    --isp-primary-hover: #0f2a3d;
    --isp-accent: #003188;
    --isp-sidebar: #143652;
    --isp-sidebar-text: #e8eef5;
    --isp-bg: #f1f4f8;
    --isp-card: #ffffff;
    --isp-border: #e5e7eb;
    --isp-text: #111827;
    --isp-muted: #6b7280;
    --isp-success: #128269;
    --isp-danger: #ed2323;
    --isp-warning: #d97706;
    --rnb-radius: 8px;
    --rnb-shadow: 0 1px 3px rgba(20, 54, 82, 0.08), 0 4px 12px rgba(20, 54, 82, 0.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body.rnb-app {
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    background: var(--isp-bg);
    color: var(--isp-text);
    font-size: 14px;
}

a { color: var(--isp-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ========== LOGIN (ISP Digital split layout) ========== */
body.rnb-login-isp { background: #f3f3f3; font-family: 'Inter', sans-serif; }

.rnb-login-split {
    display: flex;
    min-height: 100vh;
}

.rnb-login-split__brand {
    flex: 0 0 38%;
    max-width: 480px;
    background: var(--isp-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.rnb-login-split__brand-inner { text-align: center; max-width: 320px; }

.rnb-login-logo-ring {
    width: 180px;
    height: 180px;
    margin: 0 auto 1.25rem;
    border-radius: 50%;
    background: #f3f3f3;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid rgba(255,255,255,.15);
}

.rnb-login-logo-text {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--isp-primary);
    letter-spacing: -1px;
}

.rnb-login-company {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.rnb-login-slogan {
    margin: .5rem 0 0;
    font-size: 1rem;
    font-weight: 400;
    opacity: .9;
}

.rnb-login-version {
    margin-top: 2rem;
    font-size: .8rem;
    opacity: .75;
}

.rnb-login-split__form {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2rem 3rem;
    position: relative;
}

.rnb-login-form-wrap { max-width: 400px; width: 100%; }

.rnb-login-title {
    margin: 0 0 1.5rem;
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--isp-text);
}

.rnb-field-isp { margin-bottom: 1.1rem; }
.rnb-field-isp label {
    display: block;
    font-size: .85rem;
    font-weight: 500;
    color: var(--isp-muted);
    margin-bottom: .4rem;
}

.rnb-input-group {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--isp-border);
    border-radius: var(--rnb-radius);
    overflow: hidden;
    background: #fff;
}

.rnb-input-group__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    background: var(--isp-primary);
    color: #fff;
    font-size: .9rem;
}

.rnb-input-isp {
    flex: 1;
    border: 0;
    padding: .7rem .85rem;
    font: inherit;
    background: #fff;
    color: var(--isp-text);
}

.rnb-input-isp:focus { outline: none; }
.rnb-input-group:focus-within {
    border-color: var(--isp-primary);
    box-shadow: 0 0 0 3px rgba(20, 54, 82, 0.12);
}

.rnb-remember {
    display: flex;
    align-items: center;
    gap: .5rem;
    color: var(--isp-primary);
    font-size: .88rem;
    margin-bottom: 1.25rem;
    cursor: pointer;
}

.rnb-btn-isp {
    display: inline-block;
    width: 100%;
    padding: .75rem 1.25rem;
    border: 0;
    border-radius: var(--rnb-radius);
    background: var(--isp-primary);
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s;
}

.rnb-btn-isp:hover { background: var(--isp-primary-hover); }

.rnb-login-help {
    margin-top: 1.25rem;
    font-size: .82rem;
    color: var(--isp-muted);
}

.rnb-login-copy {
    position: absolute;
    bottom: 1rem;
    right: 1.5rem;
    font-size: .75rem;
    color: var(--isp-muted);
}

.rnb-alert-inline {
    padding: .65rem .85rem;
    border-radius: var(--rnb-radius);
    margin-bottom: 1rem;
    font-size: .88rem;
}

.rnb-alert-inline--error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

@media (max-width: 768px) {
    .rnb-login-split { flex-direction: column; }
    .rnb-login-split__brand { flex: none; max-width: none; padding: 2rem 1rem; }
    .rnb-login-logo-ring { width: 120px; height: 120px; }
    .rnb-login-split__form { padding: 1.5rem; }
}

/* ========== APP SHELL ========== */
.rnb-shell { display: flex; min-height: 100vh; }

.rnb-sidebar {
    width: 260px;
    flex-shrink: 0;
    background: var(--isp-sidebar);
    color: var(--isp-sidebar-text);
    display: flex;
    flex-direction: column;
    padding: 0;
    position: sticky;
    top: 0;
    height: 100vh;
}

.rnb-brand {
    display: flex;
    gap: .75rem;
    align-items: center;
    padding: 1.1rem 1rem;
    background: rgba(0,0,0,.12);
    border-bottom: 1px solid rgba(255,255,255,.08);
    position: relative;
}

.rnb-brand__text {
    flex: 1;
    min-width: 0;
}

.rnb-brand__logo {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #fff;
    color: var(--isp-primary);
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: .85rem;
    flex-shrink: 0;
}

.rnb-brand__name { font-weight: 700; font-size: .95rem; color: #fff; }
.rnb-brand__host { font-size: .68rem; opacity: .75; }

.rnb-sidebar__collapse {
    margin-left: auto;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border: 1px solid rgba(255,255,255,.15);
    border-radius: 6px;
    background: rgba(255,255,255,.08);
    color: rgba(255,255,255,.85);
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background .15s, border-color .15s;
}

.rnb-sidebar__collapse:hover {
    background: rgba(255,255,255,.15);
    border-color: rgba(255,255,255,.25);
}

.rnb-sidebar--mini {
    width: 72px;
}

.rnb-sidebar--mini .rnb-brand__text,
.rnb-sidebar--mini .rnb-nav-group__label,
.rnb-sidebar--mini .rnb-nav__text,
.rnb-sidebar--mini .rnb-nav-group__chevron {
    display: none;
}

.rnb-sidebar--mini .rnb-brand {
    justify-content: center;
    padding: 1rem .5rem;
}

.rnb-sidebar--mini .rnb-sidebar__collapse svg {
    transform: rotate(180deg);
}

.rnb-sidebar--mini .rnb-nav-group__toggle {
    display: none;
}

.rnb-sidebar--mini .rnb-nav-group__panel {
    max-height: none !important;
    overflow: visible;
}

.rnb-sidebar--mini .rnb-nav__link {
    justify-content: center;
    padding: .6rem;
}

.rnb-sidebar--mini .rnb-nav__icon {
    margin: 0;
    font-size: 1.05rem;
}

.rnb-nav--scroll {
    overflow-y: auto;
    flex: 1;
    padding: .35rem .55rem 1rem;
}

.rnb-nav-group {
    margin-bottom: .15rem;
}

.rnb-nav-group__toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: .55rem .55rem .45rem;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: rgba(255,255,255,.5);
    font: inherit;
    font-size: .64rem;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    cursor: pointer;
    transition: color .15s, background .15s;
}

.rnb-nav-group__toggle:hover {
    color: rgba(255,255,255,.75);
    background: rgba(255,255,255,.06);
}

.rnb-nav-group__label {
    flex: 1;
    text-align: left;
}

.rnb-nav-group__chevron {
    flex-shrink: 0;
    opacity: .7;
    transition: transform .2s ease;
}

.rnb-nav-group.is-open .rnb-nav-group__chevron {
    transform: rotate(180deg);
}

.rnb-nav-group.is-open .rnb-nav-group__toggle {
    color: rgba(255,255,255,.72);
}

.rnb-nav-group__panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height .25s ease;
    padding-left: .15rem;
}

.rnb-nav-group.is-open .rnb-nav-group__panel {
    max-height: 480px;
}

.rnb-nav__section {
    display: none;
}

.rnb-nav__link {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .55rem .75rem;
    border-radius: 6px;
    color: rgba(255,255,255,.85);
    text-decoration: none;
    font-size: .88rem;
    transition: background .15s;
}

.rnb-nav__icon {
    width: 1.25rem;
    text-align: center;
    font-size: .95rem;
    opacity: .9;
    flex-shrink: 0;
}

.rnb-nav__link:hover {
    background: rgba(255,255,255,.1);
    color: #fff;
    text-decoration: none;
}

.rnb-nav__link.is-active {
    background: rgba(255,255,255,.18);
    color: #fff;
    font-weight: 600;
    box-shadow: inset 3px 0 0 rgba(255,255,255,.55);
}

.rnb-nav__text {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rnb-sidebar__foot {
    display: none;
}

.rnb-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.rnb-topbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .65rem 1.25rem;
    background: var(--isp-card);
    border-bottom: 1px solid var(--isp-border);
    box-shadow: var(--rnb-shadow);
    position: sticky;
    top: 0;
    z-index: 50;
}

.rnb-menu-btn {
    display: none;
    background: var(--isp-bg);
    border: 1px solid var(--isp-border);
    border-radius: 6px;
    padding: .35rem .55rem;
    cursor: pointer;
}

.rnb-topbar__title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--isp-text);
    flex: 1;
    min-width: 0;
}

.rnb-topbar__actions {
    display: flex;
    align-items: center;
    gap: .85rem;
    margin-left: auto;
    flex-shrink: 0;
}

.rnb-pill {
    font-size: .72rem;
    padding: .25rem .6rem;
    border-radius: 999px;
    background: #ecfdf5;
    color: var(--isp-success);
    border: 1px solid #a7f3d0;
    font-weight: 600;
    white-space: nowrap;
}

/* Header user menu */
.rnb-user-menu {
    position: relative;
}

.rnb-user-menu__trigger {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .35rem .5rem .35rem .35rem;
    border: 1px solid var(--isp-border);
    border-radius: 999px;
    background: #fff;
    cursor: pointer;
    font: inherit;
    color: var(--isp-text);
    transition: border-color .15s, box-shadow .15s, background .15s;
}

.rnb-user-menu__trigger:hover,
.rnb-user-menu.is-open .rnb-user-menu__trigger {
    border-color: rgba(20, 54, 82, .25);
    box-shadow: 0 2px 8px rgba(20, 54, 82, .08);
    background: #f8fafc;
}

.rnb-user-menu__avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--isp-primary), var(--isp-accent));
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: .9rem;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(20, 54, 82, .2);
}

.rnb-user-menu__avatar--lg {
    width: 42px;
    height: 42px;
    font-size: 1rem;
}

.rnb-user-menu__info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    line-height: 1.25;
    min-width: 0;
}

.rnb-user-menu__name {
    font-size: .84rem;
    font-weight: 600;
    color: var(--isp-text);
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rnb-user-menu__role {
    font-size: .72rem;
    color: var(--isp-muted);
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rnb-user-menu__chevron {
    color: var(--isp-muted);
    flex-shrink: 0;
    margin-right: .15rem;
    transition: transform .15s;
}

.rnb-user-menu.is-open .rnb-user-menu__chevron {
    transform: rotate(180deg);
}

.rnb-user-menu__panel {
    position: absolute;
    top: calc(100% + .5rem);
    right: 0;
    min-width: 220px;
    background: #fff;
    border: 1px solid var(--isp-border);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(20, 54, 82, .12), 0 2px 6px rgba(20, 54, 82, .06);
    padding: .5rem;
    animation: rnb-menu-in .15s ease-out;
}

.rnb-user-menu__panel[hidden] {
    display: none;
}

@keyframes rnb-menu-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.rnb-user-menu__panel-head {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .65rem .5rem;
}

.rnb-user-menu__panel-name {
    font-size: .88rem;
    font-weight: 600;
    color: var(--isp-text);
}

.rnb-user-menu__panel-role {
    font-size: .75rem;
    color: var(--isp-muted);
    margin-top: .15rem;
}

.rnb-user-menu__divider {
    height: 1px;
    background: var(--isp-border);
    margin: .25rem 0;
}

.rnb-user-menu__item {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .6rem .65rem;
    border-radius: 8px;
    font-size: .84rem;
    font-weight: 500;
    color: var(--isp-text);
    text-decoration: none;
    transition: background .12s;
}

.rnb-user-menu__item:hover {
    background: #f3f4f6;
    text-decoration: none;
}

.rnb-user-menu__item--danger {
    color: var(--isp-danger);
}

.rnb-user-menu__item--danger:hover {
    background: #fef2f2;
}

.rnb-content { padding: 1.25rem; flex: 1; }

.rnb-footer {
    padding: .75rem 1.25rem;
    border-top: 1px solid var(--isp-border);
    background: #fff;
    display: flex;
    justify-content: space-between;
    font-size: .75rem;
    color: var(--isp-muted);
}

/* Alerts */
.rnb-alert {
    margin: 0 1.25rem;
    padding: .65rem .85rem;
    border-radius: var(--rnb-radius);
    font-size: .88rem;
}

.rnb-alert--success { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; }
.rnb-alert--error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }

/* Cards & tables */
.rnb-card {
    background: var(--isp-card);
    border: 1px solid var(--isp-border);
    border-radius: var(--rnb-radius);
    padding: 1rem 1.15rem;
    box-shadow: var(--rnb-shadow);
    margin-bottom: 1rem;
}

.rnb-card__title { margin: 0 0 .85rem; font-size: 1rem; font-weight: 600; color: var(--isp-text); }

.rnb-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: .85rem;
}

.rnb-card__head .rnb-card__title { margin: 0; }

.rnb-card__meta { font-size: .78rem; }

.rnb-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1rem; }

.rnb-stat {
    background: var(--isp-card);
    border: 1px solid var(--isp-border);
    border-radius: var(--rnb-radius);
    padding: 1rem 1.1rem;
    box-shadow: var(--rnb-shadow);
    position: relative;
    overflow: hidden;
    transition: transform .15s, box-shadow .15s, border-color .15s;
}

.rnb-stat::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--isp-primary), var(--isp-accent));
    border-radius: 4px 0 0 4px;
}

.rnb-stat--link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.rnb-stat--link:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(20, 54, 82, 0.1);
    border-color: rgba(20, 54, 82, 0.15);
    text-decoration: none;
}

.rnb-stat__icon {
    font-size: 1.1rem;
    margin-bottom: .35rem;
    opacity: .85;
}

.rnb-stat__label { font-size: .75rem; color: var(--isp-muted); text-transform: uppercase; letter-spacing: .04em; }
.rnb-stat__value { font-size: 1.5rem; font-weight: 700; color: var(--isp-primary); margin-top: .25rem; }
.rnb-stat__value--sm { font-size: 1rem; }
.rnb-stat__sub { font-size: .75rem; color: var(--isp-muted); margin-top: .2rem; }

.rnb-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.rnb-table th, .rnb-table td { padding: .6rem .5rem; text-align: left; border-bottom: 1px solid var(--isp-border); }
.rnb-table th {
    background: #f8fafc;
    color: var(--isp-muted);
    font-weight: 600;
    font-size: .75rem;
    text-transform: uppercase;
}

.rnb-badge {
    display: inline-block;
    padding: .15rem .5rem;
    border-radius: 4px;
    font-size: .72rem;
    font-weight: 600;
}

.rnb-badge--active, .rnb-badge--online { background: #d1fae5; color: #065f46; }
.rnb-badge--offline, .rnb-badge--suspended { background: #fee2e2; color: #991b1b; }
.rnb-badge--unpaid, .rnb-badge--open { background: #fef3c7; color: #92400e; }
.rnb-badge--paid, .rnb-badge--closed { background: #e5e7eb; color: #374151; }
.rnb-badge--partial, .rnb-badge--pending { background: #dbeafe; color: #1e40af; }
.rnb-badge--high { background: #fee2e2; color: #991b1b; }
.rnb-badge--normal { background: #e0f2fe; color: #0369a1; }
.rnb-badge--low { background: #f3f4f6; color: #6b7280; }
.rnb-badge--inactive, .rnb-badge--expired { background: #f3f4f6; color: #6b7280; }

.rnb-input {
    width: 100%;
    padding: .55rem .75rem;
    border: 1px solid var(--isp-border);
    border-radius: var(--rnb-radius);
    font: inherit;
    background: #fff;
}

.rnb-input:focus { outline: none; border-color: var(--isp-primary); box-shadow: 0 0 0 3px rgba(20,54,82,.1); }

.rnb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .55rem 1rem;
    border: 0;
    border-radius: var(--rnb-radius);
    background: var(--isp-primary);
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.rnb-btn:hover { background: var(--isp-primary-hover); }
.rnb-btn--ghost { background: #fff; border: 1px solid var(--isp-border); color: var(--isp-text); }
.rnb-btn--sm { padding: .45rem .85rem; font-size: .85rem; }
.rnb-btn--xs { padding: .3rem .55rem; font-size: .75rem; }
.rnb-btn--danger { background: var(--isp-danger); }

.rnb-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .85rem; }
.rnb-field--full { grid-column: 1 / -1; }
.rnb-form-actions { display: flex; gap: .65rem; margin-top: .5rem; flex-wrap: wrap; }
.rnb-form-card { margin-bottom: 1rem; }

.rnb-page-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1rem; flex-wrap: wrap; gap: .75rem; }
.rnb-page-head__title { margin: 0; font-size: 1.2rem; font-weight: 600; }
.rnb-page-head__sub { margin: .25rem 0 0; color: var(--isp-muted); font-size: .88rem; }

.rnb-toolbar { display: flex; flex-wrap: wrap; gap: .65rem; margin-bottom: 1rem; align-items: center; }
.rnb-empty { text-align: center; padding: 2rem; color: var(--isp-muted); }
.rnb-muted { color: var(--isp-muted); }

.rnb-signal--good { color: var(--isp-success); font-weight: 600; }
.rnb-signal--warn { color: var(--isp-warning); }
.rnb-signal--bad { color: var(--isp-danger); }

.rnb-list { margin: 0; padding-left: 1.2rem; color: var(--isp-muted); line-height: 1.7; }
.rnb-info-card { font-size: .88rem; }

.rnb-actions { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.rnb-inline-form { display: inline; }
.rnb-link-btn { font-size: .82rem; color: var(--isp-accent); background: none; border: 0; cursor: pointer; padding: 0; font: inherit; }
.rnb-link-btn--danger { color: var(--isp-danger); }

.rnb-search-form { display: flex; gap: .5rem; flex: 1; flex-wrap: wrap; }

.rnb-label { display: block; font-size: .78rem; font-weight: 600; color: var(--isp-muted); margin-bottom: .35rem; }

.rnb-input--xs { padding: .25rem .45rem; font-size: .78rem; min-width: 90px; }

.rnb-table--plain th { background: transparent; text-transform: none; font-size: .82rem; width: 35%; }
.rnb-table--plain td { font-size: .88rem; }
.rnb-row-error { font-size: .78rem; color: var(--isp-danger); background: #fef2f2; }

.rnb-chart-bars { display: flex; align-items: flex-end; gap: .5rem; height: 140px; padding-top: .5rem; }

.rnb-chart-bars--labeled { height: 160px; }

.rnb-chart-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
    gap: .35rem;
}

.rnb-chart-col__label {
    font-size: .68rem;
    color: var(--isp-muted);
    font-weight: 500;
}

.rnb-chart-total {
    font-size: .82rem;
    color: var(--isp-muted);
    margin: .85rem 0 0;
}

.rnb-chart-total strong { color: var(--isp-primary); }
.rnb-chart-bar {
    flex: 1;
    border-radius: 4px 4px 0 0;
    background: linear-gradient(180deg, var(--isp-primary), #6d89bc);
    min-height: 8px;
}

.rnb-grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1rem; }
@media (max-width: 960px) { .rnb-grid-2 { grid-template-columns: 1fr; } }

@media (max-width: 860px) {
    .rnb-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform .2s;
        box-shadow: 4px 0 24px rgba(0,0,0,.15);
    }
    .rnb-sidebar.is-open { transform: translateX(0); }
    .rnb-menu-btn { display: inline-block; }
    .rnb-user-menu__info { display: none; }
    .rnb-user-menu__chevron { display: none; }
    .rnb-user-menu__trigger {
        border-radius: 50%;
        padding: .2rem;
        border: 0;
        background: transparent;
    }
    .rnb-pill--live { display: none; }
}
