:root {
    --sidebar: #172033;
    --sidebar-hover: #26334a;
    --primary: #4361ee;
    --background: #f4f6fa;
    --surface: #ffffff;
    --text: #202a3c;
    --muted: #8490a4;
    --border: #e9edf3;
    --green: #19a875;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
        Roboto, Arial, sans-serif;
    background: var(--background);
    color: var(--text);
    font-size: 14px;
}

button {
    font: inherit;
}

.app {
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 255px;
    background: var(--sidebar);
    color: #fff;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.navigation {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #46536a transparent;
}

.nav-group {
    margin: 0;
}

.nav-group > summary {
    cursor: pointer;
    list-style: none;
}

.nav-group > summary::-webkit-details-marker {
    display: none;
}

.nav-arrow {
    margin-left: auto;
    color: #8794aa;
    font-size: 20px;
    transition: transform .2s ease;
}

.nav-group[open] > summary .nav-arrow {
    transform: rotate(90deg);
}

.nav-submenu {
    padding: 2px 0 7px 29px;
}

.nav-submenu .nav-item {
    min-height: 38px;
    padding-left: 12px;
    font-size: 12px;
}

.nav-submenu .nav-item:disabled {
    opacity: .65;
}

.brand {
    height: 88px;
    padding: 0 25px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.brand-logo {
    width: 40px;
    height: 40px;
    display: block;
    object-fit: contain;
    flex: 0 0 40px;
    background: transparent;
    border-radius: 0;
}

.brand-name {
    display: flex;
    flex-direction: column;
    gap: 4px;
    letter-spacing: 1.3px;
}

.brand-name strong {
    font-size: 14px;
}

.brand-name span {
    color: #8591a6;
    font-size: 9px;
}

.sidebar-caption {
    padding: 25px 24px 11px;
    color: #77849b;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
}

.navigation {
    padding: 0 12px;
}

.nav-item {
    width: 100%;
    min-height: 43px;
    padding: 0 12px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #b8c2d2;
    background: transparent;
    border: 0;
    border-radius: 7px;
    text-align: left;
    text-decoration: none;
    font-size: 13px;
}

.nav-item.active {
    color: #fff;
    background: var(--primary);
}

.nav-item:not(:disabled):hover {
    background: var(--sidebar-hover);
}

.nav-item:disabled {
    opacity: .75;
    cursor: default;
}

.nav-icon {
    width: 19px;
    text-align: center;
    font-size: 17px;
}

.nav-soon {
    margin-left: auto;
    color: #8794aa;
    font-size: 9px;
}

.nav-divider {
    height: 1px;
    margin: 15px 10px 0;
    background: rgba(255,255,255,.08);
}

.navigation .nav-divider + .sidebar-caption {
    padding-top: 19px;
}

.sidebar-footer {
    margin-top: auto;
    padding: 18px 24px 22px;
    border-top: 1px solid rgba(255,255,255,.08);
}

.system-status,
.welcome-status {
    display: flex;
    align-items: center;
    gap: 9px;
}

.system-status {
    color: #c1cbd9;
    font-size: 11px;
}

.status-dot {
    width: 7px;
    height: 7px;
    flex: 0 0 7px;
    border-radius: 50%;
    background: #20c58a;
    box-shadow: 0 0 0 3px rgba(32,197,138,.12);
}

.version {
    margin-top: 12px;
    color: #77849b;
    font-size: 10px;
}

.main {
    min-height: 100vh;
    margin-left: 255px;
}

.topbar {
    height: 72px;
    padding: 0 35px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar-left,
.topbar-right {
    display: flex;
    align-items: center;
}

.breadcrumb {
    color: var(--muted);
    font-size: 12px;
}

.breadcrumb span {
    padding: 0 9px;
    color: #c5ccd6;
}

.topbar-right {
    gap: 11px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #e9edff;
    color: var(--primary);
    display: grid;
    place-items: center;
    font-weight: 700;
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.user-info strong {
    font-size: 12px;
}

.user-info span {
    color: var(--muted);
    font-size: 10px;
}

.content {
    max-width: 1500px;
    margin: 0 auto;
    padding: 34px 35px 20px;
}

.page-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 25px;
}

.eyebrow,
.welcome-label {
    color: var(--primary);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
}

.page-heading h1 {
    margin-top: 8px;
    font-size: 25px;
    font-weight: 700;
    letter-spacing: -.5px;
}

.page-heading p,
.section-heading p,
.panel-heading p {
    margin-top: 7px;
    color: var(--muted);
    font-size: 12px;
}

.date-label {
    color: var(--muted);
    font-size: 12px;
}

.welcome-panel {
    min-height: 245px;
    padding: 34px 40px;
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    background: linear-gradient(110deg, #263a70, #4359a5);
    color: #fff;
    display: flex;
    align-items: center;
}

.welcome-content {
    position: relative;
    z-index: 2;
    max-width: 570px;
}

.welcome-label {
    color: #aabaff;
}

.welcome-content h2 {
    margin-top: 15px;
    font-size: 27px;
    line-height: 1.3;
    letter-spacing: -.5px;
}

.welcome-content p {
    max-width: 460px;
    margin-top: 12px;
    color: #d0d8f0;
    font-size: 12px;
    line-height: 1.7;
}

.welcome-status {
    margin-top: 23px;
    color: #e0e7ff;
    font-size: 11px;
}

.welcome-status .status-dot {
    background: #43dda4;
}

.welcome-decoration {
    position: absolute;
    inset: 0 0 0 auto;
    width: 40%;
    overflow: hidden;
}

.decoration-circle {
    position: absolute;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 50%;
}

.circle-one {
    width: 300px;
    height: 300px;
    top: -35px;
    right: -30px;
}

.circle-two {
    width: 220px;
    height: 220px;
    top: 5px;
    right: 10px;
}

.decoration-mark {
    position: absolute;
    top: 48px;
    right: 85px;
    color: rgba(255,255,255,.09);
    font-size: 175px;
    line-height: 1;
    font-weight: 800;
}

.section {
    margin-top: 32px;
}

.section-heading,
.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.section-heading h2,
.panel-heading h2 {
    font-size: 15px;
    font-weight: 700;
}

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

.stat-card,
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.stat-card {
    min-height: 145px;
    padding: 19px;
}

.stat-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-icon {
    width: 35px;
    height: 35px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    font-size: 17px;
}

.icon-blue {
    color: #4773e8;
    background: #edf2ff;
}

.icon-purple {
    color: #8961d8;
    background: #f2edff;
}

.icon-green {
    color: #1da77a;
    background: #e9f8f2;
}

.icon-orange {
    color: #db9140;
    background: #fff4e7;
}

.stat-period {
    color: var(--muted);
    font-size: 10px;
}

.stat-value {
    margin-top: 16px;
    font-size: 25px;
    font-weight: 700;
}

.stat-value small {
    color: var(--muted);
    font-size: 12px;
}

.stat-description {
    margin-top: 5px;
    color: var(--muted);
    font-size: 11px;
}

.bottom-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 16px;
    margin-top: 25px;
}

.panel {
    min-height: 240px;
    padding: 22px;
}

.panel-icon {
    color: #8995a8;
    font-size: 20px;
}

.empty-state {
    min-height: 145px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 9px;
    text-align: center;
}

.empty-icon {
    color: #aeb8c9;
    font-size: 27px;
}

.empty-state strong {
    font-size: 12px;
}

.empty-state span {
    color: var(--muted);
    font-size: 11px;
}

.system-row {
    min-height: 43px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid var(--border);
    font-size: 11px;
}

.system-value {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--green);
    white-space: nowrap;
}

.system-value i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
}

.system-pending {
    color: #c38b38;
    white-space: nowrap;
}

.system-note {
    margin-top: 13px;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.6;
}

.page-footer {
    margin-top: 28px;
    padding-top: 17px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    color: var(--muted);
    font-size: 10px;
}

.menu-toggle,
.sidebar-overlay {
    display: none;
}

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

@media (max-width: 760px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform .25s ease;
    }

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

    .sidebar-overlay.show {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 90;
        background: rgba(12,20,35,.5);
    }

    .main {
        margin-left: 0;
    }

    .topbar {
        height: 62px;
        padding: 0 17px;
    }

    .menu-toggle {
        width: 35px;
        height: 35px;
        margin-right: 12px;
        border: 0;
        background: transparent;
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
    }

    .menu-toggle span {
        width: 19px;
        height: 2px;
        background: var(--text);
        border-radius: 2px;
    }

    .user-info {
        display: flex;
        flex-direction: column;
        gap: 2px;
        max-width: 76px;
        overflow: hidden;
    }

    .user-info strong,
    .user-info span {
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }

    .user-info strong {
        font-size: 11px;
    }

    .user-info span {
        font-size: 9px;
    }

    .content {
        padding: 25px 17px 18px;
    }

    .page-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

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

    .welcome-panel {
        min-height: 235px;
        padding: 27px 23px;
    }

    .welcome-content h2 {
        font-size: 23px;
    }

    .welcome-decoration {
        opacity: .5;
    }

    .decoration-mark {
        right: -5px;
        font-size: 130px;
    }

    .stats-grid {
        gap: 10px;
    }

    .stat-card {
        min-height: 135px;
        padding: 14px;
    }

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

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

    .panel {
        padding: 18px;
    }

    .breadcrumb {
        font-size: 11px;
    }
}

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

    .welcome-content h2 {
        font-size: 20px;
    }
}

/* Исправление прокрутки бокового меню */
.sidebar {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.sidebar > .brand,
.sidebar > .sidebar-footer {
    flex-shrink: 0;
}

.sidebar > .navigation {
    display: block;
    flex: 1 1 0;
    height: 0;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    scrollbar-width: thin;
    scrollbar-color: #46536a transparent;
}

.sidebar > .navigation::-webkit-scrollbar {
    width: 6px;
}

.sidebar > .navigation::-webkit-scrollbar-thumb {
    background: #46536a;
    border-radius: 6px;
}


/* Раздел платежей */
.payments-panel {
    min-height: 180px;
    padding: 20px;
}

.payments-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 13px;
    margin-bottom: 22px;
}

.payments-filters label {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 145px;
    flex: 1;
    color: var(--muted);
    font-size: 11px;
}

.payments-filters input,
.payments-filters select {
    width: 100%;
    min-height: 39px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 12px;
}

.payments-filter-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.payments-button {
    min-height: 39px;
    padding: 0 16px;
    border: 0;
    border-radius: 7px;
    background: var(--primary);
    color: #fff;
    font-size: 12px;
    cursor: pointer;
}

.payments-reset {
    color: var(--muted);
    font-size: 12px;
    text-decoration: none;
}

.payments-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.payments-table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
    font-size: 11px;
}

.payments-table th {
    padding: 12px 10px;
    background: var(--background, #f7f8fb);
    color: var(--muted);
    text-align: left;
    font-weight: 600;
}

.payments-table td {
    padding: 13px 10px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

.payment-id {
    font-weight: 600;
}

.payment-status {
    display: inline-block;
    padding: 5px 8px;
    border-radius: 6px;
    background: #eef1f7;
    color: #596579;
    font-size: 10px;
}

.status-completed {
    background: #e8f7ef;
    color: #168454;
}

.status-failed,
.status-cancelled,
.status-expired {
    background: #fff0ef;
    color: #c34d46;
}

.status-awaiting_payment {
    background: #fff5e6;
    color: #a66b16;
}

.payment-failure {
    max-width: 180px;
    margin-top: 5px;
    color: #c34d46;
    white-space: normal;
}

.payments-empty {
    min-height: 230px;
}

.payments-pagination {
    margin-top: 18px;
}

.payments-pagination nav > div:first-child {
    color: var(--muted);
    font-size: 11px;
}

@media (max-width: 760px) {
    .payments-panel {
        padding: 14px;
    }

    .payments-filters {
        align-items: stretch;
    }

    .payments-filters label {
        min-width: calc(50% - 10px);
    }

    .payments-filter-actions {
        width: 100%;
    }
}

/* Participants / managers */
.manager-form-panel,
.manager-list-panel {
    margin-bottom: 20px;
}

.manager-form-panel .panel-heading,
.manager-list-panel .panel-heading {
    margin-bottom: 22px;
}

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

#password-fields {
    display: contents;
}

#telegram-fields {
    grid-column: 1 / -1;
}

#telegram-fields[hidden] {
    display: none;
}

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

.form-field label {
    color: #465168;
    font-size: 12px;
    font-weight: 600;
}

.form-field input,
.form-field select {
    width: 100%;
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid #dfe5ee;
    border-radius: 7px;
    background: #fff;
    color: var(--text);
    font: inherit;
    outline: none;
}

.form-field input:focus,
.form-field select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67,97,238,.1);
}

.form-field small {
    color: var(--muted);
    font-size: 11px;
}

.form-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-start;
}

.primary-button {
    min-height: 42px;
    padding: 0 18px;
    border: 0;
    border-radius: 7px;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}

.primary-button:hover {
    background: #3452dc;
}

.notice {
    margin-bottom: 18px;
    padding: 13px 16px;
    border-radius: 8px;
    font-size: 12px;
}

.notice-success {
    background: #eaf8f1;
    color: #16784f;
}

.notice-error {
    background: #fff0f0;
    color: #a52e36;
}

.notice ul {
    margin: 8px 0 0 18px;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    white-space: nowrap;
}

.data-table th {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.data-table td {
    padding: 15px 14px;
    border-bottom: 1px solid var(--border);
    color: #465168;
    font-size: 12px;
}

.data-table td strong {
    color: var(--text);
}

.status-label {
    display: inline-block;
    padding: 5px 9px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 600;
}

.status-active {
    background: #e8f7ef;
    color: #168252;
}

.status-disabled {
    background: #f1f2f5;
    color: #778195;
}

.pagination-wrap {
    margin-top: 18px;
}

.pagination-wrap nav > div:first-child {
    color: var(--muted);
    font-size: 11px;
}

.pagination-wrap nav > div:last-child {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.pagination-wrap a,
.pagination-wrap span[aria-current] span {
    display: inline-block;
    padding: 7px 11px;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    text-decoration: none;
    font-size: 11px;
}

.pagination-wrap span[aria-current] span {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

@media (max-width: 760px) {
    .manager-form {
        grid-template-columns: 1fr;
    }

    #password-fields {
        display: flex;
        flex-direction: column;
        gap: 18px;
    }

    #telegram-fields,
    .form-actions {
        grid-column: auto;
    }

    .form-actions .primary-button {
        width: 100%;
    }

    .manager-form-panel,
    .manager-list-panel {
        padding: 16px;
    }
}

/* Participants segmented switch */
.participant-tabs {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    margin-bottom: 22px;
    background: #f1f3f7;
    border: 1px solid #e4e8ef;
    border-radius: 12px;
}

.participant-tabs a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 20px;
    border-radius: 9px;
    color: #596579;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: background .18s ease, color .18s ease, box-shadow .18s ease;
}

.participant-tabs a:hover {
    color: #2563eb;
    background: #e7ecf5;
}

.participant-tabs a.active {
    color: #fff;
    background: #2563eb;
    box-shadow: 0 2px 5px rgba(37, 99, 235, .2);
}

@media (max-width: 480px) {
    .participant-tabs {
        display: flex;
        width: 100%;
    }

    .participant-tabs a {
        flex: 1;
        padding: 0 10px;
    }
}

/* Participant edit popover */
.participant-edit-cell {
    position: relative;
}

.participant-edit {
    position: relative;
}

.participant-edit > summary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 13px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #fff;
    color: var(--primary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}

.participant-edit > summary::-webkit-details-marker {
    display: none;
}

.participant-edit > summary:hover {
    background: #f5f7ff;
    border-color: var(--primary);
}

.participant-edit-form {
    position: fixed;
    top: 50%;
    left: 50%;
    right: auto;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: min(420px, calc(100vw - 32px));
    max-height: 80vh;
    overflow-y: auto;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 12px 35px rgba(20, 30, 55, .18);
    white-space: normal;
    transform: translate(-50%, -50%);
}

.participant-edit-form .form-field {
    min-width: 0;
}

.participant-edit-form .form-field input,
.participant-edit-form .form-field select {
    box-sizing: border-box;
}

.participant-edit-form .form-actions {
    display: flex;
    justify-content: flex-end;
}

.participant-edit-form .primary-button {
    min-height: 38px;
}

.participant-edit-form p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

/* Profile settings */
.profile-gear {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
    color: var(--text);
    font-size: 23px;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}

.profile-gear:hover {
    background: #f5f7ff;
    border-color: var(--primary);
}

.profile-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(15, 23, 42, .48);
}

.profile-overlay.show {
    display: flex;
}

.profile-dialog {
    width: min(440px, 100%);
    max-height: min(88vh, 760px);
    overflow-y: auto;
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 18px 55px rgba(15, 23, 42, .22);
}

.profile-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
}

.profile-dialog-header h2 {
    margin: 0;
    color: var(--text);
    font-size: 20px;
}

.profile-close {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 8px;
    background: #f1f3f7;
    color: var(--muted);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.profile-details,
.profile-password-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.profile-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 0;
}

.profile-field label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.profile-value {
    min-height: 40px;
    padding: 10px 12px;
    overflow-wrap: anywhere;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f7f8fb;
    color: var(--text);
    font-size: 13px;
}

.profile-wallet span {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 11px;
}

.profile-password-form {
    margin-top: 22px;
}

.profile-password-form input {
    box-sizing: border-box;
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    font: inherit;
    font-size: 13px;
}

.profile-primary-button,
.profile-logout-button {
    width: 100%;
    min-height: 42px;
    border: 0;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.profile-primary-button {
    background: var(--primary);
    color: #fff;
}

.profile-logout-form {
    margin-top: 12px;
}

.profile-logout-button {
    border: 1px solid var(--border);
    background: #fff;
    color: #b42318;
}

.profile-error {
    margin: 0;
    color: #b42318;
    font-size: 12px;
}

.profile-success {
    margin: 0;
    color: #16804a;
    font-size: 12px;
}

.profile-note {
    margin: 20px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

@media (max-width: 600px) {
    .profile-dialog {
        padding: 20px;
    }

    .profile-gear {
        width: 36px;
        height: 36px;
    }
}

/* Store management modal */
.store-table {
    table-layout: fixed;
    white-space: normal;
}

.store-table th,
.store-table td {
    vertical-align: middle;
}

.store-table th:first-child,
.store-table td:first-child {
    width: 30%;
}

.store-table th:nth-child(2),
.store-table td:nth-child(2) {
    width: 30%;
}

.store-table th:nth-child(3),
.store-table td:nth-child(3) {
    width: 22%;
}

.store-table th:last-child,
.store-table td:last-child {
    width: 18%;
    text-align: center;
}

.store-info-open {
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
    color: var(--primary);
    font-size: 21px;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}

.store-info-open:hover {
    background: #f5f7ff;
    border-color: var(--primary);
}

.store-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 2100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 23, 42, .55);
}

.store-modal-overlay.show {
    display: flex;
}

.store-modal {
    width: min(700px, 100%);
    max-height: min(90vh, 850px);
    overflow-y: auto;
    padding: 26px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 18px 55px rgba(15, 23, 42, .25);
}

.store-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}

.store-modal-header h2 {
    margin: 6px 0 0;
    color: var(--text);
    font-size: 21px;
    overflow-wrap: anywhere;
}

.store-modal-close {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 9px;
    background: #f1f3f7;
    color: var(--muted);
    font-size: 25px;
    line-height: 1;
    cursor: pointer;
}

.store-modal-content {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.store-modal-section {
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
}

.store-modal-section h3 {
    margin: 0 0 16px;
    color: var(--text);
    font-size: 15px;
}

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

.store-modal-form {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-top: 16px;
}

.store-modal-form .profile-field {
    width: 100%;
}

.store-modal-form input,
.store-modal-form select {
    width: 100%;
    max-width: 100%;
}

.store-modal-hint {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.store-modal-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 20px;
}

.store-modal-footer .secondary-button {
    padding: 9px 18px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f7f8fb;
    color: var(--text);
    cursor: pointer;
}

@media (max-width: 640px) {
    .store-table th,
    .store-table td {
        padding: 12px 8px;
        font-size: 11px;
    }

    .store-table th:first-child,
    .store-table td:first-child {
        width: 30%;
    }

    .store-table th:nth-child(2),
    .store-table td:nth-child(2) {
        width: 28%;
    }

    .store-table th:nth-child(3),
    .store-table td:nth-child(3) {
        width: 25%;
    }

    .store-table th:last-child,
    .store-table td:last-child {
        width: 17%;
    }

    .store-modal-overlay {
        padding: 10px;
        align-items: flex-end;
    }

    .store-modal {
        max-height: 94vh;
        padding: 18px;
        border-radius: 16px 16px 10px 10px;
    }

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

    .store-modal-section {
        padding: 14px;
    }
}

/* Store modal mobile viewport correction */
.store-modal-overlay {
    align-items: center;
    overflow-y: auto;
}

.store-modal {
    box-sizing: border-box;
}

@media (max-width: 640px) {
    .store-modal-overlay {
        align-items: center;
        justify-content: center;
        padding: 12px;
        overflow-y: auto;
    }

    .store-modal {
        width: 100%;
        max-height: calc(100vh - 24px);
        max-height: calc(100dvh - 24px);
        margin: auto;
        padding: 18px;
        overflow-y: auto;
        border-radius: 16px;
    }
}


/* Resource CRM: nested navigation */
.nav-nested {
    margin: 2px 0;
}

.nav-submenu .nav-nested > summary {
    padding-left: 12px;
}

.nav-submenu .nav-nested > .nav-submenu {
    padding-left: 15px;
}

.nav-nested > summary .nav-arrow {
    font-size: 16px;
}

/* Dashboard context tabs */
.dashboard-tabs {
    display: flex;
    gap: 8px;
    margin: 0 0 24px;
    padding: 4px;
    width: fit-content;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 9px;
}

.dashboard-tab {
    min-height: 36px;
    padding: 0 20px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

.dashboard-tab:hover {
    background: var(--sidebar-hover);
}

.dashboard-tab.is-active {
    background: var(--primary);
    color: #fff;
}

.dashboard-context[hidden] {
    display: none !important;
}

.cards-dashboard-placeholder {
    min-height: 250px;
}

@media (max-width: 760px) {
    .dashboard-tabs {
        width: 100%;
    }

    .dashboard-tab {
        flex: 1;
        padding: 0 12px;
    }
}
