* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --sidebar-bg: #02243f;
    --app-bg: #eef3f9;
    --card-bg: #ffffff;
    --header-bg: #f5f8fc;
    --sidebar-width: 320px;
    --text-main: #1f334a;
    --text-soft: #667a90;
    --line: #d4dce5;
    --input-bg: #ffffff;
    --input-filled: #e7edf7;
    --purple: #4f46e5;
}

body {
    font-family: "Inter", sans-serif;
    background: radial-gradient(circle at top right, #e6edff 0%, var(--app-bg) 35%, #edf3fa 100%);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

.app {
    min-height: 100vh;
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    width: 100%;
    transition: grid-template-columns 0.25s ease;
}

.sidebar {
    background: var(--sidebar-bg);
    color: #fff;
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    width: var(--sidebar-width);
    transition: transform 0.25s ease, width 0.25s ease, padding 0.25s ease;
}

.app.sidebar-hidden {
    grid-template-columns: 76px 1fr;
}

.app.sidebar-hidden .sidebar {
    width: 76px;
    padding: 24px 10px;
    overflow: hidden;
    transform: none;
}

.app.sidebar-hidden .logo {
    align-self: center;
    margin-bottom: 22px;
}

.app.sidebar-hidden .logo img {
    display: none;
}

.logo {
    display: inline-flex;
    align-items: center;
    margin-bottom: 30px;
}

.logo img {
    width: 170px;
    max-width: 100%;
    height: auto;
}

.menu {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.app.sidebar-hidden .menu {
    width: 100%;
    align-items: center;
    gap: 8px;
}

.menu-item {
    text-decoration: none;
    color: #8da1b5;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 2px;
    transition: color 0.25s ease;
}

.menu-item,
.logout-btn {
    width: 100%;
    line-height: 1;
}

.menu-item:hover,
.menu-item.active {
    color: #ffffff;
}

.app.sidebar-hidden .menu-item,
.app.sidebar-hidden .logout-btn {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

.app.sidebar-hidden .menu-item span,
.app.sidebar-hidden .logout-btn span {
    display: none;
}

.menu-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    display: block;
}

.logout-btn .menu-icon {
    display: block;
}

.logout-btn {
    margin-top: auto;
    border: none;
    background: transparent;
    color: #ff584d;
    font-size: 16px;
    text-align: left;
    display: flex;
    gap: 12px;
    align-items: center;
    cursor: pointer;
    padding: 10px 2px;
}

.app.sidebar-hidden .logout-btn {
    width: 100%;
}

.main-content {
    padding: 18px 18px 28px;
    min-width: 0;
}

.topbar {
    height: 58px;
    display: flex;
    align-items: center;
    gap: 14px;
    background: linear-gradient(135deg, #ffffff 0%, #eef4fb 100%);
    border: 1px solid #d5dce5;
    border-radius: 12px;
    padding: 0 12px;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.05);
    margin-bottom: 24px;
}

.menu-toggle {
    border: none;
    background: transparent;
    color: #607286;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    line-height: 0;
}

.menu-toggle .noti-icon {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    display: block;
}

.search-wrap {
    position: relative;
    flex: 1;
    max-width: 420px;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca8b6;
}

.search-wrap input {
    width: 100%;
    height: 34px;
    border-radius: 8px;
    border: 1px solid #dfe4e8;
    background: #eceff3;
    padding: 0 12px 0 30px;
    color: #6b7f94;
    font-size: 13px;
    outline: none;
}

.settings-page {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.page-heading {
    margin-bottom: 18px;
}

.settings-page h1 {
    font-size: 33px;
    font-weight: 700;
    margin-bottom: 6px;
}

.page-heading p {
    color: var(--text-soft);
    font-size: 15px;
    line-height: 1.6;
    max-width: 760px;
}

.settings-layout {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 18px;
}

.settings-card {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #dbe2ea;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
    grid-column: span 12;
}

.settings-card--wallet,
.settings-card--pin {
    grid-column: span 12;
}

.card-head {
    background: var(--header-bg);
    border-bottom: 1px solid #d3d9e0;
    padding: 14px 18px;
    font-size: 18px;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

.profile-summary-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.profile-summary {
    display: flex;
    gap: 22px;
    align-items: center;
    flex-wrap: wrap;
}

.profile-avatar-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    min-width: 180px;
}

.profile-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #e4ebf5;
    background: linear-gradient(135deg, #dbeafe, #eef2ff);
    box-shadow: 0 10px 24px rgba(79, 70, 229, 0.12);
    cursor: zoom-in;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.profile-avatar:hover {
    transform: scale(1.03);
    box-shadow: 0 14px 28px rgba(79, 70, 229, 0.2);
}

.secondary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 16px;
    border-radius: 8px;
    border: 1px solid #c7d2fe;
    background: #eef2ff;
    color: #3730a3;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.secondary-btn:hover {
    background: #e0e7ff;
}

.profile-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.profile-meta h2 {
    font-size: 28px;
    font-weight: 700;
    margin: 0;
}

.profile-meta p {
    color: #667a90;
    font-size: 15px;
    margin: 0;
}

.profile-code-box {
    display: inline-flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 16px;
    border-radius: 12px;
    background: linear-gradient(135deg, #eff6ff, #eef2ff);
    border: 1px solid #dbeafe;
    min-width: 220px;
}

.profile-code-label {
    color: #64748b;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.profile-code-box strong {
    color: #1e1b4b;
    font-size: 24px;
    letter-spacing: 0.16em;
}

.profile-code-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.profile-code-actions[hidden],
#agentInviteActions[hidden] {
    display: none !important;
}

.profile-code-note {
    margin: 0;
    color: #475569;
    font-size: 12px;
    line-height: 1.5;
    flex: 1;
    min-width: 190px;
}

.profile-code-btn {
    min-width: 120px;
}

.profile-code-btn:disabled {
    opacity: 0.7;
    cursor: wait;
}

.settings-feedback {
    min-height: 18px;
    font-size: 13px;
    font-weight: 600;
}

.settings-feedback.success {
    color: #0f8a61;
}

.settings-feedback.error {
    color: #b42340;
}

.field-group {
    margin-bottom: 16px;
}

.field-group label {
    display: block;
    color: #334a62;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
}

.field-group input {
    width: 100%;
    height: 44px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--input-bg);
    padding: 0 14px;
    font-size: 14px;
    color: #3e546c;
    outline: none;
}

.field-group select {
    width: 100%;
    height: 44px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--input-bg);
    padding: 0 14px;
    font-size: 14px;
    color: #3e546c;
    outline: none;
}

.field-group input::placeholder {
    color: #8293a6;
}

.field-group small {
    display: block;
    margin-top: 8px;
    color: #72859a;
    font-size: 12px;
    line-height: 1.45;
}

.field-group .is-filled {
    background: var(--input-filled);
    font-weight: 600;
}

.field-group input:focus,
.field-group select:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 0.2rem rgba(99, 102, 241, 0.14);
}

.primary-btn {
    border: none;
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    height: 42px;
    min-width: 142px;
    border-radius: 10px;
    padding: 0 20px;
    cursor: pointer;
}

.primary-btn:hover {
    background: linear-gradient(135deg, #4338ca, #4f46e5);
}

.alert {
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    margin-bottom: 14px;
    line-height: 1.45;
}

.alert.warning {
    background: #fff7d6;
    border: 1px solid #f1d78c;
    color: #7a5f16;
}

.alert.info {
    background: #e9f2ff;
    border: 1px solid #bfdbfe;
    color: #1e3a8a;
}

.wallet-settings-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.wallet-settings-intro {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 14px;
    background: linear-gradient(135deg, #eff6ff 0%, #eef2ff 100%);
    border: 1px solid #d7e3ff;
}

.wallet-settings-intro strong {
    display: block;
    font-size: 15px;
    margin-bottom: 4px;
    color: #1f3b63;
}

.wallet-settings-intro p {
    color: #64748b;
    font-size: 13px;
    line-height: 1.5;
}

.wallet-settings-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    background: #ffffff;
    border: 1px solid #c7d2fe;
    color: #4338ca;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.wallet-selection-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.rich-dropdown {
    position: relative;
}

.rich-dropdown-trigger {
    width: 100%;
    min-height: 46px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #f9fbfd;
    color: #3e546c;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    font-size: 14px;
    cursor: pointer;
}

.rich-dropdown-trigger:disabled {
    background: #eef2f6;
    color: #8ea0b3;
    cursor: not-allowed;
}

.rich-selected-icon,
.rich-option-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #edf3f9;
    color: #41556a;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

.rich-selected-icon img,
.rich-option-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rich-icon-fallback {
    font-size: 10px;
    font-weight: 700;
}

.rich-selected-text {
    flex: 1;
    min-width: 0;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rich-dropdown-trigger .fa-chevron-down {
    color: #7d90a5;
    font-size: 12px;
}

.rich-dropdown-menu {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 8px);
    z-index: 30;
    background: #fff;
    border: 1px solid #dbe2ea;
    border-radius: 12px;
    box-shadow: 0 16px 30px rgba(15, 23, 42, 0.14);
    padding: 10px;
    display: none;
}

.rich-dropdown.is-open .rich-dropdown-menu {
    display: block;
}

.rich-dropdown-search-wrap {
    padding-bottom: 8px;
}

.rich-dropdown-search {
    width: 100%;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 12px;
    font-size: 13px;
    color: #3a506a;
    background: #f9fbfd;
    outline: none;
}

.rich-dropdown-list {
    max-height: 240px;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.rich-option {
    width: 100%;
    border: none;
    background: #fff;
    color: #2f445b;
    border-radius: 8px;
    min-height: 42px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.rich-option:hover {
    background: #f1f7ff;
}

.rich-option-main {
    flex: 1;
    min-width: 0;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rich-option-badge {
    background: #edf2f8;
    color: #5c7087;
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 10px;
    font-weight: 700;
}

.rich-empty {
    color: #7a8da2;
    font-size: 12px;
    padding: 10px 8px;
}

.wallet-preview-card {
    padding: 16px;
    border-radius: 14px;
    border: 1px solid #dde6f2;
    background: linear-gradient(135deg, #fbfdff 0%, #f3f7fd 100%);
}

.wallet-preview-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.wallet-preview-label {
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.wallet-preview-head strong {
    color: #1f3b63;
    font-size: 15px;
}

.wallet-route-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.wallet-route-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0 14px;
    border-radius: 999px;
    background: #e0e7ff;
    color: #3730a3;
    font-size: 12px;
    font-weight: 700;
}

.wallet-route-chip.secondary {
    background: #eef2ff;
    color: #4c1d95;
}

.settings-inline-message {
    min-height: 18px;
    font-size: 13px;
    font-weight: 600;
    color: #617488;
}

.settings-inline-message.success {
    color: #1f8a68;
}

.settings-inline-message.error {
    color: #d3534f;
}

.sidebar-overlay {
    display: none;
}

.profile-image-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1300;
}

.profile-image-modal.open {
    display: flex;
}

.profile-image-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.72);
}

.profile-image-modal__content {
    position: relative;
    z-index: 1;
    width: min(92vw, 480px);
    background: linear-gradient(140deg, #f8fbff 0%, #eef2ff 100%);
    border: 1px solid #d7def0;
    border-radius: 20px;
    box-shadow: 0 24px 55px rgba(15, 23, 42, 0.35);
    padding: 22px 18px 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.profile-image-modal__close {
    position: absolute;
    top: 10px;
    right: 12px;
    border: none;
    background: transparent;
    color: #334155;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
}

.profile-image-modal__close:hover {
    color: #0f172a;
}

.profile-image-modal__preview {
    width: min(80vw, 320px);
    height: min(80vw, 320px);
    border-radius: 18px;
    object-fit: cover;
    border: 4px solid #e2e8f0;
    background: #ffffff;
}

.profile-image-modal__name {
    margin: 0;
    text-align: center;
    color: #1e293b;
    font-weight: 700;
    font-size: 20px;
}

@media (max-width: 1500px) {
    .logo img {
        width: 158px;
    }

    .menu-item {
        font-size: 15px;
    }

    .logout-btn {
        font-size: 15px;
    }

    .settings-page h1 {
        font-size: 30px;
    }

    .card-head {
        font-size: 17px;
    }

    .field-group label {
        font-size: 13px;
    }

    .field-group input {
        font-size: 14px;
        height: 42px;
    }

    .field-group select {
        font-size: 14px;
        height: 42px;
    }

    .primary-btn {
        font-size: 14px;
        height: 38px;
    }

    .alert {
        font-size: 13px;
    }
}

@media (max-width: 1024px) {
    .app {
        grid-template-columns: 1fr;
    }

    .app.sidebar-hidden {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: 280px;
        transform: translateX(-100%);
        z-index: 1000;
    }

    .app.sidebar-hidden .sidebar {
        width: 280px;
        padding: 24px 18px;
        overflow: visible;
        transform: translateX(-100%);
    }

    .app.sidebar-hidden .logo {
        align-self: stretch;
        margin-bottom: 30px;
    }

    .app.sidebar-hidden .logo img {
        display: block;
    }

    .app.sidebar-hidden .menu {
        width: auto;
        align-items: stretch;
        gap: 6px;
    }

    .app.sidebar-hidden .menu-item,
    .app.sidebar-hidden .logout-btn {
        justify-content: flex-start;
        padding-left: 2px;
        padding-right: 2px;
    }

    .app.sidebar-hidden .menu-item span,
    .app.sidebar-hidden .logout-btn span {
        display: inline;
    }

    .app.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.35);
        z-index: 900;
        display: none;
    }

    .app.sidebar-open .sidebar-overlay {
        display: block;
    }

    .main-content {
        padding: 14px 14px 16px;
    }

    .settings-page h1 {
        font-size: 28px;
    }

    .settings-layout {
        grid-template-columns: repeat(1, minmax(0, 1fr));
        gap: 14px;
    }

    .settings-card--wallet,
    .settings-card--pin {
        grid-column: span 1;
    }

    .card-head {
        font-size: 16px;
    }

    .wallet-selection-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    .profile-summary {
        align-items: flex-start;
    }

    .profile-avatar-stack {
        min-width: 100%;
    }

    .profile-code-box {
        width: 100%;
    }

    .profile-code-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .profile-code-btn {
        width: 100%;
    }

    .wallet-settings-intro {
        flex-direction: column;
    }

    .wallet-settings-pill {
        width: 100%;
    }

    .settings-page h1 {
        font-size: 24px;
    }

    .card-head {
        font-size: 15px;
        padding: 14px 16px;
    }

    .card-body {
        padding: 16px;
    }

    .field-group label {
        font-size: 13px;
    }

    .field-group input {
        font-size: 14px;
        height: 40px;
    }

    .field-group select {
        font-size: 14px;
        height: 40px;
    }

    .primary-btn {
        width: 100%;
    }

    .wallet-preview-head {
        align-items: flex-start;
    }

    .rich-dropdown-list {
        max-height: 38dvh;
    }

    .profile-image-modal__content {
        padding: 18px 14px 14px;
        border-radius: 16px;
    }

    .profile-image-modal__name {
        font-size: 18px;
    }
}