@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --primary: #4f46e5;
    --primary-dark: #3730a3;
    --secondary: #06b6d4;
    --ink: #0f172a;
    --muted: #64748b;
    --line: #e2e8f0;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --sidebar: #0b1324;
    --sidebar-soft: #111c32;
    --danger: #dc2626;
    --shadow: 0 24px 80px rgba(15, 23, 42, 0.18);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--ink);
    background: var(--surface-soft);
}

button,
input {
    font: inherit;
}

svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

/* Login */
.login-body {
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    background:
        radial-gradient(circle at 15% 20%, rgba(79, 70, 229, 0.22), transparent 34%),
        radial-gradient(circle at 90% 80%, rgba(6, 182, 212, 0.16), transparent 28%),
        linear-gradient(135deg, #07111f 0%, #0d1a30 46%, #111827 100%);
}

.login-body::before {
    content: '';
    position: fixed;
    inset: 0;
    opacity: .16;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255,255,255,.07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.07) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: linear-gradient(to bottom, black, transparent);
}

.login-decoration {
    position: fixed;
    border-radius: 999px;
    filter: blur(10px);
    opacity: .45;
    pointer-events: none;
}

.decoration-one {
    width: 250px;
    height: 250px;
    top: -80px;
    right: 14%;
    background: linear-gradient(145deg, #4f46e5, #06b6d4);
}

.decoration-two {
    width: 180px;
    height: 180px;
    bottom: -60px;
    left: 8%;
    background: linear-gradient(145deg, #7c3aed, #2563eb);
}

.login-wrapper {
    position: relative;
    z-index: 2;
    width: min(1180px, calc(100% - 40px));
    min-height: 100vh;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1.05fr .8fr;
    align-items: center;
    gap: 80px;
    padding: 48px 0;
}

.login-showcase {
    color: #fff;
    padding: 30px 10px;
}

.showcase-badge {
    display: inline-flex;
    padding: 9px 14px;
    margin-bottom: 24px;
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 999px;
    background: rgba(255,255,255,.08);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
    backdrop-filter: blur(12px);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .14em;
    color: #cbd5e1;
}

.login-showcase h1 {
    margin: 0;
    max-width: 700px;
    font-size: clamp(44px, 5vw, 72px);
    line-height: 1.04;
    letter-spacing: -.055em;
}

.login-showcase h1 span {
    background: linear-gradient(90deg, #a5b4fc, #67e8f9);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.login-showcase > p {
    max-width: 610px;
    margin: 28px 0 38px;
    color: #aebbd0;
    font-size: 17px;
    line-height: 1.8;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    max-width: 630px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 17px;
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 18px;
    background: rgba(255,255,255,.055);
    backdrop-filter: blur(12px);
}

.feature-icon {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    color: #a5f3fc;
    background: linear-gradient(145deg, rgba(79,70,229,.65), rgba(6,182,212,.36));
}

.feature-item strong,
.feature-item span {
    display: block;
}

.feature-item strong {
    margin-bottom: 4px;
    font-size: 14px;
}

.feature-item span {
    color: #94a3b8;
    font-size: 12px;
    line-height: 1.5;
}

.login-card {
    width: 100%;
    max-width: 460px;
    justify-self: end;
    padding: 38px;
    border: 1px solid rgba(255,255,255,.15);
    border-radius: 30px;
    background: rgba(255,255,255,.97);
    box-shadow: var(--shadow);
    backdrop-filter: blur(22px);
}

.mobile-brand {
    display: none;
}

.login-card-header {
    margin-bottom: 26px;
}

.mini-logo {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    margin-bottom: 22px;
    border-radius: 17px;
    color: #fff;
    background: linear-gradient(145deg, var(--primary), var(--secondary));
    box-shadow: 0 14px 28px rgba(79, 70, 229, .25);
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -.05em;
}

.login-card-header p {
    margin: 0 0 6px;
    color: var(--primary);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.login-card-header h2 {
    margin: 0 0 10px;
    font-size: 30px;
    letter-spacing: -.04em;
}

.login-card-header > span {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

.alert {
    padding: 13px 14px;
    margin-bottom: 18px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
}

.alert-danger {
    color: #991b1b;
    background: #fef2f2;
    border: 1px solid #fecaca;
}

.login-form {
    display: grid;
    gap: 10px;
}

.login-form label {
    margin-top: 5px;
    font-size: 13px;
    font-weight: 700;
    color: #334155;
}

.input-group {
    height: 54px;
    display: flex;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    transition: .2s ease;
}

.input-group:focus-within {
    border-color: #818cf8;
    box-shadow: 0 0 0 4px rgba(99,102,241,.12);
}

.input-icon {
    width: 48px;
    display: grid;
    place-items: center;
    color: #94a3b8;
}

.input-icon svg,
.password-toggle svg {
    width: 20px;
    height: 20px;
}

.input-group input {
    width: 100%;
    height: 100%;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--ink);
    font-size: 14px;
}

.input-group input::placeholder {
    color: #a8b2c1;
}

.password-toggle {
    width: 48px;
    height: 100%;
    border: 0;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
}

.password-toggle:hover,
.password-toggle.active {
    color: var(--primary);
}

.login-button {
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 14px;
    border: 0;
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(100deg, #4f46e5, #2563eb 55%, #06b6d4);
    box-shadow: 0 16px 28px rgba(37, 99, 235, .24);
    font-weight: 700;
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease;
}

.login-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 32px rgba(37, 99, 235, .31);
}

.login-button svg {
    width: 20px;
    height: 20px;
}

.login-footer {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding-top: 24px;
    margin-top: 26px;
    border-top: 1px solid #eef2f7;
    color: #94a3b8;
    font-size: 11px;
}

/* Main application */
.app-body {
    background: #f5f7fb;
}

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

.sidebar {
    position: fixed;
    z-index: 30;
    inset: 0 auto 0 0;
    width: 270px;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 24px 18px 18px;
    color: #dbe4f4;
    background:
        radial-gradient(circle at 12% 5%, rgba(79,70,229,.24), transparent 28%),
        linear-gradient(180deg, var(--sidebar) 0%, #0a1220 100%);
    box-shadow: 16px 0 40px rgba(15,23,42,.08);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
    padding: 2px 10px 20px;
}

.brand-mark {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    flex: 0 0 44px;
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(145deg, var(--primary), var(--secondary));
    box-shadow: 0 12px 24px rgba(79,70,229,.26);
    font-weight: 800;
    letter-spacing: -.05em;
}

.brand-copy strong,
.brand-copy span {
    display: block;
}

.brand-copy strong {
    color: #fff;
    font-size: 16px;
    letter-spacing: -.02em;
}

.brand-copy span {
    margin-top: 4px;
    color: #7f8da5;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .11em;
}

.sidebar-nav {
    min-height: 0;
    display: grid;
    flex: 1 1 auto;
    align-content: start;
    gap: 8px;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 0 5px 14px 0;
    overscroll-behavior: contain;
    scroll-behavior: smooth;
    scrollbar-gutter: stable;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
}

.sidebar-nav::-webkit-scrollbar {
    width: 5px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(148, 163, 184, .28);
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, .48);
}

.sidebar-nav {
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, .32) transparent;
}

.nav-label {
    margin: 10px 12px 6px;
    color: #516078;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .14em;
}

.nav-item {
    min-height: 49px;
    display: flex;
    align-items: center;
    gap: 13px;
    position: relative;
    padding: 0 14px;
    border-radius: 13px;
    color: #8fa0b9;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: .2s ease;
}

.nav-item:hover {
    color: #fff;
    background: rgba(255,255,255,.055);
    transform: translateX(2px);
}

.nav-item.active {
    color: #fff;
    background: linear-gradient(95deg, rgba(79,70,229,.98), rgba(37,99,235,.88));
    box-shadow: 0 12px 30px rgba(37,99,235,.18);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: -18px;
    width: 4px;
    height: 24px;
    border-radius: 0 8px 8px 0;
    background: #67e8f9;
}

.nav-icon {
    width: 24px;
    display: grid;
    place-items: center;
}

.nav-icon svg {
    width: 20px;
    height: 20px;
}

.sidebar-bottom {
    flex: 0 0 auto;
    margin-top: 0;
    padding-top: 12px;
    border-top: 1px solid rgba(148, 163, 184, .11);
    background: linear-gradient(
        180deg,
        rgba(10, 18, 32, 0),
        rgba(10, 18, 32, .96) 20%
    );
}

.logout-link {
    color: #fca5a5;
}

.logout-link:hover {
    color: #fff;
    background: rgba(220,38,38,.16);
}

.sidebar-version {
    margin-top: 18px;
    color: #475569;
    font-size: 10px;
    text-align: center;
}

.main-area {
    width: calc(100% - 270px);
    min-height: 100vh;
    margin-left: 270px;
}

.topbar {
    min-height: 96px;
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 18px 34px;
    border-bottom: 1px solid #e9edf4;
    background: rgba(255,255,255,.88);
    backdrop-filter: blur(16px);
    position: sticky;
    top: 0;
    z-index: 20;
}

.menu-toggle {
    display: none;
    width: 42px;
    height: 42px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    color: #475569;
    cursor: pointer;
}

.page-heading {
    min-width: 0;
}

.eyebrow {
    display: block;
    margin-bottom: 5px;
    color: #94a3b8;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .14em;
}

.page-heading h1 {
    margin: 0;
    font-size: 24px;
    letter-spacing: -.035em;
}

.user-area {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-left: auto;
    padding: 7px 10px 7px 8px;
    border: 1px solid #eef2f7;
    border-radius: 15px;
    background: #fff;
    box-shadow: 0 8px 28px rgba(15,23,42,.05);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 4px rgba(34,197,94,.11);
}

.avatar {
    width: 39px;
    height: 39px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: #fff;
    background: linear-gradient(145deg, #111827, #334155);
    font-size: 14px;
    font-weight: 800;
}

.user-copy strong,
.user-copy span {
    display: block;
}

.user-copy strong {
    max-width: 160px;
    overflow: hidden;
    color: #334155;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-copy span {
    margin-top: 3px;
    color: #94a3b8;
    font-size: 10px;
}

.page-content {
    padding: 30px 34px 36px;
}

.blank-canvas {
    min-height: calc(100vh - 162px);
    border: 1px solid #edf1f6;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 14px 40px rgba(15,23,42,.045);
}

.sidebar-overlay {
    display: none;
}

@media (max-width: 960px) {
    .login-wrapper {
        grid-template-columns: 1fr;
        justify-items: center;
        gap: 32px;
        padding: 32px 0;
    }

    .login-showcase {
        display: none;
    }

    .login-card {
        justify-self: center;
    }

    .mobile-brand {
        display: flex;
        align-items: center;
        gap: 12px;
        margin-bottom: 26px;
    }

    .mobile-brand .brand-copy strong {
        color: var(--ink);
    }

    .mobile-brand .brand-copy span {
        color: #94a3b8;
    }

    .sidebar {
        transform: translateX(-102%);
        transition: transform .25s ease;
    }

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

    .sidebar-overlay {
        position: fixed;
        z-index: 25;
        inset: 0;
        display: block;
        pointer-events: none;
        opacity: 0;
        background: rgba(2,6,23,.52);
        backdrop-filter: blur(2px);
        transition: opacity .25s ease;
    }

    .sidebar-overlay.show {
        pointer-events: auto;
        opacity: 1;
    }

    .main-area {
        width: 100%;
        margin-left: 0;
    }

    .menu-toggle {
        display: grid;
    }

    body.sidebar-open {
        overflow: hidden;
    }
}

@media (max-width: 640px) {
    .login-wrapper {
        width: min(100% - 24px, 460px);
    }

    .login-card {
        padding: 26px 22px;
        border-radius: 24px;
    }

    .login-card-header h2 {
        font-size: 26px;
    }

    .login-footer {
        flex-direction: column;
        gap: 5px;
        text-align: center;
    }

    .topbar {
        min-height: 82px;
        padding: 14px 16px;
    }

    .eyebrow,
    .user-copy,
    .status-dot {
        display: none;
    }

    .page-heading h1 {
        font-size: 20px;
    }

    .user-area {
        padding: 5px;
        border: 0;
        background: transparent;
        box-shadow: none;
    }

    .page-content {
        padding: 18px 16px 24px;
    }

    .blank-canvas {
        min-height: calc(100vh - 124px);
        border-radius: 16px;
    }
}


/* MikroTik integration */
.mikrotik-page {
    display: grid;
    gap: 24px;
}

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

.section-kicker {
    display: block;
    margin-bottom: 8px;
    color: #4f46e5;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .15em;
}

.content-title-row h2 {
    margin: 0 0 8px;
    color: #111827;
    font-size: 28px;
    letter-spacing: -.04em;
}

.content-title-row p {
    margin: 0;
    color: #64748b;
    font-size: 14px;
}

.connection-pill {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    flex: 0 0 auto;
    padding: 10px 14px;
    border: 1px solid;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.connection-pill span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.connection-pill.connected {
    color: #15803d;
    border-color: #bbf7d0;
    background: #f0fdf4;
}

.connection-pill.connected span {
    background: #22c55e;
    box-shadow: 0 0 0 4px rgba(34,197,94,.12);
}

.connection-pill.failed {
    color: #b91c1c;
    border-color: #fecaca;
    background: #fef2f2;
}

.connection-pill.failed span {
    background: #ef4444;
    box-shadow: 0 0 0 4px rgba(239,68,68,.1);
}

.connection-pill.pending {
    color: #92400e;
    border-color: #fde68a;
    background: #fffbeb;
}

.connection-pill.pending span {
    background: #f59e0b;
    box-shadow: 0 0 0 4px rgba(245,158,11,.1);
}

.notice {
    display: flex;
    align-items: flex-start;
    gap: 13px;
    padding: 16px 18px;
    border: 1px solid;
    border-radius: 16px;
}

.notice-icon {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    flex: 0 0 30px;
    border-radius: 10px;
    font-weight: 800;
}

.notice strong {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
}

.notice p {
    margin: 0;
    font-size: 12px;
    line-height: 1.6;
}

.notice-success {
    color: #166534;
    border-color: #bbf7d0;
    background: #f0fdf4;
}

.notice-success .notice-icon {
    color: #fff;
    background: #22c55e;
}

.notice-danger {
    color: #991b1b;
    border-color: #fecaca;
    background: #fff7f7;
}

.notice-danger .notice-icon {
    color: #fff;
    background: #ef4444;
}

.mikrotik-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(280px, .7fr);
    gap: 22px;
    align-items: start;
}

.settings-card,
.info-card,
.router-result-card,
.saved-status-card,
.connection-history {
    border: 1px solid #e9edf4;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 14px 40px rgba(15,23,42,.045);
}

.settings-card {
    padding: 28px;
}

.card-heading {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 23px;
    margin-bottom: 23px;
    border-bottom: 1px solid #eef2f7;
}

.heading-icon {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    flex: 0 0 46px;
    border-radius: 14px;
    color: #4f46e5;
    background: #eef2ff;
}

.heading-icon svg {
    width: 22px;
    height: 22px;
}

.card-heading h3,
.info-card h3,
.result-header h3,
.saved-status-card h3,
.history-heading h3 {
    margin: 0;
    color: #172033;
    letter-spacing: -.025em;
}

.card-heading h3 {
    margin-bottom: 5px;
    font-size: 17px;
}

.card-heading p {
    margin: 0;
    color: #8491a6;
    font-size: 12px;
}

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

.full-field {
    grid-column: 1 / -1;
}

.form-field {
    display: grid;
    gap: 8px;
}

.form-field > label:not(.switch-row) {
    color: #253047;
    font-size: 12px;
    font-weight: 700;
}

.form-field input[type="text"],
.form-field input[type="password"],
.form-field input[type="number"] {
    width: 100%;
    height: 50px;
    padding: 0 14px;
    border: 1px solid #dce3ed;
    border-radius: 13px;
    outline: none;
    background: #fff;
    color: #172033;
    font-size: 13px;
    transition: .2s ease;
}

.form-field input:focus {
    border-color: #818cf8;
    box-shadow: 0 0 0 4px rgba(99,102,241,.1);
}

.form-field small {
    color: #94a3b8;
    font-size: 10px;
    line-height: 1.45;
}

.password-field,
.suffix-field {
    position: relative;
}

.password-field input {
    padding-right: 48px !important;
}

.field-password-toggle {
    position: absolute;
    top: 0;
    right: 0;
    width: 48px;
    height: 50px;
    display: grid;
    place-items: center;
    border: 0;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
}

.field-password-toggle.active,
.field-password-toggle:hover {
    color: #4f46e5;
}

.field-password-toggle svg {
    width: 19px;
    height: 19px;
}

.suffix-field input {
    padding-right: 58px !important;
}

.suffix-field span {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 11px;
    font-weight: 600;
}

.option-field {
    align-self: end;
}

.switch-row {
    min-height: 62px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 13px;
    border: 1px solid #e4e9f1;
    border-radius: 14px;
    cursor: pointer;
}

.switch-row input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.switch-control {
    width: 40px;
    height: 23px;
    position: relative;
    flex: 0 0 40px;
    border-radius: 999px;
    background: #cbd5e1;
    transition: .2s ease;
}

.switch-control::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(15,23,42,.2);
    transition: .2s ease;
}

.switch-row input:checked + .switch-control {
    background: #4f46e5;
}

.switch-row input:checked + .switch-control::after {
    transform: translateX(17px);
}

.switch-row strong,
.switch-row small {
    display: block;
}

.switch-row strong {
    margin-bottom: 3px;
    color: #334155;
    font-size: 11px;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 24px;
    margin-top: 24px;
    border-top: 1px solid #eef2f7;
}

.button {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 17px;
    border: 0;
    border-radius: 12px;
    color: #fff;
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button svg {
    width: 17px;
    height: 17px;
}

.button-muted {
    background: #64748b;
}

.button-primary {
    background: linear-gradient(100deg, #4f46e5, #2563eb);
    box-shadow: 0 10px 20px rgba(37,99,235,.18);
}

.button-success {
    background: linear-gradient(100deg, #16a34a, #15803d);
    box-shadow: 0 10px 20px rgba(22,163,74,.16);
}

.mikrotik-side {
    display: grid;
    gap: 18px;
}

.info-card,
.router-result-card,
.saved-status-card {
    padding: 22px;
}

.info-card-top {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-bottom: 16px;
}

.info-card-icon {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    color: #0369a1;
    background: #e0f2fe;
}

.info-card-icon svg {
    width: 18px;
    height: 18px;
}

.info-card h3 {
    font-size: 14px;
}

.setup-list {
    display: grid;
    gap: 11px;
    padding-left: 20px;
    margin: 0;
    color: #64748b;
    font-size: 11px;
    line-height: 1.6;
}

.setup-list code,
.history-table code {
    padding: 2px 5px;
    border-radius: 5px;
    color: #4338ca;
    background: #eef2ff;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.router-result-card {
    color: #fff;
    border: 0;
    background:
        radial-gradient(circle at 90% 10%, rgba(103,232,249,.18), transparent 36%),
        linear-gradient(145deg, #101a2e, #182b4d);
}

.result-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 17px;
    margin-bottom: 17px;
    border-bottom: 1px solid rgba(255,255,255,.1);
}

.result-header span,
.saved-status-card > span {
    display: block;
    margin-bottom: 5px;
    color: #91a2bd;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .13em;
}

.result-header h3 {
    color: #fff;
    font-size: 17px;
}

.live-badge {
    padding: 6px 8px;
    border-radius: 7px;
    color: #bbf7d0;
    background: rgba(34,197,94,.14);
    font-size: 9px;
    font-weight: 800;
}

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

.router-stats div {
    padding: 11px;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 11px;
    background: rgba(255,255,255,.04);
}

.router-stats span,
.router-stats strong {
    display: block;
}

.router-stats span {
    margin-bottom: 5px;
    color: #91a2bd;
    font-size: 9px;
}

.router-stats strong {
    overflow: hidden;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.saved-status-card h3 {
    margin-bottom: 17px;
    font-size: 16px;
}

.saved-status-card dl {
    display: grid;
    gap: 10px;
    margin: 0;
}

.saved-status-card dl div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 9px;
    border-bottom: 1px dashed #e2e8f0;
    font-size: 10px;
}

.saved-status-card dt {
    color: #94a3b8;
}

.saved-status-card dd {
    margin: 0;
    max-width: 65%;
    overflow: hidden;
    color: #334155;
    font-weight: 600;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.connection-history {
    overflow: hidden;
}

.history-heading {
    padding: 20px 22px 15px;
}

.history-heading h3 {
    font-size: 16px;
}

.history-table-wrap {
    overflow-x: auto;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

.history-table th,
.history-table td {
    padding: 13px 18px;
    border-top: 1px solid #eef2f7;
    text-align: left;
    white-space: nowrap;
}

.history-table th {
    color: #64748b;
    background: #f8fafc;
    font-size: 9px;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.history-table td {
    color: #475569;
}

.history-table td:last-child {
    min-width: 260px;
    white-space: normal;
}

.log-status {
    display: inline-flex;
    padding: 5px 8px;
    border-radius: 7px;
    font-size: 9px;
    font-weight: 800;
}

.log-status.success {
    color: #15803d;
    background: #dcfce7;
}

.log-status.failed {
    color: #b91c1c;
    background: #fee2e2;
}

@media (max-width: 1120px) {
    .mikrotik-layout {
        grid-template-columns: 1fr;
    }

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

@media (max-width: 720px) {
    .content-title-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .settings-card {
        padding: 20px 16px;
    }

    .field-grid,
    .mikrotik-side {
        grid-template-columns: 1fr;
    }

    .full-field {
        grid-column: auto;
    }

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

    .button {
        width: 100%;
    }

    .history-table th,
    .history-table td {
        padding: 12px;
    }
}


/* =========================================================
   MikroTik simple layout - i3Connect v1.2
   ========================================================= */
.simple-mikrotik {
    width: 100%;
}

.simple-mikrotik-card {
    min-height: calc(100vh - 162px);
    padding: 28px;
    border: 1px solid #e7ecf3;
    border-radius: 20px;
    background: #ffffff;
    box-shadow: 0 14px 40px rgba(15, 23, 42, .045);
}

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

.simple-mikrotik-header h2 {
    margin: 0 0 7px;
    color: #111827;
    font-size: 26px;
    letter-spacing: -.035em;
}

.simple-mikrotik-header p {
    margin: 0;
    color: #718096;
    font-size: 14px;
    line-height: 1.6;
}

.simple-status {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    background: #f8fafc;
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
}

.simple-status > span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #94a3b8;
}

.simple-status.connected {
    border-color: #bbf7d0;
    background: #f0fdf4;
    color: #15803d;
}

.simple-status.connected > span {
    background: #22c55e;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, .12);
}

.simple-status.failed {
    border-color: #fecaca;
    background: #fef2f2;
    color: #b91c1c;
}

.simple-status.failed > span {
    background: #ef4444;
}

.simple-alert {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 22px;
    padding: 13px 15px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
}

.simple-alert strong {
    width: 23px;
    height: 23px;
    display: grid;
    place-items: center;
    flex: 0 0 23px;
    border-radius: 50%;
}

.simple-alert span {
    flex: 1;
}

.simple-alert small {
    flex: 0 0 auto;
    opacity: .75;
}

.simple-alert.success {
    border: 1px solid #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}

.simple-alert.success strong {
    color: #ffffff;
    background: #22c55e;
}

.simple-alert.danger {
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.simple-alert.danger strong {
    color: #ffffff;
    background: #ef4444;
}

.simple-mikrotik-form {
    max-width: 860px;
}

.simple-field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 20px;
}

.simple-field {
    display: grid;
    gap: 8px;
}

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

.simple-field input {
    width: 100%;
    height: 47px;
    padding: 0 14px;
    border: 1px solid #d7dfeb;
    border-radius: 11px;
    outline: none;
    background: #ffffff;
    color: #111827;
    font-size: 14px;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.simple-field input:focus {
    border-color: #4f6ff7;
    box-shadow: 0 0 0 4px rgba(79, 111, 247, .12);
}

.simple-field input::placeholder {
    color: #a0aabd;
}

.simple-password-field {
    position: relative;
}

.simple-password-field input {
    padding-right: 50px;
}

.simple-password-field button {
    position: absolute;
    top: 50%;
    right: 6px;
    width: 38px;
    height: 36px;
    display: grid;
    place-items: center;
    transform: translateY(-50%);
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #8793a7;
    cursor: pointer;
}

.simple-password-field button:hover,
.simple-password-field button.active {
    color: #315efb;
    background: #eef3ff;
}

.simple-password-field button svg {
    width: 20px;
    height: 20px;
}

.simple-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
}

.simple-button {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 18px;
    border: 0;
    border-radius: 11px;
    color: #ffffff;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}

.simple-button:hover {
    transform: translateY(-1px);
    opacity: .96;
}

.simple-button.back {
    background: #64748b;
}

.simple-button.save {
    background: #2f63ee;
    box-shadow: 0 9px 20px rgba(47, 99, 238, .18);
}

.simple-button.test {
    background: #16863f;
    box-shadow: 0 9px 20px rgba(22, 134, 63, .16);
}

@media (max-width: 700px) {
    .simple-mikrotik-card {
        min-height: calc(100vh - 124px);
        padding: 20px;
        border-radius: 16px;
    }

    .simple-mikrotik-header {
        flex-direction: column;
        gap: 14px;
    }

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

    .simple-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .simple-alert {
        align-items: flex-start;
    }

    .simple-alert small {
        display: none;
    }
}


/* =========================================================
   i3Connect Premium Notification System v1.7
   ========================================================= */

.i3-notification-layer {
    position: fixed;
    z-index: 9999;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
    visibility: hidden;
    pointer-events: none;
}

.i3-notification-layer.is-visible {
    visibility: visible;
    pointer-events: auto;
}

.i3-notification-backdrop {
    position: absolute;
    inset: 0;
    opacity: 0;
    background: rgba(2, 6, 23, .58);
    backdrop-filter: blur(7px);
    transition: opacity .28s ease;
}

.i3-notification-layer.is-visible .i3-notification-backdrop {
    opacity: 1;
}

.i3-notification-card {
    --notice-color: #4f46e5;
    --notice-color-dark: #3730a3;
    --notice-soft: #eef2ff;
    --notice-ring: rgba(79, 70, 229, .15);

    width: min(440px, 100%);
    overflow: hidden;
    position: relative;
    z-index: 2;
    padding: 34px 30px 28px;
    border: 1px solid rgba(255, 255, 255, .72);
    border-radius: 25px;
    outline: none;
    opacity: 0;
    transform: translateY(24px) scale(.94);
    background:
        radial-gradient(
            circle at 90% 0%,
            var(--notice-ring),
            transparent 34%
        ),
        linear-gradient(160deg, #ffffff 0%, #fbfcff 100%);
    box-shadow:
        0 32px 95px rgba(2, 6, 23, .29),
        0 3px 15px rgba(15, 23, 42, .1),
        inset 0 1px 0 rgba(255, 255, 255, .95);
    transition:
        opacity .3s ease,
        transform .38s cubic-bezier(.22, 1, .36, 1);
}

.i3-notification-layer.is-visible .i3-notification-card {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.i3-notification-layer.is-closing .i3-notification-card {
    opacity: 0;
    transform: translateY(14px) scale(.97);
    transition-duration: .2s;
}

.i3-notification-card[data-type="success"] {
    --notice-color: #16a34a;
    --notice-color-dark: #15803d;
    --notice-soft: #ecfdf3;
    --notice-ring: rgba(22, 163, 74, .15);
}

.i3-notification-card[data-type="warning"] {
    --notice-color: #f59e0b;
    --notice-color-dark: #b45309;
    --notice-soft: #fff7e6;
    --notice-ring: rgba(245, 158, 11, .16);
}

.i3-notification-card[data-type="danger"] {
    --notice-color: #ef4444;
    --notice-color-dark: #b91c1c;
    --notice-soft: #fef2f2;
    --notice-ring: rgba(239, 68, 68, .15);
}

.i3-notification-card[data-type="info"] {
    --notice-color: #4f46e5;
    --notice-color-dark: #3730a3;
    --notice-soft: #eef2ff;
    --notice-ring: rgba(79, 70, 229, .15);
}

.i3-notification-glow {
    position: absolute;
    top: -75px;
    right: -70px;
    width: 190px;
    height: 190px;
    border-radius: 50%;
    background: var(--notice-ring);
    filter: blur(2px);
    pointer-events: none;
}

.i3-notification-close {
    position: absolute;
    z-index: 3;
    top: 15px;
    right: 15px;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: 1px solid #e8edf4;
    border-radius: 11px;
    background: rgba(255, 255, 255, .85);
    color: #8490a3;
    cursor: pointer;
    transition:
        color .18s ease,
        background .18s ease,
        transform .18s ease;
}

.i3-notification-close:hover {
    color: #172033;
    background: #ffffff;
    transform: rotate(5deg);
}

.i3-notification-close svg {
    width: 18px;
    height: 18px;
}

.i3-notification-icon {
    width: 66px;
    height: 66px;
    display: grid;
    place-items: center;
    margin: 0 auto 19px;
    position: relative;
    border-radius: 21px;
    color: #ffffff;
    background:
        linear-gradient(
            145deg,
            var(--notice-color),
            var(--notice-color-dark)
        );
    box-shadow:
        0 16px 30px var(--notice-ring),
        inset 0 1px 0 rgba(255, 255, 255, .27);
}

.i3-notification-icon::before,
.i3-notification-icon::after {
    content: '';
    position: absolute;
    border-radius: inherit;
    border: 1px solid var(--notice-color);
    opacity: 0;
    animation: i3NoticePulse 2s ease-out infinite;
}

.i3-notification-icon::before {
    inset: -7px;
}

.i3-notification-icon::after {
    inset: -14px;
    animation-delay: .55s;
}

.i3-notification-icon svg {
    width: 31px;
    height: 31px;
    position: relative;
    z-index: 2;
}

.i3-notification-copy {
    position: relative;
    z-index: 2;
    text-align: center;
}

.i3-notification-kicker {
    display: block;
    margin-bottom: 7px;
    color: var(--notice-color-dark);
    font-size: 9px;
    font-weight: 850;
    letter-spacing: .17em;
}

.i3-notification-copy h3 {
    margin: 0 0 10px;
    color: #101828;
    font-size: 22px;
    line-height: 1.2;
    letter-spacing: -.038em;
}

.i3-notification-copy p {
    margin: 0 auto;
    max-width: 340px;
    color: #667085;
    font-size: 12px;
    line-height: 1.72;
}

.i3-notification-actions {
    display: flex;
    justify-content: center;
    position: relative;
    z-index: 2;
    margin-top: 24px;
}

.i3-notification-button {
    min-width: 132px;
    min-height: 45px;
    padding: 0 20px;
    border: 0;
    border-radius: 12px;
    color: #ffffff;
    background:
        linear-gradient(
            110deg,
            var(--notice-color),
            var(--notice-color-dark)
        );
    box-shadow: 0 12px 25px var(--notice-ring);
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
    transition:
        transform .18s ease,
        box-shadow .18s ease,
        filter .18s ease;
}

.i3-notification-button:hover {
    transform: translateY(-2px);
    filter: brightness(1.04);
    box-shadow: 0 16px 30px var(--notice-ring);
}

.i3-notification-button:active {
    transform: translateY(0);
}

.i3-notification-progress {
    height: 3px;
    position: absolute;
    inset: auto 0 0;
    overflow: hidden;
    background: #edf1f6;
}

.i3-notification-progress span {
    width: 100%;
    height: 100%;
    display: block;
    transform-origin: left center;
    background:
        linear-gradient(
            90deg,
            var(--notice-color),
            var(--notice-color-dark)
        );
}

.i3-notification-progress span.is-running {
    animation:
        i3NoticeProgress
        var(--notice-duration, 5000ms)
        linear
        forwards;
}

body.i3-notification-open {
    overflow: hidden;
}

@keyframes i3NoticePulse {
    0% {
        opacity: .32;
        transform: scale(.87);
    }
    75%,
    100% {
        opacity: 0;
        transform: scale(1.18);
    }
}

@keyframes i3NoticeProgress {
    from {
        transform: scaleX(1);
    }
    to {
        transform: scaleX(0);
    }
}

@media (max-width: 520px) {
    .i3-notification-layer {
        align-items: end;
        padding: 12px;
    }

    .i3-notification-card {
        padding: 31px 22px 24px;
        border-radius: 23px;
        transform: translateY(45px) scale(.98);
    }

    .i3-notification-layer.is-visible .i3-notification-card {
        transform: translateY(0) scale(1);
    }

    .i3-notification-icon {
        width: 59px;
        height: 59px;
        border-radius: 18px;
    }

    .i3-notification-copy h3 {
        font-size: 20px;
    }

    .i3-notification-button {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .i3-notification-card,
    .i3-notification-backdrop,
    .i3-notification-progress span,
    .i3-notification-icon::before,
    .i3-notification-icon::after {
        animation: none !important;
        transition: none !important;
    }
}


/* =========================================================
   Desktop No Topbar v2.5
   Header Billing Management disembunyikan pada desktop.
   Mobile/Android tetap menggunakan header.
   ========================================================= */

@media (min-width: 961px) {
    .topbar {
        display: none !important;
    }

    .main-area {
        padding-top: 0 !important;
    }

    .page-content {
        padding-top: 28px !important;
        min-height: 100vh;
    }

    .blank-canvas,
    .simple-mikrotik-card,
    .mk-card {
        min-height: calc(100vh - 64px) !important;
    }
}

@media (max-width: 960px) {
    .topbar {
        display: flex !important;
    }
}


/* =========================================================
   Sidebar Scroll Fix v5.8
   ========================================================= */

.sidebar-nav .nav-item {
    flex: 0 0 auto;
}

@media (max-height: 720px) and (min-width: 961px) {
    .sidebar {
        padding-top: 16px;
        padding-bottom: 12px;
    }

    .brand {
        padding-bottom: 13px;
    }

    .brand-mark {
        width: 39px;
        height: 39px;
        flex-basis: 39px;
        border-radius: 12px;
    }

    .sidebar-nav {
        gap: 5px;
        padding-bottom: 9px;
    }

    .nav-label {
        margin-top: 5px;
        margin-bottom: 4px;
    }

    .nav-item {
        min-height: 43px;
    }

    .sidebar-bottom {
        padding-top: 8px;
    }

    .sidebar-version {
        margin-top: 10px;
    }
}

@media (max-width: 960px) {
    .sidebar {
        height: 100vh;
        height: 100dvh;
        padding-bottom: max(14px, env(safe-area-inset-bottom));
    }

    .sidebar-nav {
        padding-right: 7px;
    }
}
