html {
    overflow-x: hidden;
}

body {
    min-width: 0;
}

img,
svg,
video {
    max-width: 100%;
}

.main {
    min-width: 0;
}

.page-wrapper,
.page-card,
.card-premium,
.table-card,
.activity-card,
.enterprise-table-wrapper,
.sa-form-section,
.delete-confirmation-card {
    max-width: 100%;
}

.page-wrapper {
    width: 100%;
}

.page-header {
    gap: 18px;
    flex-wrap: wrap;
}

.page-header > div {
    min-width: 0;
}

.page-header h1,
.details-title,
.section-title,
.delete-title,
.summary-value {
    overflow-wrap: anywhere;
}

.search,
.search-input {
    max-width: 100%;
}

.table-responsive {
    width: 100%;
    overflow: visible;
    -webkit-overflow-scrolling: touch;
}

.enterprise-table {
    min-width: 760px;
}

.table-footer,
.form-actions,
.delete-actions {
    gap: 14px;
    flex-wrap: wrap;
}

.case-workspace-links {
    margin-bottom: 22px;
}

.details-info-card {
    width: 100%;
    min-width: 0;
}

.details-info-value,
.delete-client-name,
.delete-client-meta,
.sa-badge-text,
.profile strong,
.profile div {
    overflow-wrap: anywhere;
}

.dropdown.nav-closed .dropdown-menu {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.main-menu-toggle,
.mobile-menu-button {
    display: none;
}

.mobile-nav-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

@media (max-width: 1200px) {
    .main {
        padding: 28px;
    }

    .grid {
        grid-template-columns: 1fr;
    }

    .page-header h1 {
        font-size: 44px;
    }
}

@media (max-width: 900px) {
    .sidebar {
        display: block;
        position: relative;
        top: auto;
        width: 100%;
        padding: 14px;
        max-height: none;
        overflow: hidden;
    }

    .mobile-nav-bar {
        width: 100%;
    }

    .logo {
        width: auto;
        min-width: 0;
        text-align: left;
    }

    .mobile-menu-button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 46px;
        height: 44px;
        border: 1px solid rgba(255,255,255,.16);
        border-radius: 14px;
        background: rgba(255,255,255,.08);
        color: #ffffff;
        font-size: 24px;
        font-weight: 800;
        cursor: pointer;
        flex: 0 0 auto;
    }

    .menu {
        display: none;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        width: 100%;
        max-height: 62vh;
        overflow-y: auto;
        overflow-x: hidden;
        margin-top: 14px;
        padding-right: 4px;
    }

    .main-menu-toggle:checked ~ .menu {
        display: flex;
    }

    .menu a,
    .menu button.nav-link,
    .dropdown,
    .dropdown > a,
    .dropdown > button {
        width: 100%;
        max-width: 100%;
    }

    .menu a:hover,
    .menu a.active,
    .menu button.nav-link:hover,
    .menu button.nav-link:focus-visible {
        transform: none;
    }

    .dropdown-menu {
        display: none;
        position: static;
        width: 100%;
        min-width: 0;
        margin-top: 8px;
        padding: 10px;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        background: rgba(15,23,42,.45);
        border-radius: 18px;
    }

    .dropdown-align-right .dropdown-menu {
        right: auto;
        left: auto;
    }

    .dropdown:hover .dropdown-menu,
    .dropdown:focus-within .dropdown-menu {
        display: block;
    }

    .main {
        padding: 22px;
    }

    .page-header {
        align-items: flex-start;
    }

    .page-header h1 {
        font-size: 38px;
        line-height: 1.08;
    }

    .page-header p {
        font-size: 15px;
    }

    .topbar {
        margin-bottom: 22px;
    }

    .page-card,
    .card,
    .table-card,
    .activity-card,
    .enterprise-table-wrapper,
    .delete-confirmation-card {
        border-radius: 22px;
        padding: 22px;
    }

    .form-grid-auto,
    .form-grid,
    .page-grid,
    .details-info-grid,
    .profile-summary-grid,
    .details-settings {
        grid-template-columns: minmax(0, 1fr);
    }

    .sa-form-section {
        border-radius: 18px;
        padding: 18px;
    }

    .profile-cover {
        height: 210px;
        border-radius: 24px;
        margin-bottom: 95px;
    }

    .sa-avatar-upload,
    .sa-avatar-image,
    .sa-avatar-placeholder {
        width: 150px;
        height: 150px;
    }

    .profile-avatar-wrapper {
        bottom: -48px;
    }

    .details-header {
        margin-top: -35px;
    }

    .details-title {
        font-size: 30px;
    }
}

@media (max-width: 640px) {
    .main {
        padding: 16px;
    }

    .table-responsive {
        overflow-x: auto;
        overflow-y: visible;
    }

    .logo {
        font-size: 22px;
        letter-spacing: 0;
    }

    .menu a,
    .dropdown > a {
        padding: 13px 14px;
    }

    .topbar {
        gap: 12px;
    }

    .search {
        min-height: 48px;
    }

    .page-header {
        margin-bottom: 20px;
    }

    .page-header h1 {
        font-size: 32px;
    }

    .primary-link-btn,
    .primary-btn,
    .secondary-btn,
    .danger-btn,
    .btn {
        width: 100%;
        min-height: 50px;
        padding-left: 18px;
        padding-right: 18px;
    }

    .page-card,
    .card,
    .table-card,
    .activity-card,
    .enterprise-table-wrapper,
    .delete-confirmation-card {
        border-radius: 18px;
        padding: 16px;
    }

    .sa-form-section-header,
    .premium-form-header,
    .premium-activity,
    .delete-client-summary,
    .details-info-card {
        align-items: flex-start;
    }

    .sa-form-section-header,
    .premium-form-header,
    .delete-client-summary {
        flex-direction: column;
    }

    .sa-form-section-title {
        font-size: 16px;
    }

    .sa-form-section-subtitle {
        font-size: 12px;
    }

    .form-group {
        padding: 8px;
        border-radius: 14px;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 14px;
    }

    .input-icon {
        width: 38px;
    }

    .input-wrapper .form-control,
    .input-wrapper .custom-select,
    .input-wrapper input,
    .input-wrapper textarea,
    .input-wrapper select {
        padding-left: 58px !important;
    }

    .table-search {
        margin-bottom: 16px;
    }

    .search-input {
        width: 100%;
        height: 48px;
        border-radius: 14px;
    }

    .enterprise-table {
        min-width: 680px;
    }

    .enterprise-table thead th,
    .enterprise-table tbody td {
        padding: 12px;
    }

    .table-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .pagination-wrapper {
        display: grid;
        grid-template-columns: 1fr auto 1fr;
        gap: 10px;
    }

    .page-btn {
        padding: 10px 12px;
    }

    .profile {
        width: 100%;
        min-width: 0;
    }

    .section-title {
        font-size: 22px;
        line-height: 1.2;
    }

    .details-title {
        font-size: 26px;
    }

    .summary-value {
        font-size: 20px;
    }

    .client-code-badge {
        border-radius: 14px;
        width: 100%;
        justify-content: center;
        text-align: center;
    }

    .delete-icon {
        width: 72px;
        height: 72px;
        font-size: 30px;
    }

    .delete-title {
        font-size: 26px;
    }

    .delete-message {
        font-size: 14px;
        margin-bottom: 24px;
    }

    .delete-client-info {
        text-align: center;
        width: 100%;
    }

    .calendar-actions {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 420px) {
    .main {
        padding: 12px;
    }

    .page-header h1 {
        font-size: 28px;
    }

    .page-card,
    .card,
    .table-card,
    .activity-card,
    .enterprise-table-wrapper,
    .sa-form-section,
    .delete-confirmation-card {
        padding: 14px;
    }

    .enterprise-table {
        min-width: 620px;
    }

    .form-actions,
    .delete-actions {
        flex-direction: column;
    }
}
