:root {
    --bg: #0f172a;
    --bg-soft: #111827;
    --card: #1e293b;
    --card-light: #263449;
    --text: #e5e7eb;
    --muted: #94a3b8;
    --accent: #38bdf8;
    --accent-hover: #0ea5e9;
    --danger: #ef4444;
    --success: #22c55e;
    --border: rgba(148, 163, 184, 0.2);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: radial-gradient(circle at top, #1e293b 0, #0f172a 45%);
    color: var(--text);
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

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

.sidebar {
    width: 260px;
    background: rgba(15, 23, 42, 0.95);
    border-right: 1px solid var(--border);
    padding: 24px 18px;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
}

.logo {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 32px;
}

.logo span {
    color: var(--accent);
}

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

.nav a {
    padding: 12px 14px;
    border-radius: 12px;
    color: var(--muted);
    transition: 0.2s;
}

.nav a:hover,
.nav a.active {
    background: var(--card);
    color: var(--text);
}

.content {
    margin-left: 260px;
    width: calc(100% - 260px);
    padding: 32px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
}

.page-title {
    font-size: 28px;
    margin: 0 0 8px;
}

.page-subtitle {
    color: var(--muted);
    margin: 0;
}

.user-box {
    background: var(--card);
    padding: 12px 16px;
    border-radius: 14px;
    border: 1px solid var(--border);
    color: var(--muted);
}

.grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin-bottom: 28px;
}

.card {
    background: linear-gradient(180deg, var(--card), var(--bg-soft));
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 22px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.25);
}

.card-title {
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 10px;
}

.card-value {
    font-size: 28px;
    font-weight: 700;
}

.card-hint {
    margin-top: 8px;
    color: var(--muted);
    font-size: 14px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 12px;
    padding: 12px 18px;
    background: var(--accent);
    color: #00111f;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s;
}

.btn:hover {
    background: var(--accent-hover);
}

.btn-secondary {
    background: var(--card-light);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #fecaca;
    border: 1px solid rgba(239, 68, 68, 0.35);
}

.keys-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.key-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 20px;
}

.key-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.key-name {
    font-size: 18px;
    font-weight: 700;
}

.badge {
    display: inline-flex;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 13px;
    background: rgba(34, 197, 94, 0.14);
    color: #bbf7d0;
    border: 1px solid rgba(34, 197, 94, 0.35);
}

.badge-muted {
    background: rgba(148, 163, 184, 0.12);
    color: var(--muted);
    border-color: var(--border);
}

.key-value {
    background: #020617;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
    color: #cbd5e1;
    font-size: 13px;
    overflow-x: auto;
    white-space: nowrap;
    margin-bottom: 14px;
}

.key-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: linear-gradient(180deg, var(--card), var(--bg-soft));
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 32px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.login-title {
    margin: 0 0 8px;
    font-size: 28px;
}

.login-subtitle {
    margin: 0 0 24px;
    color: var(--muted);
}

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

label {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 14px;
}

input {
    width: 100%;
    padding: 13px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #020617;
    color: var(--text);
    outline: none;
}

input:focus {
    border-color: var(--accent);
}

.form-footer {
    margin-top: 20px;
}

@media (max-width: 900px) {
    .sidebar {
        position: static;
        width: 100%;
        height: auto;
    }

    .layout {
        flex-direction: column;
    }

    .content {
        margin-left: 0;
        width: 100%;
        padding: 20px;
    }

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

    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
}

.alerts {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 18px;
}

.alert {
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.alert-success {
    background: rgba(34, 197, 94, 0.14);
    color: #bbf7d0;
    border-color: rgba(34, 197, 94, 0.35);
}

.alert-error {
    background: rgba(239, 68, 68, 0.14);
    color: #fecaca;
    border-color: rgba(239, 68, 68, 0.35);
}

.empty-state {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 28px;
    color: var(--muted);
}
.alerts {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 18px;
}

.alert {
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.alert-success {
    background: rgba(34, 197, 94, 0.14);
    color: #bbf7d0;
    border-color: rgba(34, 197, 94, 0.35);
}

.alert-error {
    background: rgba(239, 68, 68, 0.14);
    color: #fecaca;
    border-color: rgba(239, 68, 68, 0.35);
}

.empty-state {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 28px;
    color: var(--muted);
}
/* ===== Mobile optimization ===== */

@media (max-width: 700px) {
    body {
        background: #0f172a;
    }

    .layout {
        display: block;
        min-height: 100vh;
    }

    .sidebar {
        position: sticky;
        top: 0;
        z-index: 50;
        width: 100%;
        height: auto;
        padding: 14px;
        border-right: none;
        border-bottom: 1px solid var(--border);
        background: rgba(15, 23, 42, 0.98);
        backdrop-filter: blur(10px);
    }

    .logo {
        font-size: 20px;
        margin-bottom: 14px;
        text-align: center;
    }

    .nav {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .nav a {
        text-align: center;
        padding: 10px 8px;
        font-size: 14px;
        border-radius: 10px;
        background: rgba(30, 41, 59, 0.55);
    }

    .content {
        margin-left: 0;
        width: 100%;
        padding: 16px;
    }

    .topbar {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
        margin-bottom: 18px;
    }

    .page-title {
        font-size: 24px;
        line-height: 1.2;
    }

    .page-subtitle {
        font-size: 14px;
        line-height: 1.5;
    }

    .user-box {
        width: 100%;
        font-size: 14px;
        text-align: center;
    }

    .grid {
        grid-template-columns: 1fr;
        gap: 14px;
        margin-bottom: 18px;
    }

    .card {
        padding: 16px;
        border-radius: 16px;
    }

    .card-value {
        font-size: 24px;
        line-height: 1.2;
    }

    .keys-list {
        gap: 14px;
    }

    .key-card {
        padding: 16px;
        border-radius: 16px;
    }

    .key-header {
        flex-direction: column;
        gap: 10px;
        margin-bottom: 12px;
    }

    .key-name {
        font-size: 17px;
    }

    .badge {
        width: fit-content;
    }

    .key-value {
        white-space: normal;
        overflow-wrap: anywhere;
        word-break: break-word;
        font-size: 12px;
        line-height: 1.45;
        max-height: 140px;
        overflow-y: auto;
    }

    .key-actions {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .key-actions form,
    .key-actions button,
    .key-actions a {
        width: 100%;
    }

    .btn {
        width: 100%;
        min-height: 44px;
        padding: 12px 14px;
        font-size: 15px;
    }

    .topbar form,
    .topbar button {
        width: 100%;
    }

    .alerts {
        margin-bottom: 14px;
    }

    .alert {
        font-size: 14px;
        line-height: 1.45;
    }

    .empty-state {
        padding: 20px;
        font-size: 14px;
        line-height: 1.5;
    }

    .login-page {
        align-items: flex-start;
        padding: 18px;
        padding-top: 44px;
    }

    .login-card {
        max-width: 100%;
        padding: 24px 18px;
        border-radius: 20px;
    }

    .login-title {
        font-size: 25px;
    }

    .login-subtitle {
        font-size: 14px;
        line-height: 1.5;
    }

    input {
        min-height: 46px;
        font-size: 16px;
    }
}

@media (max-width: 420px) {
    .nav {
        grid-template-columns: 1fr;
    }

    .content {
        padding: 12px;
    }

    .card,
    .key-card {
        padding: 14px;
    }

    .page-title {
        font-size: 22px;
    }

    .card-value {
        font-size: 22px;
    }

    .key-value {
        font-size: 11.5px;
    }
}
.copy-source {
    width: 100%;
    min-height: 52px;
    resize: vertical;
    font-family: monospace;
    cursor: text;
}

.copy-source:focus {
    outline: 1px solid var(--accent);
}
.server-create-form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.server-select {
    min-height: 44px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #020617;
    color: var(--text);
    padding: 0 14px;
    outline: none;
}

.server-select:focus {
    border-color: var(--accent);
}

@media (max-width: 700px) {
    .server-create-form {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .server-select {
        width: 100%;
        min-height: 46px;
        font-size: 15px;
    }
}
/* ===== Collapsible mobile menu ===== */

.mobile-menu-head {
    display: block;
}

.mobile-menu-btn {
    display: none;
}

@media (max-width: 700px) {
    .sidebar {
        position: sticky;
        top: 0;
        z-index: 100;
        width: 100%;
        padding: 12px 16px;
        border-right: none;
        border-bottom: 1px solid var(--border);
        background: rgba(15, 23, 42, 0.98);
        backdrop-filter: blur(10px);
    }

    .mobile-menu-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
    }

    .logo {
        margin-bottom: 0;
        font-size: 20px;
        text-align: left;
    }

    .mobile-menu-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 38px;
        padding: 8px 12px;
        border-radius: 10px;
        border: 1px solid var(--border);
        background: var(--card);
        color: var(--text);
        font-weight: 700;
        cursor: pointer;
    }

    .sidebar .nav {
        display: none;
        margin-top: 12px;
    }

    .sidebar.menu-open .nav {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .sidebar.menu-open .nav a {
        text-align: center;
        padding: 12px 10px;
        border-radius: 12px;
        background: rgba(30, 41, 59, 0.75);
    }

    .content {
        padding-top: 18px;
    }
}
/* ===== Instructions page ===== */

.instruction-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 18px;
}

.instruction-tab {
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    border-radius: 12px;
    padding: 12px 18px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s;
}

.instruction-tab:hover {
    background: var(--card-light);
}

.instruction-tab.active {
    background: var(--accent);
    color: #00111f;
    border-color: var(--accent);
}

.instruction-block {
    display: none;
}

.instruction-block.active {
    display: block;
}

.instruction-steps {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.instruction-step {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.45);
}

.step-number {
    min-width: 34px;
    height: 34px;
    border-radius: 999px;
    background: var(--accent);
    color: #00111f;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
}

.instruction-step h3 {
    margin: 0 0 8px;
    font-size: 18px;
}

.instruction-step p {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

.instruction-note {
    margin-top: 18px;
    padding: 14px;
    border-radius: 14px;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.28);
    color: #bae6fd;
    line-height: 1.5;
}

code {
    background: #020617;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 2px 5px;
    color: #e5e7eb;
}

@media (max-width: 700px) {
    .instruction-tabs {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .instruction-tab {
        width: 100%;
        min-height: 44px;
        padding: 11px 12px;
    }

    .instruction-step {
        padding: 14px;
        gap: 12px;
    }

    .step-number {
        min-width: 30px;
        height: 30px;
        font-size: 14px;
    }

    .instruction-step h3 {
        font-size: 16px;
    }

    .instruction-step p {
        font-size: 14px;
    }
}
.instruction-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.routing-config-box {
    min-height: 84px;
    margin-bottom: 16px;
}

.instruction-image {
    display: block;
    width: 100%;
    max-width: 360px;
    margin-top: 14px;
    border-radius: 22px;
    border: 1px solid var(--border);
    box-shadow: 0 18px 35px rgba(0, 0, 0, 0.25);
}

.instruction-images-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 360px));
    gap: 16px;
    align-items: start;
}

@media (max-width: 700px) {
    .instruction-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .instruction-actions .btn {
        width: 100%;
    }

    .instruction-images-grid {
        grid-template-columns: 1fr;
    }

    .instruction-image {
        max-width: 100%;
        border-radius: 18px;
    }

    .routing-config-box {
        min-height: 110px;
        font-size: 11px;
    }
}
.instruction-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px;
}

.instruction-actions .btn,
.instruction-actions a.btn,
.instruction-actions button.btn {
    width: auto;
}

.routing-config-box {
    min-height: 76px;
    margin-bottom: 18px;
}

.instruction-image {
    display: block;
    width: 100%;
    max-width: 360px;
    border-radius: 18px;
    border: 1px solid var(--border);
    margin-top: 14px;
    box-shadow: 0 18px 38px rgba(0, 0, 0, 0.25);
}

.instruction-images-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 320px));
    gap: 14px;
    align-items: start;
    margin-top: 14px;
}

.instruction-images-grid .instruction-image {
    margin-top: 0;
}

.instruction-inner-card {
    margin-top: 18px;
    background: rgba(15, 23, 42, 0.35);
}

@media (max-width: 700px) {
    .instruction-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .instruction-actions .btn,
    .instruction-actions a.btn,
    .instruction-actions button.btn {
        width: 100%;
    }

    .instruction-images-grid {
        grid-template-columns: 1fr;
    }

    .instruction-image {
        max-width: 100%;
        border-radius: 14px;
    }

    .routing-config-box {
        min-height: 90px;
        font-size: 11px;
    }
}
.key-comment-form {
    margin-top: 8px;
    margin-bottom: 12px;
    max-width: 420px;
}

.key-comment-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.key-comment-input {
    width: 100%;
    min-width: 0;
    height: 38px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: #070b1a;
    color: #e5edf7;
    border-radius: 10px;
    padding: 0 12px;
    outline: none;
    font-size: 13px;
}

.key-comment-input::placeholder {
    color: #7f8ea3;
}

.key-comment-input:focus {
    border-color: #38bdf8;
}

.key-comment-save {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: 10px;
    background: rgba(56, 189, 248, 0.16);
    color: #e5edf7;
    cursor: pointer;
    font-weight: 700;
}

.key-comment-save:hover {
    background: rgba(56, 189, 248, 0.28);
}

@media (max-width: 640px) {
    .key-comment-form {
        max-width: 100%;
    }
}
.pwa-install-btn {
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.pwa-nav-btn {
    width: 100%;
    border: 0;
    text-align: left;
    cursor: pointer;
}

.mobile-menu-button {
    display: none;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: #1e293b;
    color: #e5edf7;
    border-radius: 12px;
    padding: 10px 14px;
    cursor: pointer;
    font-weight: 700;
}

@media (max-width: 768px) {
    .mobile-menu-button {
        display: block;
        width: 100%;
        margin-top: 14px;
    }

    .sidebar-nav {
        display: none;
    }

    .sidebar-nav.is-open {
        display: flex;
    }
}
/* === FIX: sidebar / mobile menu after PWA update === */

.app-layout {
    min-height: 100vh;
    display: block;
}

.sidebar {
    width: 260px;
    min-height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 50;
    padding: 26px 18px;
    background: #0f172a;
    border-right: 1px solid rgba(148, 163, 184, 0.16);
}

.main-content {
    margin-left: 260px;
    min-width: 0;
    padding: 32px;
}

.sidebar-header {
    display: block;
}

.brand {
    display: block;
    margin-bottom: 28px;
    color: #e5edf7;
    text-decoration: none;
    font-size: 24px;
    font-weight: 800;
}

.brand span {
    color: #38bdf8;
}

.mobile-menu-button {
    display: none !important;
}

.sidebar-nav {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px;
}

.nav-link {
    display: flex !important;
    align-items: center;
    width: 100%;
    min-height: 44px;
    padding: 0 14px;
    border-radius: 12px;
    color: #b8c6da;
    text-decoration: none;
    font-size: 15px;
    border: 0;
    background: transparent;
}

.nav-link:hover,
.nav-link.active {
    background: #1e293b;
    color: #ffffff;
}

@media (max-width: 768px) {
    html,
    body {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .app-layout {
        display: block;
        width: 100%;
        max-width: 100%;
    }

    .sidebar {
        position: sticky;
        top: 0;
        width: 100%;
        min-height: auto;
        padding: 18px 20px 14px;
        border-right: 0;
        border-bottom: 1px solid rgba(148, 163, 184, 0.16);
        background: #0f172a;
    }

    .main-content {
        margin-left: 0 !important;
        width: 100%;
        max-width: 100%;
        padding: 22px 20px 36px;
        overflow-x: hidden;
    }

    .brand {
        margin-bottom: 14px;
        font-size: 22px;
    }

    .mobile-menu-button {
        display: flex !important;
        width: 100%;
        min-height: 46px;
        align-items: center;
        justify-content: center;
        border: 1px solid rgba(148, 163, 184, 0.25);
        background: #1e293b;
        color: #e5edf7;
        border-radius: 12px;
        padding: 10px 14px;
        cursor: pointer;
        font-weight: 800;
        font-size: 15px;
    }

    .sidebar-nav {
        display: none !important;
        flex-direction: column !important;
        gap: 8px;
        margin-top: 12px;
    }

    .sidebar-nav.is-open {
        display: flex !important;
    }

    .nav-link {
        width: 100%;
        justify-content: center;
        min-height: 44px;
        background: #111c2e;
        border-radius: 12px;
        font-size: 16px;
    }

    .nav-link.active {
        background: #1e293b;
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }

    .page-actions,
    .create-key-form {
        width: 100%;
    }

    .create-key-form {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .server-select,
    .create-key-form .btn {
        width: 100%;
    }
}

/* === FINAL FIX DESKTOP/MOBILE MENU === */

@media (min-width: 769px) {
    .app-layout {
        display: flex !important;
        min-height: 100vh !important;
        width: 100% !important;
    }

    .sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        width: 260px !important;
        min-width: 260px !important;
        height: 100vh !important;
        padding: 28px 18px !important;
        background: #0f172a !important;
        border-right: 1px solid rgba(148, 163, 184, 0.16) !important;
        z-index: 100 !important;
        overflow-y: auto !important;
    }

    .main-content {
        margin-left: 260px !important;
        width: calc(100% - 260px) !important;
        min-height: 100vh !important;
        padding: 36px 40px !important;
    }

    .sidebar-header {
        display: block !important;
    }

    .brand {
        display: block !important;
        margin-bottom: 32px !important;
        color: #e5edf7 !important;
        text-decoration: none !important;
        font-size: 24px !important;
        font-weight: 800 !important;
    }

    .brand span {
        color: #38bdf8 !important;
    }

    .mobile-menu-button {
        display: none !important;
    }

    .sidebar-nav {
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
        width: 100% !important;
    }

    .sidebar-nav .nav-link {
        display: flex !important;
        align-items: center !important;
        width: 100% !important;
        min-height: 44px !important;
        padding: 0 14px !important;
        border-radius: 12px !important;
        color: #b8c6da !important;
        text-decoration: none !important;
        font-size: 15px !important;
        line-height: 1 !important;
        background: transparent !important;
        border: 0 !important;
    }

    .sidebar-nav .nav-link:hover,
    .sidebar-nav .nav-link.active {
        background: #1e293b !important;
        color: #ffffff !important;
    }
}

@media (max-width: 768px) {
    html,
    body {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
    }

    .app-layout {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    .sidebar {
        position: sticky !important;
        top: 0 !important;
        width: 100% !important;
        min-height: auto !important;
        padding: 18px 20px 14px !important;
        background: #0f172a !important;
        border-right: 0 !important;
        border-bottom: 1px solid rgba(148, 163, 184, 0.16) !important;
        z-index: 100 !important;
    }

    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 22px 20px 36px !important;
        overflow-x: hidden !important;
    }

    .brand {
        display: block !important;
        margin-bottom: 14px !important;
        color: #e5edf7 !important;
        text-decoration: none !important;
        font-size: 22px !important;
        font-weight: 800 !important;
    }

    .brand span {
        color: #38bdf8 !important;
    }

    .mobile-menu-button {
        display: flex !important;
        width: 100% !important;
        min-height: 46px !important;
        align-items: center !important;
        justify-content: center !important;
        border: 1px solid rgba(148, 163, 184, 0.25) !important;
        background: #1e293b !important;
        color: #e5edf7 !important;
        border-radius: 12px !important;
        padding: 10px 14px !important;
        cursor: pointer !important;
        font-weight: 800 !important;
        font-size: 15px !important;
    }

    .sidebar-nav {
        display: none !important;
        flex-direction: column !important;
        gap: 8px !important;
        margin-top: 12px !important;
        width: 100% !important;
    }

    .sidebar-nav.is-open {
        display: flex !important;
    }

    .sidebar-nav .nav-link {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 100% !important;
        min-height: 44px !important;
        padding: 0 14px !important;
        border-radius: 12px !important;
        background: #111c2e !important;
        color: #b8c6da !important;
        text-decoration: none !important;
        font-size: 16px !important;
    }

    .sidebar-nav .nav-link.active {
        background: #1e293b !important;
        color: #ffffff !important;
    }
}


/* === FINAL FIX DASHBOARD LAYOUT === */

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

.page-header h1 {
    margin: 0 0 8px;
    color: #f8fafc;
    font-size: 32px;
    line-height: 1.15;
    font-weight: 800;
}

.page-subtitle {
    margin: 0;
    color: #9fb0c8;
    font-size: 16px;
    line-height: 1.5;
}

.user-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 16px;
    border-radius: 12px;
    background: #1e293b;
    border: 1px solid rgba(148, 163, 184, 0.18);
    color: #b8c6da;
    font-size: 14px;
    white-space: nowrap;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 22px;
}

.stat-card,
.panel-card,
.key-card {
    background: #1e293b;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 18px;
    padding: 24px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.16);
}

.stat-label {
    color: #9fb0c8;
    font-size: 14px;
    margin-bottom: 10px;
}

.stat-value {
    color: #f8fafc;
    font-size: 28px;
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 8px;
}

.stat-description {
    color: #9fb0c8;
    font-size: 14px;
    line-height: 1.45;
}

.panel-card {
    margin-bottom: 22px;
}

.panel-card h2 {
    margin: 0 0 14px;
    color: #f8fafc;
    font-size: 24px;
    line-height: 1.2;
    font-weight: 800;
}

.actions-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 18px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 12px;
    border: 0;
    background: #38bdf8;
    color: #020617;
    font-weight: 800;
    font-size: 15px;
    text-decoration: none;
    cursor: pointer;
}

.btn:hover {
    filter: brightness(1.06);
}

.btn-secondary {
    background: #243449;
    color: #e5edf7;
    border: 1px solid rgba(148, 163, 184, 0.22);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.16);
    color: #fecaca;
    border: 1px solid rgba(239, 68, 68, 0.35);
}

@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
        margin-bottom: 22px;
    }

    .page-header h1 {
        font-size: 30px;
    }

    .page-subtitle {
        font-size: 16px;
    }

    .user-pill {
        width: 100%;
        min-height: 48px;
        font-size: 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 14px;
        margin-bottom: 18px;
    }

    .stat-card,
    .panel-card,
    .key-card {
        padding: 22px;
        border-radius: 18px;
    }

    .panel-card h2 {
        font-size: 28px;
    }

    .actions-row {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .actions-row .btn,
    .actions-row .pwa-install-btn {
        width: 100%;
    }
}


/* === FIX INSTRUCTIONS PAGE === */

.instruction-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}

.instruction-section {
    display: none;
}

.instruction-section.active {
    display: block;
}

.instruction-steps {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 18px;
}

.instruction-step {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    background: #111c2e;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 16px;
    padding: 18px;
}

.step-number {
    width: 36px;
    height: 36px;
    min-width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #38bdf8;
    color: #020617;
    font-weight: 800;
}

.instruction-step h3 {
    margin: 0 0 8px;
    color: #f8fafc;
    font-size: 18px;
}

.info-box {
    margin-top: 18px;
    padding: 16px 18px;
    border-radius: 16px;
    background: rgba(56, 189, 248, 0.08);
    border: 1px solid rgba(56, 189, 248, 0.25);
    color: #cfe8f7;
    line-height: 1.5;
}

.instruction-image-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 18px;
}

.instruction-image {
    background: #111c2e;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 18px;
    padding: 12px;
}

.instruction-image img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 14px;
}

.instruction-image-title {
    margin-top: 10px;
    color: #e5edf7;
    font-weight: 700;
    font-size: 14px;
}

@media (max-width: 768px) {
    .instruction-tabs {
        flex-direction: column;
    }

    .instruction-tabs .btn {
        width: 100%;
    }

    .instruction-image-grid {
        grid-template-columns: 1fr;
    }

    .instruction-step {
        padding: 16px;
    }
}


/* === FIX INSTRUCTION STEPS SCREEN POSITION === */

.instruction-step-card {
    grid-template-columns: 1fr !important;
}

.instruction-screen {
    max-width: 380px !important;
    margin-left: 50px !important;
}

.instruction-screen-grid {
    max-width: 780px !important;
    margin-left: 50px !important;
}

@media (max-width: 768px) {
    .instruction-screen,
    .instruction-screen-grid {
        max-width: 100% !important;
        margin-left: 0 !important;
    }
}

.instruction-device {
    display: none;
}

.instruction-device.active {
    display: block;
}

.instruction-card {
    background: #1e293b;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 18px;
    padding: 24px;
    margin: 20px 0;
}

.instruction-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 18px;
}

.steps-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.step-row {
    display: grid;
    grid-template-columns: 42px 1fr minmax(260px, 520px);
    gap: 18px;
    align-items: start;
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 16px;
    padding: 18px;
}

.step-number {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    background: #38bdf8;
    color: #020617;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}

.step-content h3 {
    margin: 0 0 8px;
}

.step-content p {
    margin: 0;
    color: #b8c7dc;
    line-height: 1.5;
}

.step-image img {
    width: 100%;
    max-height: 420px;
    object-fit: contain;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: #0f172a;
}

@media (max-width: 900px) {
    .step-row {
        grid-template-columns: 42px 1fr;
    }

    .step-image {
        grid-column: 1 / -1;
    }
}
