:root{
    --a2m-radius:8px;
    --a2m-toggle-radius:999px;
}

/*
 * Reusable radius for switch/toggle controls. Add .a2m-toggle-radius to any
 * future custom toggle so it remains independent from the regular UI radius.
 */
:is(
    .a2m-toggle-radius,
    .glass-theme-toggle,
    .sidebar-theme-switch,
    .toggle-switch,
    .switch-track,
    [role="switch"]
){
    border-radius:var(--a2m-toggle-radius,999px)!important;
}

/*
 * One radius language for the complete application.
 * True circles (avatars, status dots, calendar days and progress rings) remain circular.
 */
html:root:root:root:root body :where(
    .card,
    .page-card,
    .user-card,
    .user-stat,
    .user-panel,
    .dashboard-card,
    .stat-card,
    .metric-card,
    .project-card,
    .client-card,
    .estimate-card,
    .contract-card,
    .payment-card,
    .portal-card,
    .invoice-card,
    .receipt-card,
    .post-card,
    .feed-card,
    .calendar-card,
    .company-branding-card,
    .collapsible-card,
    .table-card,
    .table-container,
    .table-responsive,
    .responsive-table,
    .data-table,
    .global-table,
    table,
    fieldset,
    .panel,
    .section-panel,
    .content-panel,
    .toolbar,
    .search-box,
    .form-card,
    .form-section,
    .upload-zone,
    .preview-box,
    .image-preview,
    .video-preview
    ,.global-sidebar
    ,.global-sidebar-inner
    ,.dashboard-sidebar-collapsible
    ,.sidebar-menu
    ,.sidebar-menu-item
    ,.sidebar-link
    ,.tabs-wrap
    ,.tabs
    ,.tab
    ,.tab-content
    ,.page-shell
    ,.detail-doc
    ,.detail-card
    ,.detail-section
    ,.pro-table
    ,.modern-table
    ,.table-wrap
    ,.projects-tabs-wrap
    ,.project-info-card
    ,.estimate-side-card
    ,.contract-side-card
    ,[class$="-card"]
    ,[class*="-card "]
    ,[class$="-panel"]
    ,[class*="-panel "]
    ,[class$="-box"]
    ,[class*="-box "]
){
    border-radius:var(--a2m-radius, 8px) !important;
}

html:root:root:root:root body :where(
    button,
    .btn,
    .button,
    [role="button"],
    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
    textarea,
    select,
    .form-input,
    .form-control,
    .input-group,
    .ts-control,
    .ts-dropdown,
    .iti__selected-country,
    .file-input-label
    ,.tab
    ,.sidebar-link
    ,.profile-cover-action
    ,.action-button
    ,.action-link
    ,.projects-mobile-tab
    ,.private-mobile-tab
    ,.public-tab
    ,.flow-nav-account
    ,.theme-toggle
    ,.glass-theme-toggle
    ,.sidebar-theme-switch
    ,.dashboard-sidebar-toggle
    ,.card-collapse-toggle
    ,[class$="-btn"]
    ,[class*="-btn "]
    ,[class$="-button"]
    ,[class*="-button "]
):not(
    .avatar-edit-btn
):not(
    .notification-bell-badge
):not(
    .user-dot
):not(
    .status-dot
){
    border-radius:var(--a2m-radius, 8px) !important;
}

html:root:root:root:root body :where(
    .global-modal,
    .modal,
    .modal-content,
    .modal-card,
    .dialog,
    [role="dialog"],
    .toast,
    .toast-item,
    .toast-container > *,
    .dropdown,
    .dropdown-menu,
    .dropdown-content,
    .notification-dropdown,
    .popover,
    .tooltip,
    .menu-panel,
    .context-menu,
    .autocomplete-items,
    .ts-dropdown,
    .select-dropdown
    ,[class$="-dropdown"]
    ,[class*="-dropdown "]
    ,[class$="-popover"]
    ,[class*="-popover "]
){
    border-radius:var(--a2m-radius, 8px) !important;
}

html:root:root:root:root body :where(
    .table-wrapper,
    .table-scroll,
    .table-responsive,
    .responsive-table,
    .data-table-wrap
){
    overflow:hidden;
    border-radius:var(--a2m-radius, 8px) !important;
}

/* Components whose geometry communicates a circle, not a rounded rectangle. */
html:root:root:root:root body :where(
    .avatar,
    .user-avatar,
    .profile-avatar,
    .client-avatar,
    .people-avatar,
    .online-user-avatar,
    .avatar-wrap,
    .user-dot,
    .status-dot,
    .online-dot,
    .calendar-day,
    .calendar-arrow,
    .notification-bell-badge,
    .progress-ring,
    .conversion-ring,
    .spinner,
    .radio-circle,
    input[type="radio"]
){
    border-radius:50% !important;
}

/* Toggle controls intentionally keep their pill geometry. */
html:root:root:root:root body :is(
    .a2m-toggle-radius,
    .glass-theme-toggle,
    .sidebar-theme-switch,
    .toggle-switch,
    .toggle-track,
    .toggle-slider,
    .switch-track,
    .switch-slider,
    .form-switch,
    .custom-switch,
    [class*="toggle-switch"],
    [class*="toggle-track"],
    [class*="toggle-slider"],
    [class*="switch-track"],
    [class*="switch-slider"],
    [class$="-switch"],
    [class*="-switch "],
    [role="switch"]
){
    border-radius:var(--a2m-toggle-radius,999px)!important;
}

html:root:root:root:root body :is(
    label.share-edit-toggle,
    label.share-save-upload-toggle,
    label.historical-status-toggle,
    label.estimate-client-history-toggle,
    label:has(> input[type="checkbox"] + .sidebar-theme-switch)
){
    border-radius:var(--a2m-toggle-radius,999px)!important;
}

html:root:root:root:root body .glass-theme-toggle{
    border-radius:var(--a2m-toggle-radius,999px)!important;
    overflow:hidden!important;
}
